Skip to content

Commit

Permalink
Merge pull request #46 from gangjun06/feat/39
Browse files Browse the repository at this point in the history
Localize Web UI (#39)
  • Loading branch information
vmatsiiako authored Dec 27, 2022
2 parents 876c5f5 + cc2803a commit c9dc024
Show file tree
Hide file tree
Showing 58 changed files with 2,085 additions and 644 deletions.
302 changes: 287 additions & 15 deletions backend/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ services:
- ./frontend/public:/app/public
- ./frontend/styles:/app/styles
- ./frontend/components:/app/components
- ./frontend/locales:/app/locales
- ./frontend/next-i18next.config.js:/app/next-i18next.config.js
env_file: .env
environment:
- NEXT_PUBLIC_ENV=development
Expand Down
2 changes: 2 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ yarn-error.log*
.env.production.local
.vercel
.env.infisical

.vscode
208 changes: 106 additions & 102 deletions frontend/components/basic/Layout.tsx

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions frontend/components/basic/dialog/AddIncidentContactDialog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Fragment, useState } from "react";
import { useTranslation } from "next-i18next";
import { Dialog, Transition } from "@headlessui/react";

import addIncidentContact from "~/pages/api/organization/addIncidentContact";
Expand All @@ -14,6 +15,7 @@ const AddIncidentContactDialog = ({
setIncidentContacts,
}) => {
let [incidentContactEmail, setIncidentContactEmail] = useState("");
const { t } = useTranslation();

const submit = () => {
setIncidentContacts(
Expand Down Expand Up @@ -59,17 +61,16 @@ const AddIncidentContactDialog = ({
as="h3"
className="text-lg font-medium leading-6 text-gray-400"
>
Add an Incident Contact
{t("section-incident:add-dialog.title")}
</Dialog.Title>
<div className="mt-2 mb-2">
<p className="text-sm text-gray-500">
This contact will be notified in the unlikely event of a
severe incident.
{t("section-incident:add-dialog.description")}
</p>
</div>
<div className="max-h-28">
<InputField
label="Email"
label={t("common:email")}
onChangeHandler={setIncidentContactEmail}
type="varName"
value={incidentContactEmail}
Expand All @@ -81,7 +82,7 @@ const AddIncidentContactDialog = ({
<Button
onButtonPressed={submit}
color="mineshaft"
text="Add Incident Contact"
text={t("section-incident:add-dialog.add-incident")}
size="md"
/>
</div>
Expand Down
61 changes: 35 additions & 26 deletions frontend/components/basic/dialog/AddProjectMemberDialog.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Fragment, useState } from "react";
import { useRouter } from "next/router";
import { Trans, useTranslation } from "next-i18next";
import { Dialog, Transition } from "@headlessui/react";

import Button from "../buttons/Button";
Expand All @@ -15,6 +16,7 @@ const AddProjectMemberDialog = ({
setEmail,
}) => {
const router = useRouter();
const { t } = useTranslation();

return (
<div className="z-50">
Expand Down Expand Up @@ -49,48 +51,55 @@ const AddProjectMemberDialog = ({
as="h3"
className="text-lg font-medium leading-6 text-gray-400 z-50"
>
Add a member to your project
{t("section-members:add-dialog.add-member-to-project")}
</Dialog.Title>
) : (
<Dialog.Title
as="h3"
className="text-lg font-medium leading-6 text-gray-400 z-50"
>
All the users in your organization are already invited.
{t("section-members:add-dialog.already-all-invited")}
</Dialog.Title>
)}
<div className="mt-2 mb-4">
{data?.length > 0 ? (
<div className="flex flex-col">
<p className="text-sm text-gray-500">
The user will receive an email with the instructions.
{t("section-members:add-dialog.user-will-email")}
</p>
<div className="">
<button
type="button"
className="inline-flex justify-center rounded-md py-1 text-sm text-gray-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
onClick={() =>
router.push("/settings/org/" + router.query.id)
}
>
If you are looking to add users to your org,
</button>
<button
type="button"
className="ml-1 inline-flex justify-center rounded-md py-1 text-sm text-gray-500 hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
onClick={() =>
router.push(
"/settings/org/" + router.query.id + "?invite"
)
}
>
click here.
</button>
<Trans
i18nKey="section-members:add-dialog.looking-add"
components={[
// eslint-disable-next-line react/jsx-key
<button
type="button"
className="inline-flex justify-center rounded-md py-1 text-sm text-gray-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
onClick={() =>
router.push(
"/settings/org/" + router.query.id
)
}
/>,
// eslint-disable-next-line react/jsx-key
<button
type="button"
className="ml-1 inline-flex justify-center rounded-md py-1 text-sm text-gray-500 hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
onClick={() =>
router.push(
"/settings/org/" +
router.query.id +
"?invite"
)
}
/>,
]}
/>
</div>
</div>
) : (
<p className="text-sm text-gray-500">
Add more users to the organization first.
{t("section-members:add-dialog.add-user-org-first")}
</p>
)}
</div>
Expand All @@ -110,7 +119,7 @@ const AddProjectMemberDialog = ({
<Button
onButtonPressed={submitModal}
color="mineshaft"
text="Add Member"
text={t("section-members:add-member")}
size="md"
/>
</div>
Expand All @@ -120,7 +129,7 @@ const AddProjectMemberDialog = ({
router.push("/settings/org/" + router.query.id)
}
color="mineshaft"
text="Add Users to Organization"
text={t("section-members:add-dialog.add-user-to-org")}
size="md"
/>
)}
Expand Down
Loading

0 comments on commit c9dc024

Please sign in to comment.