From fdff476a06a167d8d26d5bb96768f9e6e0fa4474 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Mon, 27 Jan 2025 19:31:10 +0530 Subject: [PATCH 1/2] chore: notification language support and refactor --- packages/constants/src/index.ts | 1 + .../constants/src}/notification.ts | 25 ++++++++-------- .../i18n/src/locales/en/translations.json | 18 +++++++++++ .../i18n/src/locales/es/translations.json | 30 ++++++++++++++----- .../i18n/src/locales/fr/translations.json | 18 +++++++++++ .../i18n/src/locales/ja/translations.json | 28 +++++++++++++---- .../i18n/src/locales/zh-CN/translations.json | 21 +++++++++++++ .../(projects)/notifications/page.tsx | 2 +- .../notification-card/root.tsx | 3 +- .../workspace-notifications/root.tsx | 11 +++---- .../sidebar/empty-state.tsx | 3 +- .../sidebar/filters/applied-filter.tsx | 8 +++-- .../sidebar/filters/menu/menu-option-item.tsx | 4 +-- .../sidebar/filters/menu/root.tsx | 12 ++++++-- .../sidebar/header/options/root.tsx | 3 +- .../options/snooze/modal.tsx | 4 +-- .../notification-card/options/snooze/root.tsx | 9 ++++-- .../workspace-notifications.store.ts | 9 ++---- 18 files changed, 157 insertions(+), 52 deletions(-) rename {web/core/constants => packages/constants/src}/notification.ts (80%) diff --git a/packages/constants/src/index.ts b/packages/constants/src/index.ts index 2bc68dbef71..5d67cc38c6c 100644 --- a/packages/constants/src/index.ts +++ b/packages/constants/src/index.ts @@ -9,6 +9,7 @@ export * from "./graph"; export * from "./instance"; export * from "./issue"; export * from "./metadata"; +export * from "./notification"; export * from "./state"; export * from "./swr"; export * from "./user"; diff --git a/web/core/constants/notification.ts b/packages/constants/src/notification.ts similarity index 80% rename from web/core/constants/notification.ts rename to packages/constants/src/notification.ts index 36ab3c8eeda..563436c1d8a 100644 --- a/web/core/constants/notification.ts +++ b/packages/constants/src/notification.ts @@ -29,12 +29,13 @@ export type TNotificationTab = ENotificationTab.ALL | ENotificationTab.MENTIONS; export const NOTIFICATION_TABS = [ { - label: "All", + i18n_label: "notification.tabs.all", value: ENotificationTab.ALL, - count: (unReadNotification: TUnreadNotificationsCount) => unReadNotification?.total_unread_notifications_count || 0, + count: (unReadNotification: TUnreadNotificationsCount) => + unReadNotification?.total_unread_notifications_count || 0, }, { - label: "Mentions", + i18n_label: "notification.tabs.mentions", value: ENotificationTab.MENTIONS, count: (unReadNotification: TUnreadNotificationsCount) => unReadNotification?.mention_unread_notifications_count || 0, @@ -43,15 +44,15 @@ export const NOTIFICATION_TABS = [ export const FILTER_TYPE_OPTIONS = [ { - label: "Assigned to me", + i18n_label: "notification.filter_type_options.assigned_to_me", value: ENotificationFilterType.ASSIGNED, }, { - label: "Created by me", + i18n_label: "notification.filter_type_options.created_by_me", value: ENotificationFilterType.CREATED, }, { - label: "Subscribed by me", + i18n_label: "notification.filter_type_options.subscribed_by_me", value: ENotificationFilterType.SUBSCRIBED, }, ]; @@ -59,7 +60,7 @@ export const FILTER_TYPE_OPTIONS = [ export const NOTIFICATION_SNOOZE_OPTIONS = [ { key: "1_day", - label: "1 day", + i18n_label: "notification.snooze_options.1_day", value: () => { const date = new Date(); return new Date(date.getTime() + 24 * 60 * 60 * 1000); @@ -67,7 +68,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "3_days", - label: "3 days", + i18n_label: "notification.snooze_options.3_days", value: () => { const date = new Date(); return new Date(date.getTime() + 3 * 24 * 60 * 60 * 1000); @@ -75,7 +76,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "5_days", - label: "5 days", + i18n_label: "notification.snooze_options.5_days", value: () => { const date = new Date(); return new Date(date.getTime() + 5 * 24 * 60 * 60 * 1000); @@ -83,7 +84,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "1_week", - label: "1 week", + i18n_label: "notification.snooze_options.1_week", value: () => { const date = new Date(); return new Date(date.getTime() + 7 * 24 * 60 * 60 * 1000); @@ -91,7 +92,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "2_weeks", - label: "2 weeks", + i18n_label: "notification.snooze_options.2_weeks", value: () => { const date = new Date(); return new Date(date.getTime() + 14 * 24 * 60 * 60 * 1000); @@ -99,7 +100,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "custom", - label: "Custom", + i18n_label: "notification.snooze_options.custom", value: undefined, }, ]; diff --git a/packages/i18n/src/locales/en/translations.json b/packages/i18n/src/locales/en/translations.json index b384741ccc5..cdea03a40fe 100644 --- a/packages/i18n/src/locales/en/translations.json +++ b/packages/i18n/src/locales/en/translations.json @@ -969,6 +969,7 @@ }, "notification": { + "label": "Notifications", "empty_state": { "detail": { "title": "Select to view details." @@ -981,6 +982,23 @@ "title": "No issues assigned", "description": "Updates for issues assigned to you can be \n seen here" } + }, + "tabs": { + "all": "All", + "mentions": "Mentions" + }, + "filter_type_options": { + "assigned_to_me": "Assigned to me", + "created_by_me": "Created by me", + "subscribed_by_me": "Subscribed by me" + }, + "snooze_options": { + "1_day": "1 day", + "3_days": "3 days", + "5_days": "5 days", + "1_week": "1 week", + "2_weeks": "2 weeks", + "custom": "Custom" } }, diff --git a/packages/i18n/src/locales/es/translations.json b/packages/i18n/src/locales/es/translations.json index bb113599164..43aa2d62655 100644 --- a/packages/i18n/src/locales/es/translations.json +++ b/packages/i18n/src/locales/es/translations.json @@ -355,7 +355,7 @@ "description": "Elige tu foto, colores y más.", "cta": "Personalizar ahora" }, - "widgets": { + "widgets": { "title": "Está tranquilo sin widgets, actívalos", "description": "Parece que todos tus widgets están desactivados. ¡Enciéndelos ahora para mejorar tu experiencia!", "primary_button": { @@ -393,16 +393,15 @@ "title": "Enlace no eliminado", "message": "No se pudo eliminar el enlace" } - } }, "recents": { "title": "Recientes", "empty": { - "project": "Tus proyectos recientes aparecerán aquí cuando visites uno.", - "page": "Tus páginas recientes aparecerán aquí cuando visites una.", - "issue": "Tus problemas recientes aparecerán aquí cuando visites uno.", - "default": "Aún no tienes elementos recientes." + "project": "Tus proyectos recientes aparecerán aquí cuando visites uno.", + "page": "Tus páginas recientes aparecerán aquí cuando visites una.", + "issue": "Tus problemas recientes aparecerán aquí cuando visites uno.", + "default": "Aún no tienes elementos recientes." }, "filters": { "all": "Todos los elementos", @@ -429,7 +428,6 @@ "star_us_on_github": "Danos una estrella en GitHub" }, - "link": { "modal": { "url": { @@ -973,6 +971,7 @@ }, "notification": { + "label": "Notificaciones", "empty_state": { "detail": { "title": "Selecciona para ver los detalles." @@ -985,6 +984,23 @@ "title": "No hay problemas asignados", "description": "Las actualizaciones de los problemas asignados a ti se \n pueden ver aquí" } + }, + "tabs": { + "all": "Todas", + "mentions": "Menciones" + }, + "filter_type_options": { + "assigned_to_me": "Asignadas a mí", + "created_by_me": "Creadas por mí", + "subscribed_by_me": "Suscritas por mí" + }, + "snooze_options": { + "1_day": "1 día", + "3_days": "3 días", + "5_days": "5 días", + "1_week": "1 semana", + "2_weeks": "2 semanas", + "custom": "Personalizado" } }, diff --git a/packages/i18n/src/locales/fr/translations.json b/packages/i18n/src/locales/fr/translations.json index 22b11f1dbaf..034f024079b 100644 --- a/packages/i18n/src/locales/fr/translations.json +++ b/packages/i18n/src/locales/fr/translations.json @@ -968,6 +968,7 @@ }, "notification": { + "label": "Notifications", "empty_state": { "detail": { "title": "Sélectionnez pour voir les détails." @@ -980,6 +981,23 @@ "title": "Aucune tâche assignée", "description": "Les mises à jour des problèmes qui vous sont assignés peuvent être \n vues ici." } + }, + "tabs": { + "all": "Toutes", + "mentions": "Mentions" + }, + "filter_type_options": { + "assigned_to_me": "Assignées à moi", + "created_by_me": "Créées par moi", + "subscribed_by_me": "Suivies par moi" + }, + "snooze_options": { + "1_day": "1 jour", + "3_days": "3 jours", + "5_days": "5 jours", + "1_week": "1 semaine", + "2_weeks": "2 semaines", + "custom": "Personnalisé" } }, diff --git a/packages/i18n/src/locales/ja/translations.json b/packages/i18n/src/locales/ja/translations.json index 825f493c622..dd8d0907a96 100644 --- a/packages/i18n/src/locales/ja/translations.json +++ b/packages/i18n/src/locales/ja/translations.json @@ -399,10 +399,10 @@ "recents": { "title": "最近", "empty": { - "project": "プロジェクトを訪問すると、最近のプロジェクトがここに表示されます。", - "page": "ページを訪問すると、最近のページがここに表示されます。", - "issue": "課題を訪問すると、最近の課題がここに表示されます。", - "default": "最近のアイテムはまだありません。" + "project": "プロジェクトを訪問すると、最近のプロジェクトがここに表示されます。", + "page": "ページを訪問すると、最近のページがここに表示されます。", + "issue": "課題を訪問すると、最近の課題がここに表示されます。", + "default": "最近のアイテムはまだありません。" }, "filters": { "all": "すべてのアイテム", @@ -441,7 +441,7 @@ } } }, - + "common": { "all": "すべて", "states": "ステータス", @@ -971,6 +971,7 @@ }, "notification": { + "label": "通知", "empty_state": { "detail": { "title": "詳細を表示するには選択してください。" @@ -983,6 +984,23 @@ "title": "割り当てられた問題はありません", "description": "あなたに割り当てられた問題の更新情報はここで確認できます。" } + }, + "tabs": { + "all": "すべて", + "mentions": "メンション" + }, + "filter_type_options": { + "assigned_to_me": "自分に割り当て", + "created_by_me": "自分が作成", + "subscribed_by_me": "自分が購読" + }, + "snooze_options": { + "1_day": "1日", + "3_days": "3日", + "5_days": "5日", + "1_week": "1週間", + "2_weeks": "2週間", + "custom": "カスタム" } }, diff --git a/packages/i18n/src/locales/zh-CN/translations.json b/packages/i18n/src/locales/zh-CN/translations.json index 6df5251a886..4a6c2c50304 100644 --- a/packages/i18n/src/locales/zh-CN/translations.json +++ b/packages/i18n/src/locales/zh-CN/translations.json @@ -763,5 +763,26 @@ "message": "无法删除便签" } } + }, + + "notification": { + "label": "通知", + "tabs": { + "all": "全部", + "mentions": "提及" + }, + "filter_type_options": { + "assigned_to_me": "分配给我的", + "created_by_me": "我创建的", + "subscribed_by_me": "我订阅的" + }, + "snooze_options": { + "1_day": "1天", + "3_days": "3天", + "5_days": "5天", + "1_week": "1周", + "2_weeks": "2周", + "custom": "自定义" + } } } diff --git a/web/app/[workspaceSlug]/(projects)/notifications/page.tsx b/web/app/[workspaceSlug]/(projects)/notifications/page.tsx index 3074acbf8ce..a056a370a7c 100644 --- a/web/app/[workspaceSlug]/(projects)/notifications/page.tsx +++ b/web/app/[workspaceSlug]/(projects)/notifications/page.tsx @@ -5,6 +5,7 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import useSWR from "swr"; // plane imports +import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // components import { LogoSpinner } from "@/components/common"; @@ -12,7 +13,6 @@ import { PageHead } from "@/components/core"; import { SimpleEmptyState } from "@/components/empty-state"; import { InboxContentRoot } from "@/components/inbox"; import { IssuePeekOverview } from "@/components/issues"; -import { ENotificationLoader, ENotificationQueryParamType } from "@/constants/notification"; // hooks import { useIssueDetail, useUserPermissions, useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; diff --git a/web/ce/components/workspace-notifications/notification-card/root.tsx b/web/ce/components/workspace-notifications/notification-card/root.tsx index bfff113bafe..60d8e5091a8 100644 --- a/web/ce/components/workspace-notifications/notification-card/root.tsx +++ b/web/ce/components/workspace-notifications/notification-card/root.tsx @@ -2,10 +2,11 @@ import { FC } from "react"; import { observer } from "mobx-react"; +// plane imports +import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants"; // components import { NotificationItem } from "@/components/workspace-notifications"; // constants -import { ENotificationLoader, ENotificationQueryParamType } from "@/constants/notification"; // hooks import { useWorkspaceNotifications } from "@/hooks/store"; diff --git a/web/core/components/workspace-notifications/root.tsx b/web/core/components/workspace-notifications/root.tsx index fa17060d593..37623a6137a 100644 --- a/web/core/components/workspace-notifications/root.tsx +++ b/web/core/components/workspace-notifications/root.tsx @@ -3,6 +3,9 @@ import { FC, useCallback } from "react"; import { observer } from "mobx-react"; import { useParams } from "next/navigation"; +// plane imports +import { NOTIFICATION_TABS, TNotificationTab } from "@plane/constants"; +import { useTranslation } from "@plane/i18n"; // components import { Header, Row, ERowVariant, EHeaderVariant, ContentWrapper } from "@plane/ui"; import { CountChip } from "@/components/common"; @@ -12,16 +15,12 @@ import { NotificationSidebarHeader, AppliedFilters, } from "@/components/workspace-notifications"; -// constants -import { NOTIFICATION_TABS, TNotificationTab } from "@/constants/notification"; // helpers import { cn } from "@/helpers/common.helper"; import { getNumberCount } from "@/helpers/string.helper"; // hooks import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; - import { NotificationCardListRoot } from "@/plane-web/components/workspace-notifications"; - export const NotificationsSidebarRoot: FC = observer(() => { const { workspaceSlug } = useParams(); // hooks @@ -34,6 +33,8 @@ export const NotificationsSidebarRoot: FC = observer(() => { currentNotificationTab, setCurrentNotificationTab, } = useWorkspaceNotifications(); + + const { t } = useTranslation(); // derived values const workspace = workspaceSlug ? getWorkspaceBySlug(workspaceSlug.toString()) : undefined; const notificationIds = workspace ? notificationIdsByWorkspaceId(workspace.id) : undefined; @@ -76,7 +77,7 @@ export const NotificationsSidebarRoot: FC = observer(() => { : "text-custom-text-100 hover:text-custom-text-200" )} > -
{tab.label}
+
{t(tab.i18n_label)}
{tab.count(unreadNotificationsCount) > 0 && ( )} diff --git a/web/core/components/workspace-notifications/sidebar/empty-state.tsx b/web/core/components/workspace-notifications/sidebar/empty-state.tsx index 687e0c38c73..b36bc58a516 100644 --- a/web/core/components/workspace-notifications/sidebar/empty-state.tsx +++ b/web/core/components/workspace-notifications/sidebar/empty-state.tsx @@ -2,11 +2,12 @@ import { FC } from "react"; import { observer } from "mobx-react"; +// plane imports +import { ENotificationTab } from "@plane/constants"; // components import { useTranslation } from "@plane/i18n"; import { SimpleEmptyState } from "@/components/empty-state"; // constants -import { ENotificationTab } from "@/constants/notification"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; export const NotificationEmptyState: FC = observer(() => { diff --git a/web/core/components/workspace-notifications/sidebar/filters/applied-filter.tsx b/web/core/components/workspace-notifications/sidebar/filters/applied-filter.tsx index 66c5e3a2ad5..81a090fce41 100644 --- a/web/core/components/workspace-notifications/sidebar/filters/applied-filter.tsx +++ b/web/core/components/workspace-notifications/sidebar/filters/applied-filter.tsx @@ -3,9 +3,10 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { X } from "lucide-react"; -// constants +// plane imports +import { ENotificationFilterType, FILTER_TYPE_OPTIONS } from "@plane/constants"; +import { useTranslation } from "@plane/i18n"; import { Header, EHeaderVariant, Tag } from "@plane/ui"; -import { ENotificationFilterType, FILTER_TYPE_OPTIONS } from "@/constants/notification"; // hooks import { useWorkspaceNotifications } from "@/hooks/store"; @@ -17,6 +18,7 @@ export const AppliedFilters: FC = observer((props) => { const { workspaceSlug } = props; // hooks const { filters, updateFilters } = useWorkspaceNotifications(); + const { t } = useTranslation(); // derived values const isFiltersEnabled = Object.entries(filters.type || {}).some(([, value]) => value); @@ -47,7 +49,7 @@ export const AppliedFilters: FC = observer((props) => { className="flex flex-wrap flex-start" onClick={() => handleFilterTypeChange(filter?.value, !isSelected)} > -
{filter.label}
+
{t(filter.i18n_label)}
diff --git a/web/core/components/workspace-notifications/sidebar/filters/menu/menu-option-item.tsx b/web/core/components/workspace-notifications/sidebar/filters/menu/menu-option-item.tsx index 144ba90fe6a..6fdca559547 100644 --- a/web/core/components/workspace-notifications/sidebar/filters/menu/menu-option-item.tsx +++ b/web/core/components/workspace-notifications/sidebar/filters/menu/menu-option-item.tsx @@ -3,8 +3,8 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { Check } from "lucide-react"; -// constants -import { ENotificationFilterType } from "@/constants/notification"; +// plane imports +import { ENotificationFilterType } from "@plane/constants"; // helpers import { cn } from "@/helpers/common.helper"; // hooks diff --git a/web/core/components/workspace-notifications/sidebar/filters/menu/root.tsx b/web/core/components/workspace-notifications/sidebar/filters/menu/root.tsx index 751ef84469e..61a57a8040b 100644 --- a/web/core/components/workspace-notifications/sidebar/filters/menu/root.tsx +++ b/web/core/components/workspace-notifications/sidebar/filters/menu/root.tsx @@ -3,21 +3,29 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { ListFilter } from "lucide-react"; +// plane imports +import { ENotificationFilterType, FILTER_TYPE_OPTIONS } from "@plane/constants"; +import { useTranslation } from "@plane/i18n"; import { PopoverMenu, Tooltip } from "@plane/ui"; // components import { NotificationFilterOptionItem } from "@/components/workspace-notifications"; // constants -import { ENotificationFilterType, FILTER_TYPE_OPTIONS } from "@/constants/notification"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; export const NotificationFilter: FC = observer(() => { // hooks const { isMobile } = usePlatformOS(); + const { t } = useTranslation(); + + const translatedFilterTypeOptions = FILTER_TYPE_OPTIONS.map((filter) => ({ + ...filter, + label: t(filter.i18n_label), + })); return (
diff --git a/web/core/components/workspace-notifications/sidebar/header/options/root.tsx b/web/core/components/workspace-notifications/sidebar/header/options/root.tsx index 8f2caf152a9..850b472e590 100644 --- a/web/core/components/workspace-notifications/sidebar/header/options/root.tsx +++ b/web/core/components/workspace-notifications/sidebar/header/options/root.tsx @@ -1,12 +1,13 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { CheckCheck, RefreshCw } from "lucide-react"; +// plane imports +import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants"; import { Spinner, Tooltip } from "@plane/ui"; // components import { NotificationFilter, NotificationHeaderMenuOption } from "@/components/workspace-notifications"; // constants import { NOTIFICATIONS_READ } from "@/constants/event-tracker"; -import { ENotificationLoader, ENotificationQueryParamType } from "@/constants/notification"; // hooks import { useEventTracker, useWorkspaceNotifications } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx index e7bed668816..8b34af47709 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx +++ b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx @@ -5,11 +5,11 @@ import { useParams } from "next/navigation"; import { useForm, Controller } from "react-hook-form"; import { X } from "lucide-react"; import { Transition, Dialog } from "@headlessui/react"; +// plane imports +import { allTimeIn30MinutesInterval12HoursFormat } from "@plane/constants"; import { Button, CustomSelect } from "@plane/ui"; // components import { DateDropdown } from "@/components/dropdowns"; -// constants -import { allTimeIn30MinutesInterval12HoursFormat } from "@/constants/notification"; // helpers import { getDate } from "@/helpers/date-time.helper"; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx index 86e22049cc1..6a72e68a7a6 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx +++ b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx @@ -4,11 +4,13 @@ import { Dispatch, FC, Fragment, SetStateAction } from "react"; import { observer } from "mobx-react"; import { Clock } from "lucide-react"; import { Popover, Transition } from "@headlessui/react"; +// plane imports +import { NOTIFICATION_SNOOZE_OPTIONS } from "@plane/constants"; +import { useTranslation } from "@plane/i18n"; import { Tooltip, setToast, TOAST_TYPE } from "@plane/ui"; // components import { NotificationSnoozeModal } from "@/components/workspace-notifications"; -// constants -import { NOTIFICATION_SNOOZE_OPTIONS } from "@/constants/notification"; +// helpers import { cn } from "@/helpers/common.helper"; // hooks import { useWorkspaceNotifications } from "@/hooks/store"; @@ -29,6 +31,7 @@ export const NotificationItemSnoozeOption: FC = o // hooks const { isMobile } = usePlatformOS(); const {} = useWorkspaceNotifications(); + const { t } = useTranslation(); const { asJson: data, snoozeNotification, unSnoozeNotification } = notification; const handleNotificationSnoozeDate = async (snoozeTill: Date | undefined) => { @@ -131,7 +134,7 @@ export const NotificationItemSnoozeOption: FC = o handleDropdownSelect(option.value != undefined ? option.value() : option.value); }} > -
{option?.label}
+
{t(option?.i18n_label)}
))}
diff --git a/web/core/store/notifications/workspace-notifications.store.ts b/web/core/store/notifications/workspace-notifications.store.ts index a0de7bc0f60..5e0edd81601 100644 --- a/web/core/store/notifications/workspace-notifications.store.ts +++ b/web/core/store/notifications/workspace-notifications.store.ts @@ -4,6 +4,8 @@ import set from "lodash/set"; import update from "lodash/update"; import { action, makeObservable, observable, runInAction } from "mobx"; import { computedFn } from "mobx-utils"; +// plane imports +import { ENotificationTab, ENotificationLoader, ENotificationQueryParamType, TNotificationTab } from "@plane/constants"; import { TNotification, TNotificationFilter, @@ -12,13 +14,6 @@ import { TNotificationPaginatedInfoQueryParams, TUnreadNotificationsCount, } from "@plane/types"; -// constants -import { - ENotificationLoader, - ENotificationQueryParamType, - ENotificationTab, - TNotificationTab, -} from "@/constants/notification"; // helpers import { convertToEpoch } from "@/helpers/date-time.helper"; // services From 46fd7aefd5ffd2e3047d91fca1989d0eb69c6877 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Mon, 27 Jan 2025 20:08:48 +0530 Subject: [PATCH 2/2] chore: code refactor --- packages/constants/src/notification.ts | 18 +++++++++--------- packages/i18n/src/locales/en/translations.json | 10 +++++----- packages/i18n/src/locales/es/translations.json | 10 +++++----- packages/i18n/src/locales/fr/translations.json | 10 +++++----- packages/i18n/src/locales/ja/translations.json | 10 +++++----- .../i18n/src/locales/zh-CN/translations.json | 10 +++++----- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/packages/constants/src/notification.ts b/packages/constants/src/notification.ts index 563436c1d8a..cb267c4ad1f 100644 --- a/packages/constants/src/notification.ts +++ b/packages/constants/src/notification.ts @@ -44,15 +44,15 @@ export const NOTIFICATION_TABS = [ export const FILTER_TYPE_OPTIONS = [ { - i18n_label: "notification.filter_type_options.assigned_to_me", + i18n_label: "notification.filter.assigned", value: ENotificationFilterType.ASSIGNED, }, { - i18n_label: "notification.filter_type_options.created_by_me", + i18n_label: "notification.filter.created", value: ENotificationFilterType.CREATED, }, { - i18n_label: "notification.filter_type_options.subscribed_by_me", + i18n_label: "notification.filter.subscribed", value: ENotificationFilterType.SUBSCRIBED, }, ]; @@ -60,7 +60,7 @@ export const FILTER_TYPE_OPTIONS = [ export const NOTIFICATION_SNOOZE_OPTIONS = [ { key: "1_day", - i18n_label: "notification.snooze_options.1_day", + i18n_label: "notification.snooze.1_day", value: () => { const date = new Date(); return new Date(date.getTime() + 24 * 60 * 60 * 1000); @@ -68,7 +68,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "3_days", - i18n_label: "notification.snooze_options.3_days", + i18n_label: "notification.snooze.3_days", value: () => { const date = new Date(); return new Date(date.getTime() + 3 * 24 * 60 * 60 * 1000); @@ -76,7 +76,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "5_days", - i18n_label: "notification.snooze_options.5_days", + i18n_label: "notification.snooze.5_days", value: () => { const date = new Date(); return new Date(date.getTime() + 5 * 24 * 60 * 60 * 1000); @@ -84,7 +84,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "1_week", - i18n_label: "notification.snooze_options.1_week", + i18n_label: "notification.snooze.1_week", value: () => { const date = new Date(); return new Date(date.getTime() + 7 * 24 * 60 * 60 * 1000); @@ -92,7 +92,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "2_weeks", - i18n_label: "notification.snooze_options.2_weeks", + i18n_label: "notification.snooze.2_weeks", value: () => { const date = new Date(); return new Date(date.getTime() + 14 * 24 * 60 * 60 * 1000); @@ -100,7 +100,7 @@ export const NOTIFICATION_SNOOZE_OPTIONS = [ }, { key: "custom", - i18n_label: "notification.snooze_options.custom", + i18n_label: "notification.snooze.custom", value: undefined, }, ]; diff --git a/packages/i18n/src/locales/en/translations.json b/packages/i18n/src/locales/en/translations.json index cdea03a40fe..dce2cd76632 100644 --- a/packages/i18n/src/locales/en/translations.json +++ b/packages/i18n/src/locales/en/translations.json @@ -987,12 +987,12 @@ "all": "All", "mentions": "Mentions" }, - "filter_type_options": { - "assigned_to_me": "Assigned to me", - "created_by_me": "Created by me", - "subscribed_by_me": "Subscribed by me" + "filter": { + "assigned": "Assigned to me", + "created": "Created by me", + "subscribed": "Subscribed by me" }, - "snooze_options": { + "snooze": { "1_day": "1 day", "3_days": "3 days", "5_days": "5 days", diff --git a/packages/i18n/src/locales/es/translations.json b/packages/i18n/src/locales/es/translations.json index 43aa2d62655..c71bd72163b 100644 --- a/packages/i18n/src/locales/es/translations.json +++ b/packages/i18n/src/locales/es/translations.json @@ -989,12 +989,12 @@ "all": "Todas", "mentions": "Menciones" }, - "filter_type_options": { - "assigned_to_me": "Asignadas a mí", - "created_by_me": "Creadas por mí", - "subscribed_by_me": "Suscritas por mí" + "filter": { + "assigned": "Asignadas a mí", + "created": "Creadas por mí", + "subscribed": "Suscritas por mí" }, - "snooze_options": { + "snooze": { "1_day": "1 día", "3_days": "3 días", "5_days": "5 días", diff --git a/packages/i18n/src/locales/fr/translations.json b/packages/i18n/src/locales/fr/translations.json index 034f024079b..1e35db43a5f 100644 --- a/packages/i18n/src/locales/fr/translations.json +++ b/packages/i18n/src/locales/fr/translations.json @@ -986,12 +986,12 @@ "all": "Toutes", "mentions": "Mentions" }, - "filter_type_options": { - "assigned_to_me": "Assignées à moi", - "created_by_me": "Créées par moi", - "subscribed_by_me": "Suivies par moi" + "filter": { + "assigned": "Assignées à moi", + "created": "Créées par moi", + "subscribed": "Suivies par moi" }, - "snooze_options": { + "snooze": { "1_day": "1 jour", "3_days": "3 jours", "5_days": "5 jours", diff --git a/packages/i18n/src/locales/ja/translations.json b/packages/i18n/src/locales/ja/translations.json index dd8d0907a96..ecc3ff31edd 100644 --- a/packages/i18n/src/locales/ja/translations.json +++ b/packages/i18n/src/locales/ja/translations.json @@ -989,12 +989,12 @@ "all": "すべて", "mentions": "メンション" }, - "filter_type_options": { - "assigned_to_me": "自分に割り当て", - "created_by_me": "自分が作成", - "subscribed_by_me": "自分が購読" + "filter": { + "assigned": "自分に割り当て", + "created": "自分が作成", + "subscribed": "自分が購読" }, - "snooze_options": { + "snooze": { "1_day": "1日", "3_days": "3日", "5_days": "5日", diff --git a/packages/i18n/src/locales/zh-CN/translations.json b/packages/i18n/src/locales/zh-CN/translations.json index 4a6c2c50304..d8f5dcf7ef6 100644 --- a/packages/i18n/src/locales/zh-CN/translations.json +++ b/packages/i18n/src/locales/zh-CN/translations.json @@ -771,12 +771,12 @@ "all": "全部", "mentions": "提及" }, - "filter_type_options": { - "assigned_to_me": "分配给我的", - "created_by_me": "我创建的", - "subscribed_by_me": "我订阅的" + "filter": { + "assigned": "分配给我的", + "created": "我创建的", + "subscribed": "我订阅的" }, - "snooze_options": { + "snooze": { "1_day": "1天", "3_days": "3天", "5_days": "5天",