Anchor link langui

This commit is contained in:
DrMint 2022-07-23 23:11:52 +02:00
parent ac38f1dae0
commit 45b670de4e
10 changed files with 41 additions and 22 deletions

View File

@ -1,6 +1,6 @@
import { useRouter } from "next/router";
import { Ico, Icon } from "./Ico"; import { Ico, Icon } from "./Ico";
import { ToolTip } from "./ToolTip"; import { ToolTip } from "./ToolTip";
import { AppStaticProps } from "graphql/getAppStaticProps";
/* /*
* *
@ -9,18 +9,22 @@ import { ToolTip } from "./ToolTip";
interface Props { interface Props {
id: string; id: string;
langui: AppStaticProps["langui"];
} }
// ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ // ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
export const AnchorShare = ({ id }: Props): JSX.Element => ( export const AnchorShare = ({ id, langui }: Props): JSX.Element => (
<ToolTip <ToolTip
content={"Copy anchor link"} content={langui.copy_anchor_link}
trigger="mouseenter" trigger="mouseenter"
className="text-sm" className="text-sm"
> >
{/* TODO: Langui Copied! */} <ToolTip
<ToolTip content={"Copied! 👍"} trigger="click" className="text-sm"> content={langui.anchor_link_copied}
trigger="click"
className="text-sm"
>
<Ico <Ico
icon={Icon.Link} icon={Icon.Link}
className="transition-color cursor-pointer hover:text-dark" className="transition-color cursor-pointer hover:text-dark"

View File

@ -22,6 +22,7 @@ import { AnchorShare } from "components/AnchorShare";
interface MarkdawnProps { interface MarkdawnProps {
className?: string; className?: string;
text: string; text: string;
langui: AppStaticProps["langui"];
} }
// ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ // ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
@ -29,6 +30,7 @@ interface MarkdawnProps {
export const Markdawn = ({ export const Markdawn = ({
className, className,
text: rawText, text: rawText,
langui,
}: MarkdawnProps): JSX.Element => { }: MarkdawnProps): JSX.Element => {
const { playerName } = useAppLayout(); const { playerName } = useAppLayout();
const router = useRouter(); const router = useRouter();
@ -85,7 +87,7 @@ export const Markdawn = ({
}) => ( }) => (
<h1 id={compProps.id} style={compProps.style}> <h1 id={compProps.id} style={compProps.style}>
{compProps.children} {compProps.children}
<AnchorShare id={compProps.id} /> <AnchorShare id={compProps.id} langui={langui} />
</h1> </h1>
), ),
}, },
@ -98,7 +100,7 @@ export const Markdawn = ({
}) => ( }) => (
<h2 id={compProps.id} style={compProps.style}> <h2 id={compProps.id} style={compProps.style}>
{compProps.children} {compProps.children}
<AnchorShare id={compProps.id} /> <AnchorShare id={compProps.id} langui={langui} />
</h2> </h2>
), ),
}, },
@ -111,7 +113,7 @@ export const Markdawn = ({
}) => ( }) => (
<h3 id={compProps.id} style={compProps.style}> <h3 id={compProps.id} style={compProps.style}>
{compProps.children} {compProps.children}
<AnchorShare id={compProps.id} /> <AnchorShare id={compProps.id} langui={langui} />
</h3> </h3>
), ),
}, },
@ -124,7 +126,7 @@ export const Markdawn = ({
}) => ( }) => (
<h4 id={compProps.id} style={compProps.style}> <h4 id={compProps.id} style={compProps.style}>
{compProps.children} {compProps.children}
<AnchorShare id={compProps.id} /> <AnchorShare id={compProps.id} langui={langui} />
</h4> </h4>
), ),
}, },
@ -137,7 +139,7 @@ export const Markdawn = ({
}) => ( }) => (
<h5 id={compProps.id} style={compProps.style}> <h5 id={compProps.id} style={compProps.style}>
{compProps.children} {compProps.children}
<AnchorShare id={compProps.id} /> <AnchorShare id={compProps.id} langui={langui} />
</h5> </h5>
), ),
}, },
@ -150,7 +152,7 @@ export const Markdawn = ({
}) => ( }) => (
<h6 id={compProps.id} style={compProps.style}> <h6 id={compProps.id} style={compProps.style}>
{compProps.children} {compProps.children}
<AnchorShare id={compProps.id} /> <AnchorShare id={compProps.id} langui={langui} />
</h6> </h6>
), ),
}, },
@ -199,7 +201,7 @@ export const Markdawn = ({
component: (compProps) => ( component: (compProps) => (
<> <>
<strong className="!my-0 text-dark/60 mobile:!-mb-4"> <strong className="!my-0 text-dark/60 mobile:!-mb-4">
<Markdawn text={compProps.name} /> <Markdawn text={compProps.name} langui={langui} />
</strong> </strong>
<p className="whitespace-pre-line">{compProps.children}</p> <p className="whitespace-pre-line">{compProps.children}</p>
</> </>

View File

@ -195,7 +195,7 @@ export const PostPage = ({
)} )}
{prependBody} {prependBody}
<Markdawn text={body} /> <Markdawn text={body} langui={langui} />
{appendBody} {appendBody}
</ContentPanel> </ContentPanel>
), ),

