From c14d1d4fcc1eb3ae9e95bee5735232158a990d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B0=95=EC=A4=80?= Date: Sun, 27 Nov 2022 14:18:17 +0900 Subject: [PATCH] translate(frontend): dashboard page --- frontend/components/dashboard/DropZone.js | 31 +-- frontend/i18n.js | 1 + frontend/locales/en-US/common.json | 7 +- frontend/locales/en-US/dashboard.json | 10 + frontend/pages/dashboard/[id].js | 255 ++++++++++++++-------- frontend/pages/signup.js | 16 +- 6 files changed, 207 insertions(+), 113 deletions(-) create mode 100644 frontend/locales/en-US/dashboard.json diff --git a/frontend/components/dashboard/DropZone.js b/frontend/components/dashboard/DropZone.js index 5549e0821..3e5e103d9 100644 --- a/frontend/components/dashboard/DropZone.js +++ b/frontend/components/dashboard/DropZone.js @@ -9,6 +9,8 @@ import Image from "next/image"; import parse from "../utilities/file"; import Button from "../basic/buttons/Button"; +import useTranslation from "next-translate/useTranslation"; + const DropZone = ({ setData, setErrorDragAndDrop, @@ -17,8 +19,10 @@ const DropZone = ({ addPresetRow, setButtonReady, keysExist, - numCurrentRows + numCurrentRows, }) => { + const { t } = useTranslation(); + const handleDragEnter = (e) => { e.preventDefault(); e.stopPropagation(); @@ -50,15 +54,14 @@ const DropZone = ({ var file = e.dataTransfer.files[0], reader = new FileReader(); reader.onload = function (event) { - const keyPairs = parse(event.target.result) - const newData = Object.keys(keyPairs) - .map((key, index) => [ - guidGenerator(), - numCurrentRows + index, - key, - keyPairs[key], - "shared", - ]); + const keyPairs = parse(event.target.result); + const newData = Object.keys(keyPairs).map((key, index) => [ + guidGenerator(), + numCurrentRows + index, + key, + keyPairs[key], + "shared", + ]); setData(newData); setButtonReady(true); }; @@ -84,7 +87,7 @@ const DropZone = ({ .split("\n") .map((line, index) => [ guidGenerator(), - numCurrentRows + index, + numCurrentRows + index, line.split("=")[0], line.split("=").slice(1, line.split("=").length).join("="), "shared", @@ -130,7 +133,7 @@ const DropZone = ({ className="text-gray-300 text-3xl mr-6" />

- Drag and drop your .env file here to add more keys. + {t("common:drop-zone-keys")}

{errorDragAndDrop ? ( @@ -150,7 +153,7 @@ const DropZone = ({ onDrop={(e) => handleDrop(e)} > -

Drag and drop your .env file here.

+

{t("common:drop-zone")}

- Click to Copy + {t("common:click-to-copy")} @@ -417,7 +456,7 @@ export default function Dashboard() { className={`flex justify-start max-w-sm mt-2`} >