more strings extractions (#963)

This commit is contained in:
Mihai C
2021-10-15 10:53:42 +00:00
committed by GitHub
parent e1f4ba06d8
commit c4e2b6b458
20 changed files with 201 additions and 112 deletions
+19 -11
View File
@@ -1,6 +1,7 @@
import { ArrowLeftIcon } from "@heroicons/react/solid";
import { useEffect, useRef, useState } from "react";
import { useLocale } from "@lib/hooks/useLocale";
import showToast from "@lib/notification";
import { Webhook } from "@lib/webhook";
@@ -8,6 +9,7 @@ import Button from "@components/ui/Button";
import Switch from "@components/ui/Switch";
export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => void }) {
const { t } = useLocale();
const [bookingCreated, setBookingCreated] = useState(
props.webhook.eventTriggers.includes("booking_created")
);
@@ -58,7 +60,7 @@ export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => v
})
.then(handleErrors)
.then(() => {
showToast("Webhook updated successfully!", "success");
showToast(t("webhook_updated_successfully"), "success");
setBtnLoading(false);
});
};
@@ -74,12 +76,12 @@ export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => v
loading={btnLoading}
StartIcon={ArrowLeftIcon}
onClick={() => props.onCloseEdit()}>
Back
{t("back")}
</Button>
</div>
<div>
<div className="pb-5 pr-4 sm:pb-6">
<h3 className="text-lg font-bold leading-6 text-gray-900">Manage your webhook</h3>
<h3 className="text-lg font-bold leading-6 text-gray-900">{t("manage_your_webhook")}</h3>
</div>
</div>
<hr className="mt-2" />
@@ -87,7 +89,7 @@ export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => v
<div className="my-4">
<div className="mb-4">
<label htmlFor="subUrl" className="block text-sm font-medium text-gray-700">
Subscriber Url
{t("subscriber_url")}
</label>
<input
ref={subUrlRef}
@@ -99,11 +101,14 @@ export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => v
required
className="block w-full px-3 py-2 mt-1 border border-gray-300 rounded-sm shadow-sm focus:outline-none focus:ring-neutral-500 focus:border-neutral-500 sm:text-sm"
/>
<legend className="block pt-4 mb-2 text-sm font-medium text-gray-700"> Event Triggers </legend>
<legend className="block pt-4 mb-2 text-sm font-medium text-gray-700">
{" "}
{t("event_triggers")}{" "}
</legend>
<div className="p-2 bg-white border border-gray-300 rounded-sm">
<div className="flex p-2">
<div className="w-10/12">
<h2 className="text-sm text-gray-800">Booking Created</h2>
<h2 className="text-sm text-gray-800">{t("booking_created")}</h2>
</div>
<div className="flex items-center justify-end w-2/12 text-right">
<Switch
@@ -116,7 +121,7 @@ export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => v
</div>
<div className="flex px-2 py-1">
<div className="w-10/12">
<h2 className="text-sm text-gray-800">Booking Rescheduled</h2>
<h2 className="text-sm text-gray-800">{t("booking_rescheduled")}</h2>
</div>
<div className="flex items-center justify-end w-2/12 text-right">
<Switch
@@ -129,7 +134,7 @@ export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => v
</div>
<div className="flex p-2">
<div className="w-10/12">
<h2 className="text-sm text-gray-800">Booking Cancelled</h2>
<h2 className="text-sm text-gray-800">{t("booking_cancelled")}</h2>
</div>
<div className="flex items-center justify-end w-2/12 text-right">
<Switch
@@ -141,11 +146,14 @@ export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => v
</div>
</div>
</div>
<legend className="block pt-4 mb-2 text-sm font-medium text-gray-700"> Webhook Status </legend>
<legend className="block pt-4 mb-2 text-sm font-medium text-gray-700">
{" "}
{t("webhook_status")}{" "}
</legend>
<div className="p-2 bg-white border border-gray-300 rounded-sm">
<div className="flex p-2">
<div className="w-10/12">
<h2 className="text-sm text-gray-800">Webhook Enabled</h2>
<h2 className="text-sm text-gray-800">{t("webhook_enabled")}</h2>
</div>
<div className="flex items-center justify-end w-2/12 text-right">
<Switch
@@ -160,7 +168,7 @@ export default function EditTeam(props: { webhook: Webhook; onCloseEdit: () => v
</div>
<div className="gap-2 mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<Button type="submit" color="primary" className="ml-2" loading={btnLoading}>
Save
{t("save")}
</Button>
</div>
</div>
+12 -11
View File
@@ -1,5 +1,6 @@
import { TrashIcon, PencilAltIcon } from "@heroicons/react/outline";
import { useLocale } from "@lib/hooks/useLocale";
import showToast from "@lib/notification";
import { Webhook } from "@lib/webhook";
@@ -14,6 +15,7 @@ export default function WebhookListItem(props: {
webhook: Webhook;
onEditWebhook: () => void;
}) {
const { t } = useLocale();
const handleErrors = async (resp: Response) => {
if (!resp.ok) {
const err = await resp.json();
@@ -31,7 +33,7 @@ export default function WebhookListItem(props: {
})
.then(handleErrors)
.then(() => {
showToast("Webhook removed successfully!", "success");
showToast(t("webhook_removed_successfully"), "success");
props.onChange();
});
};
@@ -43,7 +45,7 @@ export default function WebhookListItem(props: {
<span className="flex flex-col space-y-2 text-xs">
{props.webhook.eventTriggers.map((eventTrigger, ind) => (
<span key={ind} className="px-1 text-xs text-blue-700 rounded-md w-max bg-blue-50">
{eventTrigger}
{t(`${eventTrigger}`)}
</span>
))}
</span>
@@ -56,16 +58,16 @@ export default function WebhookListItem(props: {
<div className="flex">
{!props.webhook.active && (
<span className="self-center h-6 px-3 py-1 text-xs text-red-700 capitalize rounded-md bg-red-50">
Disabled
{t("disabled")}
</span>
)}
{!!props.webhook.active && (
<span className="self-center h-6 px-3 py-1 text-xs text-green-700 capitalize rounded-md bg-green-50">
Enabled
{t("enabled")}
</span>
)}
<Tooltip content="Edit Webhook">
<Tooltip content={t("edit_webhook")}>
<Button
onClick={() => props.onEditWebhook()}
color="minimal"
@@ -74,7 +76,7 @@ export default function WebhookListItem(props: {
className="self-center w-full p-2 ml-4"></Button>
</Tooltip>
<Dialog>
<Tooltip content="Delete Webhook">
<Tooltip content={t("delete_webhook")}>
<DialogTrigger asChild>
<Button
onClick={(e) => {
@@ -88,14 +90,13 @@ export default function WebhookListItem(props: {
</Tooltip>
<ConfirmationDialogContent
variety="danger"
title="Delete Webhook"
confirmBtnText="Yes, delete webhook"
cancelBtnText="Cancel"
title={t("delete_webhook")}
confirmBtnText={t("confirm_delete_webhook")}
cancelBtnText={t("cancel")}
onConfirm={() => {
deleteWebhook(props.webhook.id);
}}>
Are you sure you want to delete this webhook? You will no longer receive Cal.com meeting data at
a specified URL, in real-time, when an event is scheduled or canceled .
{t("delete_webhook_confirmation_message")}
</ConfirmationDialogContent>
</Dialog>
</div>