From 260bdd5577e3be13dbcd2563558414abc924482a Mon Sep 17 00:00:00 2001 From: DrMint Date: Wed, 13 Jul 2022 03:46:58 +0200 Subject: [PATCH] useBoolean + many fixes --- .eslintignore | 3 +- DATA_TESTING.md | 3 +- graphql.config.js | 19 + src/components/AppLayout.tsx | 15 +- src/components/Inputs/Button.tsx | 8 +- src/components/Inputs/PageSelector.tsx | 22 +- src/components/Inputs/Select.tsx | 30 +- src/components/Inputs/Switch.tsx | 57 +- src/components/Inputs/TextInput.tsx | 19 +- src/components/Library/PreviewCardCTAs.tsx | 16 +- src/components/Library/ScanSet.tsx | 64 ++- src/components/Library/ScanSetCover.tsx | 202 ++++--- src/components/Markdown/Markdawn.tsx | 519 +++++++++--------- src/components/PanelComponents/NavOption.tsx | 46 +- .../PanelComponents/ReturnButton.tsx | 4 +- src/components/PostPage.tsx | 6 +- src/components/PreviewCard.tsx | 99 ++-- src/components/SmartList.tsx | 101 ++-- .../Chronology/ChronologyItemComponent.tsx | 19 +- src/components/Wiki/DefinitionCard.tsx | 4 +- .../operations/getLibraryItemScans.graphql | 108 ++++ .../operations/getWebsiteInterface.graphql | 9 + src/hooks/useBoolean.ts | 20 + src/hooks/useScrollTopOnChange.ts | 3 +- src/pages/_document.tsx | 6 +- src/pages/archives/videos/c/[uid].tsx | 10 +- src/pages/archives/videos/index.tsx | 14 +- src/pages/archives/videos/v/[uid].tsx | 10 +- src/pages/contents/[slug]/index.tsx | 10 +- src/pages/contents/index.tsx | 25 +- src/pages/library/[slug]/index.tsx | 39 +- src/pages/library/[slug]/scans.tsx | 146 ++++- src/pages/library/index.tsx | 86 +-- src/pages/news/index.tsx | 24 +- src/pages/wiki/[slug]/index.tsx | 7 +- src/pages/wiki/index.tsx | 29 +- 36 files changed, 1065 insertions(+), 737 deletions(-) create mode 100644 graphql.config.js create mode 100644 src/hooks/useBoolean.ts diff --git a/.eslintignore b/.eslintignore index bb32f2c..1d947a8 100644 --- a/.eslintignore +++ b/.eslintignore @@ -6,4 +6,5 @@ next-sitemap.config.js next.config.js postcss.config.js tailwind.config.js -design.config.js \ No newline at end of file +design.config.js +graphql.config.js \ No newline at end of file diff --git a/DATA_TESTING.md b/DATA_TESTING.md index d108151..a2b7834 100644 --- a/DATA_TESTING.md +++ b/DATA_TESTING.md @@ -30,7 +30,6 @@ The following is all the tests done on the data entries coming from Strapi. This | Text Sets | Credited Translators | Error | High | The Content is a Transcription but credits one or more Translators. | If appropriate, create a Translation Text Set with the Translator credited there. | | Text Sets | Duplicate Language | Error | High | | | - ## LibraryItems | Subitem | Name | Type | Severity | Description | Recommendation | @@ -100,4 +99,4 @@ The following is all the tests done on the data entries coming from Strapi. This | Metadata Group | Has URLs | Error | High | Variant Sets shouldn't have URLs. | | | Metadata Group | Has Contents | Error | High | Variant Sets and Relation Set shouldn't have Contents. | | | Metadata Group | Has Images | Error | High | Variant Sets and Relation Set shouldn't have Images. | | -| Metadata Group | No Subitems | Missing | High | Group Items should have subitems. | +| Metadata Group | No Subitems | Missing | High | Group Items should have subitems. | diff --git a/graphql.config.js b/graphql.config.js new file mode 100644 index 0000000..73f7dcf --- /dev/null +++ b/graphql.config.js @@ -0,0 +1,19 @@ +module.exports = { + projects: { + app: { + schema: process.env.URL_GRAPHQL, + documents: [ + "src/graphql/operations/*.graphql", + "src/graphql/fragments/*.graphql", + ], + extensions: { + endpoints: { + default: { + url: process.env.URL_GRAPHQL, + headers: { Authorization: `Bearer ${process.env.ACCESS_TOKEN}` }, + }, + }, + }, + }, + }, +}; diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx index 4d133e0..52fa941 100644 --- a/src/components/AppLayout.tsx +++ b/src/components/AppLayout.tsx @@ -97,14 +97,13 @@ export const AppLayout = ({ const isMobile = useMediaMobile(); useEffect(() => { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - router.events?.on("routeChangeStart", () => { + router.events.on("routeChangeStart", () => { setConfigPanelOpen(false); setMainPanelOpen(false); setSubPanelOpen(false); }); - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - router.events?.on("hashChangeStart", () => { + + router.events.on("hashChangeStart", () => { setSubPanelOpen(false); }); }, [router.events, setConfigPanelOpen, setMainPanelOpen, setSubPanelOpen]); @@ -461,8 +460,8 @@ export const AppLayout = ({