From 8c45e0cb1aa543bfa2938fe2a7713f4ca0baf35f Mon Sep 17 00:00:00 2001 From: Alperen Elhan Date: Mon, 10 Oct 2022 01:47:48 +0300 Subject: [PATCH] feat: implement add manga --- .eslintrc.json | 1 + package.json | 1 + public/cover-not-found.jpg | Bin 0 -> 26227 bytes src/components/addLibrary.tsx | 8 +- src/components/mangaCard.tsx | 17 +- src/components/mangaSearchResult.tsx | 142 +++++++++ src/components/newMangaCard.tsx | 444 ++++++++++++++++++++++++++- src/pages/library/[id].tsx | 48 +-- src/server/downloader/downloader.ts | 62 +--- src/server/trpc/router/manga.ts | 69 +++++ src/utils/mangal.ts | 151 +++++++++ yarn.lock | 5 + 12 files changed, 855 insertions(+), 93 deletions(-) create mode 100644 public/cover-not-found.jpg create mode 100644 src/components/mangaSearchResult.tsx create mode 100644 src/utils/mangal.ts diff --git a/.eslintrc.json b/.eslintrc.json index fa75147..80045cf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,6 +15,7 @@ "plugin:react/jsx-runtime" ], "rules": { + "no-nested-ternary": "off", "react/jsx-props-no-spreading": "off", "no-underscore-dangle": "off", "import/extensions": [ diff --git a/package.json b/package.json index 009123d..0635e49 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "@mantine/nprogress": "^5.5.4", "@mantine/spotlight": "^5.5.4", "@prisma/client": "4.4.0", + "@tabler/icons": "^1.101.0", "@tanstack/react-query": "^4.9.0", "@trpc/client": "^10.0.0-proxy-beta.13", "@trpc/next": "^10.0.0-proxy-beta.13", diff --git a/public/cover-not-found.jpg b/public/cover-not-found.jpg new file mode 100644 index 0000000000000000000000000000000000000000..378da68cee753a34a75d9c01aa7f1ee3bf82a589 GIT binary patch literal 26227 zcmeFZ2UHZzwm;fK&KX2<&S8KdO3p*hARv;H44wi;0UFfJjXlt_(mR5I`0D z11@GsP?Y?g>;V7{=K`<*0Kf!DAgBNYln@&g1RZ&_24(6?*%_2ME_F~qSpb3p;Dbjm za1#V&GVmAqN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^4LOJIO>{TYL_bg+zXtls^^-)i_F;pi}oy2bQOf)h8F@zC>yU6YX1O=+N;MC zd*7HsfVafBRZ#%pEbB69^oBH+#Wfy~0YOJhL>bbZD7Mc?0_Zaq)OtVyfICaYZ5CQ) z95EKuzVXhv?-D62;!tP=Gg_jp4@8EL5BStL16r#=3W&tL408}{j!N##aGcU&l8j($ z3orW~0nuP}uK6JsuBN3g)O{jbAwtmllW0hccsE+0;CPitt6eQG+4POns5l-aQYzO= zOZI&wR7mAkmxcaC_y*MgwS!B=I#fR=VC@nvz}BysMp$lv^Jay(@XANZ3gM!c`ntXo*=c=L=69D6H!5?hTx7hoQwHjpRZ z=PYXI-0Xj*0@Z!R1bU*gvGaRBsJ)n?Soa9Ru*iOtKpTbT{<}f|+%Gj@fZEqW`uNMO z5H3dV*{BQ9T~!A$9&mcFCQEIO!AstF_> ztEH4j`7IhUuLa&AY3bAz{{X~zF`NV*&}}7o++Sh<&IIf~>E|pDcBEI!$`Q3Q(1*$+ z#csB|2>b>eg+tLHCt%Mc9_%tw&7D!~5hB+*a$DN`o}X*dV}X-wnw6g@vLjO;Qp5aI4^S1H+VeYU6s zmqs)H01CD%&IO?`T-!tFMQ+f%psKzSA_pwJ8~K;YFt}cGVUJ^F>|XkiOQ)xY?4{-i zoU4!WUF;(4pwCij(NYS-3k_p!AO4r{(-7Vd&FX(^-J)fAG_RtApMs zfE)FnW(_GRTY1-SFf!s>IA3r;M)-fQ$`K~uFWihHV!eQZkYEqHf8t-<=OtFO?ePh# z2`<7{q6tNXgGFDf3l_iT@Hh8dCZ2eLQ79b;tYks1eS@jwgQb2FV%3b)CO7e*0jl#V zZ2`7Xb;&i&pV5!OHMF)i=xHhSi>Q%x;j=3ut4 zL$>s zF;?2Y+_pE9KcxZ1h4-9IR60u E**x`BhyVZp literal 0 HcmV?d00001 diff --git a/src/components/addLibrary.tsx b/src/components/addLibrary.tsx index 73b6a4d..bb15a14 100644 --- a/src/components/addLibrary.tsx +++ b/src/components/addLibrary.tsx @@ -2,9 +2,9 @@ import { Box, Button, Code, LoadingOverlay, Text, TextInput } from '@mantine/cor import { useForm } from '@mantine/form'; import { useModals } from '@mantine/modals'; import { showNotification } from '@mantine/notifications'; +import { IconCheck, IconX } from '@tabler/icons'; import { useState } from 'react'; -import { IoCloseCircle } from 'react-icons/io5'; -import { MdCheckCircleOutline, MdOutlineCreateNewFolder } from 'react-icons/md'; +import { MdOutlineCreateNewFolder } from 'react-icons/md'; import { trpc } from '../utils/trpc'; function Form({ onClose }: { onClose: () => void }) { @@ -35,7 +35,7 @@ function Form({ onClose }: { onClose: () => void }) { }); } catch (err) { showNotification({ - icon: , + icon: , color: 'red', autoClose: true, title: 'Library', @@ -55,7 +55,7 @@ function Form({ onClose }: { onClose: () => void }) { onClose(); setVisible((v) => !v); showNotification({ - icon: , + icon: , color: 'teal', autoClose: true, title: 'Library', diff --git a/src/components/mangaCard.tsx b/src/components/mangaCard.tsx index b12fa0e..160cca7 100644 --- a/src/components/mangaCard.tsx +++ b/src/components/mangaCard.tsx @@ -1,4 +1,5 @@ import { Badge, Button, createStyles, Paper, Title } from '@mantine/core'; +import { IconExternalLink } from '@tabler/icons'; const useStyles = createStyles((theme) => ({ card: { @@ -35,7 +36,7 @@ const useStyles = createStyles((theme) => ({ interface ArticleCardImageProps { image: string; title: string; - category: string; + category?: string; } export function MangaCard({ image, title, category }: ArticleCardImageProps) { @@ -50,16 +51,22 @@ export function MangaCard({ image, title, category }: ArticleCardImageProps) { className={classes.card} >
- - {category} - + {category && ( + + {category} + + )} {title}
- ); } + +MangaCard.defaultProps = { + category: '', +}; diff --git a/src/components/mangaSearchResult.tsx b/src/components/mangaSearchResult.tsx new file mode 100644 index 0000000..918c3b6 --- /dev/null +++ b/src/components/mangaSearchResult.tsx @@ -0,0 +1,142 @@ +import { createStyles, Image, SimpleGrid, Text, UnstyledButton } from '@mantine/core'; +import { useUncontrolled } from '@mantine/hooks'; +import { useState } from 'react'; + +const useStyles = createStyles((theme, { checked, disabled }: { checked: boolean; disabled: boolean }) => ({ + button: { + display: 'flex', + alignItems: 'center', + width: '100%', + transition: 'background-color 150ms ease, border-color 150ms ease', + border: `1px solid ${ + checked + ? theme.fn.variant({ variant: 'outline', color: theme.primaryColor }).border + : theme.colorScheme === 'dark' + ? theme.colors.dark[8] + : theme.colors.gray[3] + }`, + borderRadius: theme.radius.sm, + padding: theme.spacing.sm, + backgroundColor: checked + ? theme.fn.variant({ variant: 'light', color: theme.primaryColor }).background + : disabled + ? theme.colors.gray[3] + : theme.white, + }, + + body: { + flex: 1, + marginLeft: theme.spacing.md, + }, +})); + +interface ImageCheckboxProps { + checked?: boolean; + defaultChecked?: boolean; + onChange?(checked: boolean): void; + title: string; + description: string; + image: string; +} + +export function ImageCheckbox({ + checked, + defaultChecked, + onChange, + title, + description, + className, + disabled, + image, + ...others +}: ImageCheckboxProps & Omit, keyof ImageCheckboxProps>) { + const [value, handleChange] = useUncontrolled({ + value: checked, + defaultValue: defaultChecked, + finalValue: false, + onChange, + }); + + const { classes, cx } = useStyles({ checked: value, disabled: disabled || false }); + + return ( + { + if (!disabled) { + handleChange(!value); + } + }} + className={cx(classes.button, className)} + > + {title}} + src={image} + width={42} + height={64} + /> + +
+ + {description} + + + {title} + +
+
+ ); +} + +ImageCheckbox.defaultProps = { + checked: undefined, + defaultChecked: undefined, + onChange: () => {}, +}; + +type IMangaSearchResult = { + status: string; + title: string; + order: number; + cover: string; +}; + +export function MangaSearchResult({ + items, + onSelect, +}: { + items: IMangaSearchResult[]; + onSelect: (selected: IMangaSearchResult | undefined) => void; +}) { + const [selected, setSelected] = useState(); + + return ( + + {items.map((m) => ( + { + if (checked) { + setSelected(m); + onSelect(m); + } else { + setSelected(undefined); + onSelect(undefined); + } + }} + /> + ))} + + ); +} diff --git a/src/components/newMangaCard.tsx b/src/components/newMangaCard.tsx index 159f492..443f9df 100644 --- a/src/components/newMangaCard.tsx +++ b/src/components/newMangaCard.tsx @@ -1,4 +1,32 @@ -import { Button, createStyles, Paper } from '@mantine/core'; +import { + ActionIcon, + Badge, + Box, + Button, + Code, + createStyles, + Divider, + Grid, + Group, + Image, + LoadingOverlay, + Paper, + Select, + Stepper, + Text, + TextInput, + Title, + Tooltip, +} from '@mantine/core'; +import { useForm, UseFormReturnType, zodResolver } from '@mantine/form'; +import { getHotkeyHandler } from '@mantine/hooks'; +import { useModals } from '@mantine/modals'; +import { showNotification } from '@mantine/notifications'; +import { IconArrowRight, IconBook, IconCheck, IconSearch, IconX } from '@tabler/icons'; +import { useState } from 'react'; +import { z } from 'zod'; +import { trpc } from '../utils/trpc'; +import { MangaSearchResult } from './mangaSearchResult'; const useStyles = createStyles((theme) => ({ card: { @@ -18,11 +46,414 @@ const useStyles = createStyles((theme) => ({ boxShadow: theme.shadows.md, }, }, + form: { + display: 'flex', + flexDirection: 'column', + minHeight: 300, + padding: theme.spacing.xs, + }, + stepper: { + flexGrow: 1, + }, + stepBody: { + marginTop: 30, + marginBottom: 30, + }, + buttonGroup: { + position: 'fixed', + bottom: '19px', + right: '55px', + width: 'calc(100% - 55px)', + height: '50px', + background: 'white', + }, + placeHolder: { + alignItems: 'start !important', + justifyContent: 'flex-start !important', + }, })); -export function NewMangaCard() { +const schema = z.object({ + source: z.string().min(1, { message: 'You must select a source' }), + query: z.string().min(1, { message: 'Cannot be empty' }), + mangaOrder: z.number().gte(0, { message: 'Please select a manga' }), + mangaTitle: z.string().min(1, { message: 'Please select a manga' }), +}); + +type FormType = z.TypeOf; + +function SourceStep({ form }: { form: UseFormReturnType }) { + const query = trpc.manga.sources.useQuery(undefined, { + staleTime: Infinity, + }); + + if (query.isLoading) { + return ; + } + + const selectData = query.data?.map((s) => ({ + value: s, + label: s, + })); + + return ( + +