diff --git a/src/assets/currentlyUnused/AddCollectionForm.jsx b/src/assets/currentlyUnused/AddCollectionForm.jsx deleted file mode 100644 index 80ca8ea..0000000 --- a/src/assets/currentlyUnused/AddCollectionForm.jsx +++ /dev/null @@ -1,35 +0,0 @@ -// import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; -// import RCZodForm from './reusable/RCZodForm'; - -// const AddCollectionForm = () => { -// // Assuming 'addCollectionForm' is the key/name for this form schema in your context -// const schemaName = 'addCollectionForm'; -// const buttonLabel = 'Create Collection'; -// const startIcon = ; -// const addCollectionFields = [ -// { -// name: 'name', -// label: 'Name', -// type: 'text', -// required: true, -// }, -// { -// name: 'description', -// label: 'Description', -// type: 'text', -// required: true, -// multiline: true, -// rows: 4, -// }, -// ]; -// return ( -// -// ); -// }; - -// export default AddCollectionForm; diff --git a/src/assets/currentlyUnused/AddDeckForm.jsx b/src/assets/currentlyUnused/AddDeckForm.jsx deleted file mode 100644 index 95d6071..0000000 --- a/src/assets/currentlyUnused/AddDeckForm.jsx +++ /dev/null @@ -1,39 +0,0 @@ -// import React from 'react'; -// import { useFormContext } from '../../context'; -// import RCZodForm from './RCZodForm'; -// import SaveIcon from '@mui/icons-material/Save'; - -// const AddDeckForm = () => { -// const { setFormSchema } = useFormContext(); -// const formId = 'addDeckForm'; // Assuming this is the formId for creating decks -// const fields = [ -// { name: 'name', label: 'Name', type: 'text', required: true }, -// { -// name: 'description', -// label: 'Description', -// type: 'text', -// required: true, -// multiline: true, -// }, -// ]; - -// const handleSubmit = (data) => { -// console.log('Add Deck Data:', data); -// }; - -// React.useEffect(() => { -// setFormSchema(formId); -// }, [setFormSchema, formId]); - -// return ( -// } -// /> -// ); -// }; - -// export default AddDeckForm; diff --git a/src/assets/currentlyUnused/AuthForm.jsx b/src/assets/currentlyUnused/AuthForm.jsx deleted file mode 100644 index cb075f4..0000000 --- a/src/assets/currentlyUnused/AuthForm.jsx +++ /dev/null @@ -1,66 +0,0 @@ -// import React from 'react'; -// import PersonAddIcon from '@mui/icons-material/PersonAdd'; -// import PersonIcon from '@mui/icons-material/Person'; -// import EmailIcon from '@mui/icons-material/Email'; -// import LockIcon from '@mui/icons-material/Lock'; -// import RCZodForm from './reusable/RCZodForm'; -// import LoginIcon from '@mui/icons-material/Login'; - -// const loginFields = [ -// { -// name: 'username', -// label: 'Username', -// type: 'text', -// icon: , -// field: 'username', -// }, -// { -// name: 'password', -// label: 'Password', -// type: 'password', -// icon: , -// field: 'password', -// }, -// ]; -// const signupFields = [ -// { -// name: 'firstName', -// label: 'First Name', -// type: 'text', -// icon: , -// field: 'firstName', -// }, -// { -// name: 'lastName', -// label: 'Last Name', -// type: 'text', -// icon: , -// field: 'lastName', -// }, -// { -// name: 'email', -// label: 'Email', -// type: 'email', -// icon: , -// field: 'email', -// }, -// ]; - -// const AuthForm = ({ formType }) => { -// const combinedFields = [...signupFields, ...loginFields]; -// const isSignup = formType === 'signupForm'; -// const fields = isSignup ? combinedFields : loginFields; -// const buttonLabel = isSignup ? 'Sign Up' : 'Login'; -// const startIcon = isSignup ? : ; - -// return ( -// -// ); -// }; - -// export default AuthForm; diff --git a/src/assets/currentlyUnused/CardChart.jsx b/src/assets/currentlyUnused/CardChart.jsx deleted file mode 100644 index b169920..0000000 --- a/src/assets/currentlyUnused/CardChart.jsx +++ /dev/null @@ -1,493 +0,0 @@ -// // import React, { useState, useEffect, useMemo } from 'react'; -// // import { -// // Box, -// // Card, -// // CardActions, -// // CardContent, -// // CardHeader, -// // IconButton, -// // List, -// // ListItem, -// // Paper, -// // Typography, -// // useMediaQuery, -// // } from '@mui/material'; -// // import MoreVertIcon from '@mui/icons-material/MoreVert'; -// // import CardLinearChart from './CardLinearChart'; -// // import { ErrorBoundary, useMode, usePageContext } from '../context'; -// // import useCardCronJob from './useCardCronJob'; -// // import initialCardData from '../data/initialCardData'; -// // import { format } from 'date-fns'; -// // import LoadingCardAnimation from '../assets/animations/LoadingCardAnimation'; -// // import styled from 'styled-components'; -// // import MDButton from './REUSABLE_COMPONENTS/MDBUTTON'; -// // import { useLoading } from '../context/hooks/useLoading'; - -// // const ChartArea = styled(Box)(({ theme }) => ({ -// // width: '100%', -// // height: '100%', -// // padding: theme.spacing(2), -// // display: 'flex', -// // alignItems: 'center', -// // justifyContent: 'center', -// // border: '1px solid #000', -// // borderRadius: '5px', -// // })); -// // const SquareChartContainer = styled(Box)(({ theme }) => ({ -// // position: 'relative', -// // width: '100%', -// // paddingTop: '100%', -// // overflow: 'hidden', -// // '& > *': { -// // position: 'absolute', -// // top: 0, -// // left: 0, -// // right: 0, -// // bottom: 0, -// // }, -// // })); - -// // const CardChart = ({ cardData = initialCardData }) => { -// // // STYLING AND MEDIA QUERY HOOKS -// // const { theme } = useMode(); -// // const isLgUp = useMediaQuery(theme.breakpoints.up('lg')); -// // const [imageUrl, setImageUrl] = useState(null); -// // const { startUpdates, pauseUpdates, resetData } = -// // useCardCronJob(initialCardData); -// // const formatTimestamp = (timestamp) => -// // format(new Date(timestamp), "MMM do, yyyy 'at' HH:mm"); -// // const [chartDimensions, setChartDimensions] = useState({ -// // width: 0, -// // height: 0, -// // }); -// // const { returnDisplay } = usePageContext(); -// // const { isLoading } = useLoading(); -// // useEffect(() => { -// // if (cardData?.imageUrl) { -// // console.log('Setting image url', cardData?.imageUrl); -// // setImageUrl(cardData?.image); -// // } -// // }, [cardData?.imageUrl]); - -// // const nivoReadyData = useMemo( -// // () => [ -// // { -// // id: cardData?.name || 'default', -// // data: cardData?.dailyPriceHistory?.map(({ timestamp, num }) => ({ -// // x: timestamp, -// // y: num, -// // })), -// // }, -// // ], -// // [cardData] -// // ); -// // const renderLoadingAnimation = () => -// // isLgUp && ; -// // useEffect(() => { -// // if (isLoading('fetchCollections')) { -// // console.log('Fetching collections'); -// // } -// // }, [isLoading('fetchCollections')]); -// // useEffect(() => { -// // const updateDimensions = () => { -// // const width = window.innerWidth < 500 ? window.innerWidth : 500; -// // const height = 300; -// // setChartDimensions({ width, height }); -// // }; - -// // window.addEventListener('resize', updateDimensions); -// // updateDimensions(); - -// // return () => { -// // window.removeEventListener('resize', updateDimensions); -// // }; -// // }, []); -// // const renderHeaderWithAnimation = () => { -// // return ( -// // -// // -// // -// // -// // } -// // title="Card Cron Job Simulator" -// // subheader={cardData?.name || 'Card Name'} -// // sx={{ -// // padding: theme.spacing(1), -// // margin: theme.spacing(1), -// // }} -// // /> -// // {isLgUp && renderLoadingAnimation()} -// // -// // ); -// // }; -// // return ( -// // -// // -// // -// // -// // {renderHeaderWithAnimation()} -// // - -// // -// // -// // {isLoading('fetchCollections') ? ( -// // returnDisplay() -// // ) : ( -// // -// // -// // -// // )} -// // -// // -// // - -// // -// // -// // {['Start Updates', 'Pause Updates', 'Reset Data'].map( -// // (text, index) => ( -// // { -// // if (text === 'Start Updates') startUpdates(); -// // else if (text === 'Pause Updates') pauseUpdates(); -// // else if (text === 'Reset Data') resetData(); -// // }} -// // color="primary" -// // variant="contained" -// // sx={{ -// // color: theme.palette.backgroundA.contrastText, -// // background: theme.palette.backgroundF.darker, -// // borderColor: theme.palette.backgroundB.darkest, -// // borderWidth: 2, -// // mt: 'auto', -// // flexGrow: 1, -// // justifySelf: 'bottom', -// // bottom: 0, -// // width: '100%', -// // '&:hover': { -// // color: theme.palette.backgroundA.contrastTextC, -// // fontWeight: 'bold', -// // background: theme.palette.backgroundF.dark, -// // borderColor: theme.palette.backgroundB.darkest, -// // border: `1px solid ${theme.palette.backgroundB.darkest}`, -// // }, -// // }} -// // > -// // {text} -// // -// // ) -// // )} -// // -// // -// // -// // -// // {cardData?.dailyPriceHistory?.map((entry, index) => ( -// // -// // -// // Quantity: {cardData?.quantity} -// // -// // -// // Price: ${entry?.num} -// // -// // -// // {formatTimestamp(entry?.timestamp)} -// // -// // -// // ))} -// // -// // -// // -// // -// // -// // -// // ); -// // }; - -// // export default CardChart; -// import React, { useState, useEffect, useMemo } from 'react'; -// import { -// Box, -// Card, -// CardContent, -// CardHeader, -// IconButton, -// List, -// ListItem, -// Paper, -// Typography, -// useTheme, -// useMediaQuery, -// CardActions, -// } from '@mui/material'; -// import MoreVertIcon from '@mui/icons-material/MoreVert'; -// import CardLinearChart from './CardLinearChart'; -// import { ErrorBoundary, useMode } from '../context'; -// import useCardCronJob from './useCardCronJob'; -// import initialCardData from '../data/initialCardData'; -// import { format } from 'date-fns'; -// import LoadingCardAnimation from '../assets/animations/LoadingCardAnimation'; -// import MDButton from './REUSABLE_COMPONENTS/MDBUTTON'; -// import { useLoading } from '../context/hooks/useLoading'; -// import styled from 'styled-components'; -// import uniqueTheme from './REUSABLE_COMPONENTS/unique/uniqueTheme'; -// import SimpleButton from './REUSABLE_COMPONENTS/unique/SimpleButton'; - -// const ChartArea = styled(Box)(({ theme }) => ({ -// width: '100%', -// height: '100%', -// padding: theme.spacing(2), -// display: 'flex', -// alignItems: 'center', -// justifyContent: 'center', -// border: '1px solid #000', -// borderRadius: '5px', -// })); - -// const SquareChartContainer = styled(Box)({ -// position: 'relative', -// flex: 1, -// overflow: 'hidden', -// }); - -// const CardChart = () => { -// const { theme } = useMode(); -// const isMobileView = useMediaQuery(theme.breakpoints.down('sm')); -// const isLgUp = useMediaQuery(theme.breakpoints.up('lg')); -// const { startUpdates, pauseUpdates, resetData } = -// useCardCronJob(initialCardData); -// const [cardData, setCardData] = useState(initialCardData); -// const { isLoading } = useLoading(); - -// const getResponsiveDimensions = () => { -// return isMobileView -// ? { width: window.innerWidth / 2, height: window.innerHeight * 0.5 } -// : { width: 500, height: 300 }; -// }; - -// const [chartDimensions, setChartDimensions] = useState( -// getResponsiveDimensions() -// ); - -// useEffect(() => { -// const handleResize = () => { -// setChartDimensions(getResponsiveDimensions()); -// }; - -// window.addEventListener('resize', handleResize); -// return () => window.removeEventListener('resize', handleResize); -// }, [isMobileView]); - -// const nivoReadyData = useMemo( -// () => [ -// { -// id: cardData.name || 'default', -// data: cardData.dailyPriceHistory.map(({ timestamp, num }) => ({ -// x: format(new Date(timestamp), 'Pp'), -// y: num, -// })), -// }, -// ], -// [cardData] -// ); - -// return ( -// -// -// -// -// -// -// ) -// } -// title="Card Cron Job Simulator" -// subheader={cardData.name || 'Card Name'} -// /> -// {!isMobileView && isLgUp && isLoading('fetchCollections') && ( -// -// )} -// -// -// -// -// -// - -// {isMobileView ? ( -// -// -// -// {cardData.dailyPriceHistory.map((entry, index) => ( -// -// -// Quantity: {cardData.quantity} -// -// -// Price: ${entry.num} -// -// -// {format( -// new Date(entry.timestamp), -// "MMM do, yyyy 'at' HH:mm" -// )} -// -// -// ))} -// -// -// -// ) : ( -// -// {['Start Updates', 'Pause Updates', 'Reset Data'].map( -// (action, index) => ( -// { -// if (action === 'Start Updates') startUpdates(); -// else if (action === 'Pause Updates') pauseUpdates(); -// else resetData(); -// }} -// > -// {action} -// -// ) -// )} -// -// )} -// -// -// ); -// }; - -// export default CardChart; diff --git a/src/assets/currentlyUnused/CardDeckAnimation.js b/src/assets/currentlyUnused/CardDeckAnimation.js deleted file mode 100644 index bf6d528..0000000 --- a/src/assets/currentlyUnused/CardDeckAnimation.js +++ /dev/null @@ -1,71 +0,0 @@ -import React, { useEffect } from 'react'; -import * as THREE from 'three'; -import placeholder from '../images/placeholder.jpeg'; - -const CardDeckAnimation = () => { - // Initialize the scene, camera, and renderer here - useEffect(() => { - const scene = new THREE.Scene(); - const camera = new THREE.PerspectiveCamera( - 75, - window.innerWidth / window.innerHeight, - 0.1, - 1000 - ); - const renderer = new THREE.WebGLRenderer(); - - renderer.setSize(window.innerWidth, window.innerHeight); - const container = document.getElementById('card-deck-container'); - - if (container) { - container.appendChild(renderer.domElement); - } - - document - .getElementById('card-deck-container') - .appendChild(renderer.domElement); - - // Position the camera - camera.position.z = 15; - // Create a placeholder array with 6 images - const monsterImageUrls = Array(6).fill(placeholder); - - // Create a group to hold the cards - const cardGroup = new THREE.Group(); - - // Create cards and add them to the group - for (let i = 0; i < monsterImageUrls.length; i++) { - const imageURL = monsterImageUrls[i]; - const geometry = new THREE.BoxGeometry(2, 3, 0.2); - const textureLoader = new THREE.TextureLoader(); - const cardTexture = textureLoader.load(imageURL); - const material = new THREE.MeshBasicMaterial({ map: cardTexture }); - const card = new THREE.Mesh(geometry, material); - - // Position cards in a circle - const angle = (i / monsterImageUrls.length) * Math.PI * 2; - const radius = 5; - card.position.x = Math.cos(angle) * radius; - card.position.z = Math.sin(angle) * radius; - card.rotation.y = angle; - - // Add the card to the group - cardGroup.add(card); - } - scene.add(cardGroup); - - // Create an animation loop - const animate = () => { - requestAnimationFrame(animate); - cardGroup.rotation.y += 0.01; - renderer.render(scene, camera); - }; - - // Start the animation loop - animate(); - }, []); // Empty dependency array ensures this effect runs once when the component mounts - - return
; -}; - -export default CardDeckAnimation; diff --git a/src/assets/currentlyUnused/CardDetail.jsx b/src/assets/currentlyUnused/CardDetail.jsx deleted file mode 100644 index cbe595b..0000000 --- a/src/assets/currentlyUnused/CardDetail.jsx +++ /dev/null @@ -1,71 +0,0 @@ -// import React from 'react'; -// import { Box, Typography, Chip } from '@mui/material'; -// import { useMode } from '../../context'; -// import { -// CardDetailContainer, -// CardIconWrapper, -// CardTitleStyle, -// CardValueStyle, -// } from './styles/cardStyles'; -// import MDTypography from '../../layout/REUSABLE_COMPONENTS/MDTYPOGRAPHY/MDTypography'; - -// const CardDetail = ({ -// title, -// values, -// value, -// className, -// onRarityClick, -// icon, -// }) => { -// const { theme } = useMode(); - -// const getChipColor = (rarity) => { -// return theme.palette.rarity[rarity] || theme.palette.grey[500]; -// }; - -// return ( -// -// -// {icon && {icon}} -// -// {title}: -// - -// {value && ( -// -// {value} -// -// )} -// {Array.isArray(values) && -// values.length > 0 && -// values.map((rarityValue, index) => ( -// onRarityClick(rarityValue?.toString())} -// sx={{ -// borderColor: getChipColor(rarityValue?.toString()), -// borderWidth: '2px', -// fontWeight: 700, -// color: getChipColor(rarityValue?.toString()), -// margin: '5px', -// }} -// variant="outlined" -// /> -// ))} -// -// -// ); -// }; - -// export default CardDetail; diff --git a/src/assets/currentlyUnused/CardImagesContext/CardImagesContext.jsx b/src/assets/currentlyUnused/CardImagesContext/CardImagesContext.jsx deleted file mode 100644 index 0dd2c1c..0000000 --- a/src/assets/currentlyUnused/CardImagesContext/CardImagesContext.jsx +++ /dev/null @@ -1,114 +0,0 @@ -// import React, { createContext, useContext, useEffect, useState } from 'react'; - -// const CardImagesContext = createContext(); - -// export const useCardImages = () => useContext(CardImagesContext); - -// const fetchWrapper = async (url, method, body = null) => { -// const options = { -// method, -// headers: { -// 'Content-Type': 'application/json', -// // 'Access-Control-Allow-Origin': '*', -// // crossOrigin: 'anonymous', -// }, -// ...(body && { body: JSON.stringify(body) }), -// }; - -// try { -// const response = await fetch(url, options); -// if (!response.ok) { -// // We handle non-ok responses immediately -// throw new Error(`API request failed with status ${response.status}`); -// } -// // updateLastRequestTime(method); // Assumed to be a function that updates some kind of state -// return await response.json(); // Directly returning the JSON response -// } catch (error) { -// console.error(`Fetch failed: ${error}`); -// console.trace(); -// throw error; // Re-throwing the error for upstream catch blocks to handle -// } -// }; - -// export const CardImagesProvider = ({ children }) => { -// const [cards, setCards] = useState([]); -// const [images, setImages] = useState([]); // [ -// const [randomCardImage, setRandomCardImage] = useState(null); -// const [imageSrc, setImageSrc] = useState(null); -// const [isLoading, setIsLoading] = useState(false); -// const [error, setError] = useState(null); -// // const BASE_API_URL = 'http://localhost:3001/api/card-image'; -// const BASE_API_URL = `${process.env.REACT_APP_SERVER}/api/card-image`; - -// // Function to download card images -// const downloadCardImages = async () => { -// setIsLoading(true); -// try { -// const response = await fetchWrapper(BASE_API_URL + '/download', 'GET'); -// const fetchedCards = response.data; -// const imageUrls = fetchedCards -// .map((card) => { -// if (card.card_images && card.card_images.length > 0) { -// return card.card_images[0].image_url + '?dummy=' + Date.now(); -// } -// return null; // or some placeholder image URL -// }) -// .filter(Boolean); // Remove any nulls - -// setCards(fetchedCards); -// setImages(imageUrls); // Set all image URLs at once -// } catch (error) { -// console.error('Error in downloadCardImages:', error); -// setError(error.message); -// } finally { -// setIsLoading(false); -// } -// }; - -// // useEffect(() => { -// // downloadCardImages(); -// // }, []); - -// // Handle random card image selection -// useEffect(() => { -// if (cards && cards.length > 0) { -// const randomCardIndex = Math.floor(Math.random() * cards.length); -// const randomCard = cards[randomCardIndex]; -// if ( -// randomCard && -// randomCard.card_images && -// randomCard.card_images.length > 0 -// ) { -// setRandomCardImage(randomCard.card_images[0].image_url); -// } -// } -// }, [cards]); // Dependency on cards means this will rerun when cards are fetched/updated - -// useEffect(() => { -// if (images && images.length > 0) { -// const randomCard = images[Math.floor(Math.random() * images.length)]; -// if (randomCard.card_images && randomCard.card_images.length > 0) { -// setRandomCardImage(randomCard.card_images[0].image_url); -// } -// } -// }, [images]); - -// return ( -// -// {children} -// -// ); -// }; diff --git a/src/assets/currentlyUnused/CardImagesContext/useCardManager.jsx b/src/assets/currentlyUnused/CardImagesContext/useCardManager.jsx deleted file mode 100644 index 8c2c4e3..0000000 --- a/src/assets/currentlyUnused/CardImagesContext/useCardManager.jsx +++ /dev/null @@ -1,39 +0,0 @@ -// import { useState } from 'react'; - -// const useCardManager = (initialCards = []) => { -// const [cards, setCards] = useState(initialCards); - -// // General function to update a card -// const updateCard = (cardId, updatedData) => { -// setCards((currentCards) => -// currentCards.map((card) => -// card.id === cardId ? { ...card, ...updatedData } : card -// ) -// ); -// }; - -// // Add a new card -// const addCard = (newCardData) => { -// setCards([...cards, newCardData]); -// }; - -// // General utility to update a specific field of a card -// const updateField = (cardId, field, value) => { -// updateCard(cardId, { [field]: value }); -// }; - -// // Update a nested field like priceHistory or card_images -// const updateNestedField = (cardId, field, newValue) => { -// const card = cards.find((card) => card.id === cardId); -// updateCard(cardId, { [field]: [...card[field], newValue] }); -// }; - -// return { -// cards, -// addCard, -// updateCard: updateField, // for updating single fields -// updateNestedField, // for updating nested fields like arrays -// }; -// }; - -// export default useCardManager; diff --git a/src/assets/currentlyUnused/CardImagesContext/useCardVariantManager.jsx b/src/assets/currentlyUnused/CardImagesContext/useCardVariantManager.jsx deleted file mode 100644 index 88a8f22..0000000 --- a/src/assets/currentlyUnused/CardImagesContext/useCardVariantManager.jsx +++ /dev/null @@ -1,73 +0,0 @@ -// import { useState } from 'react'; - -// const useCardVariantManager = (initialCards = []) => { -// const [cards, setCards] = useState(initialCards); - -// // Function to identify the variant index -// const findVariantIndex = (cardId, setCode) => -// cards.findIndex( -// (card) => card.id === cardId && card.card_set.set_code === setCode -// ); - -// // Function to determine overlay based on rarity -// const getOverlayByRarity = (rarity) => { -// // Define overlays for different rarities -// const overlays = { -// Common: 'commonOverlay', -// Rare: 'rareOverlay', -// 'Ultra Rare': 'ultraRareOverlay', -// // ... other rarities -// }; -// return overlays[rarity] || 'defaultOverlay'; -// }; - -// // Function to update a specific variant field -// const updateVariantField = (cardId, setCode, field, value) => { -// const index = findVariantIndex(cardId, setCode); -// if (index < 0) return; // Variant not found - -// const updatedCards = [...cards]; -// updatedCards[index] = { -// ...updatedCards[index], -// [field]: value, -// // Update overlay based on rarity -// overlay: getOverlayByRarity(updatedCards[index].card_set.set_rarity), -// }; -// setCards(updatedCards); -// }; - -// // Function to add a new variant -// const addVariant = (cardId, newVariantData) => { -// const updatedCards = [...cards]; -// updatedCards.push({ -// ...newVariantData, -// id: cardId, -// // Assign overlay based on rarity -// overlay: getOverlayByRarity(newVariantData.card_set.set_rarity), -// }); -// setCards(updatedCards); -// }; - -// // Function to update nested fields like priceHistory for a specific variant -// const updateNestedField = (cardId, setCode, field, newValue) => { -// const index = findVariantIndex(cardId, setCode); -// if (index < 0) return; // Variant not found - -// const updatedCards = [...cards]; -// const variant = updatedCards[index]; -// updatedCards[index] = { -// ...variant, -// [field]: [...variant[field], newValue], -// }; -// setCards(updatedCards); -// }; - -// return { -// cards, -// addVariant, -// updateVariantField, -// updateNestedField, -// }; -// }; - -// export default useCardVariantManager; diff --git a/src/assets/currentlyUnused/CardLinearChart.jsx b/src/assets/currentlyUnused/CardLinearChart.jsx deleted file mode 100644 index 421d50e..0000000 --- a/src/assets/currentlyUnused/CardLinearChart.jsx +++ /dev/null @@ -1,85 +0,0 @@ -// import { Box, Tooltip, Typography, useMediaQuery } from '@mui/material'; - -// import { ResponsiveLine } from '@nivo/line'; -// import { useCallback, useMemo, useState } from 'react'; -// import { useMode } from '../context'; -// import styled from 'styled-components'; -// const ChartContainer = styled(Box)(({ theme }) => ({ -// display: 'flex', -// alignItems: 'center', -// justifyContent: 'center', -// width: '100%', -// height: 'auto', -// [theme.breakpoints.down('sm')]: { -// width: '150%', // Adjust width for mobile screens -// height: '300px', // Adjust height for mobile screens -// // transform: 'translateX(10%)', // Shift the chart to the right by 50% -// }, -// })); - -// const parseDate = (dateString) => { -// const date = new Date(dateString); -// if (isNaN(date.getTime())) { -// console.error(`Invalid date: ${dateString}`); -// return null; // or a sensible default, or throw an error, depending on your needs -// } -// return date; -// }; -// export const useEventHandlers = () => { -// const [hoveredData, setHoveredData] = useState(null); -// const handleMouseMove = useCallback((point) => { -// setHoveredData(point ? { x: point.data.x, y: point.data.y } : null); -// }, []); -// const handleMouseLeave = useCallback(() => setHoveredData(null), []); -// return { hoveredData, handleMouseMove, handleMouseLeave }; -// }; - -// const CardLinearChart = ({ nivoReadyData, dimensions }) => { -// const { theme } = useMode(); -// const processedData = useMemo(() => { -// return nivoReadyData?.map((series) => ({ -// ...series, -// data: series?.data?.map((point) => ({ -// ...point, -// x: parseDate(point?.x) || point?.x, -// })), -// })); -// }, [nivoReadyData]); - -// const chartProps = useMemo( -// () => ({ -// data: processedData, -// margin: { top: 20, right: 20, bottom: 20, left: 35 }, -// xScale: { -// type: 'time', -// format: 'time:%Y-%m-%dT%H:%M:%S.%LZ', -// useUTC: false, -// precision: 'second', -// }, -// axisBottom: { -// tickRotation: 0, -// legend: 'Time', -// legendOffset: 36, -// legendPosition: 'middle', -// tickSize: 5, -// tickPadding: 5, -// tickValues: 'every 2 days', -// format: '%b %d', -// }, -// enableSlices: 'x', -// yScale: { type: 'linear', min: 'auto', max: 'auto' }, -// }), -// [nivoReadyData, processedData] -// ); - -// if (!processedData || !processedData?.length) { -// return No data available; -// } -// return ( -// -// -// -// ); -// }; - -// export default CardLinearChart; diff --git a/src/assets/currentlyUnused/CardStormAnimation.jsx b/src/assets/currentlyUnused/CardStormAnimation.jsx deleted file mode 100644 index 344f72a..0000000 --- a/src/assets/currentlyUnused/CardStormAnimation.jsx +++ /dev/null @@ -1,140 +0,0 @@ -import React, { useRef, useEffect } from 'react'; -import * as THREE from 'three'; -import placeholder from '../images/placeholder.jpeg'; - -const CardStormAnimation = () => { - const mountRef = useRef(null); - const cards = []; - const textureLoader = new THREE.TextureLoader(); - // Configuration - const initialPullRange = 1; - const orderlinessThreshold = 300; - const gravitationalPull = 0.01; - const rotationSpeed = 0.005; // Uniform rotation speed for all cards - - useEffect(() => { - const scene = new THREE.Scene(); - const camera = new THREE.PerspectiveCamera( - 75, - window.innerWidth / window.innerHeight, - 0.1, - 1000 - ); - const renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - mountRef.current.appendChild(renderer.domElement); - - // Lighting - const ambientLight = new THREE.AmbientLight(0x999999); - scene.add(ambientLight); - const pointLight = new THREE.PointLight(0xffffff, 1, 100); - pointLight.position.set(10, 10, 10); - pointLight.castShadow = true; - scene.add(pointLight); - - // Card creation - for (let i = 0; i < 100; i++) { - const geometry = new THREE.BoxGeometry(0.5, 0.7, 0.01); - const material = new THREE.MeshStandardMaterial({ - map: textureLoader.load(placeholder), - }); - const card = new THREE.Mesh(geometry, material); - card.position.set( - (Math.random() - 0.5) * 10, - (Math.random() - 0.5) * 10, - (Math.random() - 0.5) * 10 - ); - card.castShadow = true; - card.receiveShadow = true; - cards.push(card); - scene.add(card); - } - - camera.position.z = 5; - - // Mouse position - let mouseX = 0, - mouseY = 0; - const onDocumentMouseMove = (event) => { - const vector = new THREE.Vector3( - (event.clientX / window.innerWidth) * 2 - 1, - -(event.clientY / window.innerHeight) * 2 + 1, - 0.5 - ); - vector.unproject(camera); - const dir = vector.sub(camera.position).normalize(); - const distance = -camera.position.z / dir.z; - const pos = camera.position.clone().add(dir.multiplyScalar(distance)); - mouseX = pos.x; - mouseY = pos.y; - }; - document.addEventListener('mousemove', onDocumentMouseMove, false); - - const animate = () => { - requestAnimationFrame(animate); - - cards.forEach((card) => { - const dx = card.position.x - mouseX; - const dy = card.position.y - mouseY; - const distance = Math.sqrt(dx * dx + dy * dy); - const angle = Math.atan2(dy, dx); - - if (distance < initialPullRange || card.isInfluenced) { - card.isInfluenced = true; - card.timeInfluenced = card.timeInfluenced || 0; - card.timeInfluenced++; - - if (card.timeInfluenced > orderlinessThreshold) { - const targetRotation = Math.atan2( - mouseY - card.position.y, - mouseX - card.position.x - ); - card.rotation.z = THREE.MathUtils.lerp( - card.rotation.z, - targetRotation, - 0.01 - ); - } - - // Velocity for orbital movement - card.velocityX = card.velocityX || 0.01 * (Math.random() - 0.5); - card.velocityY = card.velocityY || 0.01 * (Math.random() - 0.5); - - card.velocityX -= gravitationalPull * Math.cos(angle); - card.velocityY -= gravitationalPull * Math.sin(angle); - - card.position.x += card.velocityX; - card.position.y += card.velocityY; - - // Reducing gravitational pull gradually - if (card.timeInfluenced > orderlinessThreshold) { - const pullReductionFactor = - 1 - - (card.timeInfluenced - orderlinessThreshold) / - orderlinessThreshold; - card.velocityX *= pullReductionFactor; - card.velocityY *= pullReductionFactor; - } - } - - // Applying continuous rotation for a smooth effect - card.rotation.x += rotationSpeed; - card.rotation.y += rotationSpeed; - }); - - renderer.render(scene, camera); - }; - animate(); - - // Clean up - return () => { - mountRef?.current?.removeChild(renderer.domElement); - document?.removeEventListener('mousemove', onDocumentMouseMove, false); - }; - }, []); // Only re-run the effect if mountRef changes - - return
; -}; - -export default CardStormAnimation; diff --git a/src/assets/currentlyUnused/CarouselImage.jsx b/src/assets/currentlyUnused/CarouselImage.jsx deleted file mode 100644 index 4cf9356..0000000 --- a/src/assets/currentlyUnused/CarouselImage.jsx +++ /dev/null @@ -1,28 +0,0 @@ -import { Box, Typography } from '@mui/material'; - -export const CarouselImage = ({ image, caption }) => { - return ( -
- {caption} - theme.palette.grey.black || 'common.white', - width: '100%', - padding: 2, - textAlign: 'center', - }} - > - - Browse and shop for your favorite trading cards. Whether buying or - selling, we've got something for every collector! - - -
- ); -}; diff --git a/src/assets/currentlyUnused/CartPage.css b/src/assets/currentlyUnused/CartPage.css deleted file mode 100644 index 8c2c9f3..0000000 --- a/src/assets/currentlyUnused/CartPage.css +++ /dev/null @@ -1,47 +0,0 @@ -.cart-container { - display: flex; - flex-direction: column; - align-items: center; - padding: 20px; - background-color: #f8f9fa; - border-radius: 10px; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); - width: 80%; - margin: 20px auto; -} - -.cart-item { - display: flex; - justify-content: space-between; - align-items: center; - width: 100%; - margin-bottom: 10px; - background-color: #fff; - padding: 10px; - border-radius: 8px; - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); -} - -.item-detail { - display: flex; - flex-direction: column; - justify-content: space-between; - margin-left: 10px; -} - -.item-image { - width: 100px; - height: 150px; - border-radius: 5px; - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); -} - -.total-price { - font-weight: bold; - margin-top: 20px; -} - -.empty-cart { - color: #888; - margin-top: 20px; -} diff --git a/src/assets/currentlyUnused/CartSummary.js b/src/assets/currentlyUnused/CartSummary.js deleted file mode 100644 index f235171..0000000 --- a/src/assets/currentlyUnused/CartSummary.js +++ /dev/null @@ -1,29 +0,0 @@ -// import React from 'react'; -// import { Box, Typography } from '@mui/material'; - -// const CartSummary = ({ quantity, totalCost }) => { -// return ( -// -// -// Items: {quantity} -// -// -// Grand Total: ${totalCost} -// -// -// ); -// }; - -// export default CartSummary; diff --git a/src/assets/currentlyUnused/ChartContext/ChartContext.jsx b/src/assets/currentlyUnused/ChartContext/ChartContext.jsx deleted file mode 100644 index 3803881..0000000 --- a/src/assets/currentlyUnused/ChartContext/ChartContext.jsx +++ /dev/null @@ -1,40 +0,0 @@ -// import { createContext, useContext, useEffect, useMemo, useState } from 'react'; -// import { useCollectionStore } from '../CollectionContext/CollectionContext'; -// import { defaultChartConstants, defaultContextValue } from '../../constants'; -// import useSelectedCollection from '../CollectionContext/useSelectedCollection'; -// const { TIME_RANGES, SELECTED_TIME_RANGE, TIME_RANGE_PROPS, TIME_RANGES_KEYS } = -// defaultChartConstants; - -// const ChartContext = createContext(defaultContextValue.CHART_CONTEXT); - -// export const ChartProvider = ({ children }) => { -// const { selectedCollection } = useSelectedCollection(); - -// const contextValue = useMemo( -// () => ({ -// nivoChartData: selectedCollection?.nivoChartData, -// newNivoChartData: selectedCollection?.newNivoChartData, -// muiChartData: selectedCollection?.muiChartData, -// nivoTestData: selectedCollection?.nivoTestData, -// }), -// [ -// selectedCollection?.nivoChartData, -// selectedCollection?.newNivoChartData, -// selectedCollection?.muiChartData, -// selectedCollection?.nivoTestData, -// ] -// ); -// return ( -// -// {children} -// -// ); -// }; - -// export const useChartContext = () => { -// const context = useContext(ChartContext); -// if (!context) { -// throw new Error('useChartContext must be used within a ChartProvider'); -// } -// return context; -// }; diff --git a/src/assets/currentlyUnused/ChartContext/helpers.jsx b/src/assets/currentlyUnused/ChartContext/helpers.jsx deleted file mode 100644 index 64f629c..0000000 --- a/src/assets/currentlyUnused/ChartContext/helpers.jsx +++ /dev/null @@ -1,245 +0,0 @@ -import { roundToNearestTenth } from '../../../context/Helpers'; -import { Tooltip, Typography } from '@mui/material'; -import { useState, useCallback, useMemo, useEffect } from 'react'; -import { debounce } from 'lodash'; -import styled from 'styled-components'; -import { Box } from '@mui/system'; -import useMode from '../../../context/UTILITIES_CONTEXT/ColorModeContext/useMode'; - -export const groupAndAverageData = (data, threshold = 600000, timeRange) => { - if (!data || data.length === 0) return []; - - const clusters = []; - let currentCluster = [data[0]]; - - // console.log('Initial cluster with first data point: ', currentCluster); - - // loop for each data point - for (let i = 1; i < data.length; i++) { - const prevTime = new Date(data[i - 1].x).getTime(); - const currentTime = new Date(data[i].x).getTime(); - const timeDiff = currentTime - prevTime; - - // console.log( - // `Time difference between points ${i - 1} and ${i}: ${timeDiff}ms` - // ); - - if (timeDiff <= threshold) { - currentCluster.push(data[i]); - } else { - clusters.push(currentCluster); - currentCluster = [data[i]]; - } - } - clusters.push(currentCluster); // Push the last cluster - // console.log('Final cluster: ', currentCluster); - - // Process each cluster to create the desired output format - clusters.map((cluster) => { - const middleIndex = Math.floor(cluster.length / 2); - const middleDatum = cluster[middleIndex]; - const avgY = - cluster.reduce((sum, point) => sum + point.y, 0) / cluster.length; - - const date = new Date(middleDatum.x); - const formattedDate = date.toISOString(); - - return { - label: `Price at ${formattedDate}`, - x: formattedDate, - y: avgY, - }; - }); - - return clusters; -}; - -export const getAveragedData = (data) => { - // Use a regular function instead of a hook - if (!Array.isArray(data)) { - return []; - } - return data.map((row, index, total) => { - const start = Math.max(0, index - 6); - const end = index; - const subset = total.slice(start, end + 1); - const sum = subset.reduce((a, b) => a + b.y, 0); - return { - x: row.x, - y: sum / subset.length || 0, - }; - }); -}; - -// export const convertDataForNivo2 = (rawData2) => { -// if (!Array.isArray(rawData2) || rawData2.length === 0) { -// console.error('Invalid or empty rawData provided', rawData2); -// return []; -// } - -// // Assuming rawData2 is an array of objects with 'x' and 'y' properties -// const nivoData = rawData2?.map((dataPoint) => { -// // Ensure the 'x' value is in ISO date string format -// const xValue = -// dataPoint[0]?.x instanceof Date -// ? dataPoint[0]?.x?.toISOString() -// : dataPoint[0]?.x; -// const yValue = dataPoint[0]?.y; // Assuming y value is directly usable - -// return { x: xValue, y: yValue }; -// }); - -// // Wrapping the data for a single series. You can add more series similarly -// return [ -// { -// id: 'Your Data', // Replace with a meaningful id -// color: 'hsl(252, 70%, 50%)', // Replace with color of your choice or logic for dynamic colors -// data: nivoData, -// }, -// ]; -// }; - -export const finalizeNivoData = (nivoChartData) => { - // return nivoData which is the data array, combined with id and color properties - return [ - { - id: 'Your Data', // Replace with a meaningful id - color: 'hsl(252, 70%, 50%)', // Replace with color of your choice or logic for dynamic colors - data: nivoChartData[0]?.data, - }, - ]; -}; - -export const getFilteredData = (data, timeRange) => { - const cutOffTime = new Date().getTime() - timeRange; - return data - .filter((d) => { - const date = new Date(d.x); - if (isNaN(date.getTime())) { - console.error('Invalid date:', d.x); - return false; - } - return date.getTime() >= cutOffTime; - }) - .map((d) => ({ ...d, y: roundToNearestTenth(d.y) })); -}; - -export const formatDateToString = (date) => { - if (!(date instanceof Date) || isNaN(date.getTime())) { - console.error('Invalid date:', date); - return ''; - } - return `${date.getFullYear()}-${(date.getMonth() + 1) - .toString() - .padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date - .getHours() - .toString() - .padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`; -}; - -export const ChartTooltip = ({ point, lastData, hoveredData, latestData }) => { - if (!point) return null; - const formattedTime = hoveredData - ? new Date(hoveredData.x).toLocaleString() - : new Date((latestData || lastData).x).toLocaleString(); - - const formattedValue = `$${ - hoveredData ? hoveredData.y : (latestData || lastData)?.y - }`; - - return ( - <> - - - {formattedTime} - - - - - {formattedValue} - - - - ); -}; - -export const useEventHandlers = () => { - const [hoveredData, setHoveredData] = useState(null); - const debouncedSetHoveredData = useCallback( - debounce(setHoveredData, 100), - [] - ); - const handleMouseMove = useCallback( - (point) => { - debouncedSetHoveredData( - point ? { x: point?.data?.x, y: point?.data?.y } : null - ); - }, - [debouncedSetHoveredData] - ); - const handleMouseLeave = useCallback( - () => debouncedSetHoveredData(null), - [debouncedSetHoveredData] - ); - return { hoveredData, handleMouseMove, handleMouseLeave }; -}; -const TooltipBox = styled(Box)(({ theme }) => ({ - padding: theme.spacing(2), - backgroundColor: theme.palette.background.paper, - boxShadow: theme.shadows[3], - borderRadius: theme.shape.borderRadius, -})); -export const isSpecialPoint = (markers, point) => - markers?.some((sp) => sp?.x === point.data.x && sp.y === point.data.y); -export const CustomTooltipLayer = ({ points, xScale, yScale, markers }) => ( - <> - {points?.map((point, index) => { - const specialPoint = markers?.find( - (sp) => sp.x === point.data.x && sp.y === point.data.y - ); - return specialPoint ? ( - - - - {specialPoint.label} - - - ) : null; - })} - -); -export const CustomTooltip = ({ point, markers, timeRange }) => { - const { theme } = useMode(); - return ( - - - {`Card: ${point.data.label}`} - {`Time: ${new Date(point.data.xFormatted).toLocaleString()}`} - {`Value: $${parseFloat(point.data.yFormatted).toFixed(2)}`} - {isSpecialPoint(markers, point) && ( - Special Point! - )} - - - ); -}; diff --git a/src/assets/currentlyUnused/ChartErrorBoundary.jsx b/src/assets/currentlyUnused/ChartErrorBoundary.jsx deleted file mode 100644 index 513ae6e..0000000 --- a/src/assets/currentlyUnused/ChartErrorBoundary.jsx +++ /dev/null @@ -1,49 +0,0 @@ -// import React, { useState, useEffect } from 'react'; -// import { Box, Container, Icon, Typography, useMediaQuery } from '@mui/material'; -// import useSkeletonLoader from '../../../REUSABLE_COMPONENTS/useSkeletonLoader'; -// import BoxHeader from '../../../REUSABLE_COMPONENTS/BoxHeader'; -// import { useMode } from '../../../../context'; - -// function ChartErrorBoundary({ children }) { -// const [hasError, setHasError] = useState(false); -// const [error, setError] = useState(null); -// const { SkeletonLoader } = useSkeletonLoader(); -// const { theme } = useMode(); -// const isSmall = useMediaQuery(theme.breakpoints.down('sm')); - -// useEffect(() => { -// const errorListener = (event) => { -// event.preventDefault(); -// setError(event.error); -// setHasError(true); -// }; - -// window.addEventListener('error', errorListener); - -// return () => { -// window.removeEventListener('error', errorListener); -// }; -// }, []); - -// if (hasError) { -// return ( -// -// Unable to display chart - -// table_chart} -// sideText={new Date().toLocaleString()} -// /> -// -// -// -// -// ); -// } - -// return children; -// } - -// export default ChartErrorBoundary; diff --git a/src/assets/currentlyUnused/ChartWrapper.jsx b/src/assets/currentlyUnused/ChartWrapper.jsx deleted file mode 100644 index 2852113..0000000 --- a/src/assets/currentlyUnused/ChartWrapper.jsx +++ /dev/null @@ -1,20 +0,0 @@ -// import React from 'react'; - -// const ChartWrapper = ({ theme, children, ...rest }) => { -// const chartStyle = { -// display: 'flex', -// alignItems: 'center', -// justifyContent: 'center', -// marginBottom: theme.lenLg1, -// height: theme.heightChartMd, -// width: '100%', -// }; - -// return ( -//
-// {children} -//
-// ); -// }; - -// export default ChartWrapper; diff --git a/src/assets/currentlyUnused/CollectionForm.jsx b/src/assets/currentlyUnused/CollectionForm.jsx deleted file mode 100644 index 7c4e018..0000000 --- a/src/assets/currentlyUnused/CollectionForm.jsx +++ /dev/null @@ -1,67 +0,0 @@ -// import React, { useEffect } from 'react'; -// import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; -// import { useMode } from '../../context'; -// import RCZodForm from './reusable/RCZodForm'; - -// // Common fields structure used in both add and update forms -// const collectionFields = [ -// { -// label: 'Name', -// type: 'text', -// placeHolder: 'Enter collection name', -// defaultValue: '', -// rules: { -// required: true, -// }, -// value: '', -// required: true, -// name: 'name', -// }, -// { -// label: 'Description', -// type: 'text', -// placeHolder: 'Enter collection description', -// defaultValue: '', -// rules: { -// required: true, -// multiline: true, -// rows: 4, -// }, -// value: '', -// required: true, -// multiline: true, -// rows: 4, -// name: 'description', -// }, -// ]; - -// const CollectionForm = ({ collectionData, actionType }) => { -// const { theme } = useMode(); -// const schemaName = -// actionType === 'add' ? 'addCollectionForm' : 'updateCollectionForm'; -// const buttonLabel = -// actionType === 'add' ? 'Create Collection' : 'Update Collection'; -// const startIcon = -// actionType === 'add' ? : ; -// // console.log('COLLECTION DATA', collectionData); -// return ( -// ({ -// ...field, -// value: collectionData?.[field.name], -// })) -// } -// // onSubmit={handleFormSubmit} -// theme={theme} -// initialValues={actionType === 'update' ? collectionData : {}} -// /> -// ); -// }; - -// export default CollectionForm; diff --git a/src/assets/currentlyUnused/CollectionStatisticsSelector.jsx b/src/assets/currentlyUnused/CollectionStatisticsSelector.jsx deleted file mode 100644 index 6433dde..0000000 --- a/src/assets/currentlyUnused/CollectionStatisticsSelector.jsx +++ /dev/null @@ -1,54 +0,0 @@ -// import React from 'react'; -// import { FormControl, InputLabel } from '@mui/material'; - -// import SelectComponent from '../../../assets/Select'; -// import { useStatisticsStore, useMode, useFormContext } from '../../../context'; -// import { StyledChartBox } from '../../../pages/pageStyles/StyledComponents'; -// import { useSnackbar } from 'notistack'; -// import { Controller } from 'react-hook-form'; - -// const CollectionStatisticsSelector = () => { -// const { formMethods } = useFormContext(); -// const [selectedStat, setSelectedStat] = React.useState(''); -// const { enqueueSnackbar } = useSnackbar(); // Assuming useOverlay has enqueueSnackbar method -// const { theme } = useMode(); -// const { -// control, -// handleSubmit, -// formState: { errors }, -// } = formMethods; -// const statisticsOptions = [ -// { value: 'highPoint', label: 'High Point' }, -// { value: 'lowPoint', label: 'Low Point' }, -// { value: 'twentyFourHourAverage', label: '24 Hour Average' }, -// { value: 'average', label: 'Average' }, -// { value: 'volume', label: 'Volume' }, -// { value: 'volatility', label: 'Volatility' }, -// ]; - -// // const handleChange = (event) => setSelectedStat(event.target.value); -// const onFormSubmit = (data) => { -// setSelectedStat(data.themeRange); -// enqueueSnackbar('Stat updated successfully', { variant: 'success' }); -// }; -// return ( -// -// -// Statistics Range -// ( -// -// )} -// /> -// -// -// ); -// }; - -// export default CollectionStatisticsSelector; diff --git a/src/assets/currentlyUnused/CombinedContext/CombinedProvider.jsx b/src/assets/currentlyUnused/CombinedContext/CombinedProvider.jsx deleted file mode 100644 index 968ed00..0000000 --- a/src/assets/currentlyUnused/CombinedContext/CombinedProvider.jsx +++ /dev/null @@ -1,673 +0,0 @@ -// import React, { -// createContext, -// useContext, -// useEffect, -// useMemo, -// useState, -// } from 'react'; -// import { useCookies } from 'react-cookie'; -// import { -// generateListOfMonitoredCards, -// updateCardPricesInList, -// initialState, -// } from './helpers'; -// import { useSocketContext } from '../../UTILITIES_CONTEXT/SocketContext/SocketProvider'; -// import useCollectionManager from '../../MAIN_CONTEXT/CollectionContext/useCollectionManager'; - -// export const CombinedContext = createContext(); - -// export const CombinedProvider = ({ children }) => { -// const [cookies] = useCookies(['authUser']); -// const [state, setState] = useState(initialState); -// const user = cookies?.authUser; -// const userId = user?.userId; -// const { selectedCollection, allCollections, updateOneInCollection } = -// useCollectionManager(); -// const socket = useSocketContext(); - -// const setDataFunctions = { -// data: (key, data) => setState((prev) => ({ ...prev, [key]: data })), -// eventsTriggered: (data) => -// setState((prev) => ({ ...prev, eventsTriggered: data })), -// }; - -// const setLoader = (isLoading) => { -// if (typeof isLoading !== 'boolean') { -// console.error('Invalid argument type for setLoader: Expected boolean'); -// return; -// } -// setState((prev) => ({ ...prev, isLoading })); -// }; - -// const handleEvent = (event, data) => { -// console.log(`Handling event: ${event}`); -// switch (event) { -// case 'MESSAGE_TO_CLIENT': -// console.log('Received message:', data); -// setDataFunctions.data('messageTest', data); -// break; -// case 'STATUS_UPDATE_CRON': -// console.log('Received status update from cron:', data); -// if (Array.isArray(data) && data.length > 0) { -// setDataFunctions.data('chartData', data); -// } -// break; -// case 'CARD_PRICES_UNCHANGED': -// console.log('Received card prices unchanged:', data); -// setDataFunctions.data('cardPrices', data.currentPrices); -// break; -// case 'COLLECTIONS_UPDATED': -// console.log('Collections updated:', data); -// // if (Array.isArray(data.allCollections)) { -// // for (const collection of data.allCollections) { -// // updateAllCollectionState(collection); -// // } -// // setDataFunctions.data('allCollectionData', data.allCollections); -// // setDataFunctions.data('allCardPrices', data.updatedCards); -// // } -// break; -// case 'SEND_PRICING_DATA_TO_CLIENT': -// console.log('Received pricing data:', data); -// handleCardPricesUpdated(data.data.data); -// break; -// case 'ERROR': -// console.error('Received error:', data); -// setDataFunctions.data('error', data.error); -// break; -// default: -// break; -// } -// }; - -// const handleCardPricesUpdated = async (priceData) => { -// console.log('Card prices retrieved:', priceData); -// const updatedCardPrices = priceData.data.data; -// const currentListOfMonitoredCards = -// generateListOfMonitoredCards(allCollections); -// const updatedListOfMonitoredCards = updateCardPricesInList( -// currentListOfMonitoredCards, -// updatedCardPrices -// ); -// const updatedSelectedCollectionCards = selectedCollection.cards.map( -// (card) => { -// const updatedCardPrice = updatedListOfMonitoredCards.find( -// (updatedCard) => updatedCard.id === card.id -// ); -// return updatedCardPrice ? { ...card, ...updatedCardPrice } : card; -// } -// ); - -// const updatedCollection = { -// ...selectedCollection, -// cards: updatedSelectedCollectionCards, -// }; - -// // Update each card in the collection -// for (const card of updatedCollection.cards) { -// const updatedCollectionResult = await updateOneInCollection( -// updatedCollection._id, -// card, -// 'update' -// ); -// setDataFunctions.data('updatedCollectionResult', updatedCollectionResult); -// // if (updatedCollectionResult) { -// // updateAllCollectionState( -// // updatedCollectionResult.filteredRestructuredCollection -// // ); -// // setDataFunctions.data( -// // 'listOfSimulatedCards', -// // updatedCollectionResult.filteredRestructuredCollection.cards -// // ); -// // } -// } - -// // Update the global state with the new card prices -// setDataFunctions.data('allCardPrices', updatedListOfMonitoredCards); -// }; - -// useEffect(() => { -// if (!socket) return; -// const eventHandlers = { -// MESSAGE_TO_CLIENT: handleEvent, -// STATUS_UPDATE_CRON: handleEvent, -// CARD_PRICES_UNCHANGED: handleEvent, -// COLLECTIONS_UPDATED: handleEvent, -// SEND_PRICING_DATA_TO_CLIENT: handleEvent, -// ERROR: handleEvent, -// }; -// Object.entries(eventHandlers).forEach(([event, handler]) => { -// socket.on(event, handler); -// }); -// return () => { -// Object.keys(eventHandlers).forEach((event) => { -// socket.off(event, eventHandlers[event]); -// }); -// }; -// }, [socket]); - -// const listOfMonitoredCards = useMemo( -// () => generateListOfMonitoredCards([allCollections]), -// [allCollections] -// ); - -// useEffect(() => { -// if (state.eventsTriggered) { -// console.log(`Handling event: ${state.eventsTriggered.eventName}`); -// } -// }, [state?.eventsTriggered]); - -// useEffect(() => { -// if (selectedCollection) { -// setDataFunctions.data('collectionData', selectedCollection); -// } -// }, [selectedCollection]); - -// useEffect(() => { -// if ( -// allCollections && -// JSON.stringify(allCollections) !== JSON.stringify(state.allCollectionData) -// ) { -// setDataFunctions.data('allCollectionData', allCollections); -// } -// }, [allCollections]); - -// useEffect(() => { -// if (user) { -// setDataFunctions.data('userData', user); -// } -// }, [user]); - -// useEffect(() => { -// if (listOfMonitoredCards) { -// setDataFunctions.data( -// 'retrievedListOfMonitoredCards', -// listOfMonitoredCards -// ); -// } -// }, [listOfMonitoredCards]); - -// const handleCronRequest = (userId, selectedList) => { -// socket?.emit('START_CRON_JOB', { userId, selectedList }); -// }; - -// const handleSend = (message) => { -// if (!message) return console.error('Message content is missing.'); -// socket?.emit('MESSAGE_FROM_CLIENT', { message, data: message }); -// }; - -// const handleSendAllCardsInCollections = (userId, selectedList) => { -// if (!userId || !selectedList) return; -// socket?.emit('REQUEST_CRON_UPDATED_CARDS_IN_COLLECTION', { -// userId, -// data: { selectedList }, -// }); -// }; - -// const handleRequestCronStop = (userId) => { -// if (!userId) return console.error('Missing userId for cron job stop.'); -// socket?.emit('REQUEST_CRON_STOP', { userId }); -// }; - -// const handlePricesActivateCron = ( -// userId, -// selectedList, -// cardsWithChangedPrice -// ) => { -// if (!userId || !selectedList || !cardsWithChangedPrice) return; -// socket?.emit('REQUEST_PRICES_ACTIVATE_CRON', { -// userId, -// data: { userId, selectedList, cardsWithChangedPrice }, -// }); -// }; -// const contextValue = useMemo( -// () => ({ -// ...state, -// listOfMonitoredCards, -// setLoader, -// handleCronRequest, -// handleSend, -// handleSendAllCardsInCollections, -// handleRequestCronStop, -// handlePricesActivateCron, -// socket, -// }), -// [state, listOfMonitoredCards, socket] -// ); - -// // useEffect(() => { -// // console.log('COMBINED CONTEXT:', state); -// // }, [ -// // userId, -// // state.allCollectionData, -// // state.updatedCollection, -// // state.cardPrices, -// // ]); - -// return ( -// -// {children} -// -// ); -// }; - -// export const useCombinedContext = () => { -// const context = useContext(CombinedContext); -// if (context === undefined) { -// throw new Error( -// 'useCombinedContext must be used within a CombinedProvider' -// ); -// } -// return context; -// }; - -// // import React, { -// // createContext, -// // useCallback, -// // useContext, -// // useEffect, -// // useMemo, -// // useState, -// // } from 'react'; -// // import { useCookies } from 'react-cookie'; -// // import { CollectionContext } from '../MAIN_CONTEXT/CollectionContext/CollectionContext'; -// // import { filterNullPriceHistoryForCollection } from '../MAIN_CONTEXT/CollectionContext/helpers'; -// // import { -// // generateListOfMonitoredCards, -// // updateCardPricesInList, -// // initialState, -// // } from './helpers'; -// // import { useUnsavedCardsEffect } from '../hooks/useUnsavedCardsEffect'; -// // import { useSocketContext } from '../UTILITIES_CONTEXT/SocketContext/SocketProvider'; -// // export const CombinedContext = createContext(); - -// // export const CombinedProvider = ({ children }) => { -// // const [cookies] = useCookies(['authUser']); -// // const [state, setState] = useState(initialState); -// // const user = cookies?.authUser; -// // const userId = user?.userId; -// // const { -// // selectedCollection, -// // updateCollection, -// // allCollections, -// // getNewTotalPrice, -// // updateCollectionState, -// // updateAllCollectionState, -// // getUpdatedCollection, -// // } = useContext(CollectionContext); -// // const socket = useSocketContext(); - -// // const createStateUpdaterFunction = (key) => -// // useCallback( -// // (data) => { -// // setState((prev) => { -// // let newData; - -// // // validateData(data, key, 'createStateUpdaterFunction'); -// // if (Array.isArray(data)) { -// // newData = [...data]; -// // } else if (typeof data === 'object' && data !== null) { -// // newData = { ...data }; -// // } else { -// // newData = data; -// // } -// // return { ...prev, [key]: newData }; -// // }); -// // }, -// // [setState] -// // ); - -// // const setDataFunctions = { -// // data: createStateUpdaterFunction('chartData'), -// // userData: createStateUpdaterFunction('userData'), -// // messageTest: createStateUpdaterFunction('messageTest'), -// // chartData: createStateUpdaterFunction('chartData'), -// // listOfSimulatedCards: createStateUpdaterFunction('listOfSimulatedCards'), -// // cardPrices: createStateUpdaterFunction('cardPrices'), -// // allCardPrices: createStateUpdaterFunction('allCardPrices'), -// // retrievedListOfMonitoredCards: createStateUpdaterFunction( -// // 'retrievedListOfMonitoredCards' -// // ), -// // cronData: createStateUpdaterFunction('cronData'), -// // error: createStateUpdaterFunction('error'), -// // collectionData: createStateUpdaterFunction('collectionData'), -// // allCollectionData: createStateUpdaterFunction('allCollectionData'), -// // emittedResponses: createStateUpdaterFunction('emittedResponses'), -// // eventsTriggered: createStateUpdaterFunction('eventsTriggered'), -// // }; - -// // const setLoader = (isLoading) => { -// // if (typeof isLoading !== 'boolean') { -// // console.error('Invalid argument type for setLoader: Expected boolean'); -// // return; -// // } -// // setState((prev) => ({ ...prev, isLoading })); -// // }; - -// // useEffect(() => { -// // if (state.eventsTriggered) { -// // console.log(`Handling event: ${state.eventsTriggered.eventName}`); -// // } -// // }, [state?.eventsTriggered]); - -// // // ----------- XXX ----------- - -// // const listOfMonitoredCards = useMemo( -// // () => generateListOfMonitoredCards([allCollections]), -// // [allCollections] -// // ); - -// // const handleReceive = (message) => { -// // console.log('Received message:', message); -// // setDataFunctions.messageTest(message); -// // }; -// // const handleEventResponse = (newData) => { -// // const { message, data } = newData; -// // console.log('EVENT_RESPONSE:', message, data); -// // setDataFunctions.eventsTriggered(data); -// // }; -// // const handleStatusUpdateCron = (newData) => { -// // const { message, data } = newData; -// // // console.log('[STATUS_UPDATE_CRON]', message, data); -// // if (!Array.isArray(data) || !data.data || data.data.length === 0) { -// // return null; -// // } -// // setDataFunctions.data(data); -// // }; -// // const handleCollectionsUpdated = async (data) => { -// // const { message, updatedCards, allCollections } = data; -// // console.log('message', message); -// // console.log('updatedCards', updatedCards); -// // console.log('allCollections', allCollections); -// // // console.log('updatedCards', updatedCards); - -// // // Update the selected collection with new card prices -// // // const updatedSelectedCollectionCards = selectedCollection.cards.map( -// // // (card) => { -// // // const updatedCardPrice = updatedCards.find( -// // // (updatedCard) => updatedCard.id === card.id -// // // ); -// // // return updatedCardPrice ? { ...card, ...updatedCardPrice } : card; -// // // } -// // // ); -// // if (!allCollections) return; -// // if (!Array.isArray(allCollections)) return; -// // // const updatedCardsLocalAndRemote = useUnsavedCardsEffect( -// // // allCollections, -// // // userId -// // // ); -// // // console.log('UPDATED CARDS', updatedCardsLocalAndRemote); -// // for (const collection of allCollections) { -// // updateAllCollectionState(collection); -// // } -// // setDataFunctions.data(allCollections); -// // setDataFunctions.allCardPrices(updatedCards); -// // }; -// // const handlePricesUnchanged = (data) => { -// // const { message, currentPrices } = data; -// // console.log('message', message); -// // // console.log('currentPrices', currentPrices); -// // setDataFunctions.cardPrices(currentPrices); -// // }; -// // const handleError = (errorData) => { -// // console.log('ERROR RECEIVED', errorData); -// // const { status, message, error } = errorData; -// // console.log('ERROR RECEIVED'); -// // console.log('ERROR STATUS: ', status); -// // console.log('ERROR MESSAGE: ', message); -// // console.log('ERROR DATA: ', error); -// // setDataFunctions.error(error); -// // }; -// // const handleCardPricesUpdated = async (priceData) => { -// // console.log('Card prices retrieved:', priceData); -// // const updatedCardPrices = priceData.data.data; -// // const userId = user?.id; - -// // const currentListOfMonitoredCards = -// // generateListOfMonitoredCards(allCollections); -// // console.log( -// // `[currentListOfMonitoredCards: $${getNewTotalPrice( -// // currentListOfMonitoredCards -// // )}] | `, -// // currentListOfMonitoredCards -// // ); -// // const updatedListOfMonitoredCards = updateCardPricesInList( -// // currentListOfMonitoredCards, -// // updatedCardPrices -// // ); -// // console.log( -// // `[updatedListOfMonitoredCards: $${getNewTotalPrice( -// // updatedListOfMonitoredCards -// // )}] | `, -// // updatedListOfMonitoredCards -// // ); - -// // const updatedSelectedCollectionCards = selectedCollection.cards.map( -// // (card) => { -// // const updatedCardPrice = updatedListOfMonitoredCards.find( -// // (updatedCard) => updatedCard.id === card.id -// // ); -// // return updatedCardPrice ? { ...card, ...updatedCardPrice } : card; -// // } -// // ); - -// // const updatedCollection = { -// // ...selectedCollection, -// // cards: updatedSelectedCollectionCards, -// // }; - -// // const filteredUpdatedCollection = -// // filterNullPriceHistoryForCollection(updatedCollection); - -// // try { -// // // Update each card in the collection -// // for (const card of filteredUpdatedCollection.cards) { -// // const updatedCollectionResult = await getUpdatedCollection( -// // filteredUpdatedCollection, -// // card, // No specific card to update -// // 'update', // Operation type -// // userId -// // ); - -// // if (updatedCollectionResult) { -// // // console.log( -// // // 'UPDATED COLLECTION RESULT IN COMBINED:', -// // // updatedCollectionResult.filteredRestructuredCollection -// // // ); -// // updateCollectionState( -// // updatedCollectionResult.filteredRestructuredCollection -// // ); -// // setDataFunctions.listOfSimulatedCards( -// // updatedCollectionResult.filteredRestructuredCollection.cards -// // ); -// // } -// // } -// // } catch (error) { -// // console.error('Failed to update collection:', error); -// // } - -// // // Update the global state with the new card prices -// // setDataFunctions.allCardPrices(updatedListOfMonitoredCards); -// // }; - -// // useEffect(() => { -// // if (!socket) return; -// // const eventHandlers = new Map([ -// // ['MESSAGE_TO_CLIENT', handleReceive], -// // ['STATUS_UPDATE_CRON', handleStatusUpdateCron], -// // ['CARD_PRICES_UNCHANGED', handlePricesUnchanged], -// // ['COLLECTIONS_UPDATED', handleCollectionsUpdated], -// // ['SEND_PRICING_DATA_TO_CLIENT', handleCardPricesUpdated], -// // ['EVENT_RESPONSE', handleEventResponse], -// // ['ERROR', handleError], -// // ]); -// // eventHandlers.forEach((handler, event) => { -// // socket.on(event, handler); -// // }); -// // return () => { -// // eventHandlers.forEach((_, event) => { -// // socket.off(event); -// // }); -// // }; -// // }, [socket, state, setDataFunctions]); - -// // // ----------- DATA PROCESSING & HANDLERS ----------- - -// // const handleSocketInteraction = { -// // requestData: {}, -// // sendAction: { -// // message: (message) => { -// // if (!message) return console.error('Message content is missing.'); -// // socket?.emit('MESSAGE_FROM_CLIENT', { message, data: message }); -// // }, -// // stopCronJob: (userId) => { -// // if (!userId) return console.error('Missing userId for cron job stop.'); -// // socket?.emit('REQUEST_CRON_STOP', { userId }); -// // }, -// // checkAndUpdateCardPrices: ( -// // userId, -// // listOfMonitoredCards -// // // retrievedListOfMonitoredCards -// // ) => { -// // if (!userId) -// // return console.error('Missing userId or listOfMonitoredCards.'); -// // if (!listOfMonitoredCards || listOfMonitoredCards.length === 0) -// // return console.error('Missing retrievedListOfMonitoredCards.'); -// // let attempt2; -// // if (!Array.isArray(listOfMonitoredCards)) { -// // console.warn( -// // 'INITIAL LISTOFMONITOREDCARDSVALUE NOT AN ARRAY, ATTEMPTING TO RETREIVE AND TRY AGAIN', -// // listOfMonitoredCards -// // ); -// // attempt2 = generateListOfMonitoredCards(allCollections); -// // console.log('ATTEMPT 2', attempt2); - -// // if (!attempt2 || attempt2.length === 0) { -// // console.error( -// // 'ATTEMPT 2 FAILED, listOfMonitoredCards IS NOT AN ARRAY' -// // ); -// // return; -// // } -// // } -// // console.log( -// // 'SENDING CHECK AND UPDATE CARD PRICES', -// // listOfMonitoredCards -// // ); -// // const selectedList = listOfMonitoredCards -// // ? listOfMonitoredCards -// // : attempt2; -// // socket?.emit('REQUEST_CRON_UPDATED_CARDS_IN_COLLECTION', { -// // userId, -// // data: { -// // selectedList, -// // }, -// // }); -// // }, -// // checkPriceUpdates: ( -// // userId, -// // listOfMonitoredCards, -// // allCollections, -// // cardsWithChangedPrice -// // ) => { -// // if (!userId) -// // return console.log('Missing userId or listOfMonitoredCards.'); -// // if (!listOfMonitoredCards) -// // return console.log('Missing retrievedListOfMonitoredCards.'); -// // if (!allCollections) return console.log('Missing allCollections.'); -// // const selectedList = listOfMonitoredCards; -// // socket.emit('REQUEST_PRICES_ACTIVATE_CRON', { -// // userId, -// // data: { -// // userId, -// // selectedList, -// // allCollections, -// // cardsWithChangedPrice, -// // }, -// // }); -// // }, -// // triggerCronJob: (userId, listOfMonitoredCards) => { -// // if (!userId) -// // return console.error('Missing userId for cron job trigger.'); - -// // // Emit the START_CRON_JOB event with userId and listOfMonitoredCards -// // socket.emit('START_CRON_JOB', { userId, listOfMonitoredCards }); -// // }, -// // }, -// // }; -// // const confirm = (message) => window.confirm(message); -// // useEffect(() => { -// // // Update the collectionData state when selectedCollection changes -// // setDataFunctions.collectionData(selectedCollection); -// // }, [selectedCollection]); -// // useEffect(() => { -// // if (allCollections) { -// // if ( -// // JSON.stringify(allCollections) !== -// // JSON.stringify(state.allCollectionData) -// // ) { -// // setDataFunctions.allCollectionData(allCollections); -// // } -// // } -// // }, [allCollections]); -// // useEffect(() => { -// // if (user) { -// // // console.log('userId', user.userId); -// // setDataFunctions.userData(user); -// // } -// // }, [user]); -// // useEffect(() => { -// // if (listOfMonitoredCards) { -// // // console.log('userId', user.userId); -// // setDataFunctions.retrievedListOfMonitoredCards(listOfMonitoredCards); -// // } -// // }, [user, listOfMonitoredCards]); -// // // ----------- CONTEXT VALUE ----------- -// // const value = useMemo( -// // () => ({ -// // ...state, -// // ...setDataFunctions, -// // listOfMonitoredCards, -// // confirm, -// // setLoader, -// // handleCronRequest: handleSocketInteraction.sendAction.triggerCronJob, -// // handleSend: handleSocketInteraction.sendAction.message, -// // handleSendAllCardsInCollections: -// // handleSocketInteraction.sendAction.checkAndUpdateCardPrices, -// // handleRequestCronStop: handleSocketInteraction.sendAction.stopCronJob, -// // handlePricesActivateCron: -// // handleSocketInteraction.sendAction.checkPriceUpdates, -// // handleSocketInteraction, -// // socket, -// // isDelaying: state.isDelaying, -// // isCronJobTriggered: state.isCronJobTriggered, -// // }), -// // [state, socket] -// // ); - -// // // Log combined context value for debugging -// // useEffect(() => { -// // console.log('COMBINED CONTEXT:', state); -// // }, [ -// // userId, -// // setDataFunctions.allCollectionData, -// // state.updatedCollection, -// // // state.allCollectionData, -// // // state.collectionData, -// // state.cardPrices, -// // ]); - -// // return ( -// // -// // {children} -// // -// // ); -// // }; - -// // export const useCombinedContext = () => { -// // const context = useContext(CombinedContext); -// // if (context === undefined) { -// // throw new Error( -// // 'useCombinedContext must be used within a CombinedProvider' -// // ); -// // } -// // return context; -// // }; diff --git a/src/assets/currentlyUnused/CombinedContext/helpers.jsx b/src/assets/currentlyUnused/CombinedContext/helpers.jsx deleted file mode 100644 index f14b432..0000000 --- a/src/assets/currentlyUnused/CombinedContext/helpers.jsx +++ /dev/null @@ -1,95 +0,0 @@ -// export const initialState = { -// data: {}, -// messageTest: {}, -// userData: {}, -// collectionData: {}, -// allCollectionsUpdated: {}, -// allCollectionData: {}, -// cronData: {}, -// cardPrices: {}, -// eventsTriggered: null, -// allCardPrices: {}, -// retrievedListOfMonitoredCards: {}, -// listOfMonitoredCards: {}, -// listOfSimulatedCards: {}, -// emittedResponses: [], -// error: null, -// isDelaying: false, // Added isDelaying to initialState as it is referred in your code -// isCronJobTriggered: false, // Added isCronJobTriggered to initialState as it is referred in your code -// }; - -// export const generateListOfMonitoredCards = (allCollections) => { -// if (!allCollections) return []; - -// const cardsWithCollectionId = allCollections?.flatMap((collection) => -// collection?.cards?.map((card) => ({ -// ...card, -// collectionId: collection._id, -// })) -// ); - -// const uniqueCardIds = new Set(cardsWithCollectionId.map((card) => card?.id)); - -// return Array.from(uniqueCardIds).map((id) => { -// const originalCard = cardsWithCollectionId.find((card) => card?.id === id); -// return { -// ...originalCard, -// }; -// }); -// }; -// export const updateCardPricesInList = (listOfMonitoredCards, cardPrices) => { -// return listOfMonitoredCards.map((originalCard) => { -// const updatedCardInfo = -// cardPrices?.find((price) => price.id === originalCard.id) || {}; -// if (updatedCardInfo.latestPrice?.num !== originalCard.latestPrice?.num) { -// return { -// ...originalCard, -// ...updatedCardInfo, -// quantity: originalCard?.quantity, -// price: updatedCardInfo?.latestPrice?.num || originalCard?.price, -// lastSavedPrice: { -// num: updatedCardInfo?.lastSavedPrice?.num || originalCard?.price, -// timestamp: -// updatedCardInfo?.latestPrice?.timestamp || new Date().toISOString(), -// }, -// priceHistory: [ -// ...originalCard.priceHistory, -// updatedCardInfo?.latestPrice, -// ], -// }; -// } - -// return originalCard; -// }); -// }; -// // Regular function to process unsaved cards -// export const processUnsavedCards = ( -// allCollections, -// userId, -// externalOperationHandler, -// externalCollectionUpdate -// ) => { -// if (!allCollections || !userId) return; -// console.log('allCollections:', allCollections); -// const unsavedCollections = allCollections -// ?.map((collection) => { -// const unsavedCardsInCollection = collection?.cards?.filter( -// (card) => card.tag === 'unsaved' -// ); -// return { -// collectionId: collection._id, -// unsavedCards: unsavedCardsInCollection, -// }; -// }) -// .filter((collection) => collection.unsavedCards.length > 0); - -// const unsavedCardsPromises = unsavedCollections?.flatMap((collection) => -// collection?.unsavedCards?.map((card) => -// externalOperationHandler(card, 'update', collection, userId).then(() => -// externalCollectionUpdate(collection, null, 'update', userId) -// ) -// ) -// ); - -// return Promise.all(unsavedCardsPromises); -// }; diff --git a/src/assets/currentlyUnused/CronJobContext/CronJobContext.jsx b/src/assets/currentlyUnused/CronJobContext/CronJobContext.jsx deleted file mode 100644 index 0bd1f0f..0000000 --- a/src/assets/currentlyUnused/CronJobContext/CronJobContext.jsx +++ /dev/null @@ -1,54 +0,0 @@ -// import React, { createContext, useContext, useEffect, useState } from 'react'; -// import { useUserContext } from '../../MAIN_CONTEXT/UserContext/UserContext'; -// import { useCollectionStore } from '../../MAIN_CONTEXT/CollectionContext/CollectionContext'; -// import { useCombinedContext } from '../../MISC_CONTEXT/CombinedContext/CombinedProvider'; - -// const CronJobContext = createContext(); - -// export const useCronJobContext = () => useContext(CronJobContext); - -// export const CronJobProvider = ({ children }) => { -// const { user, userId } = useUserContext(); -// const { selectedCollection } = useCollectionStore(); // Assuming this is where you get your selectedCollection -// // const { handleSendAllCardsInCollections, listOfMonitoredCards } = -// // useCombinedContext(); -// const [lastCronJobTriggerTime, setLastCronJobTriggerTime] = useState( -// new Date().getTime() -// ); - -// // useEffect(() => { -// // const handleTriggerCronJob = () => { -// // const currentTime = new Date().getTime(); -// // const timeDifference = currentTime - lastCronJobTriggerTime; - -// // if ( -// // timeDifference >= 120000 && -// // listOfMonitoredCards.length > 5 && -// // selectedCollection?.chartData?.allXYValues?.length > 10 -// // ) { -// // setLastCronJobTriggerTime(currentTime); -// // if (userId) { -// // console.log('Triggering cron job actions'); -// // handleSendAllCardsInCollections(userId, listOfMonitoredCards); -// // } -// // } -// // }; - -// // const interval = setInterval(handleTriggerCronJob, 120000); // Trigger every 2 minutes (120000 ms) -// // return () => clearInterval(interval); -// // }, [ -// // lastCronJobTriggerTime, -// // user, -// // listOfMonitoredCards, -// // selectedCollection, -// // handleSendAllCardsInCollections, -// // ]); - -// return ( -// -// {children} -// -// ); -// }; diff --git a/src/assets/currentlyUnused/DataTableBodyCell.jsx b/src/assets/currentlyUnused/DataTableBodyCell.jsx deleted file mode 100644 index bb4dd82..0000000 --- a/src/assets/currentlyUnused/DataTableBodyCell.jsx +++ /dev/null @@ -1,57 +0,0 @@ -// // prop-types is a library for typechecking of props -// import PropTypes from 'prop-types'; -// import MDBox from '../../../REUSABLE_COMPONENTS/MDBOX'; -// import { useMode } from '../../../../context'; -// import { Box } from '@mui/system'; - -// function DataTableBodyCell({ noBorder, align, children }) { -// const { theme } = useMode(); -// return ( -// -// -// {children} -// -// -// ); -// } - -// // Setting default values for the props of DataTableBodyCell -// DataTableBodyCell.defaultProps = { -// noBorder: false, -// align: 'left', -// }; - -// // Typechecking props for the DataTableBodyCell -// DataTableBodyCell.propTypes = { -// children: PropTypes.node.isRequired, -// noBorder: PropTypes.bool, -// align: PropTypes.oneOf(['left', 'right', 'center']), -// }; - -// export default DataTableBodyCell; diff --git a/src/assets/currentlyUnused/DataTableHeadCell.jsx b/src/assets/currentlyUnused/DataTableHeadCell.jsx deleted file mode 100644 index d67a02d..0000000 --- a/src/assets/currentlyUnused/DataTableHeadCell.jsx +++ /dev/null @@ -1,113 +0,0 @@ -// import { useMemo } from 'react'; -// import PropTypes from 'prop-types'; -// import { TableRow, Checkbox, Icon } from '@mui/material'; -// import MDBox from '../../../REUSABLE_COMPONENTS/MDBOX'; -// import MDTypography from '../../../REUSABLE_COMPONENTS/MDTYPOGRAPHY/MDTypography'; -// import { useMode } from '../../../../context'; -// import FlexBetween from '../../../REUSABLE_COMPONENTS/FlexBetween'; - -// const DataTableHeadCell = ({ headerGroups, isSorted, setSortedValue }) => { -// const { theme } = useMode(); - -// const renderCellContent = (column, idx) => { -// const sorted = setSortedValue(column, isSorted); -// const shouldShowIcons = column.showIcons; - -// return ( -// -// -// -// {column.render('Header')} -// -// {shouldShowIcons && sorted && ( -// -// -// arrow_drop_up -// -// -// arrow_drop_down -// -// -// )} -// -// -// ); -// }; - -// return useMemo( -// () => ( -// <> -// {headerGroups.map((headerGroup, key) => ( -// -// {headerGroup.headers.map(renderCellContent)} -// -// ))} -// -// ), -// [ -// headerGroups, -// isSorted, -// setSortedValue, -// theme.palette.divider, -// theme.typography.fontWeightMedium, -// ] -// ); -// }; - -// DataTableHeadCell.propTypes = { -// headerGroups: PropTypes.array.isRequired, -// isSorted: PropTypes.bool.isRequired, -// setSortedValue: PropTypes.func.isRequired, -// }; - -// export default DataTableHeadCell; diff --git a/src/assets/currentlyUnused/DeckEditor.jsx b/src/assets/currentlyUnused/DeckEditor.jsx deleted file mode 100644 index ddda4d6..0000000 --- a/src/assets/currentlyUnused/DeckEditor.jsx +++ /dev/null @@ -1,17 +0,0 @@ -// import React, { useState, useEffect } from 'react'; -// import { Paper, Typography, Box, useMediaQuery } from '@mui/material'; -// import { useMode } from '../../context'; -// import DeckForm from '../../components/forms/DeckForm'; - -// const DeckEditor = ({ deck, onClose }) => { -// const { theme } = useMode(); -// const isMobile = useMediaQuery(theme.breakpoints.down('sm')); - -// return ( -// -// {/* */} -// -// ); -// }; - -// export default DeckEditor; diff --git a/src/assets/currentlyUnused/DeckForm.jsx b/src/assets/currentlyUnused/DeckForm.jsx deleted file mode 100644 index d8028b7..0000000 --- a/src/assets/currentlyUnused/DeckForm.jsx +++ /dev/null @@ -1,147 +0,0 @@ -// import React, { useEffect, useState } from 'react'; -// import SaveIcon from '@mui/icons-material/Save'; -// import DeleteIcon from '@mui/icons-material/Delete'; -// import { useFormContext } from '../../context'; -// import RCZodForm from './reusable/RCZodForm'; - -// const DeckForm = ({ actionType, deckData }) => { -// const { onSubmit, setFormSchema, formMethods } = useFormContext(); -// const isUpdateMode = actionType === 'update'; -// const [tags, setTags] = useState(deckData?.tags || []); - -// const handleAddTag = (tag) => { -// if (tag && !tags.includes(tag)) { -// setTags([...tags, tag]); -// formMethods.setValue('tags', [...tags, tag].join(', ')); -// } -// }; - -// const handleDeleteTag = (tagToDelete) => { -// const updatedTags = tags.filter((tag) => tag !== tagToDelete); -// setTags(updatedTags); -// formMethods.setValue('tags', updatedTags.join(', ')); -// }; -// const updateDeckFields = [ -// { -// name: 'name', -// label: 'Name', -// type: 'text', -// value: '', -// icon: null, -// required: true, -// }, -// { -// name: 'description', -// label: 'Description', -// type: 'text', -// value: '', -// multiline: true, -// rows: 4, -// icon: null, -// required: false, -// }, -// { -// name: 'tags', -// label: 'Tags', -// type: 'chips', -// value: tags.join(', '), -// chipData: tags, -// icon: null, -// onAddChip: handleAddTag, -// onDeleteChip: handleDeleteTag, -// required: false, -// }, -// { -// name: 'color', -// label: 'Color', -// type: 'select', -// icon: null, -// required: false, -// options: [ -// { value: 'red', label: 'Red' }, -// { value: 'blue', label: 'Blue' }, -// { value: 'green', label: 'Green' }, -// { value: 'yellow', label: 'Yellow' }, -// { value: 'purple', label: 'Purple' }, -// { value: 'pink', label: 'Pink' }, -// { value: 'orange', label: 'Orange' }, -// { value: 'teal', label: 'Teal' }, -// ], -// }, -// ]; - -// const addDeckFields = [ -// { name: 'name', label: 'Name', type: 'text', icon: null, required: true }, -// { -// name: 'description', -// label: 'Description', -// type: 'text', -// multiline: true, -// rows: 4, -// icon: null, -// required: false, -// }, -// ]; - -// const formId = isUpdateMode ? 'updateDeckForm' : 'addDeckForm'; -// const deckFields = isUpdateMode ? updateDeckFields : addDeckFields; - -// React.useEffect(() => { -// if (!isUpdateMode) { -// setFormSchema('addDeckForm'); -// } -// if (deckData) { -// console.log('deckData:', deckData); -// formMethods.reset({ -// ...deckData, -// tags: deckData?.tags?.join(', '), -// color: deckData?.color || 'red', -// }); -// } -// }, [setFormSchema, formId, isUpdateMode]); - -// const handleDelete = () => { -// if (isUpdateMode) { -// console.log('Deleting deck:', deckData._id); -// onSubmit({ _id: deckData._id, delete: true }, formId); -// } -// }; - -// return ( -// ({ -// ...field, -// value: deckData?.[field.name], -// })) -// } -// buttonLabel={isUpdateMode ? 'Save Changes' : 'Create Deck'} -// startIcon={} -// initialValues={isUpdateMode ? deckData : {}} -// additionalData={{ -// deckId: deckData ? deckData?._id : null, -// }} -// additionalButtons={ -// isUpdateMode -// ? [ -// { -// label: 'Delete Deck', -// onClick: handleDelete, -// startIcon: , -// color: 'error', -// variant: 'contained', -// disabled: !deckData, -// }, -// ] -// : [] -// } -// defaultValues={isUpdateMode ? deckData : {}} -// /> -// ); -// }; - -// export default DeckForm; diff --git a/src/assets/currentlyUnused/FormTextField.jsx b/src/assets/currentlyUnused/FormTextField.jsx deleted file mode 100644 index 71f3cd2..0000000 --- a/src/assets/currentlyUnused/FormTextField.jsx +++ /dev/null @@ -1,26 +0,0 @@ -// import { TextField } from '@mui/material'; -// import React from 'react'; -// import { Controller, useFormContext } from 'react-hook-form'; - -// // Removed the TypeScript-specific type definitions and kept the structure of the component -// function FormTextField({ control: providedControl, name, rules, ...rest }) { -// const { control } = useFormContext(); -// return ( -// ( -// -// )} -// /> -// ); -// } - -// export default FormTextField; diff --git a/src/assets/currentlyUnused/GenerateNivoTestData.jsx b/src/assets/currentlyUnused/GenerateNivoTestData.jsx deleted file mode 100644 index c31e9c1..0000000 --- a/src/assets/currentlyUnused/GenerateNivoTestData.jsx +++ /dev/null @@ -1,77 +0,0 @@ -import { addDays, format, parseISO } from 'date-fns'; - -// Function to generate an incremental data set with occasional dips -const generateIncrementalData = (start, end, minY, maxY, interval = 1) => { - let data = []; - let currentValue = Math.floor(Math.random() * (maxY - minY + 1)) + minY; - - for (let date = start; date <= end; date = addDays(date, interval)) { - // Randomly decide if the next point should be a dip - if (Math.random() > 0.8) { - // Create a dip but ensure it's above the minimum - currentValue = Math.max( - currentValue - Math.floor(Math.random() * (maxY / 10)), - minY - ); - } else { - // Increment the value but cap it at maxY - currentValue = Math.min( - currentValue + Math.floor(Math.random() * (maxY / 10)), - maxY - ); - } - - data.push({ - _id: Math.random().toString(36).substr(2, 9), // Simulate an objectId - x: format(date, "yyyy-MM-dd'T'HH:mm:ss'Z'"), - y: currentValue, - }); - } - - return data; -}; - -const generateNivoTestData = () => { - const today = new Date(); - return [ - { - id: '24h', - color: '#06d6a0', - data: generateIncrementalData(addDays(today, -1), today, 2, 30, 1 / 24), - }, - { - id: '7d', - color: '#06d6a0', - data: generateIncrementalData(addDays(today, -7), today, 31, 60), - }, - { - id: '30d', - color: '#06d6a0', - data: generateIncrementalData(addDays(today, -30), today, 61, 120), - }, - { - id: '90d', - color: '#06d6a0', - data: generateIncrementalData(addDays(today, -90), today, 121, 240, 3), - }, - { - id: '180d', - color: '#06d6a0', - data: generateIncrementalData(addDays(today, -180), today, 241, 480, 6), - }, - { - id: '270d', - color: '#06d6a0', - data: generateIncrementalData(addDays(today, -270), today, 481, 960, 9), - }, - { - id: '365d', - color: '#06d6a0', - data: generateIncrementalData(addDays(today, -365), today, 961, 2789, 12), - }, - ]; -}; - -const nivoTestData = generateNivoTestData(); - -export default nivoTestData; diff --git a/src/assets/currentlyUnused/Header.jsx b/src/assets/currentlyUnused/Header.jsx deleted file mode 100644 index b5ecfd7..0000000 --- a/src/assets/currentlyUnused/Header.jsx +++ /dev/null @@ -1,28 +0,0 @@ -// import { Typography, Box, useTheme } from '@mui/material'; -// import { useMode } from '../../../../../context'; - -// const Header = ({ title, subtitle }) => { -// const { theme } = useMode(); -// const colors = theme.palette.chartTheme; -// const grey = theme.palette.chartTheme.grey.darkest; -// const lightGrey = theme.palette.chartTheme.grey.lightest; -// const greenAccent = colors.greenAccent.light; - -// return ( -// -// -// {title} -// -// -// {subtitle} -// -// -// ); -// }; - -// export default Header; diff --git a/src/assets/currentlyUnused/ImageWithFallback.jsx b/src/assets/currentlyUnused/ImageWithFallback.jsx deleted file mode 100644 index d356b13..0000000 --- a/src/assets/currentlyUnused/ImageWithFallback.jsx +++ /dev/null @@ -1,75 +0,0 @@ -import React from 'react'; -import square from './square.png'; -import rectangle from './rectangle.png'; -import { Card, CardMedia, Container } from '@mui/material'; - -class ImageWithFallback extends React.Component { - constructor(props) { - super(props); - this.state = { - src: props.src || rectangle, // Default image - error: false, - }; - } - - onError = () => { - if (!this.state.error) { - this.setState({ - src: square, // Fallback image - error: true, - }); - } - }; - - render() { - const { alt, ...rest } = this.props; - return ( - // {alt} - - - - - - ); - } -} - -export default ImageWithFallback; diff --git a/src/assets/currentlyUnused/LoginForm.jsx b/src/assets/currentlyUnused/LoginForm.jsx deleted file mode 100644 index 68ab149..0000000 --- a/src/assets/currentlyUnused/LoginForm.jsx +++ /dev/null @@ -1,36 +0,0 @@ -// import React from 'react'; -// import LoginIcon from '@mui/icons-material/Login'; -// import PersonIcon from '@mui/icons-material/Person'; -// import LockIcon from '@mui/icons-material/Lock'; -// import RCZodForm from './reusable/RCZodForm'; - -// const loginFields = [ -// { -// name: 'username', -// label: 'Username', -// type: 'text', -// icon: , -// field: 'username', -// }, -// { -// name: 'password', -// label: 'Password', -// type: 'password', -// icon: , -// field: 'password', -// }, -// ]; - -// const LoginForm = () => { -// const startIcon = ; -// return ( -// -// ); -// }; - -// export default LoginForm; diff --git a/src/assets/currentlyUnused/LongMenu.jsx b/src/assets/currentlyUnused/LongMenu.jsx deleted file mode 100644 index 0d1e3b1..0000000 --- a/src/assets/currentlyUnused/LongMenu.jsx +++ /dev/null @@ -1,112 +0,0 @@ -import React from 'react'; -import IconButton from '@mui/material/IconButton'; -import Menu from '@mui/material/Menu'; -import MenuItem from '@mui/material/MenuItem'; -import MoreVertIcon from '@mui/icons-material/MoreVert'; -import ListItemIcon from '@mui/material/ListItemIcon'; -import EditIcon from '@mui/icons-material/Edit'; -import VisibilityIcon from '@mui/icons-material/Visibility'; -import BarChartIcon from '@mui/icons-material/BarChart'; -import SelectAllIcon from '@mui/icons-material/SelectAll'; -import Typography from '@mui/material/Typography'; -import DeleteIcon from '@mui/icons-material/Delete'; -import { Box } from '@mui/material'; -const ITEM_HEIGHT = 48; - -// Wrap your component with React.forwardRef to forward the ref -const LongMenu = React.forwardRef( - ( - { onEdit, onDelete, onStats, onView, onSelect, collectionId, collection }, - ref - ) => { - const [anchorEl, setAnchorEl] = React.useState(null); - const open = Boolean(anchorEl); - const handleClick = (event) => { - setAnchorEl(event.currentTarget); - }; - const handleClose = () => { - setAnchorEl(null); - }; - - return ( - - - - - - {[ - { text: 'Edit Collection', icon: , action: onEdit }, - { - text: 'Delete Collection', - icon: , - action: () => onDelete(collectionId), - }, - { - text: 'Select Collection', - icon: , - action: () => onSelect(collection), - }, - { - text: 'Collection Stats', - icon: , - action: onStats, - }, - { text: 'Quick View', icon: , action: onView }, - ].map((item) => ( - { - handleClose(); - item.action(); - }} - > - {item.icon} - - {item.text} - - - ))} - - - ); - } -); - -LongMenu.displayName = 'LongMenu'; - -export default LongMenu; diff --git a/src/assets/currentlyUnused/MDAVATAR/MDAvatarRoot.jsx b/src/assets/currentlyUnused/MDAVATAR/MDAvatarRoot.jsx deleted file mode 100644 index 6fb5a6b..0000000 --- a/src/assets/currentlyUnused/MDAVATAR/MDAvatarRoot.jsx +++ /dev/null @@ -1,75 +0,0 @@ -// import Avatar from '@mui/material/Avatar'; -// import styled from 'styled-components'; -// import { useMode } from '../../../context'; - -// export default styled(Avatar)(({ ownerState }) => { -// const { theme } = useMode(); -// const { palette, functions, typography, boxShadows } = theme; -// const { shadow, bgColor, size } = ownerState; - -// const { gradients, transparent, white } = palette; -// const { pxToRem, linearGradient } = functions; -// const { size: fontSize, fontWeightRegular } = typography; - -// // backgroundImage value -// const backgroundValue = -// bgColor === 'transparent' -// ? transparent.main -// : linearGradient(gradients[bgColor].main, gradients[bgColor].state); - -// // size value -// let sizeValue; - -// switch (size) { -// case 'xs': -// sizeValue = { -// width: pxToRem(24), -// height: pxToRem(24), -// fontSize: fontSize.xs, -// }; -// break; -// case 'sm': -// sizeValue = { -// width: pxToRem(36), -// height: pxToRem(36), -// fontSize: fontSize.sm, -// }; -// break; -// case 'lg': -// sizeValue = { -// width: pxToRem(58), -// height: pxToRem(58), -// fontSize: fontSize.sm, -// }; -// break; -// case 'xl': -// sizeValue = { -// width: pxToRem(74), -// height: pxToRem(74), -// fontSize: fontSize.md, -// }; -// break; -// case 'xxl': -// sizeValue = { -// width: pxToRem(110), -// height: pxToRem(110), -// fontSize: fontSize.md, -// }; -// break; -// default: { -// sizeValue = { -// width: pxToRem(48), -// height: pxToRem(48), -// fontSize: fontSize.md, -// }; -// } -// } - -// return { -// background: backgroundValue, -// color: white.main, -// fontWeight: fontWeightRegular, -// boxShadow: boxShadows[shadow], -// ...sizeValue, -// }; -// }); diff --git a/src/assets/currentlyUnused/MDAVATAR/index.jsx b/src/assets/currentlyUnused/MDAVATAR/index.jsx deleted file mode 100644 index 6051423..0000000 --- a/src/assets/currentlyUnused/MDAVATAR/index.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import { forwardRef } from 'react'; - -// prop-types is a library for typechecking of props -import PropTypes from 'prop-types'; -import MDAvatarRoot from './MDAvatarRoot'; - -// Custom styles for MDAvatar - -const MDAvatar = forwardRef(({ bgColor, size, shadow, ...rest }, ref) => ( - -)); - -// Setting display name for the MDAvatar -MDAvatar.displayName = 'MDAvatar'; - -// Setting default values for the props of MDAvatar -MDAvatar.defaultProps = { - bgColor: 'transparent', - size: 'md', - shadow: 'none', -}; - -// Typechecking props for the MDAvatar -MDAvatar.propTypes = { - bgColor: PropTypes.oneOf([ - 'transparent', - 'primary', - 'secondary', - 'info', - 'success', - 'warning', - 'error', - 'light', - 'dark', - ]), - size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', 'xxl']), - shadow: PropTypes.oneOf([ - 'none', - 'xs', - 'sm', - 'md', - 'lg', - 'xl', - 'xxl', - 'inset', - ]), -}; - -export default MDAvatar; diff --git a/src/assets/currentlyUnused/PageContext/PageContext.jsx b/src/assets/currentlyUnused/PageContext/PageContext.jsx deleted file mode 100644 index 3a5b9f7..0000000 --- a/src/assets/currentlyUnused/PageContext/PageContext.jsx +++ /dev/null @@ -1,67 +0,0 @@ -// import React, { -// createContext, -// useState, -// useContext, -// useEffect, -// useMemo, -// } from 'react'; -// import LoadingIndicator from '../../../layout/LoadingIndicator'; -// import ErrorIndicator from '../../../layout/ErrorIndicator'; -// import SplashPage2 from '../../../layout/REUSABLE_COMPONENTS/SplashPage2'; -// // import useSnackBar from '../../hooks/useSnackBar'; -// import { defaultContextValue } from '../../constants'; -// import { useLoading } from '../../hooks/useLoading'; - -// const PageContext = createContext(defaultContextValue.PAGE_CONTEXT); - -// export const PageProvider = ({ children }) => { -// const { -// isLoading, -// isAnyLoading, -// startLoading, -// stopLoading, -// setError, -// error, -// clearLoading, -// } = useLoading(); -// const returnDisplay = () => { -// if (error) { -// return ; -// } -// if (isLoading('isPageLoading')) { -// return ; -// } else if (isAnyLoading()) { -// return ; -// } -// return null; -// }; -// const contextValue = useMemo( -// () => ({ -// startLoading, -// stopLoading, -// setError, -// error, -// isLoading, -// clearLoading, -// returnDisplay, -// // You can expose any additional functionalities from useLoading as needed. -// }), -// [ -// startLoading, -// stopLoading, -// setError, -// error, -// isLoading, -// clearLoading, -// returnDisplay, -// ] -// ); - -// return ( -// -// {children}{' '} -// -// ); -// }; - -// export const usePageContext = () => useContext(PageContext); diff --git a/src/assets/currentlyUnused/PopoverContext/PopoverContext.jsx b/src/assets/currentlyUnused/PopoverContext/PopoverContext.jsx deleted file mode 100644 index b63741c..0000000 --- a/src/assets/currentlyUnused/PopoverContext/PopoverContext.jsx +++ /dev/null @@ -1,31 +0,0 @@ -// import React, { createContext, useState } from 'react'; - -// export const PopoverContext = createContext({ -// hoveredCard: null, -// isPopoverOpen: false, -// // eslint-disable-next-line @typescript-eslint/no-empty-function -// setHoveredCard: () => {}, -// // eslint-disable-next-line @typescript-eslint/no-empty-function -// setIsPopoverOpen: () => {}, -// }); - -// export const PopoverProvider = ({ children }) => { -// const [hoveredCard, setHoveredCard] = useState(null); -// const [isPopoverOpen, setIsPopoverOpen] = useState(false); -// // const [clickedCard, setClickedCard] = useState(null); - -// const value = { -// hoveredCard, -// isPopoverOpen, -// setHoveredCard, -// setIsPopoverOpen, -// }; - -// return ( -// {children} -// ); -// }; - -// export const usePopoverContext = () => { -// return React.useContext(PopoverContext); -// }; diff --git a/src/assets/currentlyUnused/ProfileForm.jsx b/src/assets/currentlyUnused/ProfileForm.jsx deleted file mode 100644 index 4dd6dc3..0000000 --- a/src/assets/currentlyUnused/ProfileForm.jsx +++ /dev/null @@ -1,75 +0,0 @@ -// import React, { useState, useEffect } from 'react'; -// import PropTypes from 'prop-types'; -// import { TextField, Button } from '@mui/material'; -// import { useFormContext } from '../../context'; -// import FormField from './reusable/FormField'; - -// const ProfileForm = ({ userName, name, age, status, onSave }) => { -// const { forms, handleChange, handleSubmit } = useFormContext(); -// const profileValues = forms?.updateUserDataForm || {}; -// const formType = 'updateUserDataForm'; -// const handleFormSubmit = (event) => { -// event.preventDefault(); // Prevent the default form submission behavior -// handleSubmit(formType)(event); // Pass the event to your form handler -// }; - -// return ( -//
-// -// -// -// -// -// -// -// ); -// }; - -// ProfileForm.propTypes = { -// username: PropTypes.string, -// firstName: PropTypes.string, -// lastName: PropTypes.string, - -// age: PropTypes.string, -// status: PropTypes.string, -// onSave: PropTypes.func.isRequired, -// }; - -// export default ProfileForm; diff --git a/src/assets/currentlyUnused/RCForm.jsx b/src/assets/currentlyUnused/RCForm.jsx deleted file mode 100644 index 75693c5..0000000 --- a/src/assets/currentlyUnused/RCForm.jsx +++ /dev/null @@ -1,19 +0,0 @@ -// import { FormProvider } from 'react-hook-form'; -// import Container from '@mui/material/Container'; - -// export const RCForm = ({ form, onSubmit, children, ...props }) => { -// return ( -// -// -//
-//
-// {children} -//
-//
-//
-//
-// ); -// }; diff --git a/src/assets/currentlyUnused/RCFormInput.jsx b/src/assets/currentlyUnused/RCFormInput.jsx deleted file mode 100644 index d390cfc..0000000 --- a/src/assets/currentlyUnused/RCFormInput.jsx +++ /dev/null @@ -1,23 +0,0 @@ -// import { forwardRef } from 'react'; -// import TextField from '@mui/material/TextField'; -// import { RCFieldError } from './RCFieldError'; - -// export const RCFormInput = forwardRef(function Input( -// { label, type = 'text', name, ...props }, -// ref -// ) { -// return ( -//
-// : null} -// /> -//
-// ); -// }); diff --git a/src/assets/currentlyUnused/RCFormInputs.jsx b/src/assets/currentlyUnused/RCFormInputs.jsx deleted file mode 100644 index fec7b3b..0000000 --- a/src/assets/currentlyUnused/RCFormInputs.jsx +++ /dev/null @@ -1,29 +0,0 @@ -// import React from 'react'; -// import { Controller } from 'react-hook-form'; -// import { TextField } from '@mui/material'; - -// const RCFormInputs = Object.keys(dynamicForm).map((key) => { -// const { rules, defaultValue, label } = dynamicForm[key]; - -// return ( -//
-// ( -// -// )} -// /> -//
-// ); -// }); diff --git a/src/assets/currentlyUnused/RCZodForm.jsx b/src/assets/currentlyUnused/RCZodForm.jsx deleted file mode 100644 index 53f33a0..0000000 --- a/src/assets/currentlyUnused/RCZodForm.jsx +++ /dev/null @@ -1,196 +0,0 @@ -// import React, { useEffect } from 'react'; -// import { -// Box, -// InputAdornment, -// FormControl, -// InputLabel, -// Select, -// MenuItem, -// Chip, -// useMediaQuery, -// } from '@mui/material'; -// import FormField from './FormField'; -// import ReusableLoadingButton from '../../buttons/other/ReusableLoadingButton'; -// import { useFormContext, useMode } from '../../../context'; -// import { -// FormBox, -// FormFieldBox, -// } from '../../../layout/REUSABLE_STYLED_COMPONENTS/ReusableStyledComponents'; - -// const RCZodForm = ({ -// fields, -// buttonLabel, -// startIcon, -// schemaName, -// additionalButtons, -// initialValues, -// additionalData, -// }) => { -// const { theme } = useMode(); -// const isMobile = useMediaQuery(theme.breakpoints.down('sm')); -// const { -// formMethods, -// onSubmit, -// handleChange, -// setFormSchema, -// currentForm, -// currentFormSchema, -// formState: { errors, isSubmitting }, -// } = useFormContext(); - -// // const onFormSubmit = (data) => { -// // onSubmit(data, additionalData); -// // }; -// useEffect(() => { -// if (initialValues) { -// Object.keys(initialValues).forEach((key) => { -// formMethods.setValue(key, initialValues[key]); -// }); -// } -// }, [initialValues]); -// const renderField = (field) => { -// const isSearchForm = -// schemaName === 'searchForm' && field.name === 'searchTerm'; - -// const onChange = isSearchForm ? handleChange : undefined; - -// if (field.type === 'select') { -// return ( -// -// -// {field.label} -// -// -// -// ); -// } else if (field.type === 'chips') { -// return ( -// -// -// {field?.values?.map((value, index) => ( -// field.onDelete(value)} -// /> -// ))} -// -// -// ); -// } else { -// return ( -// -// formMethods.handleChange(e.target.value)} -// InputProps={ -// field.icon -// ? { -// endAdornment: ( -// -// {field.icon} -// -// ), -// } -// : null -// } -// multiline={field.multiline} -// rows={field.rows} -// /> -// -// ); -// } -// }; - -// return ( -// -// {fields?.map(renderField)} -// -// {startIcon} -// -// } -// fullWidth -// sx={{ -// ...(isMobile && { -// fontSize: '0.75rem', // Adjust button font size for mobile -// }), -// }} -// /> - -// {additionalButtons && -// additionalButtons?.map((button, index) => ( -// -// ))} -// -// ); -// }; - -// export default RCZodForm; diff --git a/src/assets/currentlyUnused/SECONDARY_CONTEXT/StatisticsContext/StatisticsContext.jsx b/src/assets/currentlyUnused/SECONDARY_CONTEXT/StatisticsContext/StatisticsContext.jsx deleted file mode 100644 index da1feff..0000000 --- a/src/assets/currentlyUnused/SECONDARY_CONTEXT/StatisticsContext/StatisticsContext.jsx +++ /dev/null @@ -1,147 +0,0 @@ -// import React, { -// createContext, -// useContext, -// useState, -// useMemo, -// useCallback, -// } from 'react'; -// import { -// calculateStatistics, -// calculateTotalPriceOfAllCollections, -// calculatePriceChanges, -// getTopCard, -// getTopCollection, -// calculateStatsForCollection, -// } from '../../MAIN_CONTEXT/CollectionContext/helpers'; -// import { useCollectionStore } from '../../index'; -// import { defaultContextValue } from '../../constants'; -// import useSelectedCollection from '../../MAIN_CONTEXT/CollectionContext/useSelectedCollection'; -// import useTimeRange from '../../../components/forms/selectors/useTimeRange'; - -// const StatisticsContext = createContext(defaultContextValue.STATISTICS_CONTEXT); - -// export const StatisticsProvider = ({ children }) => { -// const { allXYValues, hasFetchedCollections } = useCollectionStore(); -// const { selectedCollection, allCollections } = useSelectedCollection(); -// const { selectedTimeRange } = useTimeRange(); -// if (!Array.isArray(allCollections)) { -// return null; -// } -// const [selectedStat, setSelectedStat] = useState(''); -// const validCollections = -// Array.isArray(allCollections) && allCollections.length > 0; - -// // Calculate statistics for all collections -// const statsByCollectionId = useMemo( -// () => -// validCollections -// ? allCollections?.reduce((acc, collection) => { -// acc[collection?._id] = calculateStatsForCollection( -// collection, -// selectedTimeRange -// ); -// return acc; -// }, {}) -// : {}, -// [allCollections, selectedTimeRange] -// ); - -// const totalValue = useMemo(() => { -// if (!validCollections) { -// return 0; // Ensure a default numeric value -// } -// return allCollections?.reduce((acc, collection) => { -// const collectionPrice = parseFloat(collection?.totalPrice); -// return acc + (isNaN(collectionPrice) ? 0 : collectionPrice); -// }, 0); -// }, [allCollections]); - -// const topFiveCards = useMemo( -// () => -// validCollections -// ? allCollections -// .flatMap((collection) => collection?.cards || []) -// .sort((a, b) => b.price - a.price) -// .slice(0, 30) -// : [], -// [allCollections] -// ); - -// const createMarkers = (selectedCollection) => { -// if (!selectedCollection || !selectedCollection.collectionStatistics) -// return []; - -// const { highPoint, lowPoint, avgPrice, percentageChange } = -// selectedCollection.collectionStatistics; -// return [ -// { -// axis: 'y', -// value: percentageChange, -// lineStyle: { stroke: '#b0413e', strokeWidth: 2 }, -// legend: `${selectedCollection.name} High`, -// legendOrientation: 'vertical', -// }, -// { -// axis: 'y', -// value: lowPoint, -// lineStyle: { stroke: '#b0413e', strokeWidth: 2 }, -// legend: `${selectedCollection.name} Low`, -// legendOrientation: 'vertical', -// }, -// { -// axis: 'y', -// value: avgPrice, -// lineStyle: { stroke: '#b0413e', strokeWidth: 2 }, -// legend: `${selectedCollection.name} Avg`, -// legendOrientation: 'vertical', -// }, -// ]; -// }; - -// const markers = useMemo(() => { -// if (!selectedCollection) return []; -// return createMarkers(selectedCollection); -// }, [allCollections]); // Add dependencies as necessary, e.g., someSelectedCollectionId - -// const contextValue = useMemo( -// () => ({ -// stats: -// calculateStatistics( -// { data: null }, -// selectedTimeRange, -// allCollections -// ) || {}, - -// allStats: [statsByCollectionId], -// statsByCollectionId: statsByCollectionId[selectedCollection?._id], -// selectedStat, -// markers, -// setSelectedStat, -// totalValue, -// topFiveCards, -// calculateTotalPriceOfAllCollections, -// calculatePriceChanges, -// getTopCard, -// getTopCollection, -// }), -// [ -// statsByCollectionId, -// selectedCollection, -// markers, -// totalValue, -// topFiveCards, -// setSelectedStat, -// selectedTimeRange, -// ] -// ); - -// return ( -// -// {children} -// -// ); -// }; - -// export default StatisticsProvider; - -// export const useStatisticsStore = () => useContext(StatisticsContext); diff --git a/src/assets/currentlyUnused/SearchForm.jsx b/src/assets/currentlyUnused/SearchForm.jsx deleted file mode 100644 index 2e9082e..0000000 --- a/src/assets/currentlyUnused/SearchForm.jsx +++ /dev/null @@ -1,93 +0,0 @@ -// import React, { useEffect } from 'react'; -// import SearchIcon from '@mui/icons-material/Search'; -// import { useForm, Controller } from 'react-hook-form'; -// import { zodResolver } from '@hookform/resolvers/zod'; -// import { formFields, getFormFieldHandlers, zodSchemas } from './formsConfig'; -// import { Box, InputAdornment, useMediaQuery } from '@mui/material'; -// import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; -// import { -// FormBox, -// FormFieldBox, -// } from '../../layout/REUSABLE_STYLED_COMPONENTS/ReusableStyledComponents'; -// import { useCardStore, useMode } from '../../context'; -// import RCInput from './Factory/RCInput'; -// import useRCFormHook from './hooks/useRCFormHook'; -// import { useFormSubmission } from './hooks/useFormSubmission'; -// import ReusableLoadingButton from '../buttons/other/ReusableLoadingButton'; -// const SearchForm = () => { -// const { theme } = useMode(); -// const isMobile = useMediaQuery(theme.breakpoints.down('sm')); -// const methods = useRCFormHook('searchForm', zodSchemas, formFields, {}); -// const { control, handleSubmit, watch, reset } = methods; -// const searchTerm = watch('searchTerm'); -// const { onSubmit, isSubmitting } = useFormSubmission( -// getFormFieldHandlers(), -// 'searchForm' -// ); -// const { handleRequest } = useCardStore(); -// useEffect(() => { -// console.log('Search term changed:', searchTerm); -// if (searchTerm) { -// handleRequest(searchTerm); -// } -// }, [searchTerm, handleRequest]); - -// return ( -// -// -// ( -// -// {field.icon} -// -// ), -// } -// ) : ( -// -// ) -// } -// /> -// )} -// /> -// -// -// {} -// -// } -// fullWidth -// sx={{ -// ...(isMobile && { -// fontSize: '0.75rem', // Adjust button font size for mobile -// }), -// }} -// /> -// -// ); -// }; - -// export default SearchForm; diff --git a/src/assets/currentlyUnused/Select.jsx b/src/assets/currentlyUnused/Select.jsx deleted file mode 100644 index 6aa2f37..0000000 --- a/src/assets/currentlyUnused/Select.jsx +++ /dev/null @@ -1,59 +0,0 @@ -// import React from 'react'; -// import { Select, MenuItem } from '@mui/material'; -// import MDTypography from '../../../layout/REUSABLE_COMPONENTS/MDTYPOGRAPHY/MDTypography'; -// import { useMode } from '../../../context'; -// import { FormControl, InputLabel } from '@mui/material'; -// import { Controller } from 'react-hook-form'; -// import SelectComponent from '../reusable/Select'; -// import { StyledChartBox } from '../../../pages/pageStyles/StyledComponents'; - -// const SelectorComponent = ({ -// name, -// label, -// options, -// control, -// errors, -// theme, -// onSubmit, -// }) => { -// return ( -// -// -// {label} -// ( -// -// )} -// /> -// -// -// ); -// }; - -// export default SelectorComponent; diff --git a/src/assets/currentlyUnused/SignupForm.jsx b/src/assets/currentlyUnused/SignupForm.jsx deleted file mode 100644 index 4bc256f..0000000 --- a/src/assets/currentlyUnused/SignupForm.jsx +++ /dev/null @@ -1,57 +0,0 @@ -// import React from 'react'; -// import PersonAddIcon from '@mui/icons-material/PersonAdd'; -// import PersonIcon from '@mui/icons-material/Person'; -// import EmailIcon from '@mui/icons-material/Email'; -// import LockIcon from '@mui/icons-material/Lock'; -// import RCZodForm from './reusable/RCZodForm'; - -// const signupFields = [ -// { -// name: 'firstName', -// label: 'First Name', -// type: 'text', -// icon: , -// field: 'firstName', -// }, -// { -// name: 'lastName', -// label: 'Last Name', -// type: 'text', -// icon: , -// field: 'lastName', -// }, -// { -// name: 'email', -// label: 'Email', -// type: 'email', -// icon: , -// field: 'email', -// }, -// { -// name: 'username', -// label: 'Username', -// type: 'text', -// icon: , -// field: 'username', -// }, -// { -// name: 'password', -// label: 'Password', -// type: 'password', -// icon: , -// field: 'password', -// }, -// ]; - -// const SignupForm = () => { -// return ( -// } -// /> -// ); -// }; - -// export default SignupForm; diff --git a/src/assets/currentlyUnused/SimplePieChart.jsx b/src/assets/currentlyUnused/SimplePieChart.jsx deleted file mode 100644 index bf03d1b..0000000 --- a/src/assets/currentlyUnused/SimplePieChart.jsx +++ /dev/null @@ -1,89 +0,0 @@ -// import React, { useState, useEffect, useContext } from 'react'; -// import Chart from 'react-apexcharts'; -// import { ThemeContext } from '../../../context/ThemeContext'; // Adjust the path as necessary -// import { Card, InfoStack } from '../../../'; - -// const Wrapper = ({ cardTitle, value, label, series }) => { -// const theme = useContext(ThemeContext); // Assuming theme is provided through context - -// const cardStyle = { -// height: theme.heightCardMd, -// minHeight: theme.heightCardMd, -// maxHeight: theme.heightCardMd, -// }; - -// const chartStyle = { -// position: 'relative', -// display: 'flex', -// alignItems: 'center', -// justifyContent: 'center', -// marginBottom: theme.lenLg1, -// height: theme.heightChartMd, -// transform: 'translateX(0)', -// marginTop: '2rem', -// }; - -// const chartWrapperStyle = { -// position: 'absolute', -// top: '50%', -// left: '50%', -// transform: 'translate(-50%, -50%)', -// minWidth: '240px', -// }; - -// const [options, setOptions] = useState({ -// chart: { -// animations: { -// enabled: false, -// }, -// }, -// grid: { -// padding: { -// top: 40, -// left: 0, -// right: 0, -// bottom: 20, -// }, -// }, -// stroke: { -// show: false, -// }, -// tooltip: { enabled: false }, -// legend: { show: false }, -// dataLabels: { enabled: false }, -// plotOptions: { pie: { donut: { size: '75%' } } }, -// }); - -// useEffect(() => { -// if (theme) { -// setOptions((prevOptions) => ({ -// ...prevOptions, -// colors: [ -// theme.colorPrimary, -// theme.colorAccent, -// theme.colorDefaultBackground, -// ], -// })); -// } -// }, [theme]); - -// return ( -// -// -//
-//
-// {options.colors && ( -// -// )} -//
-//
-//
-// ); -// }; - -// export default Wrapper; diff --git a/src/assets/currentlyUnused/SingleCardRowAnimation.jsx b/src/assets/currentlyUnused/SingleCardRowAnimation.jsx deleted file mode 100644 index a150ab0..0000000 --- a/src/assets/currentlyUnused/SingleCardRowAnimation.jsx +++ /dev/null @@ -1,122 +0,0 @@ -import React, { useEffect, useRef } from 'react'; -import * as THREE from 'three'; -import placeholder from '../../assets/images/placeholder.jpeg'; - -const SingleCardRowAnimation = () => { - const containerRef = useRef(null); - - useEffect(() => { - let camera, scene, renderer, cardRow, cardTexture; - - const textureLoader = new THREE.TextureLoader(); - cardTexture = textureLoader.load(placeholder); // Load the texture once and reuse it - - const calculateCardsPerRow = () => { - const cardWidth = 1 * 1.8; // assuming geometry and spacing are constant - return Math.floor(containerRef.current.clientWidth / cardWidth); - }; - - const updateRowWithNewCardCount = (cardsPerRow) => { - const geometry = new THREE.PlaneGeometry(1, 1.4); - const material = new THREE.MeshBasicMaterial({ map: cardTexture }); - while (cardRow.children.length) { - cardRow.remove(cardRow.children[0]); - } - for (let j = 0; j < cardsPerRow; j++) { - const card = new THREE.Mesh(geometry, material); - card.position.x = (j - cardsPerRow / 2) * 1.8; - card.position.y = -containerRef.current.clientHeight / 2 + 1.4 / 2; // Top position - cardRow.add(card); - } - }; - - const onWindowResize = () => { - camera.aspect = - containerRef.current.clientWidth / containerRef.current.clientHeight; - camera.updateProjectionMatrix(); - renderer.setSize( - containerRef.current.clientWidth, - containerRef.current.clientHeight - ); - const newCardsPerRow = calculateCardsPerRow(); - updateRowWithNewCardCount(newCardsPerRow); - }; - - const onSetup = () => { - scene = new THREE.Scene(); - camera = new THREE.PerspectiveCamera( - 75, - containerRef.current.clientWidth / containerRef.current.clientHeight, - 0.1, - 1000 - ); - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setSize( - containerRef.current.clientWidth, - containerRef.current.clientHeight - ); - containerRef.current.appendChild(renderer.domElement); - camera.position.z = 5; - - const geometry = new THREE.PlaneGeometry(1, 1.4); - const material = new THREE.MeshBasicMaterial({ map: cardTexture }); - - let cardsPerRow = calculateCardsPerRow(); - const topPosition = -containerRef.current.clientHeight / 2 + 1.4 / 2; - - cardRow = new THREE.Group(); - for (let j = 0; j < cardsPerRow; j++) { - const card = new THREE.Mesh(geometry, material); - card.position.x = (j - cardsPerRow / 2) * 1.8; - card.position.y = topPosition; - cardRow.add(card); - } - cardRow.userData = { direction: 0.005 }; - scene.add(cardRow); - - const animate = () => { - requestAnimationFrame(animate); - cardRow.children.forEach((card) => { - card.position.x += cardRow.userData.direction; - wrapPosition(card); - }); - renderer.render(scene, camera); - }; - - const wrapPosition = (card) => { - if ( - card.position.x > - containerRef.current.clientWidth / 2 + 1 / 2 // considering the width of the card is 1 unit - ) { - card.position.x = -containerRef.current.clientWidth / 2 - 1 / 2; - } else if ( - card.position.x < - -containerRef.current.clientWidth / 2 - 1 / 2 - ) { - card.position.x = containerRef.current.clientWidth / 2 + 1 / 2; - } - }; - - animate(); - }; - - if (containerRef.current) { - onSetup(); - } - - window.addEventListener('resize', onWindowResize); - - return () => { - if (containerRef.current) { - containerRef.current.removeChild(renderer.domElement); - } - window.removeEventListener('resize', onWindowResize); - }; - }, []); - - return ( -
- ); -}; - -export default SingleCardRowAnimation; diff --git a/src/assets/currentlyUnused/SocketContext/SocketProvider.jsx b/src/assets/currentlyUnused/SocketContext/SocketProvider.jsx deleted file mode 100644 index 46cdcc2..0000000 --- a/src/assets/currentlyUnused/SocketContext/SocketProvider.jsx +++ /dev/null @@ -1,40 +0,0 @@ -// import React, { -// createContext, -// useContext, -// useEffect, -// useMemo, -// useState, -// } from 'react'; -// import io from 'socket.io-client'; - -// const SocketContext = createContext(); - -// export const SocketProvider = ({ children }) => { -// const [socket, setSocket] = useState(null); - -// useEffect(() => { -// const socketInstance = io( -// process.env.REACT_APP_SERVER || 'ws://localhost:3001', -// { -// transports: ['websocket'], -// } -// ); -// setSocket(socketInstance); - -// return () => { -// socketInstance.disconnect(); -// }; -// }, []); - -// return ( -// {children} -// ); -// }; - -// export const useSocketContext = () => { -// const context = useContext(SocketContext); -// if (context === undefined) { -// throw new Error('useSocketContext must be used within a SocketProvider'); -// } -// return context; -// }; diff --git a/src/assets/currentlyUnused/SplashPage.js b/src/assets/currentlyUnused/SplashPage.js deleted file mode 100644 index a957b68..0000000 --- a/src/assets/currentlyUnused/SplashPage.js +++ /dev/null @@ -1,77 +0,0 @@ -import React, { useEffect, useContext } from 'react'; -import * as THREE from 'three'; -import placeholder from '../../assets/images/placeholder.jpeg'; - -const SplashPage = () => { - // const { fetchDirectedResponses } = useUtilityContext(); - - useEffect(() => { - // Initialize the scene, camera, and renderer - const scene = new THREE.Scene(); - const camera = new THREE.PerspectiveCamera( - 75, - window.innerWidth / window.innerHeight, - 0.1, - 1000 - ); - const renderer = new THREE.WebGLRenderer(); - - renderer.setSize(window.innerWidth, window.innerHeight); - const container = document.getElementById('splash-container'); - - if (container) { - container.appendChild(renderer.domElement); - } - - // Position the camera - camera.position.z = 15; - - // Create a placeholder array with 6 images - const imageUrls = Array(6).fill(placeholder); - - // Create a group to hold the objects - const group = new THREE.Group(); - - // Create objects and add them to the group - for (let i = 0; i < imageUrls.length; i++) { - const imageURL = imageUrls[i]; - const geometry = new THREE.BoxGeometry(2, 3, 0.2); - const textureLoader = new THREE.TextureLoader(); - const texture = textureLoader.load(imageURL); - const material = new THREE.MeshBasicMaterial({ map: texture }); - const object = new THREE.Mesh(geometry, material); - - // Position objects in a circle - const angle = (i / imageUrls.length) * Math.PI * 2; - const radius = 5; - object.position.x = Math.cos(angle) * radius; - object.position.z = Math.sin(angle) * radius; - object.rotation.y = angle; - - // Add the object to the group - group.add(object); - } - scene.add(group); - - // Create an animation loop - const animate = () => { - requestAnimationFrame(animate); - group.rotation.y += 0.01; - renderer.render(scene, camera); - }; - - // Start the animation loop - animate(); - console.log('Three.js scene initialized'); // Debug log - }, []); // Empty dependency array ensures this runs once when component mounts - - // useEffect(() => { - // // Fetch the directed responses - // fetchDirectedResponses(); - // console.log('fetchDirectedResponses called'); // Debug log - // }, [fetchDirectedResponses]); // fetchDirectedResponses as a dependency - - return
; -}; - -export default SplashPage; diff --git a/src/assets/currentlyUnused/ThemeSelector.jsx b/src/assets/currentlyUnused/ThemeSelector.jsx deleted file mode 100644 index 2c255e9..0000000 --- a/src/assets/currentlyUnused/ThemeSelector.jsx +++ /dev/null @@ -1,51 +0,0 @@ -// import React from 'react'; -// import { FormControl, InputLabel } from '@mui/material'; -// import { Controller } from 'react-hook-form'; -// import { useSnackbar } from 'notistack'; -// import { useFormContext, useMode } from '../../../context'; -// import { StyledChartBox } from '../../../pages/pageStyles/StyledComponents'; -// import SelectComponent from '../../../assets/Select'; - -// const ThemeSelector = ({ setTheme }) => { -// const { theme } = useMode(); -// const { formMethods } = useFormContext(); -// const { enqueueSnackbar } = useSnackbar(); - -// const { -// control, -// handleSubmit, -// formState: { errors }, -// } = formMethods; - -// const themeOptions = [ -// { value: 'light', label: 'Light Theme' }, -// { value: 'dark', label: 'Dark Theme' }, -// { value: 'system', label: 'System Theme' }, -// ]; - -// const onFormSubmit = (data) => { -// setTheme(data.themeRange); -// enqueueSnackbar('Theme updated successfully', { variant: 'success' }); -// }; - -// return ( -// -// -// Theme Range -// ( -// -// )} -// /> -// -// -// ); -// }; - -// export default ThemeSelector; diff --git a/src/assets/currentlyUnused/TimeRangeSelector.jsx b/src/assets/currentlyUnused/TimeRangeSelector.jsx deleted file mode 100644 index a7b1348..0000000 --- a/src/assets/currentlyUnused/TimeRangeSelector.jsx +++ /dev/null @@ -1,42 +0,0 @@ -// import { useMemo } from 'react'; -// import { useFormContext, useMode } from '../../../context'; -// import useSelectedCollection from '../../../context/MAIN_CONTEXT/CollectionContext/useSelectedCollection'; -// import { StyledChartBox } from '../../../pages/pageStyles/StyledComponents'; -// import { FormControl, InputLabel, Typography } from '@mui/material'; -// import { Controller } from 'react-hook-form'; -// import SelectComponent from '../../../assets/Select'; -// import useTimeRange from './useTimeRange'; -// import MDTypography from '../../../layout/REUSABLE_COMPONENTS/MDTYPOGRAPHY/MDTypography'; - -// const TimeRangeSelector = () => { -// const { theme } = useMode(); -// const { timeRangeOptions, onFormSubmit, control, errors } = useTimeRange(); - -// return ( -// -// -// -// Time Range -// -// ( -// -// )} -// /> -// -// -// ); -// }; -// export default TimeRangeSelector; diff --git a/src/assets/currentlyUnused/TopCardsDisplay.jsx b/src/assets/currentlyUnused/TopCardsDisplay.jsx deleted file mode 100644 index 07d511b..0000000 --- a/src/assets/currentlyUnused/TopCardsDisplay.jsx +++ /dev/null @@ -1,188 +0,0 @@ -// import React, { useEffect, useRef, useState } from 'react'; -// import SwipeableViews from 'react-swipeable-views'; -// import { -// Box, -// Button, -// Container, -// Grid, -// MobileStepper, -// useMediaQuery, -// useTheme, -// } from '@mui/material'; -// import { KeyboardArrowLeft, KeyboardArrowRight } from '@mui/icons-material'; -// import { useCollectionStore } from '../../../context/MAIN_CONTEXT/CollectionContext/CollectionContext'; -// import { styled } from 'styled-components'; - -// import { MainContainer } from '../../../pages/pageStyles/StyledComponents'; -// import CarouselCard from '../../../components/cards/CarouselCard'; -// import LoadingIndicator from '../../../components/reusable/indicators/LoadingIndicator'; -// import { useMode } from '../../../context'; - -// const StyledStepper = styled(MobileStepper)(({ theme }) => ({ -// background: theme.palette.backgroundB.dark, -// border: `1px solid ${theme.palette.backgroundB.lighter}`, -// borderRadius: theme.shape.borderRadiusLarge, -// color: theme.palette.greenAccent.lightest, -// overflow: 'hidden', -// padding: theme.spacing(1), -// height: '100%', -// '@media (max-width: 600px)': { -// width: '100%', // Full width on mobile screens -// padding: theme.spacing(0.5), // Reduced padding on mobile -// }, -// })); - -// const StyledCardDetails = styled(Box)(({ theme }) => ({ -// display: 'flex', -// flexDirection: 'column', -// justifyContent: 'center', -// alignItems: 'center', -// })); - -// const StyledSwipeableView = styled(SwipeableViews)(({ theme }) => ({ -// '@media (max-width: 600px)': { -// width: '100%', // Full width on mobile screens -// overflow: 'hidden', // Hide overflow on mobile -// }, -// })); - -// const StyledContainer = styled(Container)(({ theme }) => ({ -// display: 'flex', -// flexDirection: 'column', -// // Set a maximum height to prevent expansion. Adjust according to your needs. -// maxHeight: '100vh', -// overflow: 'auto', // Add scroll if content exceeds container size -// alignItems: 'center', -// background: theme.palette.backgroundB.darker, -// borderRadius: theme.shape.borderRadiusLarge, -// padding: theme.spacing(3), -// color: '#fff', -// '@media (max-width: 600px)': { -// padding: theme.spacing(1), // Reduced padding on mobile -// }, -// })); - -// // Assuming SwipeableViews and CarouselCard do not need custom styling here -// // If they do, use styled in a similar manner - -// const TopCardsDisplay = () => { -// const { theme } = useMode(); -// const theme2 = useTheme(); -// const { selectedCollection } = useCollectionStore(); -// const [top5Cards, setTop5Cards] = useState([]); -// const [activeStep, setActiveStep] = useState(0); -// const isMobile = useMediaQuery(theme.breakpoints.down('sm')); - -// useEffect(() => { -// const sortedCards = selectedCollection?.cards -// ?.map((card) => { -// const latestPrice = card?.latestPrice?.num ?? 0; -// const lastSavedPrice = card?.lastSavedPrice?.num ?? 0; -// if (latestPrice === undefined) { -// console.warn(`Price missing for card: ${card.name}`); -// return { ...card, diff: 0 }; -// } -// return { ...card, diff: Math.abs(latestPrice - lastSavedPrice) }; -// }) -// .sort((a, b) => b.diff - a.diff || b.price - a.price) -// .slice(0, 5); -// setTop5Cards(sortedCards); -// }, [selectedCollection]); - -// const maxSteps = top5Cards?.length; -// const handleNext = () => setActiveStep((prev) => prev + 1); -// const handleBack = () => setActiveStep((prev) => prev - 1); -// const isSmall = useMediaQuery(theme2.breakpoints.down('sm')); -// if (!selectedCollection) { -// return ( -// -// -// -// ); -// } - -// return ( -// -// {/* */} -// -// -// -// {top5Cards?.map((card, index) => ( -// -// -// -// ))} -// -// -// {theme.direction === 'rtl' ? ( -// -// ) : ( -// -// )}{' '} -// Next -// -// } -// backButton={ -// -// } -// /> -// -// -// {/* */} -// -// ); -// }; - -// export default TopCardsDisplay; diff --git a/src/assets/currentlyUnused/UpdateCollectionForm.jsx b/src/assets/currentlyUnused/UpdateCollectionForm.jsx deleted file mode 100644 index fdf6970..0000000 --- a/src/assets/currentlyUnused/UpdateCollectionForm.jsx +++ /dev/null @@ -1,55 +0,0 @@ -// import React, { useEffect } from 'react'; -// import { useFormContext, useMode } from '../../context'; -// import useSnackbarManager from '../../context/hooks/useSnackbarManager'; -// import RCZodForm from './reusable/RCZodForm'; - -// const updateCollectionFields = [ -// { -// name: 'name', -// label: 'Name', -// type: 'text', -// required: true, -// }, -// { -// name: 'description', -// label: 'Description', -// type: 'text', -// required: true, -// multiline: true, -// rows: 4, -// }, -// ]; - -// const UpdateCollectionForm = ({ collectionData }) => { -// const { setFormSchema, onSubmit } = useFormContext(); -// const { theme } = useMode(); -// const { showSuccess, showError } = useSnackbarManager(); - -// useEffect(() => { -// if (collectionData) { -// setFormSchema('updateCollectionForm', collectionData); -// } -// }, [collectionData, setFormSchema]); - -// const handleFormSubmit = async (data) => { -// try { -// await onSubmit(data, 'updateCollectionForm', collectionData?._id); -// showSuccess("You've successfully updated the collection."); -// } catch (error) { -// showError('Failed to update collection. Please try again.'); -// } -// }; - -// return ( -// -// ); -// }; - -// export default UpdateCollectionForm; diff --git a/src/assets/currentlyUnused/UpdateDeckForm.jsx b/src/assets/currentlyUnused/UpdateDeckForm.jsx deleted file mode 100644 index 6d4fbcf..0000000 --- a/src/assets/currentlyUnused/UpdateDeckForm.jsx +++ /dev/null @@ -1,65 +0,0 @@ -// import React from 'react'; -// import RCZodForm from './RCZodForm'; -// import SaveIcon from '@mui/icons-material/Save'; -// import DeleteIcon from '@mui/icons-material/Delete'; -// import { useFormContext } from '../../context'; - -// // Assume the schema is defined elsewhere and imported here -// // import { updateDeckFormSchema } from './yourSchemaDefinitions'; - -// const updateDeckFields = [ -// { -// name: 'name', -// label: 'Name', -// type: 'text', -// icon: null, // No icons used for these fields -// }, -// { -// name: 'description', -// label: 'Description', -// type: 'text', -// multiline: true, -// rows: 4, -// icon: null, -// }, -// ]; - -// const UpdateDeckForm = ({ selectedDeck }) => { -// const { onSubmit } = useFormContext(); // Assuming useFormContext provides onSubmit - -// // Placeholder for the submission logic within the component or from props -// const handleSubmit = (data) => { -// console.log('Submitting update deck data:', data); -// onSubmit(data, 'updateDeckForm'); // This should align with your context action -// }; - -// // Placeholder for the deletion logic within the component or from props -// const handleDelete = () => { -// console.log('Deleting deck:', selectedDeck._id); -// // Here you would call a context function or similar to delete the deck -// onSubmit({ _id: selectedDeck._id, delete: true }, 'updateDeckForm'); -// }; - -// return ( -// } -// additionalButtons={[ -// { -// label: 'Delete Deck', -// onClick: handleDelete, -// startIcon: , -// color: 'error', -// variant: 'contained', -// disabled: !selectedDeck, -// }, -// ]} -// defaultValues={selectedDeck} // Assuming this prop is structured correctly for the form -// /> -// ); -// }; - -// export default UpdateDeckForm; diff --git a/src/assets/currentlyUnused/VisibilityContext.jsx b/src/assets/currentlyUnused/VisibilityContext.jsx deleted file mode 100644 index abd40b2..0000000 --- a/src/assets/currentlyUnused/VisibilityContext.jsx +++ /dev/null @@ -1,38 +0,0 @@ -// // VisibilityContext.js -// import React, { createContext, useContext, useState } from 'react'; - -// const VisibilityContext = createContext(); - -// export const useVisibilityContext = () => useContext(VisibilityContext); - -// export const VisibilityProvider = ({ children }) => { -// const [isCollectionVisible, setCollectionVisibility] = useState(false); -// const [dialogStates, setDialogStates] = useState({ -// isAddCollectionDialogOpen: false, -// isSelectionErrorDialogOpen: false, -// }); - -// const toggleCollectionVisibility = () => { -// setCollectionVisibility(!isCollectionVisible); -// }; - -// const toggleDialog = (dialogName) => { -// setDialogStates((prevState) => ({ -// ...prevState, -// [dialogName]: !prevState[dialogName], -// })); -// }; - -// return ( -// -// {children} -// -// ); -// }; diff --git a/src/assets/currentlyUnused/cardStyles.jsx b/src/assets/currentlyUnused/cardStyles.jsx deleted file mode 100644 index 14cdb56..0000000 --- a/src/assets/currentlyUnused/cardStyles.jsx +++ /dev/null @@ -1,307 +0,0 @@ -// import { -// Box, -// Button, -// Card, -// CardContent, -// Tooltip, -// Typography, -// } from '@mui/material'; -// import styled from 'styled-components'; - -// export const StyledCard = styled(Card)(({ theme }) => ({ -// display: 'flex', -// flexDirection: 'column', -// height: '100%', -// maxHeight: '300px', -// minHeight: '300px', -// overflow: 'hidden', -// borderRadius: theme.spacing(1), -// boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.2)', -// transition: 'transform 0.2s', -// '&:hover': { -// transform: 'scale(1.03)', -// }, -// })); -// export const StyledImage = styled('img')(({ theme }) => ({ -// maxHeight: '200px', -// width: '100%', -// objectFit: 'cover', -// })); - -// // export const StyledButton = styled(Button)(({ theme }) => ({ -// // minHeight: '40px', -// // maxHeight: '60px', -// // width: '100%', -// // })); -// // export const StyledToolTipBox = styled(Box)(({ theme }) => ({ -// // width: 'auto', -// // border: `1px solid ${theme.palette.divider}`, -// // borderRadius: theme.shape.borderRadius, -// // padding: theme.spacing(2), -// // backgroundColor: theme.palette.greenAccent.contrastText, -// // color: theme.palette.text.primary, -// // boxShadow: theme.shadows[3], -// // alignContent: 'flex-start', -// // alignItems: 'flex-start', -// // height: '100%', -// // maxWidth: 220, -// // position: 'relative', -// // '&::before': { -// // content: '""', -// // display: 'block', -// // paddingTop: '100%', -// // }, -// // '& > img': { -// // position: 'absolute', -// // top: 0, -// // left: 0, -// // width: '100%', -// // height: '100%', -// // objectFit: 'cover', -// // }, -// // })); -// // export const StyledTooltip = styled(Tooltip)(({ theme }) => ({ -// // // width: 'auto', -// // // border: `1px solid ${theme.palette.divider}`, -// // // borderRadius: theme.shape.borderRadius, -// // // padding: theme.spacing(2), -// // // backgroundColor: theme.palette.greenAccent.contrastText, -// // // color: theme.palette.text.primary, -// // // boxShadow: theme.shadows[3], -// // // alignContent: 'flex-start', -// // // alignItems: 'flex-start', -// // // height: '100%', -// // // maxWidth: 220, -// // // position: 'relative', -// // // '&::before': { -// // // content: '""', -// // // display: 'block', -// // // paddingTop: '100%', -// // // }, -// // // '& > img': { -// // // position: 'absolute', -// // // top: 0, -// // // left: 0, -// // // width: '100%', -// // // height: '100%', -// // // objectFit: 'cover', -// // // }, -// // })); -// // export const StyledTooltipTitle = styled('h4')(({ theme }) => ({ -// // fontWeight: 'bold', -// // marginBottom: theme.spacing(1), -// // alignContent: 'flex-start', -// // alignItems: 'flex-start', -// // })); -// // export const StyledDescriptionSpan = styled('span')(({ theme }) => ({ -// // display: 'block', -// // marginTop: theme.spacing(1), -// // flexGrow: 1, -// // })); -// // export const StyledAttributeSpan = styled('span')(({ theme }) => ({ -// // display: 'block', -// // marginBottom: theme.spacing(0.5), -// // })); - -// export const CardDetailContainer = styled(Box)(({ theme }) => ({ -// padding: theme.spacing(2), -// borderRadius: theme.shape.borderRadius, -// boxShadow: `0 4px 8px 0 ${theme.palette.shadow}`, -// backgroundColor: theme.palette.greenAccent.contrastText, -// display: 'flex', -// flexDirection: 'column', -// gap: theme.spacing(1), -// marginBottom: theme.spacing(2), -// transition: 'transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out', -// '&:hover': { -// transform: 'scale(1.03)', -// boxShadow: `0 6px 12px 0 ${theme.palette.shadow}`, -// }, -// })); - -// export const CardDetailRow = styled(Box)(({ theme }) => ({ -// display: 'flex', -// alignItems: 'center', -// gap: theme.spacing(2), -// })); - -// export const CardIconWrapper = styled('div')(({ theme }) => ({ -// display: 'inline-flex', -// alignItems: 'center', -// justifyContent: 'center', -// height: theme.spacing(4), -// width: theme.spacing(4), -// borderRadius: '50%', -// backgroundColor: theme.palette.backgroundA.lighter, -// color: theme.palette.backgroundA.contrastTextD, -// '& svg': { -// fontSize: theme.typography.pxToRem(20), -// }, -// })); - -// export const CardTitleStyle = styled('span')(({ theme }) => ({ -// fontWeight: 700, -// color: theme.palette.text.primary, -// textTransform: 'uppercase', -// })); - -// export const CardValueStyle = styled('span')(({ theme }) => ({ -// fontWeight: 400, -// color: theme.palette.text.secondary, -// })); -// // export const useStyles = makeStyles((theme) => ({ -// // card: { -// // display: 'flex', -// // flexDirection: 'column', -// // height: '100%', -// // maxHeight: '300px', // or any desired max height -// // minHeight: '300px', // make sure it matches max height -// // overflow: 'hidden', // ensures content doesn't spill out -// // borderRadius: theme.spacing(1), // Add border radius for cards -// // boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.2)', // Add shadow for cards -// // transition: 'transform 0.2s', -// // '&:hover': { -// // transform: 'scale(1.03)', // Add a slight scale effect on hover -// // }, -// // }, -// // image: { -// // maxHeight: '200px', -// // width: '100%', -// // objectFit: 'cover', // Ensure the image covers the entire space -// // }, -// // text: { -// // whiteSpace: 'nowrap', -// // overflow: 'hidden', -// // textOverflow: 'ellipsis', -// // }, -// // button: { -// // // maxWidth: '200px', -// // minHeight: '40px', -// // maxHeight: '60px', -// // width: '100%', -// // }, -// // content: { -// // transform: 'scale(0.9)', // scales down to 90% of the original size -// // padding: 0, -// // }, -// // cardActions: { -// // marginTop: 'auto', // pushes the actions to the bottom -// // display: 'flex', -// // justifyContent: 'center', // centers the buttons -// // width: '100%', -// // }, -// // tooltip: { -// // // maxWidth: '75vw', // 75% of the viewport width -// // width: 'auto', // Let the width be automatic -// // border: `1px solid ${theme.palette.divider}`, // Add border -// // borderRadius: theme.shape.borderRadius, // Use theme border radius -// // padding: theme.spacing(2), // Add some padding -// // backgroundColor: theme.palette.greenAccent.contrastText, // Use theme background -// // color: theme.palette.text.primary, // Use theme text color -// // boxShadow: theme.shadows[3], // Use theme shadow -// // alignContent: 'flex-start', -// // alignItems: 'flex-start', -// // height: '100%', -// // // Add more styles here for intricate design -// // // You can add background images, gradients, etc. -// // maxWidth: 220, -// // position: 'relative', -// // '&::before': { -// // // Create a pseudo-element to control the aspect ratio -// // content: '""', -// // display: 'block', -// // paddingTop: '100%', // This controls the aspect ratio, 100% for 1:1, 56.25% for 16:9, etc. -// // }, -// // '& > img': { -// // // Assuming you are including an image -// // position: 'absolute', -// // top: 0, -// // left: 0, -// // width: '100%', -// // height: '100%', -// // objectFit: 'cover', // This makes sure your image covers the entire content area -// // }, -// // }, -// // // tooltip: { -// // // // Define the width or max-width for your tooltip -// // // maxWidth: 220, -// // // position: 'relative', -// // // '&::before': { -// // // // Create a pseudo-element to control the aspect ratio -// // // content: '""', -// // // display: 'block', -// // // paddingTop: '100%' // This controls the aspect ratio, 100% for 1:1, 56.25% for 16:9, etc. -// // // }, -// // // '& > img': { // Assuming you are including an image -// // // position: 'absolute', -// // // top: 0, -// // // left: 0, -// // // width: '100%', -// // // height: '100%', -// // // objectFit: 'cover', // This makes sure your image covers the entire content area -// // // }, -// // // Define styles for children components like headers, images, etc. -// // tooltipTitle: { -// // fontWeight: 'bold', -// // marginBottom: theme.spacing(1), -// // alignContent: 'flex-start', -// // alignItems: 'flex-start', -// // }, -// // descriptionSpan: { -// // display: 'block', // Make description appear on a new line -// // marginTop: theme.spacing(1), -// // flexGrow: 1, -// // }, -// // attributeSpan: { -// // display: 'block', -// // marginBottom: theme.spacing(0.5), -// // }, -// // })); - -// // export const useCardDetailStyles = makeStyles((theme, theme2) => ({ -// // cardDetailContainer: { -// // padding: theme.spacing(2), -// // borderRadius: theme.shape.borderRadius, -// // boxShadow: `0 4px 8px 0 ${theme2.palette.shadow}`, -// // backgroundColor: theme.palette.greenAccent.contrastText, -// // display: 'flex', -// // flexDirection: 'column', -// // gap: theme.spacing(1), -// // marginBottom: theme.spacing(2), -// // transition: 'transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out', -// // '&:hover': { -// // transform: 'scale(1.03)', -// // boxShadow: `0 6px 12px 0 ${theme.palette.shadow}`, -// // }, -// // }, -// // detailRow: { -// // display: 'flex', -// // alignItems: 'center', -// // gap: theme.spacing(2), -// // }, -// // iconWrapper: { -// // display: 'inline-flex', -// // alignItems: 'center', -// // justifyContent: 'center', -// // height: theme.spacing(4), -// // width: theme.spacing(4), -// // borderRadius: '50%', -// // backgroundColor: theme.palette.backgroundA.lighter, -// // color: theme.palette.backgroundA.contrastTextD, -// // '& svg': { -// // fontSize: theme.typography.pxToRem(20), -// // }, -// // }, -// // titleStyle: { -// // fontWeight: 700, -// // color: theme.palette.text.primary, -// // textTransform: 'uppercase', -// // }, -// // valueStyle: { -// // fontWeight: 400, -// // color: theme.palette.text.secondary, -// // }, -// // divider: { -// // margin: theme.spacing(2, 0), -// // }, -// // })); diff --git a/src/assets/currentlyUnused/collectionPortfolioData.jsx b/src/assets/currentlyUnused/collectionPortfolioData.jsx deleted file mode 100644 index 00aa978..0000000 --- a/src/assets/currentlyUnused/collectionPortfolioData.jsx +++ /dev/null @@ -1,130 +0,0 @@ -// import Icon from '@mui/material/Icon'; -// // Images -// import MDTypography from '../../REUSABLE_COMPONENTS/MDTYPOGRAPHY/MDTypography'; -// import React from 'react'; -// import GenericActionButtons from '../../../components/buttons/actionButtons/GenericActionButtons'; -// import { useSnackbar } from 'notistack'; -// const Name = ({ name }) => ( -// -// {name} -// -// ); -// const Price = ({ price }) => ( -// -// {price} -// -// ); -// const TPrice = ({ tPrice }) => ( -// -// {tPrice} -// -// ); -// const Quantity = ({ quantity }) => ( -// -// {quantity} -// -// ); -// export default function prepareTableData(selectedCards) { -// const roundToNearestTenth = (value) => Math.round(value * 10) / 10; -// const { enqueueSnackbar } = useSnackbar(); -// const columns = React.useMemo( -// () => [ -// { -// Header: 'Name', -// accessor: 'name', -// id: 'name', -// Cell: ({ value }) => , -// }, -// { -// Header: 'Price', -// accessor: 'price', -// id: 'price', -// Cell: ({ value }) => , -// }, -// { -// Header: 'Total Price', -// accessor: 'tPrice', -// id: 'tPrice', -// Cell: ({ value }) => , -// }, -// { -// Header: 'Quantity', -// accessor: 'quantity', -// id: 'quantity', -// Cell: ({ value }) => , -// }, -// { -// id: 'action', -// Header: 'Action', -// accessor: 'action', -// Cell: ({ value }) => ( -// console.log('clicked')} -// onSuccess={() => -// enqueueSnackbar( -// { -// title: 'Action successful', -// message: `Card added to ${value} successfully.`, -// }, -// 'success', -// null -// ) -// } -// onFailure={(error) => -// enqueueSnackbar( -// { -// title: 'Action failed', -// message: `Failed to add card to ${value}.`, -// }, -// 'error', -// error -// ) -// } -// page={'Collection'} -// cardSize={'small'} -// /> -// ), -// }, -// ], -// [] -// ); - -// const data = React.useMemo( -// () => -// selectedCards?.map((card) => ({ -// ...card, -// tPrice: roundToNearestTenth(card.totalPrice), -// action: card, -// })), -// [selectedCards] -// ); - -// return { columns, data }; -// } diff --git a/src/assets/currentlyUnused/collectionUtility.jsx b/src/assets/currentlyUnused/collectionUtility.jsx deleted file mode 100644 index 5c22c81..0000000 --- a/src/assets/currentlyUnused/collectionUtility.jsx +++ /dev/null @@ -1,21 +0,0 @@ -// /* eslint-disable @typescript-eslint/no-empty-function */ -// export const calculateCollectionValue = (collection) => { -// if (!collection) return 0; - -// const cards = collection?.cards; - -// if (!Array.isArray(cards)) { -// console.warn('Invalid collection format', collection, cards); -// return 0; -// } - -// return cards.reduce((totalValue, card) => { -// const cardPrice = card?.price || 0; -// const cardQuantity = card?.quantity || 0; -// return totalValue + cardPrice * cardQuantity; -// }, 0); -// }; - -// export const shouldFetchCollections = (prevUserId, currentUserId) => { -// return prevUserId !== currentUserId && currentUserId != null; -// }; diff --git a/src/assets/currentlyUnused/colors/Azure.jsx b/src/assets/currentlyUnused/colors/Azure.jsx deleted file mode 100644 index bfb5af3..0000000 --- a/src/assets/currentlyUnused/colors/Azure.jsx +++ /dev/null @@ -1,70 +0,0 @@ -// /* CSS HEX */ -// --yale-blue: #173667ff; -// --polynesian-blue: #214c91ff; -// --sapphire: #2557a5ff; -// --true-blue: #2d6ac7ff; -// --azure: #3781f1ff; -// --silver-lake-blue: #668cc8ff; -// --powder-blue: #b8ceefff; - -const azure = { - darkest: '#173667ff', // --yale-blue-- - darker: '#214c91ff', // --polynesian-blue-- - dark: '#2557a5ff', // --sapphire-- - default: '#2d6ac7ff', // --true-blue-- - // test1: '#3276dcff', // --crayola-- - light: '#3781f1ff', // --azure-- - // test2: '#4f87ddff', // --chafchaouen-blue-- - lighter: '#668cc8ff', // --silver-lake-blue-- - // test3: '#8faddcff', // --vista-blue-- - lightest: '#b8ceefff', // --powder-blue-- - contrastText: '#fff', - lightContrastText: '#d6e3f5', // --lavendar-- - secondaryContrastText: '#173667', -}; - -const emerald = { - darkest: '#073b4cff', // --midnight-green-- - darker: '#0c637fff', // --cerulean-- - dark: '#118ab2ff', // --blue-ncs-- - default: '#0cb0a9ff', // --light-sea-green-- - light: '#06d6a0ff', // --emerald-- - lighter: '#91dacbff', // --tiffany-blue-- - lightest: '#c8ede5ff', // --mint-green-- - contrastText: '#fff', -}; - -const coral = { - darkest: '#7f2e2eff', // --persian-plum-- - darker: '#a63c3cff', // --pomegranate-- - dark: '#cc4a4aff', // --flamingo-- - default: '#e55e5eff', // --sunset-orange-- - light: '#f4755fff', // --bittersweet-- - lighter: '#f89a7dff', // --rajah-- - lightest: '#facbb0ff', // --navajo-white-- - contrastText: '#fff', -}; - -const defalt = { - id: 'lightBlue', - borderRadius: '0.75rem', - colorBackground: '#f4f4f8', - colorNavbar: '#151939', - // colorNavbarLabel: rgba('white', 0.65), - // colorNavbarLink: colorTextForDark, - colorText: '#343239', - colorLabel: '#A4A3A6', - colorBorder: '#f0f0f9', - colorPrimary: '#06d6a0ff', - // colorPrimaryText: colorTextForDark, - colorAccent: '#c8ede5ff', - // colorAccentText: colorTextForDark, - colorCardBackground: '#ffffff', - colorDefaultBackground: '#ececf0', - colorDefaultText: '#73707C', - colorDisabledBackground: '#d5d5e3', - colorDisabledText: '#bebed0', - colorCode: '#a5a5a5', - colorChartShading: '#696969', - boxShadowLogo: 'none', -}; diff --git a/src/assets/currentlyUnused/colors/Cyan.jsx b/src/assets/currentlyUnused/colors/Cyan.jsx deleted file mode 100644 index b94d422..0000000 --- a/src/assets/currentlyUnused/colors/Cyan.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import { createTheme } from '@mui/material'; - -const cyanTheme = createTheme({ - palette: { - primary: { - light: '#80deea', - main: '#00bcd4', - dark: '#00838f', - contrastText: '#000', - }, - secondary: { - light: '#ffab40', - main: '#ff9100', - dark: '#ff6d00', - contrastText: '#000', - }, - grey: { - 300: '#e0e0e0', - }, - common: { - white: '#ffffff', - black: '#000000', - }, - text: { - primary: '#212121', - }, - background: { - paper: '#f5f5f5', - }, - }, -}); - -export default cyanTheme; diff --git a/src/assets/currentlyUnused/colors/Dark.jsx b/src/assets/currentlyUnused/colors/Dark.jsx deleted file mode 100644 index e0bf501..0000000 --- a/src/assets/currentlyUnused/colors/Dark.jsx +++ /dev/null @@ -1,34 +0,0 @@ -import { createTheme } from '@mui/material'; - -const darkTheme = createTheme({ - palette: { - type: 'dark', - primary: { - light: '#757ce8', - main: '#3f50b5', - dark: '#002884', - contrastText: '#fff', - }, - secondary: { - light: '#ff7961', - main: '#f44336', - dark: '#ba000d', - contrastText: '#000', - }, - grey: { - 300: '#9e9e9e', - }, - common: { - white: '#ffffff', - black: '#000000', - }, - text: { - primary: '#fafafa', - }, - background: { - paper: '#424242', - }, - }, -}); - -export default darkTheme; diff --git a/src/assets/currentlyUnused/colors/DeepPurple.jsx b/src/assets/currentlyUnused/colors/DeepPurple.jsx deleted file mode 100644 index bf9c16e..0000000 --- a/src/assets/currentlyUnused/colors/DeepPurple.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import { createTheme } from '@mui/material'; - -const deepPurpleTheme = createTheme({ - palette: { - primary: { - light: '#b39ddb', - main: '#673ab7', - dark: '#4527a0', - contrastText: '#fff', - }, - secondary: { - light: '#ff4081', - main: '#f50057', - dark: '#c51162', - contrastText: '#000', - }, - grey: { - 300: '#e0e0e0', - }, - common: { - white: '#ffffff', - black: '#000000', - }, - text: { - primary: '#212121', - }, - background: { - paper: '#f5f5f5', - }, - }, -}); - -export default deepPurpleTheme; diff --git a/src/assets/currentlyUnused/colors/Default.jsx b/src/assets/currentlyUnused/colors/Default.jsx deleted file mode 100644 index 2ce5d1f..0000000 --- a/src/assets/currentlyUnused/colors/Default.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import { createTheme } from '@mui/material'; - -const defaultTheme = createTheme({ - palette: { - primary: { - light: '#757ce8', - main: '#3f50b5', - dark: '#002884', - contrastText: '#fff', - }, - secondary: { - light: '#ff7961', - main: '#f44336', - dark: '#ba000d', - contrastText: '#000', - }, - grey: { - 300: '#e0e0e0', - }, - common: { - white: '#ffffff', - black: '#000000', - }, - text: { - primary: '#333', - }, - background: { - paper: '#f5f5f5', - }, - }, -}); - -export default defaultTheme; diff --git a/src/assets/currentlyUnused/colors/Indigo.jsx b/src/assets/currentlyUnused/colors/Indigo.jsx deleted file mode 100644 index ec003ea..0000000 --- a/src/assets/currentlyUnused/colors/Indigo.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import { createTheme } from '@mui/material'; - -const indigoTheme = createTheme({ - palette: { - primary: { - light: '#9fa8da', - main: '#3f51b5', - dark: '#283593', - contrastText: '#fff', - }, - secondary: { - light: '#ff7961', - main: '#f44336', - dark: '#ba000d', - contrastText: '#000', - }, - grey: { - 300: '#e0e0e0', - }, - common: { - white: '#ffffff', - black: '#000000', - }, - text: { - primary: '#212121', - }, - background: { - paper: '#f5f5f5', - }, - }, -}); - -export default indigoTheme; diff --git a/src/assets/currentlyUnused/colors/Light.jsx b/src/assets/currentlyUnused/colors/Light.jsx deleted file mode 100644 index 59f8dbc..0000000 --- a/src/assets/currentlyUnused/colors/Light.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import { createTheme } from '@mui/material'; - -const lightTheme = createTheme({ - palette: { - primary: { - light: '#7986cb', - main: '#3f51b5', - dark: '#303f9f', - contrastText: '#fff', - }, - secondary: { - light: '#ff4081', - main: '#f50057', - dark: '#c51162', - contrastText: '#fff', - }, - grey: { - 300: '#e0e0e0', - }, - common: { - white: '#ffffff', - black: '#000000', - }, - text: { - primary: '#212121', - }, - background: { - paper: '#ffffff', - }, - }, -}); - -export default lightTheme; diff --git a/src/assets/currentlyUnused/colors/LightBlue.jsx b/src/assets/currentlyUnused/colors/LightBlue.jsx deleted file mode 100644 index 098aa0f..0000000 --- a/src/assets/currentlyUnused/colors/LightBlue.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import { createTheme } from '@mui/material'; - -const lightBlueTheme = createTheme({ - palette: { - primary: { - light: '#81d4fa', - main: '#29b6f6', - dark: '#01579b', - contrastText: '#fff', - }, - secondary: { - light: '#80deea', - main: '#00bcd4', - dark: '#00838f', - contrastText: '#000', - }, - grey: { - 300: '#e0e0e0', - }, - common: { - white: '#ffffff', - black: '#000000', - }, - text: { - primary: '#212121', - }, - background: { - paper: '#f5f5f5', - }, - }, -}); - -export default lightBlueTheme; diff --git a/src/assets/currentlyUnused/formFieldData.jsx b/src/assets/currentlyUnused/formFieldData.jsx deleted file mode 100644 index a4f17be..0000000 --- a/src/assets/currentlyUnused/formFieldData.jsx +++ /dev/null @@ -1,263 +0,0 @@ -// import LoginIcon from '@mui/icons-material/Login'; -// import PersonIcon from '@mui/icons-material/Person'; -// import LockIcon from '@mui/icons-material/Lock'; -// import EmailRoundedIcon from '@mui/icons-material/EmailRounded'; -// import VerifiedUserRoundedIcon from '@mui/icons-material/VerifiedUserRounded'; -// import DescriptionRoundedIcon from '@mui/icons-material/DescriptionRounded'; -// import AccountCircleRoundedIcon from '@mui/icons-material/AccountCircleRounded'; -// import FindInPageRoundedIcon from '@mui/icons-material/FindInPageRounded'; -// // TODO: ADD EMAIL ICON -// // TODO: ADD First ICON -// // TODO: ADD Last ICON -// // TODO: ADD General Name ICON -// // TODO: ADD Description ICON -// const loginFields = [ -// { -// label: 'Username', -// type: 'text', -// placeHolder: 'Enter username', -// defaultValue: '', -// rules: { -// required: true, -// }, -// icon: , -// field: 'username', -// name: 'username', -// }, -// { -// label: 'Password', -// type: 'text', -// placeHolder: 'Enter password', -// defaultValue: '', -// rules: { -// required: true, -// }, -// icon: , -// field: 'password', -// name: 'password', -// }, -// ]; -// const signupFields = [ -// { -// label: 'First Name', -// type: 'text', -// placeHolder: 'Enter first name', -// defaultValue: '', -// rules: { -// required: true, -// }, -// icon: , -// field: 'firstName', -// name: 'firstName', -// }, -// { -// label: 'Last Name', -// type: 'text', -// placeHolder: 'Enter last name', -// defaultValue: '', -// rules: { -// required: true, -// }, -// icon: , -// field: 'lastName', -// name: 'lastName', -// }, -// { -// label: 'Email', -// type: 'email', -// placeHolder: 'Enter email', -// defaultValue: '', -// rules: { -// required: true, -// }, -// icon: , -// field: 'email', -// name: 'email', -// }, -// ]; -// const addDeckFields = [ -// { -// label: 'Name', -// type: 'text', -// placeHolder: 'Enter deck name', -// defaultValue: '', -// rules: { -// required: true, -// }, -// icon: , -// field: 'name', -// value: '', -// required: true, -// name: 'name', -// }, -// { -// label: 'Description', -// type: 'text', -// placeHolder: 'Enter deck description', -// defaultValue: '', -// rules: { -// required: true, -// multiline: true, -// rows: 4, -// }, -// value: '', -// multiline: true, -// rows: 4, -// icon: , -// required: false, -// name: 'description', -// }, -// ]; -// const updateDeckFields = [ -// { -// label: 'Tags', -// type: 'chips', -// placeHolder: 'Enter tags', -// defaultValue: '', -// rules: { -// required: true, -// }, -// chipData: tags, -// icon: , -// onAddChip: handleAddTag, -// onDeleteChip: handleDeleteTag, -// required: false, -// name: 'tags', -// value: tags.join(', '), -// // chipData: tags, -// // icon: null, -// // onAddChip: handleAddTag, -// // onDeleteChip: handleDeleteTag, -// // required: false, -// // name: 'tags', -// }, -// { -// label: 'Color', -// type: 'select', -// placeHolder: 'Select color', -// defaultValue: '', -// rules: { -// required: true, -// }, -// icon: null, -// required: false, -// options: [ -// { value: 'red', label: 'Red' }, -// { value: 'blue', label: 'Blue' }, -// { value: 'green', label: 'Green' }, -// { value: 'yellow', label: 'Yellow' }, -// { value: 'purple', label: 'Purple' }, -// { value: 'pink', label: 'Pink' }, -// { value: 'orange', label: 'Orange' }, -// { value: 'teal', label: 'Teal' }, -// ], -// name: 'color', -// }, -// ]; -// const authFormFields = [...signupFields, ...loginFields]; -// const collectionFormFields = [ -// { -// label: 'Name', -// type: 'text', -// placeHolder: 'Enter collection name', -// defaultValue: '', -// rules: { -// required: true, -// }, -// icon: , -// value: '', -// required: true, -// name: 'name', -// }, -// { -// label: 'Description', -// type: 'text', -// placeHolder: 'Enter collection description', -// defaultValue: '', -// rules: { -// required: true, -// multiline: true, -// rows: 4, -// }, -// icon: , -// value: '', -// required: true, -// multiline: true, -// rows: 4, -// name: 'description', -// }, -// ]; -// const deckFormFields = [...addDeckFields, ...updateDeckFields]; -// const searchFormFields = [ -// { -// label: 'Search Cards', -// type: 'text', -// placeholder: 'Search for cards...', -// defaultValue: '', -// rules: { -// required: false, -// }, -// required: false, -// value: forms?.searchForm?.searchTerm || '', -// onChange: handleChange, -// onFocus: handleFocus, -// onBlur: handleBlur, -// name: 'searchTerm', -// }, -// ]; -// const statisticsFormFields = [ -// { value: 'highPoint', label: 'High Point' }, -// { value: 'lowPoint', label: 'Low Point' }, -// { value: 'twentyFourHourAverage', label: '24 Hour Average' }, -// { value: 'average', label: 'Average' }, -// { value: 'volume', label: 'Volume' }, -// { value: 'volatility', label: 'Volatility' }, -// ]; -// const themeFormFields = [ -// { value: 'light', label: 'Light Theme' }, -// { value: 'dark', label: 'Dark Theme' }, -// { value: 'system', label: 'System Theme' }, -// ]; -// const timeRangeFormFields = [ -// { value: '24hr', label: 'Today' }, -// { value: '7d', label: 'This Week' }, -// { value: '30d', label: 'This Month' }, -// { value: '90d', label: 'Last Three Months' }, -// { value: '180d', label: 'Last Six Months' }, -// { value: '270d', label: 'Last Nine Months' }, -// { value: '365d', label: 'All Time' }, -// ]; -// const formHandlers = { -// signupForm: async (formData) => signup(formData), -// loginForm: async (formData) => login(formData), -// updateUserDataForm: (formData) => console.log(formData), -// addCollectionForm: (formData, additionalData) => -// createNewCollection(formData, additionalData), -// updateCollectionForm: (formData, additionalData) => -// updateCollection(additionalData, formData), -// updateDeckForm: (formData, additionalData) => -// updateDeckDetails(formData, additionalData), -// addDeckForm: (formData, additionalData) => -// createNewDeck(formData, additionalData), -// deleteDeckForm: (formData, additionalData) => -// deleteDeck(formData, additionalData), -// searchForm: (formData, additionalData) => -// setSearchSettings(formData, additionalData), -// collectionSearchForm: (formData, additionalData) => -// console.log(formData, additionalData), -// // timeRangeSelector: (formData, additionalData) => -// // handleTimeRangeChange(formData, additionalData), -// searchSettingsSelector: (formData, additionalData) => -// setSearchSettings(formData, additionalData), -// rememberMeForm: (formData) => { -// // Implement remember me form submission logic here -// console.log('Remember Me Form Data:', formData); -// }, -// authSwitch: (formData) => { -// console.log('Auth Switch Form Data:', formData); -// toggleActiveForm('loginForm', 'signupForm'); -// }, -// }; - -// return formHandlers; -// }; diff --git a/src/assets/currentlyUnused/helpers.jsx b/src/assets/currentlyUnused/helpers.jsx deleted file mode 100644 index 102ea76..0000000 --- a/src/assets/currentlyUnused/helpers.jsx +++ /dev/null @@ -1,193 +0,0 @@ -// export const transformPriceHistoryToXY = (collectionPriceHistory) => { -// return collectionPriceHistory?.map((entry) => ({ -// x: entry?.timestamp, // x represents the timestamp -// y: entry?.num, // y represents the numerical value -// label: `Price at ${entry?.timestamp}`, // label can be customized as needed -// })); -// }; - -// export const logError = (source, action, error) => { -// console.error( -// `[${source.toUpperCase()}] Failed to ${action}: ${error.message}` -// ); -// }; - -/** - * Checks if the given object is empty. - * @param {Object} obj - Object to check. - * @returns {Boolean} True if the object is empty, false otherwise. - */ -export const isEmpty = (obj) => { - return ( - [Object, Array].includes((obj || {}).constructor) && - !Object.entries(obj || {}).length - ); -}; -export const constructCardDifferencesPayload = ( - oldCollection, - newCollection, - debug = false -) => { - const differences = {}; - - newCollection.cards.forEach((newCard) => { - const oldCard = - oldCollection.cards.find((card) => card.id === newCard.id) || {}; - - Object.keys(newCard).forEach((key) => { - if (newCard[key] !== oldCard[key]) { - if (!differences[newCard.id]) { - differences[newCard.id] = { old: {}, new: {} }; - } - differences[newCard.id].old[key] = oldCard[key]; - differences[newCard.id].new[key] = newCard[key]; - } - }); - }); - - if (debug && Object.keys(differences).length > 0) { - console.log('Card Differences:', differences); - } - - return differences; -}; - -export const determineMethod = (operation, cardUpdate, collection) => { - console.log('CARD UPDATE QUANTITY TEST', cardUpdate); - if (operation === 'remove' && cardUpdate?.quantity >= 1) { - return 'PUT'; - // } else if (collection?.cards?.some((card) => card?.id === cardUpdate?.id)) { - } else if (operation === 'remove') { - return 'DELETE'; - } else if (operation === 'update') { - return 'PUT'; - } else if (operation === 'add' && cardUpdate?.quantity >= 1) { - return 'PUT'; - } else if (operation === 'add') { - return 'POST'; - } -}; -export const getTotalQuantityOfSelectedCollection = (selectedCollection) => { - if (!selectedCollection) return 'n/a'; - return selectedCollection?.cards?.reduce( - (total, card) => total + card.quantity, - 0 - ); -}; - -export const createPriceHistoryObject = (price) => { - return { - num: price, - timestamp: new Date(), - }; -}; - -export const getUpdatedCollectionPriceHistory = ( - selectedCollection, - updatedPrice -) => { - const updatedPriceHistory = selectedCollection?.collectionPriceHistory || []; - return [...updatedPriceHistory, createPriceHistoryObject(updatedPrice)]; -}; -/** - * Ensures a value is a number, providing a default if not. - * @param {any} value - Value to check. - * @param {Number} defaultValue - Default value if check fails. - * @returns {Number} Ensured number. - */ -export const ensureNumber = (value, defaultValue = 0) => { - const num = parseFloat(value); - return isNaN(num) ? defaultValue : num; -}; - -export const getCardPrice = (collection) => - parseFloat(collection?.cards?.card_prices?.[0]?.tcgplayer_price || 0); - -export const getAllCardPrices = (cards) => - cards.flatMap((card) => Array(card.quantity).fill(card.price)); - -export const determineCardPrice = (card, update) => { - let price = 0; - // console.log('CARD UPDATE:', update); - if (card?.price !== update?.price) { - price = update?.price; - } else { - price = card?.price; - } - - return price || card?.card_prices[0]?.tcgplayer_price; -}; - -export const convertToXYLabelData = (collectionPriceHistory) => { - return collectionPriceHistory?.map((item) => ({ - x: new Date(item?.timestamp).toLocaleDateString(), // Converts timestamp to a readable date string - y: item?.num, - label: `Price: $${item?.num} at ${new Date( - item.timestamp - ).toLocaleTimeString()}`, // Combines price and time for the label - })); -}; -export const getPriceChange = (currentChartDataSets2) => { - if ( - !Array.isArray(currentChartDataSets2) || - currentChartDataSets2?.length === 0 - ) { - console.warn('Invalid or empty chart data sets provided'); - return []; - } - - const sortedData = currentChartDataSets2 - .filter((dataPoint) => dataPoint && dataPoint?.x && dataPoint?.y != null) // Filter out invalid data points - .sort((a, b) => new Date(a.x) - new Date(b.x)); - - if (sortedData?.length === 0) { - console.error('No valid chart data points after filtering'); - return []; - } - - const latestDataPoint = sortedData[sortedData.length - 1]; - const latestTime = new Date(latestDataPoint.x).getTime(); - const twentyFourHoursAgo = latestTime - 24 * 60 * 60 * 1000; - - let closestIndex = -1; - let closestTimeDifference = Number.MAX_SAFE_INTEGER; - - for (let i = 0; i < sortedData.length - 1; i++) { - const time = new Date(sortedData[i].x).getTime(); - const timeDifference = Math.abs(time - twentyFourHoursAgo); - - if (timeDifference < closestTimeDifference) { - closestTimeDifference = timeDifference; - closestIndex = i; - } - } - - if (closestIndex !== -1) { - const pastPrice = sortedData[closestIndex].y; - const priceChange = latestDataPoint.y - pastPrice; - const percentageChange = ((priceChange / pastPrice) * 100).toFixed(2); - - return [ - { - startDate: sortedData[closestIndex].x, - lowPoint: pastPrice.toFixed(2), - highPoint: latestDataPoint?.y?.toFixed(2), - endDate: latestDataPoint?.x, - priceChange: priceChange.toFixed(2), - percentageChange: `${percentageChange}%`, - priceIncreased: priceChange > 0, - }, - ]; - } - - return []; -}; - -export const createChartDataEntry = (chartDataSets) => { - const chartData = { - id: 'priceHistory', - data: chartDataSets, - }; - - return [chartData]; -}; diff --git a/src/assets/currentlyUnused/helpers2.jsx b/src/assets/currentlyUnused/helpers2.jsx deleted file mode 100644 index 527c92d..0000000 --- a/src/assets/currentlyUnused/helpers2.jsx +++ /dev/null @@ -1,120 +0,0 @@ -// export const calculatePriceChanges = (data) => { -// if (!Array.isArray(data) || data.length === 0) return []; - -// const sortedData = data.sort((a, b) => new Date(a.x) - new Date(b.x)); -// const latestDataPoint = sortedData[sortedData.length - 1]; -// const latestTime = new Date(latestDataPoint.x).getTime(); -// const twentyFourHoursAgo = latestTime - 24 * 60 * 60 * 1000; - -// let closestIndex = -1; -// let closestTimeDifference = Number.MAX_SAFE_INTEGER; - -// for (let i = 0; i < sortedData.length - 1; i++) { -// const time = new Date(sortedData[i].x).getTime(); -// const timeDifference = Math.abs(time - twentyFourHoursAgo); - -// if (timeDifference < closestTimeDifference) { -// closestTimeDifference = timeDifference; -// closestIndex = i; -// } -// } - -// if (closestIndex !== -1) { -// const pastPrice = sortedData[closestIndex].y; -// const priceChange = latestDataPoint.y - pastPrice; -// const percentageChange = ((priceChange / pastPrice) * 100).toFixed(2); -// return [ -// { -// startDate: sortedData[closestIndex].x, -// lowPoint: pastPrice.toFixed(2), -// highPoint: latestDataPoint?.y?.toFixed(2), -// endDate: latestDataPoint?.x, -// priceChange: priceChange.toFixed(2), -// percentageChange: `${percentageChange}%`, -// priceIncreased: priceChange > 0, -// }, -// ]; -// } - -// return []; -// }; - -// export const getTopCollection = (collections) => { -// return collections?.reduce( -// (max, collection) => -// max.totalPrice > collection.totalPrice ? max : collection, -// collections[0] -// ); -// }; -// export const getTopCard = (cards) => { -// return cards?.reduce( -// (max, card) => (max.price > card.price ? max : card), -// cards[0] -// ); -// }; -// const calculateTotalPriceOfAllCollections = (collections) => { -// return collections -// ?.reduce((total, collection) => total + collection.totalPrice, 0) -// .toFixed(2); -// }; - -// export const calculateStatistics = (data, timeRange, allCollections, cards) => { -// if (!data || !Array.isArray(data.data) || data.data.length === 0) return {}; - -// const filteredData = data?.data?.filter( -// (item) => new Date(item?.x).getTime() >= Date.now() - timeRange -// ); -// if (filteredData.length === 0) return {}; - -// let highPoint = Math.max(...filteredData.map((item) => item.y)); -// let lowPoint = Math.min(...filteredData.map((item) => item.y)); -// let sum = filteredData.reduce((acc, curr) => acc + curr.y, 0); -// let averageData = calculatePriceChanges(filteredData); -// let average = sum / filteredData.length || 0; -// let volume = filteredData.length; -// let mean = sum / volume; -// let squaredDiffs = filteredData.map((item) => { -// const diff = item.y - mean; -// return diff * diff; -// }); -// let volatility = Math.sqrt(squaredDiffs.reduce((a, b) => a + b, 0) / volume); - -// const topCollection = getTopCollection(allCollections); -// const topCard = getTopCard(cards); -// const totalPriceAllCollections = -// calculateTotalPriceOfAllCollections(allCollections); - -// return { -// highPoint: highPoint.toFixed(2), -// lowPoint: lowPoint.toFixed(2), -// twentyFourHourAverage: { -// startDate: averageData[0]?.startDate, -// endDate: averageData[0]?.endDate, -// lowPoint: averageData[0]?.lowPoint, -// highPoint: averageData[0]?.highPoint, -// priceChange: averageData[0]?.priceChange, -// percentageChange: averageData[0]?.percentageChange, -// priceIncreased: averageData[0]?.priceIncreased, -// }, -// average: average.toFixed(2), -// volume, -// volatility: volatility.toFixed(2), -// general: { -// totalPrice: totalPriceAllCollections, -// topCard: topCard?.name, // or any other identifier for the card -// topCollection: topCollection?.name, // or any other identifier for the collection -// }, -// }; -// }; -// export const calculateStatsForCollection = (collection, timeRange) => { -// try { -// const data = collection?.chartData?.allXYValues || []; -// return calculateStatistics({ data }, timeRange) || {}; -// } catch (error) { -// console.error( -// `Error calculating statistics for collection ${collection._id}:`, -// error -// ); -// return {}; // Default value in case of error -// } -// }; diff --git a/src/assets/currentlyUnused/index.jsx b/src/assets/currentlyUnused/index.jsx deleted file mode 100644 index 5dea71e..0000000 --- a/src/assets/currentlyUnused/index.jsx +++ /dev/null @@ -1,298 +0,0 @@ -// /* eslint-disable @typescript-eslint/no-empty-function */ -// import { useMemo, useEffect, useState } from 'react'; -// import PropTypes from 'prop-types'; -// import { -// useTable, -// usePagination, -// useGlobalFilter, -// useAsyncDebounce, -// useSortBy, -// useRowSelect, -// } from 'react-table'; -// // @mui material components -// import Table from '@mui/material/Table'; -// import TableContainer from '@mui/material/TableContainer'; -// import TableRow from '@mui/material/TableRow'; -// import DataTableBodyCell from './DataTableBodyCell'; -// import { Box, Button, Checkbox, Grid, Paper, TableBody } from '@mui/material'; -// import PaginationComponent from './PaginationComponent'; -// import OptionsComponent from '../../../../components/forms/OptionsComponent'; -// import GenericActionButtons from '../../../../components/buttons/actionButtons/GenericActionButtons'; -// import { useMode } from '../../../../context'; -// import DataTableHeadCell from './DataTableHeadCell'; -// import FlexBetween from '../../../REUSABLE_COMPONENTS/FlexBetween'; -// const setSortedValue = (column, isSorted) => { -// let sortedValue; - -// if (isSorted && column.isSorted) { -// sortedValue = column.isSortedDesc ? 'desc' : 'asce'; -// } else if (isSorted) { -// sortedValue = 'none'; -// } else { -// sortedValue = false; -// } - -// return sortedValue; -// }; -// function DataTable({ -// entriesPerPage, -// canSearch, -// showTotalEntries, -// table, -// pagination, -// isSorted, -// noEndBorder, -// tableSize, -// }) { -// const { theme } = useMode(); -// const [showTotalPrice, setShowTotalPrice] = useState(window.innerWidth > 800); -// const [showSelection, setShowSelection] = useState(window.innerWidth > 500); -// useEffect(() => { -// const handleResize = () => { -// setShowTotalPrice(window.innerWidth > 800); -// setShowSelection(window.innerWidth > 500); -// }; -// window.addEventListener('resize', handleResize); -// return () => { -// window.removeEventListener('resize', handleResize); -// }; -// }, []); - -// const data = useMemo(() => table.data, [table.data]); -// const columns = useMemo(() => { -// let baseColumns = [ -// showSelection && { -// id: 'selection', -// showIcons: false, -// Header: ({ getToggleAllRowsSelectedProps }) => ( -// -// ), -// Cell: ({ row }) => , -// // Apply a fixed width to the checkbox column -// // width: 30, // Adjust the width as needed -// // minWidth: 30, // Ensure it doesn't get smaller than the set width -// // maxWidth: 30, // Ensure it doesn't get larger than the set width -// }, -// { Header: 'Name', accessor: 'name' }, -// { Header: 'Price', accessor: 'price' }, - -// { Header: 'Quantity', accessor: 'quantity', showIcons: false }, -// { -// id: 'action', -// Header: 'Action', -// accessor: 'action', -// showIcons: false, - -// Cell: ({ value }) => ( -// console.log('clicked')} -// onSuccess={() => console.log('success')} -// onFailure={(error) => console.log(error)} -// page={'Collection'} -// cardSize={'small'} -// variant="data-table" -// /> -// ), -// }, -// ]; -// if (tableSize !== 'large' && showTotalPrice) { -// baseColumns.push({ -// Header: 'Total Price', -// accessor: 'tPrice', -// }); -// } -// // Filter out any falsey values to remove the conditionally included columns when not shown -// return baseColumns.filter(Boolean); -// }, [showTotalPrice, showSelection, tableSize]); - -// const defaultPageSize = useMemo( -// () => entriesPerPage.defaultValue, -// [entriesPerPage] -// ); -// const pageSizeOptions = useMemo( -// () => entriesPerPage.entries, -// [entriesPerPage] -// ); - -// const { -// getTableProps, -// getTableBodyProps, -// headerGroups, -// prepareRow, -// page, -// canPreviousPage, -// canNextPage, -// pageOptions, -// gotoPage, -// nextPage, -// previousPage, -// setPageSize, -// setGlobalFilter, -// selectedFlatRows, -// toggleAllRowsSelected, -// state: { pageIndex, pageSize, globalFilter }, -// } = useTable( -// { -// columns, -// data, -// initialState: { pageIndex: 0, pageSize: entriesPerPage.defaultValue }, -// }, -// useGlobalFilter, -// useSortBy, -// usePagination, -// useRowSelect -// ); -// const [search, setSearch] = useState(globalFilter); - -// useEffect(() => { -// setGlobalFilter(search || undefined); -// }, [search, setGlobalFilter]); - -// useEffect(() => { -// setPageSize(defaultPageSize); -// }, [defaultPageSize, setPageSize]); - -// const handleSelectAllClick = (event) => { -// toggleAllRowsSelected(event.target.checked); -// }; - -// let entriesEnd; -// if (pageIndex === 0) { -// entriesEnd = pageSize; -// } else if (pageIndex === pageOptions.length - 1) { -// entriesEnd = data.length; -// } else { -// entriesEnd = pageSize * (pageIndex + 1); -// } - -// return ( -// -// -// {/* Search and Entries Per Page Options */} -// setSearch(e.target.value)} -// pageSize={pageSize} -// setPageSize={(size) => setPageSize(Number(size))} -// pageOptions={pageSizeOptions} -// /> -// {/* Table */} -// -// -// -// {}} -// headerGroups={headerGroups} -// isSorted={isSorted} -// setSortedValue={setSortedValue} -// /> -// -// {/* Table Body */} -// -// {page.map((row, key) => { -// prepareRow(row); -// return ( -// -// {' '} -// -// {row.cells.map((cell, idx) => ( -// -// {cell.render('Cell')} -// -// ))} -// -// -// ); -// })} -// -//
-//
-// {/* Pagination */} -// -// -// -//
-//
-// ); -// } - -// DataTable.propTypes = { -// entriesPerPage: PropTypes.shape({ -// defaultValue: PropTypes.number, -// entries: PropTypes.arrayOf(PropTypes.number), -// }).isRequired, -// canSearch: PropTypes.bool, -// showTotalEntries: PropTypes.bool, -// table: PropTypes.shape({ -// columns: PropTypes.array.isRequired, -// data: PropTypes.array.isRequired, -// }).isRequired, -// isSorted: PropTypes.bool, -// noEndBorder: PropTypes.bool, -// }; -// DataTable.defaultProps = { -// canSearch: false, -// showTotalEntries: true, -// isSorted: true, -// noEndBorder: false, -// }; - -// export default DataTable; diff --git a/src/assets/currentlyUnused/menuItemsData.jsx b/src/assets/currentlyUnused/menuItemsData.jsx deleted file mode 100644 index 9d8cfbf..0000000 --- a/src/assets/currentlyUnused/menuItemsData.jsx +++ /dev/null @@ -1,137 +0,0 @@ -// import React, { useCallback, useState } from 'react'; -// import { -// Home as HomeIcon, -// Store as StoreIcon, -// ShoppingCart as CartIcon, -// Assessment as CollectionIcon, -// Person as ProfileIcon, -// } from '@mui/icons-material'; -// import DeckBuilderIcon from '../REUSABLE_COMPONENTS/icons/DeckBuilderIcon'; -// import { Badge } from '@mui/material'; -// import { useCartStore } from '../../context/MAIN_CONTEXT/CartContext/CartContext'; -// import { IconButton } from '@mui/joy'; -// import MenuIcon from '@mui/icons-material/Menu'; - -// // const iconWrapper = (icon) => { -// // return ( -// // -// // {icon} -// // -// // ); -// // }; -// export const getMenuItemsData = ({ -// isLoggedIn, -// cartCardQuantity, -// // iconColor, -// // isOpen, -// // setIsOpen, -// }) => { -// // const { cartCardQuantity } = useCartStore(); -// // const [isOpen, setIsOpen] = useState(false); // Manage open state locally -// // const toggleSidebar = useCallback(() => setIsOpen(!isOpen), [isOpen]); -// // const iconColor = isMobileView ? theme.palette.success.secondary : 'white'; - -// try { -// const baseMenuItems = [ -// { -// name: 'Menu', -// icon: , -// to: '/', -// requiresLogin: false, -// }, -// { name: 'Home', icon: , to: '/home', requiresLogin: false }, -// { -// name: 'Deck', -// // icon: , -// icon: , -// to: '/deckbuilder', -// requiresLogin: false, -// }, -// { -// name: 'Collection', -// icon: , -// to: '/collection', -// requiresLogin: !isLoggedIn, -// }, -// { -// name: 'Store', -// icon: , -// to: '/store', -// requiresLogin: !isLoggedIn, -// }, -// { -// name: 'Cart', -// icon: ( -// -// -// -// ), -// to: '/cart', -// requiresLogin: !isLoggedIn, -// }, -// { -// name: 'Profile', -// icon: , -// to: '/profile', -// requiresLogin: isLoggedIn, -// }, -// // { -// // name: 'Login', -// // icon: , -// // to: '/login', -// // requiresLogin: false, -// // }, -// ]; - -// if (isLoggedIn) { -// return baseMenuItems.map((item) => ({ -// ...item, -// requiresLogin: false, -// })); -// } - -// // Processed menu items -// const processedMenuItems = isLoggedIn -// ? baseMenuItems.map((item) => ({ ...item, requiresLogin: false })) -// : baseMenuItems; - -// return { -// baseMenuItems, -// menuItems: processedMenuItems, -// }; -// } catch (error) { -// console.error('An error occurred in getMenuItemsData:', error); -// return { -// baseMenuItems: [], -// menuItems: [], -// }; -// } -// }; - -// export default getMenuItemsData; diff --git a/src/assets/currentlyUnused/schemas.jsx b/src/assets/currentlyUnused/schemas.jsx deleted file mode 100644 index 1f079a9..0000000 --- a/src/assets/currentlyUnused/schemas.jsx +++ /dev/null @@ -1,71 +0,0 @@ -// import { z } from 'zod'; - -// const loginSchema = z.object({ -// username: z.string().min(1, 'Username is required'), -// password: z.string().min(1, 'Password is required'), -// }); -// const signupSchema = z.object({ -// firstName: z.string().min(1, 'First Name is required'), -// lastName: z.string().min(1, 'Last Name is required'), -// email: z.string().email('Invalid email format'), -// }); -// const authFormSchema = signupSchema.merge(loginSchema); -// const addDeckSchema = z.object({ -// name: z.string().min(1, 'Deck Name is required'), -// description: z.string().min(1, 'Description is required').optional(), -// }); -// const updateDeckSchema = z.object({ -// tags: z.array(z.string()).optional(), // Assuming tags can be optional -// color: z.enum([ -// 'red', -// 'blue', -// 'green', -// 'yellow', -// 'purple', -// 'pink', -// 'orange', -// 'teal', -// ]), -// }); -// const deckFormSchema = addDeckSchema.merge(updateDeckSchema); -// const collectionFormSchema = z.object({ -// name: z.string().min(1, 'Collection Name is required'), -// description: z.string().min(1, 'Collection Description is required'), -// }); -// const searchFormSchema = z.object({ -// searchTerm: z.string().optional(), -// }); -// const statisticsSchema = z.object({ -// selectedStatistic: z -// .enum([ -// 'highPoint', -// 'lowPoint', -// 'twentyFourHourAverage', -// 'average', -// 'volume', -// 'volatility', -// ]) -// .optional(), -// }); -// const themeFormSchema = z.object({ -// theme: z.enum(['light', 'dark', 'system']).optional(), -// }); -// const timeRangeFormSchema = z.object({ -// timeRange: z -// .enum(['24hr', '7d', '30d', '90d', '180d', '270d', '365d']) -// .optional(), -// }); - -// export { -// loginSchema, -// signupSchema, -// authFormSchema, -// addDeckSchema, -// updateDeckSchema, -// deckFormSchema, -// collectionFormSchema, -// searchFormSchema, -// statisticsSchema, -// themeFormSchema, -// timeRangeFormSchema, -// }; diff --git a/src/assets/currentlyUnused/scss/_theme-vars.modules.scss b/src/assets/currentlyUnused/scss/_theme-vars.modules.scss deleted file mode 100644 index 4b2edc1..0000000 --- a/src/assets/currentlyUnused/scss/_theme-vars.modules.scss +++ /dev/null @@ -1,157 +0,0 @@ -// // paper & background -// $paper: #ffffff; - -// // primary -// $primaryLight: #eef2f6; -// $primaryMain: #2196f3; -// $primaryDark: #1e88e5; -// $primary200: #90caf9; -// $primary800: #1565c0; - -// // secondary -// $secondaryLight: #ede7f6; -// $secondaryMain: #673ab7; -// $secondaryDark: #5e35b1; -// $secondary200: #b39ddb; -// $secondary800: #4527a0; - -// // success Colors -// $successLight: #b9f6ca; -// $success200: #69f0ae; -// $successMain: #00e676; -// $successDark: #00c853; - -// // error -// $errorLight: #ef9a9a; -// $errorMain: #f44336; -// $errorDark: #c62828; - -// // orange -// $orangeLight: #fbe9e7; -// $orangeMain: #ffab91; -// $orangeDark: #d84315; - -// // warning -// $warningLight: #fff8e1; -// $warningMain: #ffe57f; -// $warningDark: #ffc107; - -// // grey -// $grey50: #f8fafc; -// $grey100: #eef2f6; -// $grey200: #e3e8ef; -// $grey300: #cdd5df; -// $grey500: #697586; -// $grey600: #4b5565; -// $grey700: #364152; -// $grey900: #121926; - -// // ==============================|| DARK THEME VARIANTS ||============================== // - -// // paper & background -// $darkBackground: #1a223f; // level 3 -// $darkPaper: #111936; // level 4 - -// // dark 800 & 900 -// $darkLevel1: #29314f; // level 1 -// $darkLevel2: #212946; // level 2 - -// // primary dark -// $darkPrimaryLight: #eef2f6; -// $darkPrimaryMain: #2196f3; -// $darkPrimaryDark: #1e88e5; -// $darkPrimary200: #90caf9; -// $darkPrimary800: #1565c0; - -// // secondary dark -// $darkSecondaryLight: #d1c4e9; -// $darkSecondaryMain: #7c4dff; -// $darkSecondaryDark: #651fff; -// $darkSecondary200: #b39ddb; -// $darkSecondary800: #6200ea; - -// // text variants -// $darkTextTitle: #d7dcec; -// $darkTextPrimary: #bdc8f0; -// $darkTextSecondary: #8492c4; - -// // ==============================|| JAVASCRIPT ||============================== // - -// :export { -// // paper & background -// paper: $paper; - -// // primary -// primaryLight: $primaryLight; -// primary200: $primary200; -// primaryMain: $primaryMain; -// primaryDark: $primaryDark; -// primary800: $primary800; - -// // secondary -// secondaryLight: $secondaryLight; -// secondary200: $secondary200; -// secondaryMain: $secondaryMain; -// secondaryDark: $secondaryDark; -// secondary800: $secondary800; - -// // success -// successLight: $successLight; -// success200: $success200; -// successMain: $successMain; -// successDark: $successDark; - -// // error -// errorLight: $errorLight; -// errorMain: $errorMain; -// errorDark: $errorDark; - -// // orange -// orangeLight: $orangeLight; -// orangeMain: $orangeMain; -// orangeDark: $orangeDark; - -// // warning -// warningLight: $warningLight; -// warningMain: $warningMain; -// warningDark: $warningDark; - -// // grey -// grey50: $grey50; -// grey100: $grey100; -// grey200: $grey200; -// grey300: $grey300; -// grey500: $grey500; -// grey600: $grey600; -// grey700: $grey700; -// grey900: $grey900; - -// // ==============================|| DARK THEME VARIANTS ||============================== // - -// // paper & background -// darkPaper: $darkPaper; -// darkBackground: $darkBackground; - -// // dark 800 & 900 -// darkLevel1: $darkLevel1; -// darkLevel2: $darkLevel2; - -// // text variants -// darkTextTitle: $darkTextTitle; -// darkTextPrimary: $darkTextPrimary; -// darkTextSecondary: $darkTextSecondary; - -// // primary dark -// darkPrimaryLight: $darkPrimaryLight; -// darkPrimaryMain: $darkPrimaryMain; -// darkPrimaryDark: $darkPrimaryDark; -// darkPrimary200: $darkPrimary200; -// darkPrimary800: $darkPrimary800; - -// // secondary dark -// darkSecondaryLight: $darkSecondaryLight; -// darkSecondaryMain: $darkSecondaryMain; -// darkSecondaryDark: $darkSecondaryDark; -// darkSecondary200: $darkSecondary200; -// darkSecondary800: $darkSecondary800; -// } diff --git a/src/assets/currentlyUnused/statList.jsx b/src/assets/currentlyUnused/statList.jsx deleted file mode 100644 index 401f5ad..0000000 --- a/src/assets/currentlyUnused/statList.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import useSelectedCollection from '../../context/MAIN_CONTEXT/CollectionContext/useSelectedCollection'; - -const data = [ - { - label: '', - value: null, - }, -]; - -const DynamicCollectionDestructuring = () => { - const { allCollections, selectedCollection } = useSelectedCollection(); - const { totalPrice, totalQuantity, collectionStatistics } = - selectedCollection; - const { avgPrice, highPoint, lowPoint, percentageChange, priceChange } = - collectionStatistics; - return ( -
-
{totalPrice}
-
{totalQuantity}
-
{avgPrice}
-
{highPoint}
-
{lowPoint}
-
{percentageChange}
-
{priceChange}
-
- ); -}; - -export default DynamicCollectionDestructuring; diff --git a/src/assets/currentlyUnused/useAuthDialog.jsx b/src/assets/currentlyUnused/useAuthDialog.jsx deleted file mode 100644 index c9f8805..0000000 --- a/src/assets/currentlyUnused/useAuthDialog.jsx +++ /dev/null @@ -1,26 +0,0 @@ -// import { useCallback, useState } from 'react'; -// import { useAuthContext } from '../MAIN_CONTEXT/AuthContext/authContext'; -// import useDialog from './useDialog'; -// import useManageCookies from './useManageCookies'; - -// const useAuthDialog = () => { -// const { logout } = useAuthContext(); -// const { addCookie, getCookie, deleteCookie } = useManageCookies(); -// const { isLoggedIn } = getCookie(['isLoggedIn']); -// console.log(isLoggedIn); -// const { openDialog, closeDialog } = useDialog(); - -// // Toggle login dialog based on authentication status -// const toggleLoginDialog = useCallback(() => { -// if (!isLoggedIn) { -// openDialog('Login'); -// } else { -// logout(); -// closeDialog('Login'); -// } -// }, [isLoggedIn, openDialog, closeDialog, logout]); - -// return { toggleLoginDialog, isLoggedIn, logout }; -// }; - -// export default useAuthDialog; diff --git a/src/assets/currentlyUnused/useCollectionStats.jsx b/src/assets/currentlyUnused/useCollectionStats.jsx deleted file mode 100644 index d4de332..0000000 --- a/src/assets/currentlyUnused/useCollectionStats.jsx +++ /dev/null @@ -1,84 +0,0 @@ -// import { useEffect, useState } from 'react'; -// import useSelectedCollection from './useSelectedCollection'; - -// const useCollectionStats = () => { -// const { allCollections } = useSelectedCollection(); -// const [collectionStats, setCollectionStats] = useState({}); -// const [metaStats, setMetaStats] = useState({}); -// const totals = []; -// const quantities = []; -// useEffect(() => { -// const stats = {}; -// for (const collection of allCollections) { -// const { -// totalPrice, -// totalQuantity, // Fixed typo from 'toalQuantity' to 'totalQuantity' -// nivoChartData, -// newNivoChartData, -// nivoTestData, -// averagedChartData, -// chartData, -// muiChartData, -// name, -// descriptions, -// lastUpdated, -// collectionPriceHistory, -// dailyCollectionPriceHistory, -// createdAt, -// collectionStatistics, -// id, // Assuming 'id' is available in 'collection' for mapping -// } = collection; - -// const { avgPrice, highPoint, lowPoint, percentageChange, priceChange } = -// collectionStatistics; - -// totals.push(totalPrice); -// quantities.push(totalQuantity); - -// stats[collection.id] = { -// totalPrice, -// totalQuantity, -// nivoChartData, -// newNivoChartData, -// nivoTestData, -// averagedChartData, -// chartData, -// muiChartData, -// name, -// descriptions, -// lastUpdated, -// collectionPriceHistory, -// dailyCollectionPriceHistory, -// createdAt, -// avgPrice, -// highPoint, -// lowPoint, -// percentageChange, -// priceChange, -// collectionStatistics, -// }; -// } - -// setCollectionStats(stats); -// console.log('COLLECTION STATS RECORDED: ', stats); -// }, []); // Dependency array ensures this effect runs only when allCollections changes - -// const calculateAndSetMetaStats = () => { -// const metaStats = {}; -// metaStats.totalValue = totals.reduce((acc, total) => acc + total, 0); -// metaStats.totalQuantity = quantities.reduce( -// (acc, quantity) => acc + quantity, -// 0 -// ); -// setMetaStats(metaStats); -// console.log('META STATS RECORDED: ', metaStats); -// return metaStats; -// }; - -// useEffect(() => { -// calculateAndSetMetaStats(); -// }, []); -// return { collectionStats, metaStats }; -// }; - -// export default useCollectionStats; diff --git a/src/assets/currentlyUnused/useResponsiveStyles.jsx b/src/assets/currentlyUnused/useResponsiveStyles.jsx deleted file mode 100644 index 7574343..0000000 --- a/src/assets/currentlyUnused/useResponsiveStyles.jsx +++ /dev/null @@ -1,110 +0,0 @@ -// import { useMediaQuery } from '@mui/material'; -// import DeckOfCardsIcon from '../../../layout/REUSABLE_COMPONENTS/icons/DeckOfCardsIcon'; -// import MoneyIcon from '../../../layout/REUSABLE_COMPONENTS/icons/MoneyIcon'; -// import ChartsIcon from '../../../layout/REUSABLE_COMPONENTS/icons/ChartsIcon'; - -// const useResponsiveStyles = (theme) => { -// const isXSmall = useMediaQuery(theme.breakpoints.down('xs')); -// const isSmall = useMediaQuery(theme.breakpoints.down('sm')); -// const isSmallMedium = useMediaQuery(theme.breakpoints.up('sm')); -// const isMedium = useMediaQuery(theme.breakpoints.down('md')); -// const isMediumLarge = useMediaQuery(theme.breakpoints.up('md')); -// const isMediumExtraLarge = useMediaQuery(theme.breakpoints.up('md')); -// const isLarge = useMediaQuery(theme.breakpoints.up('lg')); - -// const getTypographyVariant = () => { -// if (isXSmall) return 'h4'; -// if (isSmall) return 'h3'; -// if (isMedium) return 'h2'; -// return 'h2'; -// }; -// const getButtonTypographyVariant = () => { -// if (isXSmall) return 'body1'; -// if (isSmall) return 'body2'; -// if (isMedium) return 'body3'; -// if (isLarge) return 'body3'; -// return 'body1'; -// }; -// const getButtonTypographyVariant2 = () => { -// if (isXSmall) return 'h6'; -// if (isSmall) return 'h6'; -// if (isMedium) return 'h6'; -// if (isLarge) return 'body1'; -// return 'body1'; -// }; -// const getIconForTitle = (title) => { -// switch (title) { -// case 'Deck Builder': -// return ; -// case 'Collection Tracker': -// return ; -// case 'Store': -// return ; -// default: -// return null; -// } -// }; - -// const getProductGridContainerStyle = (theme) => ({ -// maxWidth: 'lg', -// maxHeight: '100%', -// display: 'flex', -// flexDirection: 'column', -// marginTop: theme.spacing(4), -// }); - -// const getStyledGridStyle = (theme) => ({ -// '@media (maxWidth:599.95px)': { -// margin: theme.spacing(0.5), -// }, -// '@media (minWidth:600px) and (maxWidth:1199.95px)': { -// margin: theme.spacing(1), -// }, -// '@media (minWidth:1200px)': { -// margin: theme.spacing(2), -// }, -// '@media (minWidth:1800px)': { -// margin: theme.spacing(2), -// }, -// }); - -// const getStyledGridItemStyle = (theme) => ({ -// display: 'flex', -// flexDirection: 'column', -// alignItems: 'stretch', -// // Correct media query syntax in JS object -// '@media (maxWidth:599.95px)': { -// padding: theme.spacing(1), -// }, -// '@media (minWidth:600px)': { -// padding: theme.spacing(0.25), -// }, -// '@media (minWidth:1200px)': { -// padding: theme.spacing(1), -// }, -// '@media (minWidth:1800px)': { -// padding: theme.spacing(2), -// }, -// }); - -// return { -// isMobile: isSmall, -// isXSmall, -// isSmall, -// isSmallMedium, -// isMedium, -// isMediumLarge, -// isMediumExtraLarge, -// isLarge, -// getTypographyVariant, -// getButtonTypographyVariant, -// getButtonTypographyVariant2, -// getIconForTitle, -// getProductGridContainerStyle, -// // getHeaderStyle, -// getStyledGridStyle, -// getStyledGridItemStyle, -// }; -// }; - -// export default useResponsiveStyles; diff --git a/src/assets/currentlyUnused/useSelectCollectionListStyles.jsx b/src/assets/currentlyUnused/useSelectCollectionListStyles.jsx deleted file mode 100644 index 5c6a0e6..0000000 --- a/src/assets/currentlyUnused/useSelectCollectionListStyles.jsx +++ /dev/null @@ -1,217 +0,0 @@ -// import { Button, Card, Grid, ListItem } from '@mui/material'; -// import styled from 'styled-components'; - -// export const ListItemText = styled()(({ theme }) => ({ -// flex: 1, -// textAlign: 'left', -// marginLeft: theme.spacing(3), -// })); - -// export const LoadingContainer = styled()(({ theme }) => ({ -// display: 'flex', -// justifyContent: 'center', -// alignItems: 'center', -// height: '100vh', -// })); - -// export const EditButton = styled(Button)(({ theme }) => ({ -// marginLeft: theme.spacing(2), -// backgroundColor: theme.palette.greenAccent.light, -// color: '#ffffff', -// '&:hover': { -// backgroundColor: theme.palette.greenAccent.default, -// }, -// })); - -// export const CollectionListItem = styled('div')(({ theme }) => ({ -// backgroundColor: theme.palette.greenAccent.contrastText, -// transition: theme.transitions.create(['background-color', 'box-shadow']), -// '&:hover': { -// backgroundColor: theme.palette.grey[100], -// boxShadow: theme.shadows[1], -// }, -// padding: theme.spacing(2), -// })); - -// export const ListItemSkeleton = styled(ListItem)(({ theme }) => ({ -// // margin: theme.spacing(1, 0), -// // borderRadius: theme.shape.borderRadius, -// margin: theme.spacing(1), -// width: '100%', -// minWidth: 200, -// flexGrow: 1, -// transition: '0.3s', -// boxShadow: '0 8px 40px -12px rgba(0,0,0,0.3)', -// '&:hover': { -// boxShadow: '0 16px 70px -12.125px rgba(0,0,0,0.3)', -// }, -// })); - -// export const SkeletonCard = styled(Card)(({ theme }) => ({ -// width: '100%', -// borderRadius: theme.shape.borderRadius, -// // eslint-disable-next-line max-len -// background: `linear-gradient(to right, ${theme.palette.greenAccent.contrastText} 40%, ${theme.palette.grey[300]} 70%, ${theme.palette.greenAccent.contrastText} 100%)`, -// animation: '$shimmer 2s infinite', -// })); - -// export const ComponentListItem = styled(ListItem)(({ theme }) => ({ -// position: 'relative', -// display: 'flex', -// alignItems: 'center', -// justifyContent: 'space-between', -// padding: theme.spacing(1), -// backgroundColor: '#ffffff', -// borderRadius: '8px', -// width: '100%', -// marginBottom: theme.spacing(1), -// boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)', -// [theme.breakpoints.up('sm')]: { -// flexDirection: 'row', -// padding: theme.spacing(2), -// marginBottom: theme.spacing(2), -// }, -// })); - -// export const GridItem = styled(Grid)(({ theme }) => ({ -// display: 'flex', -// flexDirection: 'column', -// alignItems: 'flex-start', -// width: '50%', -// justifyContent: 'center', -// padding: theme.spacing(0.5), -// [theme.breakpoints.up('sm')]: { -// width: '100%', -// padding: theme.spacing(1), -// }, -// })); - -// export const GridItemText = styled('span')(({ theme }) => ({ -// fontWeight: 'bold', -// fontSize: '0.8rem', -// [theme.breakpoints.up('sm')]: { -// fontSize: '1rem', -// }, -// })); - -// export const PositivePerformance = styled('div')({ -// color: 'green', -// }); - -// export const NegativePerformance = styled('div')({ -// color: 'red', -// }); - -// export const MenuButton = styled(Button)({ -// position: 'absolute', -// top: 0, -// right: 0, -// // Adjust padding and margin as needed -// }); - -// // import { makeStyles } from '@mui/material'; - -// // const useSelectCollectionListStyles = () => { -// // const useStyles = makeStyles((theme) => ({ -// // listItemText: { -// // flex: 1, -// // textAlign: 'left', -// // marginLeft: theme.spacing(3), -// // }, -// // loadingContainer: { -// // display: 'flex', -// // justifyContent: 'center', -// // alignItems: 'center', -// // height: '100vh', -// // }, -// // editButton: { -// // marginLeft: theme.spacing(2), -// // backgroundColor: theme.palette.greenAccent.light, -// // color: '#ffffff', -// // '&:hover': { -// // backgroundColor: theme.palette.greenAccent.default, -// // }, -// // }, -// // collectionListItem: { -// // backgroundColor: theme.palette.greenAccent.contrastText, -// // transition: theme.transitions.create(['background-color', 'box-shadow']), -// // '&:hover': { -// // backgroundColor: theme.palette.grey[100], -// // boxShadow: theme.shadows[1], -// // }, -// // padding: theme.spacing(2), -// // }, -// // listItemSkeleton: { -// // margin: theme.spacing(1, 0), -// // borderRadius: theme.shape.borderRadius, -// // }, -// // skeletonCard: { -// // width: '100%', -// // borderRadius: theme.shape.borderRadius, -// // // For shimmer effect -// // // eslint-disable-next-line max-len -// // background: `linear-gradient(to right, ${theme.palette.greenAccent.contrastText} 40%, ${theme.palette.grey[300]} 70%, ${theme.palette.greenAccent.contrastText} 100%)`, -// // animation: '$shimmer 2s infinite', -// // }, -// // '@keyframes shimmer': { -// // '0%': { -// // backgroundPosition: '-200%', -// // }, -// // '100%': { -// // backgroundPosition: '200%', -// // }, -// // }, -// // listItem: { -// // position: 'relative', // Added to position the menu button absolutely -// // display: 'flex', -// // alignItems: 'center', -// // justifyContent: 'space-between', -// // padding: theme.spacing(1), -// // backgroundColor: '#ffffff', -// // borderRadius: '8px', -// // width: '100%', -// // marginBottom: theme.spacing(1), -// // boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)', -// // [theme.breakpoints.up('sm')]: { -// // flexDirection: 'row', -// // padding: theme.spacing(2), -// // marginBottom: theme.spacing(2), -// // }, -// // }, -// // gridItem: { -// // display: 'flex', -// // flexDirection: 'column', -// // alignItems: 'flex-start', -// // width: '50%', // Half width for xs breakpoint -// // justifyContent: 'center', -// // padding: theme.spacing(0.5), // Reduced padding -// // [theme.breakpoints.up('sm')]: { -// // width: '100%', // Full width for larger screens -// // padding: theme.spacing(1), -// // }, -// // }, -// // gridItemText: { -// // fontWeight: 'bold', -// // fontSize: '0.8rem', // Smaller text size -// // [theme.breakpoints.up('sm')]: { -// // fontSize: '1rem', // Larger text size for larger screens -// // }, -// // }, -// // positivePerformance: { -// // color: 'green', -// // }, -// // negativePerformance: { -// // color: 'red', -// // }, -// // menuButton: { -// // position: 'absolute', -// // top: 0, -// // right: 0, -// // // Adjust padding and margin as needed -// // }, -// // })); - -// // return useStyles(); -// // }; - -// // export default useSelectCollectionListStyles; diff --git a/src/assets/currentlyUnused/useSnackbarManager.jsx b/src/assets/currentlyUnused/useSnackbarManager.jsx deleted file mode 100644 index 66aeb19..0000000 --- a/src/assets/currentlyUnused/useSnackbarManager.jsx +++ /dev/null @@ -1,59 +0,0 @@ -// // useSnackbarManager.js -// import { useSnackbar } from 'notistack'; - -// export default function useSnackbarManager() { -// const { enqueueSnackbar } = useSnackbar(); - -// const showSuccess = (message) => { -// enqueueSnackbar(message, { -// variant: 'success', -// anchorOrigin: { -// vertical: 'top', -// horizontal: 'right', -// }, -// }); -// }; - -// const showInfo = (message) => { -// enqueueSnackbar(message, { -// variant: 'info', -// anchorOrigin: { -// vertical: 'top', -// horizontal: 'right', -// }, -// }); -// }; - -// const showWarning = (message) => { -// enqueueSnackbar(message, { -// variant: 'warning', -// anchorOrigin: { -// vertical: 'top', -// horizontal: 'right', -// }, -// }); -// }; - -// const showError = (message) => { -// enqueueSnackbar(message, { -// variant: 'error', -// anchorOrigin: { -// vertical: 'top', -// horizontal: 'right', -// }, -// }); -// }; - -// // More examples: -// const showCustom = (message, variant = 'default') => { -// enqueueSnackbar(message, { -// variant: variant, // could be default, error, success, warning, info, etc. -// anchorOrigin: { -// vertical: 'bottom', -// horizontal: 'left', -// }, -// }); -// }; - -// return { showSuccess, showInfo, showWarning, showError, showCustom }; -// } diff --git a/src/assets/currentlyUnused/useTimeRange.jsx b/src/assets/currentlyUnused/useTimeRange.jsx deleted file mode 100644 index 7778df4..0000000 --- a/src/assets/currentlyUnused/useTimeRange.jsx +++ /dev/null @@ -1,91 +0,0 @@ -// // import { useMemo, useCallback } from 'react'; -// // import { useFormContext } from '../../../context'; -// // import useSelectedCollection from '../../../context/MAIN_CONTEXT/CollectionContext/useSelectedCollection'; -// // import useSubmitHandler from './useSubmitHandler'; -// // import useRCFormHook from './useRCFormHook'; -// // import { zodSchemas } from '../formsConfig'; - -// // function useTimeRange() { -// // const methods = useRCFormHook('timeRange', zodSchemas, {}); -// // const { selectedCollection } = useSelectedCollection(); -// // if (!selectedCollection) { -// // return console.error('No collection selected'); -// // } -// // const averagedChartData = selectedCollection?.averagedChartData; -// // const statistics = selectedCollection?.collectionStatistics; -// // const themes = [ -// // { value: 'light', label: 'Light Theme' }, -// // { value: 'dark', label: 'Dark Theme' }, -// // { value: 'system', label: 'System Theme' }, -// // ]; -// // const selectedTimeRange = methods.watch('timeRange', '24hr'); -// // const timeRangeOptions = useMemo(() => { -// // return Object.entries(averagedChartData || {}).map(([key, value]) => { -// // return { -// // value: value?.id, -// // label: value?.name?.toUpperCase(), -// // }; -// // }); -// // }, [averagedChartData]); - -// // const handleTimeRangeSubmit = async (data) => { -// // console.log('Time Range Selected:', data.timeRange); -// // }; -// // const successTitle = 'Success'; -// // const successDescription = 'Now viewing chart data for {timeRange}'; -// // const errorDescription = 'Failed to view chart data for {timeRange}'; -// // const onFormSubmit = useSubmitHandler( -// // handleTimeRangeSubmit, -// // successTitle, -// // successDescription, -// // errorDescription -// // ); -// // return { -// // timeRangeOptions, -// // onFormSubmit, -// // control: methods.control, -// // errors: methods.formState.errors, -// // selectedTimeRange, // Including the selected time range in the hook's return value -// // }; -// // } - -// // export default useTimeRange; -// import { useEffect, useState } from 'react'; -// import { useWatch } from 'react-hook-form'; - -// const useTimeRange = (control, selectedCollection) => { -// const [selectedChartData, setSelectedChartData] = useState(null); -// const [updatedRangeData, setUpdatedRangeData] = useState(null); -// const selectedTimeRange = useWatch({ -// control, -// name: 'timeRange', // Adjust according to your form field's name -// defaultValue: '24hr', // Default value -// }); -// const logTimeRange = (value) => { -// console.log(`Time Range changed to: ${value.timeRange}`); -// }; - -// // Update chart data based on the selected time range -// useEffect(() => { -// if (selectedCollection && selectedTimeRange) { -// console.log(selectedTimeRange); -// console.log('Current Collection:', selectedCollection); -// const newChartData = -// selectedCollection.averagedChartData?.[selectedTimeRange]; -// console.log(newChartData); -// setSelectedChartData(newChartData || null); -// setUpdatedRangeData(selectedTimeRange); -// } -// }, [selectedTimeRange, selectedCollection]); - -// return { -// selectedTimeRange, -// selectedChartData, -// logTimeRange, -// updatedRangeData, -// setSelectedChartData, -// setUpdatedRangeData, -// }; -// }; - -// export default useTimeRange; diff --git a/src/assets/currentlyUnused/utils/FormFactory.jsx b/src/assets/currentlyUnused/utils/FormFactory.jsx deleted file mode 100644 index 069a52f..0000000 --- a/src/assets/currentlyUnused/utils/FormFactory.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { Grid } from '@mui/material'; -import FormInputText from './FormInputText'; -import FormInputDate from './FormInputDate'; - -export const FormFactory = ({ field, control }) => { - const { componentType, grid, ...fieldProps } = field; - - const renderFieldComponent = () => { - switch (componentType) { - case 'text': - return ; - case 'date': - return ; - default: - return null; // Default case if the type is unknown - } - }; - - return ( - - {renderFieldComponent()} - - ); -}; diff --git a/src/components/forms/search/SearchComponent.jsx b/src/components/forms/search/SearchComponent.jsx index b3cbf8b..0ee5436 100644 --- a/src/components/forms/search/SearchComponent.jsx +++ b/src/components/forms/search/SearchComponent.jsx @@ -13,7 +13,6 @@ import { } from '@mui/material'; import SearchResults from './SearchResults'; import MDBox from '../../../layout/REUSABLE_COMPONENTS/MDBOX'; -import SearchForm from '../../../assets/currentlyUnused/SearchForm'; import MDTypography from '../../../layout/REUSABLE_COMPONENTS/MDTYPOGRAPHY/MDTypography'; import SettingsIcon from '@mui/icons-material/Settings'; import { useMode } from '../../../context'; diff --git a/src/pages/LoginPage.jsx b/src/pages/LoginPage.jsx index ea623ce..529362d 100644 --- a/src/pages/LoginPage.jsx +++ b/src/pages/LoginPage.jsx @@ -8,7 +8,6 @@ import Grid from '@mui/material/Grid'; import LockOutlinedIcon from '@mui/icons-material/LockOutlined'; import Typography from '@mui/material/Typography'; import { createTheme, ThemeProvider } from '@mui/material/styles'; -import LoginForm from '../assets/currentlyUnused/LoginForm'; import { useMode } from '../context'; import useManageCookies from '../context/hooks/useManageCookies'; @@ -74,7 +73,7 @@ export default function LoginPage() { Sign in - + {/* */}