Skip to content

Commit

Permalink
feat: routes were replaced by absolute routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Franqsanz committed Jan 16, 2024
1 parent 065563a commit 4e63c63
Show file tree
Hide file tree
Showing 46 changed files with 164 additions and 126 deletions.
14 changes: 7 additions & 7 deletions src/components/AllBooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
} from '@chakra-ui/react';
import { useInView } from 'react-intersection-observer';

import { CardType } from './types';
import { useBooksPaginate } from '../hooks/querys';
import { MySimpleGrid } from './MySimpleGrid';
import { Card } from './cards/Card';
import { Aside } from './Aside';
import { SkeletonAllBooks } from './skeletons/SkeletonABooks';
import ResultLength from './ResultLength';
import { CardType } from '@components/types';
import { useBooksPaginate } from '@hooks/querys';
import { MySimpleGrid } from '@components/MySimpleGrid';
import { Card } from '@components/cards/Card';
import { Aside } from '@components/Aside';
import { SkeletonAllBooks } from '@components/skeletons/SkeletonABooks';
import ResultLength from '@components/ResultLength';

export function AllBooks() {
const { ref, inView } = useInView();
Expand Down
2 changes: 1 addition & 1 deletion src/components/BooksSection.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Suspense } from 'react';
import { Box, Center, Flex, Divider, Spinner } from '@chakra-ui/react';

import { BooksSectionType } from './types';
import { BooksSectionType } from '@components/types';

