From ac38f1dae09e68653cfdae3b728f8f756071378f Mon Sep 17 00:00:00 2001 From: DrMint Date: Sat, 23 Jul 2022 22:56:48 +0200 Subject: [PATCH] Chronology v2 --- src/components/AnchorShare.tsx | 37 ++ src/components/Chronicles/ChroniclesList.tsx | 2 +- src/components/Inputs/LanguageSwitcher.tsx | 4 +- src/components/Markdown/Markdawn.tsx | 42 +- src/components/Translated.tsx | 2 +- .../Chronology/ChronologyItemComponent.tsx | 182 ------- .../Chronology/ChronologyYearComponent.tsx | 38 -- .../operations/getChronologyItems.graphql | 7 + src/graphql/operations/getEras.graphql | 7 + src/helpers/date.ts | 9 +- src/helpers/formatters.ts | 8 +- src/helpers/openGraph.ts | 4 +- src/pages/api/revalidate.ts | 42 ++ src/pages/index.tsx | 7 +- src/pages/library/index.tsx | 4 +- src/pages/wiki/chronology.tsx | 448 +++++++++++++++--- 16 files changed, 497 insertions(+), 346 deletions(-) create mode 100644 src/components/AnchorShare.tsx delete mode 100644 src/components/Wiki/Chronology/ChronologyItemComponent.tsx delete mode 100644 src/components/Wiki/Chronology/ChronologyYearComponent.tsx diff --git a/src/components/AnchorShare.tsx b/src/components/AnchorShare.tsx new file mode 100644 index 0000000..a367f1d --- /dev/null +++ b/src/components/AnchorShare.tsx @@ -0,0 +1,37 @@ +import { useRouter } from "next/router"; +import { Ico, Icon } from "./Ico"; +import { ToolTip } from "./ToolTip"; + +/* + * ╭─────────────╮ + * ───────────────────────────────────────╯ COMPONENT ╰─────────────────────────────────────────── + */ + +interface Props { + id: string; +} + +// ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ + +export const AnchorShare = ({ id }: Props): JSX.Element => ( + + {/* TODO: Langui Copied! */} + + { + navigator.clipboard.writeText( + `${ + process.env.NEXT_PUBLIC_URL_SELF + window.location.pathname + }#${id}` + ); + }} + /> + + +); diff --git a/src/components/Chronicles/ChroniclesList.tsx b/src/components/Chronicles/ChroniclesList.tsx index 1ba2bb1..c439e4f 100644 --- a/src/components/Chronicles/ChroniclesList.tsx +++ b/src/components/Chronicles/ChroniclesList.tsx @@ -47,7 +47,7 @@ export const ChroniclesList = ({
{filterHasAttributes(chronicles, [ diff --git a/src/components/Inputs/LanguageSwitcher.tsx b/src/components/Inputs/LanguageSwitcher.tsx index dd00893..7e71a00 100644 --- a/src/components/Inputs/LanguageSwitcher.tsx +++ b/src/components/Inputs/LanguageSwitcher.tsx @@ -19,6 +19,7 @@ interface Props { localesIndex: number | undefined; onLanguageChanged: (index: number) => void; size?: Parameters[0]["size"]; + showBadge?: boolean; } // ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ @@ -30,6 +31,7 @@ export const LanguageSwitcher = ({ languages, size, onLanguageChanged, + showBadge = true, }: Props): JSX.Element => (