mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-30 21:01:51 +01:00
localize setupPart
This commit is contained in:
parent
8cc6faff09
commit
88b788d831
@ -393,6 +393,28 @@
|
|||||||
"colorLabel": "Color"
|
"colorLabel": "Color"
|
||||||
},
|
},
|
||||||
"connections": {
|
"connections": {
|
||||||
|
"setup": {
|
||||||
|
"errorStatus": {
|
||||||
|
"title": "Something needs your attention",
|
||||||
|
"description": "It seems that one or more items in this setup need your attention."
|
||||||
|
},
|
||||||
|
"unsetStatus": {
|
||||||
|
"title": "You haven't gone through setup",
|
||||||
|
"description": "Please click the button to the right to start the setup process."
|
||||||
|
},
|
||||||
|
"successStatus": {
|
||||||
|
"title": "Everything is set up!",
|
||||||
|
"description": "All things are in place for you to start watching your favourite media."
|
||||||
|
},
|
||||||
|
"redoSetup": "Redo setup",
|
||||||
|
"doSetup": "Do setup",
|
||||||
|
"itemError": "There is something wrong with this setting. Go through setup again to fix it.",
|
||||||
|
"items": {
|
||||||
|
"extension": "Extension",
|
||||||
|
"proxy": "Custom proxy",
|
||||||
|
"default": "Default setup"
|
||||||
|
}
|
||||||
|
},
|
||||||
"server": {
|
"server": {
|
||||||
"description": "If you would like to connect to a custom backend to store your data, enable this and provide the URL.",
|
"description": "If you would like to connect to a custom backend to store your data, enable this and provide the URL.",
|
||||||
"label": "Custom server",
|
"label": "Custom server",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { t } from "i18next";
|
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useAsync } from "react-use";
|
import { useAsync } from "react-use";
|
||||||
|
|
||||||
@ -78,6 +78,7 @@ function SetupCheckList(props: {
|
|||||||
grey?: boolean;
|
grey?: boolean;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
const statusMap: Record<Status, StatusCircleProps["type"]> = {
|
const statusMap: Record<Status, StatusCircleProps["type"]> = {
|
||||||
error: "error",
|
error: "error",
|
||||||
success: "success",
|
success: "success",
|
||||||
@ -97,17 +98,16 @@ function SetupCheckList(props: {
|
|||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
className={classNames({
|
className={classNames({
|
||||||
"!text-type-dimmed opacity-75": props.grey,
|
"text-type-dimmed opacity-75": props.grey,
|
||||||
"text-type-danger": props.status === "error",
|
"text-type-danger": props.status === "error",
|
||||||
"text-white": props.status === "success",
|
"text-white !opacity-100": props.status === "success",
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</p>
|
</p>
|
||||||
{props.status === "error" ? (
|
{props.status === "error" ? (
|
||||||
<p className="max-w-96">
|
<p className="max-w-96">
|
||||||
There is something wrong with this setting. Go through setup again
|
{t("settings.connections.setup.itemError")}
|
||||||
to fix it.
|
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
@ -116,22 +116,29 @@ function SetupCheckList(props: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SetupPart() {
|
export function SetupPart() {
|
||||||
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { loading, setupStates, globalState } = useIsSetup();
|
const { loading, setupStates, globalState } = useIsSetup();
|
||||||
if (loading || !setupStates) return <p>Loading states...</p>;
|
if (loading || !setupStates) return <p>Loading states...</p>;
|
||||||
|
|
||||||
const textLookupMap: Record<Status, { title: string; desc: string }> = {
|
const textLookupMap: Record<
|
||||||
|
Status,
|
||||||
|
{ title: string; desc: string; button: string }
|
||||||
|
> = {
|
||||||
error: {
|
error: {
|
||||||
title: "err1",
|
title: "settings.connections.setup.errorStatus.title",
|
||||||
desc: "err2",
|
desc: "settings.connections.setup.errorStatus.description",
|
||||||
|
button: "settings.connections.setup.redoSetup",
|
||||||
},
|
},
|
||||||
success: {
|
success: {
|
||||||
title: "success1",
|
title: "settings.connections.setup.successStatus.title",
|
||||||
desc: "success2",
|
desc: "settings.connections.setup.successStatus.description",
|
||||||
|
button: "settings.connections.setup.redoSetup",
|
||||||
},
|
},
|
||||||
unset: {
|
unset: {
|
||||||
title: "unset1",
|
title: "settings.connections.setup.unsetStatus.title",
|
||||||
desc: "unset2",
|
desc: "settings.connections.setup.unsetStatus.description",
|
||||||
|
button: "settings.connections.setup.doSetup",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -162,18 +169,18 @@ export function SetupPart() {
|
|||||||
{t(textLookupMap[globalState].desc)}
|
{t(textLookupMap[globalState].desc)}
|
||||||
</p>
|
</p>
|
||||||
<SetupCheckList status={setupStates.extension}>
|
<SetupCheckList status={setupStates.extension}>
|
||||||
Extension
|
{t("settings.connections.setup.items.extension")}
|
||||||
</SetupCheckList>
|
</SetupCheckList>
|
||||||
<SetupCheckList status={setupStates.proxy}>
|
<SetupCheckList status={setupStates.proxy}>
|
||||||
Custom proxy
|
{t("settings.connections.setup.items.proxy")}
|
||||||
</SetupCheckList>
|
</SetupCheckList>
|
||||||
<SetupCheckList grey status={setupStates.defaultProxy}>
|
<SetupCheckList grey status={setupStates.defaultProxy}>
|
||||||
Default setup
|
{t("settings.connections.setup.items.default")}
|
||||||
</SetupCheckList>
|
</SetupCheckList>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-5">
|
<div className="mt-5">
|
||||||
<Button theme="purple" onClick={() => navigate("/onboarding")}>
|
<Button theme="purple" onClick={() => navigate("/onboarding")}>
|
||||||
Do setup
|
{t(textLookupMap[globalState].button)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user