diff --git a/public/deckIcon1.png b/public/images/deckIcon1.png similarity index 100% rename from public/deckIcon1.png rename to public/images/deckIcon1.png diff --git a/public/logo192.png b/public/logo192.png deleted file mode 100644 index fc44b0a..0000000 Binary files a/public/logo192.png and /dev/null differ diff --git a/public/logo512.png b/public/logo512.png deleted file mode 100644 index a4e47a6..0000000 Binary files a/public/logo512.png and /dev/null differ diff --git a/public/manifest.json b/public/manifest.json index 080d6c7..b6594c7 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -8,12 +8,12 @@ "type": "image/x-icon" }, { - "src": "logo192.png", + "src": "deckIcon2.png", "type": "image/png", "sizes": "192x192" }, { - "src": "logo512.png", + "src": "deckIcon2.png", "type": "image/png", "sizes": "512x512" } diff --git a/public/blue-eyes.jpeg b/public/monsterImages/blue-eyes.jpeg similarity index 100% rename from public/blue-eyes.jpeg rename to public/monsterImages/blue-eyes.jpeg diff --git a/public/exodia.webp b/public/monsterImages/exodia.webp similarity index 100% rename from public/exodia.webp rename to public/monsterImages/exodia.webp diff --git a/public/kuriboh.jpeg b/public/monsterImages/kuriboh.jpeg similarity index 100% rename from public/kuriboh.jpeg rename to public/monsterImages/kuriboh.jpeg diff --git a/public/neos.jpeg b/public/monsterImages/neos.jpeg similarity index 100% rename from public/neos.jpeg rename to public/monsterImages/neos.jpeg diff --git a/public/panther.png b/public/monsterImages/panther.png similarity index 100% rename from public/panther.png rename to public/monsterImages/panther.png diff --git a/public/red-eyes.jpeg b/public/monsterImages/red-eyes.jpeg similarity index 100% rename from public/red-eyes.jpeg rename to public/monsterImages/red-eyes.jpeg diff --git a/public/skull-servant.jpeg b/public/monsterImages/skull-servant.jpeg similarity index 100% rename from public/skull-servant.jpeg rename to public/monsterImages/skull-servant.jpeg diff --git a/public/temple.jpeg b/public/monsterImages/temple.jpeg similarity index 100% rename from public/temple.jpeg rename to public/monsterImages/temple.jpeg diff --git a/public/toon.png b/public/monsterImages/toon.png similarity index 100% rename from public/toon.png rename to public/monsterImages/toon.png diff --git a/public/screenshot.png b/public/siteImages/screenshot.png similarity index 100% rename from public/screenshot.png rename to public/siteImages/screenshot.png diff --git a/src/App.js b/src/App.js index 457943f..db8da5c 100644 --- a/src/App.js +++ b/src/App.js @@ -36,40 +36,38 @@ const App = () => { // const user = cookies?.user; // const userId = user?.id; const [currentPage, setCurrentPage] = useState(''); - // const { setContext } = useAppContext(); // Assuming useAppContext provides setContext const { fetchAllCollectionsForUser, selectedCollection } = useCollectionStore(); const { user, fetchUser } = useUserContext(); const userId = user?.id; - console.log('user', user); - console.log('userId', userId); const [showLoginDialog, setShowLoginDialog] = useState(false); const { allDecks, fetchAllDecksForUser, selectedDeck } = useDeckStore(); const { fetchUserCart, cartData } = useCartStore(); const { isLoading, setIsLoading } = useUtilityContext(); - const handleLoginSuccess = (isLoggedIn, userId) => { - // Close the dialog and perform other actions if needed - setShowLoginDialog(false); - console.log('isLoggedIn', isLoggedIn); - console.log('userId', userId); - }; // useEffect(() => { // getRandomCardImages(10); // Fetch 10 random images on app start // }, []); // Add this useEffect + const handleLoginSuccess = (isLoggedIn, userId) => { + setShowLoginDialog(false); + setIsLoading(false); + // Perform other actions after login + }; + useEffect(() => { - // Open the login dialog if there's no userId + // Open the login dialog and pause splash page if there's no userId if (!userId) { - setIsLoading(false); setShowLoginDialog(true); + setIsLoading(true); // Continue showing splash page } else { setShowLoginDialog(false); + setIsLoading(false); // Hide splash page } }, [userId]); useEffect(() => { - if (userId) { + if (userId && typeof userId === 'string') { fetchAllCollectionsForUser() .then(() => { setIsLoading(false); @@ -84,20 +82,24 @@ const App = () => { // console.log('Checking userId in useEffect:', userId); // setShowLoginDialog(!userId); // }, [userId]); + useEffect(() => { + if (userId && typeof userId === 'string') { + fetchAllDecksForUser() + .then(() => { + setIsLoading(false); + }) + .catch((error) => console.error('Error fetching decks:', error)); + } + }, [userId, fetchAllDecksForUser, selectedDeck, setIsLoading]); // 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) - // ); + // if (userId && typeof userId === 'string') { + // fetchUserCart() + // .then(() => { + // setIsLoading(false); + // }) + // .catch((error) => console.error('Error fetching cart:', error)); // } - // }, [fetchUserCart]); + // }, [userId, fetchUserCart, cartData, setIsLoading]); // Handle initial loading state useEffect(() => { @@ -124,10 +126,6 @@ const App = () => { ) : ( - {console.log( - 'Login Dialog should be:', - showLoginDialog ? 'Open' : 'Closed' - )} setShowLoginDialog(false)} @@ -179,7 +177,7 @@ const App = () => { } /> {/* Add a Route for 404 Not Found page if needed */} -