View File

@ -55,7 +55,9 @@ export const RecorderChip = ({ recorder, langui }: Props): JSX.Element => (
)} )}
</div> </div>
</div> </div>
{recorder.bio?.[0] && <Markdawn text={recorder.bio[0].bio ?? ""} />} {recorder.bio?.[0] && (
<Markdawn text={recorder.bio[0].bio ?? ""} langui={langui} />
)}
</div> </div>
} }
placement="top" placement="top"

View File

@ -107,7 +107,7 @@ export const ThumbnailHeader = ({
</div> </div>
{description && ( {description && (
<InsetBox className="mt-8"> <InsetBox className="mt-8">
{<Markdawn text={description}></Markdawn>} {<Markdawn text={description} langui={langui} />}
</InsetBox> </InsetBox>
)} )}
</> </>

View File

@ -168,6 +168,8 @@ query getWebsiteInterface($language_code: String) {
cover cover
tags tags
no_source_warning no_source_warning
copy_anchor_link
anchor_link_copied
} }
} }
} }

View File

@ -111,7 +111,7 @@ const Chronicle = ({
)} )}
{isDefined(selectedTranslation.body) && ( {isDefined(selectedTranslation.body) && (
<Markdawn text={selectedTranslation.body.body} /> <Markdawn text={selectedTranslation.body.body} langui={langui} />
)} )}
</> </>
) : ( ) : (
@ -139,7 +139,10 @@ const Chronicle = ({
<HorizontalLine /> <HorizontalLine />
{selectedContentTranslation.text_set?.text && ( {selectedContentTranslation.text_set?.text && (
<Markdawn text={selectedContentTranslation.text_set.text} /> <Markdawn
text={selectedContentTranslation.text_set.text}
langui={langui}
/>
)} )}
</> </>
)} )}

View File

@ -212,7 +212,10 @@ const Content = ({
<div> <div>
<p className="font-headers font-bold">{langui.notes}:</p> <p className="font-headers font-bold">{langui.notes}:</p>
<div className="grid place-content-center place-items-center gap-2"> <div className="grid place-content-center place-items-center gap-2">
<Markdawn text={selectedTranslation.text_set.notes} /> <Markdawn
text={selectedTranslation.text_set.notes}
langui={langui}
/>
</div> </div>
</div> </div>
)} )}
@ -393,7 +396,10 @@ const Content = ({
<HorizontalLine /> <HorizontalLine />
<Markdawn text={selectedTranslation?.text_set?.text ?? ""} /> <Markdawn
text={selectedTranslation?.text_set?.text ?? ""}
langui={langui}
/>
{nextContent?.attributes && ( {nextContent?.attributes && (
<> <>

View File

@ -442,7 +442,7 @@ const Editor = ({ langui, ...otherProps }: Props): JSX.Element => {
<div> <div>
<h2>Preview</h2> <h2>Preview</h2>
<div className="h-[70vh] overflow-scroll rounded-xl bg-mid bg-opacity-40 p-8"> <div className="h-[70vh] overflow-scroll rounded-xl bg-mid bg-opacity-40 p-8">
<Markdawn className="w-full" text={markdown} /> <Markdawn className="w-full" text={markdown} langui={langui} />
</div> </div>
</div> </div>
</div> </div>

View File

@ -210,7 +210,7 @@ const ChronologyEra = ({
<InsetBox className="my-8 grid gap-4 text-center"> <InsetBox className="my-8 grid gap-4 text-center">
<h2 className="flex place-content-center gap-3 text-2xl"> <h2 className="flex place-content-center gap-3 text-2xl">
{title} {title}
<AnchorShare id={id} /> <AnchorShare id={id} langui={langui} />
</h2> </h2>
{isDefinedAndNotEmpty(description) && ( {isDefinedAndNotEmpty(description) && (
@ -437,7 +437,7 @@ export const ChronologyEvent = ({
</p> </p>
<span className="flex-shrink"> <span className="flex-shrink">
<AnchorShare id={id} /> <AnchorShare id={id} langui={langui} />
</span> </span>
</div> </div>