export function BooksSection({
title,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { NavLink } from 'react-router-dom';
import { Link } from '@chakra-ui/react';
import { BsTag } from 'react-icons/bs';

import { MyTag } from '../components/MyTag';
import { useAllFilterOptions } from '../hooks/querys';
import { MyTag } from '@components/MyTag';
import { useAllFilterOptions } from '@hooks/querys';

export default function Categories() {
const { data } = useAllFilterOptions();
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContainerTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Container, Box, useColorModeValue } from '@chakra-ui/react';

import { TitleType } from './types';
import { TitleType } from '@components/types';

export function ContainerTitle({ title }: TitleType) {
const bgContainer = useColorModeValue('green.50', 'green.900');
Expand Down
2 changes: 1 addition & 1 deletion src/components/FilterDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
Button,
} from '@chakra-ui/react';

import { DrawerType } from './types';
import { DrawerType } from '@components/types';

export function FilterDrawer({
isOpen,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Head.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Helmet } from 'react-helmet-async';

import { HeadType } from './types';
import { HeadType } from '@components/types';
// million-ignore
export function MainHead({ title, description, urlImage }: HeadType) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModalConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
useColorModeValue,
} from '@chakra-ui/react';

import { ModalOptionsAndConfirType } from './types';
import { ModalOptionsAndConfirType } from '@components/types';

export function ModalConfirmation({
isOpen,
Expand Down
4 changes: 3 additions & 1 deletion src/components/ModalOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import {
Flex,
} from '@chakra-ui/react';

import { ModalOptionsAndConfirType } from './types';
import { ModalOptionsAndConfirType } from '@components/types';

export function ModalOptions({
isOpen,
onClose,
onDeleteBook,
onEditBook,
}: ModalOptionsAndConfirType) {
return (
<>
Expand All @@ -36,6 +37,7 @@ export function ModalOptions({
<Button
fontWeight='normal'
fontSize='sm'
onClick={onEditBook}
_hover={{ color: 'none' }}
>
Editar
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModalShare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { FaCheckCircle } from 'react-icons/fa';
import { MdCopyAll } from 'react-icons/md';

import { ModalType } from './types';
import { ModalType } from '@components/types';

export function ModalShare({ shareUrl, data, isOpen, onClose }: ModalType) {
const bgInput = useColorModeValue('gray.200', 'gray.900');
Expand Down
2 changes: 1 addition & 1 deletion src/components/MyLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { NavLink } from 'react-router-dom';
import { Box, Link, useColorModeValue } from '@chakra-ui/react';

import { MyLinkType } from './types';
import { MyLinkType } from '@components/types';

export function MyLink({ data, href, external, index }: MyLinkType) {
const colorLinkCategory = useColorModeValue('green.800', 'green.400');
Expand Down
4 changes: 2 additions & 2 deletions src/components/MySliderCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useEffect, useRef, Suspense, lazy } from 'react';
import { Box, Button, Flex, useColorModeValue } from '@chakra-ui/react';
import { MdChevronLeft, MdChevronRight } from 'react-icons/md';

import { SkeletonTags } from './skeletons/SkeletonTags';
const Categories = lazy(() => import('../components/Categories'));
import { SkeletonTags } from '@components/skeletons/SkeletonTags';
const Categories = lazy(() => import('@components/Categories'));

export function MySliderCategories() {
const bgArrows = useColorModeValue('white', 'black');
Expand Down
2 changes: 1 addition & 1 deletion src/components/MyTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useColorModeValue,
} from '@chakra-ui/react';

import { TagType } from './types';
import { TagType } from '@components/types';

export function MyTag({
bg,
Expand Down
2 changes: 1 addition & 1 deletion src/components/PrivateRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Navigate } from 'react-router-dom';

import { useAuth } from '../store/AuthContext';
import { SkeletonAllBooks } from './skeletons/SkeletonABooks';
import { SkeletonAllBooks } from '@components/skeletons/SkeletonABooks';

export function PrivateRoute({ children }: { children: React.ReactNode }) {
const { currentUser, loading } = useAuth();
Expand Down
10 changes: 3 additions & 7 deletions src/components/cards/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ import {
import { BsTag } from 'react-icons/bs';
import { IoLanguageOutline } from 'react-icons/io5';

import { CardType } from '../types';
import { MyTag } from '../MyTag';
import {
handleImageLoad,
useHandleEnterKey,
isSpanish,
} from '../../utils/utils';
import { CardType } from '@components/types';
import { MyTag } from '@components/MyTag';
import { handleImageLoad, useHandleEnterKey, isSpanish } from '@utils/utils';

export function Card({
title,
Expand Down
10 changes: 5 additions & 5 deletions src/components/cards/MoreBooks.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';

import { RelatedCard } from './RelatedCard';
import { ContainerRCard } from './ContainerRCard';
import { CardType, RelatedBooksType } from '../types';
import { useMoreBooks } from '../../hooks/querys';
import { useRefetchLocation } from '../../hooks/useRefetchLocation';
import { RelatedCard } from '@components/cards/RelatedCard';
import { ContainerRCard } from '@components/cards/ContainerRCard';
import { CardType, RelatedBooksType } from '@components/types';
import { useMoreBooks } from '@hooks/querys';
import { useRefetchLocation } from '@hooks/useRefetchLocation';

export default function MoreBooks({ currentBookId }: RelatedBooksType) {
const { data, refetch } = useMoreBooks();
Expand Down
10 changes: 5 additions & 5 deletions src/components/cards/MoreBooksAuthors.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { Box, Text } from '@chakra-ui/react';

import { RelatedCard } from './RelatedCard';
import { ContainerRCard } from './ContainerRCard';
import { CardType, RelatedBooksType } from '../types';
import { useMoreBooksAuthors } from '../../hooks/querys';
import { useRefetchLocation } from '../../hooks/useRefetchLocation';
import { RelatedCard } from '@components/cards/RelatedCard';
import { ContainerRCard } from '@components/cards/ContainerRCard';
import { CardType, RelatedBooksType } from '@components/types';
import { useMoreBooksAuthors } from '@hooks/querys';
import { useRefetchLocation } from '@hooks/useRefetchLocation';

export default function MoreBooksAuthors({
currentBookId,
Expand Down
10 changes: 5 additions & 5 deletions src/components/cards/RelatedBooks.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { Box, Text } from '@chakra-ui/react';

import { RelatedCard } from './RelatedCard';
import { ContainerRCard } from './ContainerRCard';
import { CardType, RelatedBooksType } from '../types';
import { useRelatedBooks } from '../../hooks/querys';
import { useRefetchLocation } from '../../hooks/useRefetchLocation';
import { RelatedCard } from '@components/cards/RelatedCard';
import { ContainerRCard } from '@components/cards/ContainerRCard';
import { CardType, RelatedBooksType } from '@components/types';
import { useRelatedBooks } from '@hooks/querys';
import { useRefetchLocation } from '@hooks/useRefetchLocation';

export default function RelatedBooks({ currentBookId, id }: RelatedBooksType) {
const { data, refetch } = useRelatedBooks(id);
Expand Down
4 changes: 2 additions & 2 deletions src/components/cards/RelatedCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { NavLink } from 'react-router-dom';
import { Flex, Box, useColorModeValue, Link, Icon } from '@chakra-ui/react';
import { FiArrowRight } from 'react-icons/fi';

import { CardType } from '../types';
import { useHandleEnterKey } from '../../utils/utils';
import { CardType } from '@components/types';
import { useHandleEnterKey } from '@utils/utils';

export function RelatedCard({
title,
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/ModalCropper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@chakra-ui/react';
import { RiScissorsCutFill } from 'react-icons/ri';

import { ModalCroppType } from '../types';
import { ModalCroppType } from '@components/types';

export function ModalCropper({
children,
Expand Down
10 changes: 5 additions & 5 deletions src/components/forms/NewBook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import { AiOutlineCloudUpload } from 'react-icons/ai';
import { BiImageAdd } from 'react-icons/bi';

import { categories, format, languages } from '../../data/links';
import { BookType } from '../types';
import { useMutatePost } from '../../hooks/querys';
import { ModalCropper } from '../forms/ModalCropper';
import { generatePathUrl } from '../../utils/utils';
import { MyPopover } from '../MyPopover';
import { BookType } from '@components/types';
import { useMutatePost } from '@hooks/querys';
import { ModalCropper } from '@components/forms/ModalCropper';
import { generatePathUrl } from '@utils/utils';
import { MyPopover } from '@components/MyPopover';
import { useAuth } from '../../store/AuthContext';

const Cropper = lazy(() => import('react-cropper'));
Expand Down
4 changes: 2 additions & 2 deletions src/components/forms/filters/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
} from '@chakra-ui/react';
import { FiSearch } from 'react-icons/fi';

import { useAllFilterOptions } from '../../../hooks/querys';
import { SelectType } from '../../../components/types';
import { useAllFilterOptions } from '@hooks/querys';
import { SelectType } from '@components/types';

interface Props {
onClose: () => void;
Expand Down
6 changes: 3 additions & 3 deletions src/components/forms/filters/InputSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import {
import { CgOptions } from 'react-icons/cg';
import { FiSearch } from 'react-icons/fi';

import { useAllSearchBooks } from '../../../hooks/querys';
import { useDebounce } from '../../../hooks/useDebounce';
import { BookSearchResultsType } from '../../../components/types';
import { useAllSearchBooks } from '@hooks/querys';
import { useDebounce } from '@hooks/useDebounce';
import { BookSearchResultsType } from '@components/types';

function highlightText(text, query) {
const regex = new RegExp(`(${query.trim()})`, 'gi');
Expand Down
4 changes: 2 additions & 2 deletions src/components/forms/filters/ModalFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
ModalCloseButton,
} from '@chakra-ui/react';

import Filter from './Filter';
import { ModalType } from '../../types';
import Filter from '@components/forms/filters/Filter';
import { ModalType } from '@components/types';

export function ModalFilter({ isOpen, onClose }: ModalType) {
return (
Expand Down
6 changes: 3 additions & 3 deletions src/components/nav/DesktopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
} from '@chakra-ui/react';

import { navLink, accountLinks } from '../../data/links';
import { MenuProfile } from '../../components/nav/menu/MenuProfile';
import { InputSearch } from '../forms/filters/InputSearch';
import { ModalFilter } from '../forms/filters/ModalFilter';
import { MenuProfile } from '@components/nav/menu/MenuProfile';
import { InputSearch } from '@components/forms/filters/InputSearch';
import { ModalFilter } from '@components/forms/filters/ModalFilter';
import { useAuth } from '../../store/AuthContext';

export function DesktopNav() {
Expand Down
6 changes: 3 additions & 3 deletions src/components/nav/MobileNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import {
} from '@chakra-ui/react';

import { navLink, accountLinks } from '../../data/links';
import { InputSearch } from '../forms/filters/InputSearch';
import { ModalFilter } from '../forms/filters/ModalFilter';
import { MenuProfile } from '../../components/nav/menu/MenuProfile';
import { InputSearch } from '@components/forms/filters/InputSearch';
import { ModalFilter } from '@components/forms/filters/ModalFilter';
import { MenuProfile } from '@components/nav/menu/MenuProfile';
import { useAuth } from '../../store/AuthContext';

export function MobileNav() {
Expand Down
4 changes: 2 additions & 2 deletions src/components/nav/Nav.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { useBreakpointValue } from '@chakra-ui/react';

import { MobileNav } from './MobileNav';
import { DesktopNav } from './DesktopNav';
import { MobileNav } from '@components/nav/MobileNav';
import { DesktopNav } from '@components/nav/DesktopNav';

export function Nav() {
const isMobile = useBreakpointValue({ base: true, md: false });
Expand Down
4 changes: 2 additions & 2 deletions src/components/nav/menu/MenuProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
MenuDivider,
} from '@chakra-ui/react';

import { logOut } from '../../../services/firebase/auth';
import { MenuType } from '../../../components/types';
import { logOut } from '@services/firebase/auth';
import { MenuType } from '@components/types';

export function MenuProfile({ displayName, photoURL, uid }: MenuType) {
const navigate = useNavigate();
Expand Down
8 changes: 4 additions & 4 deletions src/components/skeletons/SkeletonABooks.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { Skeleton, SkeletonText, Flex, Box, Stack } from '@chakra-ui/react';

import { MySimpleGrid } from '../MySimpleGrid';
import { Aside } from '../Aside';
import { SkeletonTags } from './SkeletonTags';
import { SkeletonType } from '../types';
import { MySimpleGrid } from '@components/MySimpleGrid';
import { Aside } from '@components/Aside';
import { SkeletonTags } from '@components/skeletons/SkeletonTags';
import { SkeletonType } from '@components/types';

export function SkeletonAllBooks({ showTags = true }: SkeletonType) {
const Cards = Array.from({ length: 12 }, (_, index) => (
Expand Down
3 changes: 2 additions & 1 deletion src/components/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ interface SkeletonType {
}

interface ModalOptionsAndConfirType extends DisclosureType {
onDeleteBook: () => any | void;
onDeleteBook?: () => any | void;
onEditBook?: () => any | void;
name?: string;
isPending?: boolean;
}
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/querys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import {
getUserAndBooks,
updateBook,
deleteBook,
} from '../services/api';
import { logOut } from '../services/firebase/auth';
import { keys } from '../utils/utils';
import { BookType } from '../components/types';
} from '@services/api';
import { logOut } from '@services/firebase/auth';
import { keys } from '@utils/utils';
import { BookType } from '@components/types';

const queryClient = new QueryClient();

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useRefetchLocation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import { useLocation } from 'react-router-dom';

import { RelatedBooksType } from '../components/types';
import { RelatedBooksType } from '@components/types';

type Book = {
pathUrl: string;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { NavLink } from 'react-router-dom';
import { Link, Text, VStack, Box, Image, Flex, Icon } from '@chakra-ui/react';
import { FiArrowLeft } from 'react-icons/fi';

import { MainHead } from '../components/Head';
import { PageNotFound } from '../assets/assets';
import { MainHead } from '@components/Head';
import { PageNotFound } from '@assets/assets';

export function ErrorPage() {
return (
Expand Down
Loading

1 comment on commit 4e63c63

@vercel
Copy link

@vercel vercel bot commented on 4e63c63 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

xbu – ./

xbu-git-main-franqsanz.vercel.app
xbu-franqsanz.vercel.app
xbu.vercel.app

Please sign in to comment.