From 96bc101f9f4a46f7cb60645671e52c92a46fba04 Mon Sep 17 00:00:00 2001 From: franco sanchez Date: Mon, 16 Sep 2024 12:47:29 -0300 Subject: [PATCH] chore: minor changes --- src/components/skeletons/SkeletonABooks.tsx | 40 ++-------------- .../skeletons/SkeletonContainer.tsx | 46 ++++++++++++++++++ src/components/skeletons/SkeletonProfile.tsx | 47 ++----------------- src/pages/Favorites.tsx | 23 ++++++++- src/pages/profile/Profile.tsx | 15 +++++- src/store/useCategoryStore.ts | 1 + 6 files changed, 89 insertions(+), 83 deletions(-) create mode 100644 src/components/skeletons/SkeletonContainer.tsx diff --git a/src/components/skeletons/SkeletonABooks.tsx b/src/components/skeletons/SkeletonABooks.tsx index b19c5d2..7da9362 100644 --- a/src/components/skeletons/SkeletonABooks.tsx +++ b/src/components/skeletons/SkeletonABooks.tsx @@ -1,24 +1,11 @@ import React from 'react'; -import { Skeleton, SkeletonText, Flex, Box, Stack } from '@chakra-ui/react'; +import { Skeleton, Flex } from '@chakra-ui/react'; -import { MySimpleGrid } from '@components/ui/MySimpleGrid'; -import { MyContainer } from '@components/ui/MyContainer'; -import { Aside } from '@components/aside/Aside'; import { SkeletonTags } from '@components/skeletons/SkeletonTags'; import { SkeletonType } from '@components/types'; +import { SkeletonContainer } from '@components/skeletons/SkeletonContainer'; export function SkeletonAllBooks({ showTags = true }: SkeletonType) { - const Cards = Array.from({ length: 12 }, (_, index) => ( - - - - - )); - return ( <> {showTags && ( @@ -30,28 +17,7 @@ export function SkeletonAllBooks({ showTags = true }: SkeletonType) { )} - - - {Cards} - + ); } diff --git a/src/components/skeletons/SkeletonContainer.tsx b/src/components/skeletons/SkeletonContainer.tsx new file mode 100644 index 0000000..ff50d89 --- /dev/null +++ b/src/components/skeletons/SkeletonContainer.tsx @@ -0,0 +1,46 @@ +import React from 'react'; +import { Box, Skeleton, SkeletonText, Stack } from '@chakra-ui/react'; + +import { Aside } from '@components/aside/Aside'; +import { MyContainer } from '@components/ui/MyContainer'; +import { MySimpleGrid } from '@components/ui/MySimpleGrid'; + +export function SkeletonContainer() { + const Cards = Array.from({ length: 12 }, (_, index) => ( + + + + + )); + + return ( + <> + + + {Cards} + + + ); +} diff --git a/src/components/skeletons/SkeletonProfile.tsx b/src/components/skeletons/SkeletonProfile.tsx index b1981d9..5bbb299 100644 --- a/src/components/skeletons/SkeletonProfile.tsx +++ b/src/components/skeletons/SkeletonProfile.tsx @@ -1,29 +1,9 @@ import React from 'react'; -import { - Box, - Flex, - Skeleton, - SkeletonCircle, - SkeletonText, - Stack, -} from '@chakra-ui/react'; +import { Flex, Skeleton, SkeletonCircle } from '@chakra-ui/react'; -import { MyContainer } from '@components/ui/MyContainer'; -import { Aside } from '@components/aside/Aside'; -import { MySimpleGrid } from '@components/ui/MySimpleGrid'; +import { SkeletonContainer } from '@components/skeletons/SkeletonContainer'; export function SkeletonProfile() { - const Cards = Array.from({ length: 12 }, (_, index) => ( - - - - - )); - return ( <> @@ -31,28 +11,7 @@ export function SkeletonProfile() { - - - {Cards} - + ); } diff --git a/src/pages/Favorites.tsx b/src/pages/Favorites.tsx index fc42b94..4ae8d37 100644 --- a/src/pages/Favorites.tsx +++ b/src/pages/Favorites.tsx @@ -1,6 +1,14 @@ import React, { useEffect } from 'react'; import { NavLink, ScrollRestoration } from 'react-router-dom'; -import { Box, Flex, Icon, Image, Link, Spinner } from '@chakra-ui/react'; +import { + Box, + Flex, + Icon, + Image, + Link, + Spinner, + useColorModeValue, +} from '@chakra-ui/react'; import { useInView } from 'react-intersection-observer'; import { MdOutlineExplore } from 'react-icons/md'; @@ -19,6 +27,7 @@ import { SkeletonAllBooks } from '@components/skeletons/SkeletonABooks'; import { emptyFavorites } from '@assets/assets'; export default function Favorites() { + const grayColor = useColorModeValue('#E2E8F0', '#2D3748'); const { ref, inView } = useInView(); const { currentUser } = useAuth(); const uid = currentUser?.uid; @@ -136,6 +145,18 @@ export default function Favorites() { + + + {asideAndCardsUI} {fetchingNextPageUI} diff --git a/src/pages/profile/Profile.tsx b/src/pages/profile/Profile.tsx index c5724fc..6ee2525 100644 --- a/src/pages/profile/Profile.tsx +++ b/src/pages/profile/Profile.tsx @@ -31,6 +31,7 @@ import { MyContainer } from '@components/ui/MyContainer'; // import { logOut } from '../../services/firebase/auth'; export function Profile() { + const grayColor = useColorModeValue('#E2E8F0', '#2D3748'); const bgCover = useColorModeValue('gray.100', 'gray.700'); const { ref, inView } = useInView(); const getToken = window.localStorage.getItem('app_tk'); @@ -213,11 +214,23 @@ export function Profile() { {createdAt} - + PUBLICACIONES + + + {asideAndCardsUI} {fetchingNextPageUI} diff --git a/src/store/useCategoryStore.ts b/src/store/useCategoryStore.ts index ded04f1..2cd1fff 100644 --- a/src/store/useCategoryStore.ts +++ b/src/store/useCategoryStore.ts @@ -10,6 +10,7 @@ interface CategoryType { const disabledRoutes = [ '/explore', '/most-viewed', + '/my-favorites', '/books/filter/year/', '/books/filter/language/', ];