This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext, useEffect, useState } from "react"; | |
import { Link } from "react-router-dom"; | |
import { ProductContext } from "../contexts/ProductContext"; | |
import DeleteIcon from "@mui/icons-material/Delete"; | |
import { Product } from "../contexts/ProductContext"; | |
import { Divider } from "@mui/material"; | |
function Cart() { | |
const { populateCart, populatedCart, removeFromCart, editCartItem } = | |
useContext(ProductContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Product = { | |
// ... product stuff | |
quantity?: number; // add this to the existing product type | |
} | |
// create new state (and add it to the types and context value etc) | |
const [populatedCart, setPopulatedCart] = useState<Product[]>([]); | |
async function fetchProduct(productId: string): Promise<Product> { | |
const res = await fetch(`${BASE_URL}/products/${productId}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
import moment from 'moment'; | |
// Once you fix your modal, logic, this component can be used | |
// as a starting point for the content of the modal | |
// this will need to be styled and tied into the filter logic for the games outside of the modal | |
// either in a parent state, or global context/redux so that when you close the modal | |
// the page will have access to the selected date and update results | |
// npm i --save moment (if you don't already have it) | |
// check out flexbox if you are unfamiliar, you can use css flexbox to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPrettyTimeDiff(startDateTime, endDateTime) { | |
// get total seconds between the times | |
let delta = Math.abs(endDateTime - startDateTime) / 1000; | |
// calculate (and subtract) whole days | |
let days = Math.floor(delta / 86400); | |
delta -= days * 86400; | |
// calculate (and subtract) whole hours | |
let hours = Math.floor(delta / 3600) % 24; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE DIM_UI_SBM ( | |
LETO_UI_SBM_ID SERIAL, | |
SUB_PRJ_ID NUMERIC(20) NOT NULL, | |
LETO_UI_SBM_TYP VARCHAR(25) NOT NULL, | |
UI_TST_SBM_SUB_TYP VARCHAR(25), | |
EXC_STU VARCHAR(30), | |
HPQC_USR_NM VARCHAR(50), | |
MTA_EFC_DTE TIMESTAMP, | |
MTA_UPT_DTE TIMESTAMP, | |
CRT_USR_ID VARCHAR(15), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--set search_path TO apdp; | |
--SHOW search_path; | |
CREATE TABLE DB_SCH_DTA ( | |
PRJ_ID NUMERIC(20) NOT NULL, | |
CONN_DTA_ID NUMERIC(20) NOT NULL, | |
ENV_NM VARCHAR(15) NOT NULL, | |
SCH_NM VARCHAR(25) NOT NULL, | |
USR_NM VARCHAR(30), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asyncFunction(bool) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if(bool) { | |
resolve('Promise resolved after .5 of a second'); | |
} else { | |
reject('Promise rejected after .5 of a second'); | |
} | |
}, 500); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asyncFunction(bool) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if(bool) { | |
resolve('Promise resolved after .5 of a second'); | |
} else { | |
reject('Promise rejected after .5 of a second'); | |
} | |
}, 500); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asyncFunction(bool) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if (bool) { | |
resolve('Promise resolved after .5 of a second'); | |
} else { | |
reject('Promise rejected after .5 of a second'); | |
} | |
}, 500); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asyncFunction(bool) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if(bool) { | |
resolve('Promise resolved after 5 seconds'); | |
} else { | |
reject('Promise rejected after 5 seconds'); | |
} | |
}, 5000); |
NewerOlder