Added missing translations

This commit is contained in:
DrMint 2022-06-06 22:51:45 +02:00
parent 670b2b8469
commit 46c4fece41
8 changed files with 46 additions and 37 deletions

View File

@ -4,7 +4,7 @@ import { UploadImageFragment } from "graphql/generated";
import { AppStaticProps } from "graphql/getAppStaticProps";
import { prettyLanguage, prettySlug } from "helpers/formatters";
import { getOgImage, ImageQuality, OgImage } from "helpers/img";
import { getClient, Indexes, search, SearchResult } from "helpers/search";
// import { getClient, Indexes, search, SearchResult } from "helpers/search";
import { Immutable } from "helpers/types";
import { useMediaMobile } from "hooks/useMediaQuery";
import { AnchorIds } from "hooks/useScrollTopOnChange";
@ -18,7 +18,6 @@ import { Select } from "./Inputs/Select";
import { TextInput } from "./Inputs/TextInput";
import { MainPanel } from "./Panels/MainPanel";
import { Popup } from "./Popup";
import { PreviewCard } from "./PreviewCard";
interface Props extends AppStaticProps {
subPanel?: React.ReactNode;
@ -47,8 +46,10 @@ export function AppLayout(props: Immutable<Props>): JSX.Element {
const isMobile = useMediaMobile();
const appLayout = useAppLayout();
const [searchQuery, setSearchQuery] = useState("");
const [searchResult, setSearchResult] = useState<SearchResult>();
/*
* const [searchQuery, setSearchQuery] = useState("");
* const [searchResult, setSearchResult] = useState<SearchResult>();
*/
const sensibilitySwipe = 1.1;
@ -88,19 +89,19 @@ export function AppLayout(props: Immutable<Props>): JSX.Element {
},
});
const client = getClient();
useEffect(() => {
if (searchQuery.length > 1) {
search(client, Indexes.Post, searchQuery).then((result) => {
setSearchResult(result);
});
} else {
setSearchResult(undefined);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchQuery]);
/*
* const client = getClient();
* useEffect(() => {
* if (searchQuery.length > 1) {
* search(client, Indexes.Post, searchQuery).then((result) => {
* setSearchResult(result);
* });
* } else {
* setSearchResult(undefined);
* }
* // eslint-disable-next-line react-hooks/exhaustive-deps
* }, [searchQuery]);
*/
const turnSubIntoContent = subPanel && !contentPanel;

View File

@ -2,16 +2,18 @@ import { Icon } from "components/Ico";
import { Button } from "components/Inputs/Button";
import { ToolTip } from "components/ToolTip";
import { useAppLayout } from "contexts/AppLayoutContext";
import { AppStaticProps } from "graphql/getAppStaticProps";
import { LibraryItemUserStatus } from "helpers/types";
interface Props {
id: string | null | undefined;
displayCTAs: boolean;
expand?: boolean;
langui: AppStaticProps["langui"];
}
export function PreviewCardCTAs(props: Props): JSX.Element {
const { id, displayCTAs, expand = false } = props;
const { id, displayCTAs, expand = false, langui } = props;
const appLayout = useAppLayout();
return (
@ -22,11 +24,10 @@ export function PreviewCardCTAs(props: Props): JSX.Element {
expand ? "gap-4" : "gap-2"
}`}
>
{/* TODO: Add to langui */}
<ToolTip content="I want it!" disabled={expand}>
<ToolTip content={langui.want_it} disabled={expand}>
<Button
icon={Icon.Favorite}
text={expand ? "I want it!" : undefined}
text={expand ? langui.want_it : undefined}
active={
appLayout.libraryItemUserStatus?.[id] ===
LibraryItemUserStatus.Want
@ -46,10 +47,10 @@ export function PreviewCardCTAs(props: Props): JSX.Element {
}}
/>
</ToolTip>
<ToolTip content="I have it!" disabled={expand}>
<ToolTip content={langui.have_it} disabled={expand}>
<Button
icon={Icon.BackHand}
text={expand ? "I have it!" : undefined}
text={expand ? langui.have_it : undefined}
active={
appLayout.libraryItemUserStatus?.[id] ===
LibraryItemUserStatus.Have

View File

@ -146,6 +146,14 @@ query getWebsiteInterface($language_code: String) {
description
available_at
search_title
want_it
have_it
source
reset_all_filters
only_display_items_i_have
only_display_items_i_want
only_display_unmarked_items
display_all_items
}
}
}

View File

@ -193,8 +193,7 @@ export default function Content(props: Immutable<Props>): JSX.Element {
<>
<HorizontalLine />
<div>
{/* TODO: Add to langui */}
<p className="font-headers text-2xl">Source</p>
<p className="font-headers text-2xl">{langui.source}</p>
<div className="mt-6 grid place-items-center gap-6 text-left">
{content.ranged_contents.data.map((rangedContent) => {
const libraryItem =
@ -241,6 +240,7 @@ export default function Content(props: Immutable<Props>): JSX.Element {
libraryItem.attributes.metadata?.[0]
)
}
langui={langui}
/>
}
/>

View File

@ -8,7 +8,7 @@ import {
ContentPanelWidthSizes,
} from "components/Panels/ContentPanel";
import { SubPanel } from "components/Panels/SubPanel";
import { PreviewCard, TranslatedPreviewCard } from "components/PreviewCard";
import { TranslatedPreviewCard } from "components/PreviewCard";
import { GetContentsQuery } from "graphql/generated";
import { AppStaticProps, getAppStaticProps } from "graphql/getAppStaticProps";
import { getReadySdk } from "graphql/sdk";
@ -123,10 +123,9 @@ export default function Contents(props: Immutable<Props>): JSX.Element {
input={<Switch setState={setKeepInfoVisible} state={keepInfoVisible} />}
/>
{/* TODO: Add to Langui */}
<Button
className="mt-8"
text={"Reset all filters"}
text={langui.reset_all_filters}
icon={Icon.Replay}
onClick={() => {
setSearchName(defaultFiltersState.searchName);

View File

@ -175,6 +175,7 @@ export default function LibrarySlug(props: Immutable<Props>): JSX.Element {
<PreviewCardCTAs
id={itemId}
displayCTAs={!isUntangibleGroupItem(item?.metadata?.[0])}
langui={langui}
expand
/>
{item?.descriptions?.[0] && (
@ -437,6 +438,7 @@ export default function LibrarySlug(props: Immutable<Props>): JSX.Element {
infoAppend={
<PreviewCardCTAs
id={subitem.id}
langui={langui}
displayCTAs={
!isUntangibleGroupItem(
subitem.attributes.metadata?.[0]

View File

@ -195,8 +195,7 @@ export default function Library(props: Immutable<Props>): JSX.Element {
/>
<div className="mt-4 grid grid-flow-col">
{/* TODO: Add to Langui */}
<ToolTip content="Only display items marked as &ldquo;I want&rdquo;">
<ToolTip content={langui.only_display_items_i_want}>
<Button
className="rounded-r-none"
icon={Icon.Favorite}
@ -204,7 +203,7 @@ export default function Library(props: Immutable<Props>): JSX.Element {
active={filterUserStatus === LibraryItemUserStatus.Want}
/>
</ToolTip>
<ToolTip content="Only display items marked as &ldquo;I have&rdquo;">
<ToolTip content={langui.only_display_items_i_have}>
<Button
className="rounded-none border-l-0"
icon={Icon.BackHand}
@ -212,7 +211,7 @@ export default function Library(props: Immutable<Props>): JSX.Element {
active={filterUserStatus === LibraryItemUserStatus.Have}
/>
</ToolTip>
<ToolTip content="Only display unmarked items">
<ToolTip content={langui.only_display_unmarked_items}>
<Button
className="rounded-none border-l-0"
icon={Icon.RadioButtonUnchecked}
@ -220,7 +219,7 @@ export default function Library(props: Immutable<Props>): JSX.Element {
active={filterUserStatus === LibraryItemUserStatus.None}
/>
</ToolTip>
<ToolTip content="Display all items">
<ToolTip content={langui.display_all_items}>
<Button
className="rounded-l-none border-l-0"
text={"All"}
@ -230,10 +229,9 @@ export default function Library(props: Immutable<Props>): JSX.Element {
</ToolTip>
</div>
{/* TODO: Add to Langui */}
<Button
className="mt-8"
text={"Reset all filters"}
text={langui.reset_all_filters}
icon={Icon.Replay}
onClick={() => {
setSearchName(defaultFiltersState.searchName);
@ -307,6 +305,7 @@ export default function Library(props: Immutable<Props>): JSX.Element {
item.attributes.metadata?.[0]
)
}
langui={langui}
/>
}
/>

View File

@ -66,10 +66,9 @@ export default function News(props: Immutable<Props>): JSX.Element {
input={<Switch setState={setKeepInfoVisible} state={keepInfoVisible} />}
/>
{/* TODO: Add to Langui */}
<Button
className="mt-8"
text={"Reset all filters"}
text={langui.reset_all_filters}
icon={Icon.Replay}
onClick={() => {
setSearchName(defaultFiltersState.searchName);