From 317a493656e4aa61d065e5298d559d2dbe8338ef Mon Sep 17 00:00:00 2001 From: Reed Vogt Date: Fri, 24 Nov 2023 14:55:38 -0800 Subject: [PATCH] add --- .github/workflows/main.yml | 37 ++++ src/App.js | 24 ++- src/assets/themeSettings.jsx | 2 + .../topButton/TopButton.css | 0 .../buttons => assets}/topButton/TopButton.js | 0 .../actionButtons/CardActionButtons.jsx | 181 +++++++++++------- .../actionButtons/GenericActionButtons.jsx | 56 +++++- src/components/buttons/other/SearchButton.js | 9 +- src/components/cards/GenericCard.jsx | 40 +++- src/components/chart/LinearChart.js | 2 +- src/components/chart/PortfolioChart.jsx | 2 +- src/components/cleanUp/AppWrapper.jsx | 13 -- .../cleanUp/CalculateCollectionStatistics.jsx | 57 ------ src/components/cleanUp/CardModal.js | 123 ------------ src/components/cleanUp/CartActionButtons.js | 36 ---- .../cleanUp/CollectionActionButtons.jsx | 73 ------- src/components/cleanUp/CollectionDialog.jsx | 61 ------ .../cleanUp/CollectionEditPanel.jsx | 89 --------- src/components/cleanUp/CollectionForm.jsx | 63 ------ src/components/cleanUp/CustomPopover.jsx | 69 ------- src/components/cleanUp/DeckActionButtons.js | 65 ------- src/components/cleanUp/DeckCard.js | 118 ------------ src/components/cleanUp/DeckCardDialog.jsx | 16 -- src/components/cleanUp/DeckCardDialogue.js | 96 ---------- src/components/cleanUp/DeckCardModal.js | 55 ------ src/components/cleanUp/DeckCountDisplay.jsx | 12 -- src/components/cleanUp/DeckDialog.jsx | 57 ------ src/components/cleanUp/Hero.jsx | 49 ----- src/components/cleanUp/PortfolioCard.jsx | 118 ------------ src/components/cleanUp/PracticeScraperPage.js | 48 ----- src/components/cleanUp/ProductCard.js | 98 ---------- src/components/cleanUp/ScrapeDisplay.js | 26 --- src/components/cleanUp/ScrapeSearch.js | 44 ----- src/components/cleanUp/ScraperContainer.js | 36 ---- .../cleanUp/SelectCollectionDialog.jsx | 133 ------------- src/components/cleanUp/UpdateChartData.jsx | 72 ------- src/components/cleanUp/button/Button.css | 43 ----- src/components/cleanUp/button/Button.js | 35 ---- src/components/cleanUp/theme.jsx | 0 src/components/collection/example-data.json | 64 ------- src/components/forms/AddCardForm.jsx | 74 +++---- src/components/forms/SearchForm.jsx | 123 ++++++------ .../customerCheckoutForm/CartActions.jsx | 2 +- .../customerCheckoutForm/CustomerForm.js | 40 ++-- src/components/grids/DeckDisplay.js | 88 ++++----- src/components/grids/StoreItem.jsx | 11 ++ .../grids/deckBuilderGrids/DeckButtonList.js | 2 + .../searchResultGrids/DeckSearchCardGrid.jsx | 35 ++-- .../storeSearchResultsGrid/ProductGrid.js | 58 ++++-- src/components/headings/PortfolioHeader.jsx | 24 --- src/components/icons/DeckOfCardsIcon.jsx | 8 - .../{ => cardModal}/GenericCardModal.jsx | 21 +- .../modals/stripeModal/StripeCheckoutModal.js | 87 ++++----- src/components/other/DeckEditPanel.js | 99 ---------- .../other/InputComponents/CardNameInput.js | 21 +- .../CollectionStatisticsSelector.jsx | 2 +- .../other/InputComponents/CustomSelector.js | 49 +++-- .../other/InputComponents/DeckEditPanel.js | 109 +++++++++++ .../other/{ => dataDisplay}/CartSummary.js | 0 .../other/{ => dataDisplay}/CartTotal.jsx | 0 .../CollectionValueTracker.jsx | 2 +- .../{ => dataDisplay}/ProgressCircle.jsx | 0 .../other/{ => dataDisplay}/StatBox.jsx | 0 .../{ => dataDisplay}/StatisticsArea.jsx | 0 .../{ => dataDisplay}/TopCardsDisplay.jsx | 42 ++-- .../other/{ => dataDisplay}/UserStats.jsx | 6 +- .../ChartErrorBoundary.jsx | 0 src/components/reusable/HeaderTitle.jsx | 55 +++--- .../{chart => reusable}/chartUtils.jsx | 124 ------------ .../{ => reusable}/icons/CartIcon.jsx | 0 .../{ => reusable}/icons/CollectionIcon.jsx | 0 .../reusable/icons/DeckOfCardsIcon.jsx | 29 +++ .../{ => reusable}/icons/TestingIcon.jsx | 0 .../reusable/indicators/LoadingIndicator2.js | 22 +-- src/components/search/DeckSearch.js | 14 +- src/components/search/PortfolioCardSearch.jsx | 27 --- src/components/search/SearchBar.js | 132 ++++++++----- .../cartPageContainers}/AddressForm.jsx | 0 .../cartPageContainers/CartContent.js | 2 +- .../cartPageContainers}/Checkout.jsx | 0 .../cartPageContainers}/PaymentForm.jsx | 0 .../cartPageContainers}/Review.jsx | 0 .../PortfolioChartContainer.jsx | 2 +- .../PortfolioContent.jsx | 107 +++++------ .../CardImagesContext/CardImagesContext.jsx | 3 +- src/context/CartContext/CartContext.js | 135 +++++++------ .../CollectionContext/CollectionContext.jsx | 52 +---- .../CollectionContext/collectionUtility.jsx | 52 +++++ src/context/DeckContext/DeckContext.js | 45 +++-- src/index.js | 55 +++--- src/pages/CartPage.js | 1 - src/pages/CollectionPage.js | 10 +- src/pages/DeckBuilderPage.js | 10 +- src/pages/HomePage.js | 50 ++--- src/pages/ProfilePage.js | 2 +- src/pages/StorePage.js | 97 +++++++++- src/pages/pages.json | 33 ++-- src/setupProxy.js | 18 -- 98 files changed, 1263 insertions(+), 2839 deletions(-) create mode 100644 .github/workflows/main.yml rename src/{components/buttons => assets}/topButton/TopButton.css (100%) rename src/{components/buttons => assets}/topButton/TopButton.js (100%) delete mode 100644 src/components/cleanUp/AppWrapper.jsx delete mode 100644 src/components/cleanUp/CalculateCollectionStatistics.jsx delete mode 100644 src/components/cleanUp/CardModal.js delete mode 100644 src/components/cleanUp/CartActionButtons.js delete mode 100644 src/components/cleanUp/CollectionActionButtons.jsx delete mode 100644 src/components/cleanUp/CollectionDialog.jsx delete mode 100644 src/components/cleanUp/CollectionEditPanel.jsx delete mode 100644 src/components/cleanUp/CollectionForm.jsx delete mode 100644 src/components/cleanUp/CustomPopover.jsx delete mode 100644 src/components/cleanUp/DeckActionButtons.js delete mode 100644 src/components/cleanUp/DeckCard.js delete mode 100644 src/components/cleanUp/DeckCardDialog.jsx delete mode 100644 src/components/cleanUp/DeckCardDialogue.js delete mode 100644 src/components/cleanUp/DeckCardModal.js delete mode 100644 src/components/cleanUp/DeckCountDisplay.jsx delete mode 100644 src/components/cleanUp/DeckDialog.jsx delete mode 100644 src/components/cleanUp/Hero.jsx delete mode 100644 src/components/cleanUp/PortfolioCard.jsx delete mode 100644 src/components/cleanUp/PracticeScraperPage.js delete mode 100644 src/components/cleanUp/ProductCard.js delete mode 100644 src/components/cleanUp/ScrapeDisplay.js delete mode 100644 src/components/cleanUp/ScrapeSearch.js delete mode 100644 src/components/cleanUp/ScraperContainer.js delete mode 100644 src/components/cleanUp/SelectCollectionDialog.jsx delete mode 100644 src/components/cleanUp/UpdateChartData.jsx delete mode 100644 src/components/cleanUp/button/Button.css delete mode 100644 src/components/cleanUp/button/Button.js delete mode 100644 src/components/cleanUp/theme.jsx delete mode 100644 src/components/collection/example-data.json create mode 100644 src/components/grids/StoreItem.jsx delete mode 100644 src/components/headings/PortfolioHeader.jsx delete mode 100644 src/components/icons/DeckOfCardsIcon.jsx rename src/components/modals/{ => cardModal}/GenericCardModal.jsx (79%) delete mode 100644 src/components/other/DeckEditPanel.js create mode 100644 src/components/other/InputComponents/DeckEditPanel.js rename src/components/other/{ => dataDisplay}/CartSummary.js (100%) rename src/components/other/{ => dataDisplay}/CartTotal.jsx (100%) rename src/components/other/{ => dataDisplay}/CollectionValueTracker.jsx (98%) rename src/components/other/{ => dataDisplay}/ProgressCircle.jsx (100%) rename src/components/other/{ => dataDisplay}/StatBox.jsx (100%) rename src/components/other/{ => dataDisplay}/StatisticsArea.jsx (100%) rename src/components/other/{ => dataDisplay}/TopCardsDisplay.jsx (80%) rename src/components/other/{ => dataDisplay}/UserStats.jsx (76%) rename src/components/{chart => reusable}/ChartErrorBoundary.jsx (100%) rename src/components/{chart => reusable}/chartUtils.jsx (55%) rename src/components/{ => reusable}/icons/CartIcon.jsx (100%) rename src/components/{ => reusable}/icons/CollectionIcon.jsx (100%) create mode 100644 src/components/reusable/icons/DeckOfCardsIcon.jsx rename src/components/{ => reusable}/icons/TestingIcon.jsx (100%) delete mode 100644 src/components/search/PortfolioCardSearch.jsx rename src/{components/other => containers/cartPageContainers}/AddressForm.jsx (100%) rename src/{components/other => containers/cartPageContainers}/Checkout.jsx (100%) rename src/{components/other => containers/cartPageContainers}/PaymentForm.jsx (100%) rename src/{components/other => containers/cartPageContainers}/Review.jsx (100%) delete mode 100644 src/setupProxy.js diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..6a3095a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: '18.16.0' + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm test + + - name: Build + run: npm run build + + - name: Install Netlify CLI + run: npm install netlify-cli -g + + - name: Deploy to Netlify + run: npx netlify deploy --dir=src --prod + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/src/App.js b/src/App.js index e56bc47..2f136d0 100644 --- a/src/App.js +++ b/src/App.js @@ -26,6 +26,8 @@ import { useUtilityContext } from './context/UtilityContext/UtilityContext'; import { AppContainer } from './pages/pageStyles/StyledComponents'; import { useCardImages } from './context/CardImagesContext/CardImagesContext'; import { useCookies } from 'react-cookie'; +import { useDeckStore } from './context/DeckContext/DeckContext'; +import { useCartStore } from './context/CartContext/CartContext'; const App = () => { const [cookies] = useCookies(['user']); @@ -34,6 +36,8 @@ const App = () => { // const { setContext } = useAppContext(); // Assuming useAppContext provides setContext const { fetchAllCollectionsForUser, selectedCollection } = useCollectionStore(); + const { allDecks, fetchAllDecksForUser, selectedDeck } = useDeckStore(); + const { fetchUserCart, cartData } = useCartStore(); const { isLoading, setIsLoading } = useUtilityContext(); // const { getRandomCardImages } = useCardImages(); // Add this line @@ -44,7 +48,7 @@ const App = () => { useEffect(() => { if (user) { - fetchAllCollectionsForUser(user.id) + fetchAllCollectionsForUser() .then(() => { setIsLoading(false); }) @@ -54,6 +58,20 @@ const App = () => { }); } }, [user, fetchAllCollectionsForUser, setIsLoading, selectedCollection]); + // useEffect(() => { + // if (user) { + // fetchAllDecksForUser(user?.id).catch((err) => + // console.error('Failed to get all decks:', err) + // ); + // } + // }, [fetchAllDecksForUser]); + // useEffect(() => { + // if (user) { + // fetchUserCart(user?.id).catch((err) => + // console.error('Failed to get cart:', err) + // ); + // } + // }, [fetchUserCart]); // Handle initial loading state useEffect(() => { @@ -79,7 +97,7 @@ const App = () => { {isLoading ? ( ) : ( - +
@@ -127,7 +145,7 @@ const App = () => {