Skip to content

Commit f04ee31

Browse files
committed
feat: ln support for notifications
1 parent 03e44f2 commit f04ee31

File tree

11 files changed

+72
-23
lines changed

11 files changed

+72
-23
lines changed

packages/i18n/src/locales/en/translations.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@
505505
"desc": "Descending"
506506
},
507507
"comments": "Comments",
508-
"updates": "Updates"
508+
"updates": "Updates",
509+
"clear_all": "Clear all"
509510
},
510511

511512
"form": {
@@ -1063,7 +1064,30 @@
10631064
},
10641065

10651066
"notification": {
1066-
"label": "Notifications",
1067+
"label": "Inbox",
1068+
"page_label": "{workspace} - Inbox",
1069+
"options": {
1070+
"mark_all_as_read": "Mark all as read",
1071+
"mark_read": "Mark as read",
1072+
"mark_unread": "Mark as unread",
1073+
"refresh": "Refresh",
1074+
"filters": "Inbox Filters",
1075+
"show_unread": "Show unread",
1076+
"show_snoozed": "Show snoozed",
1077+
"show_archived": "Show archived",
1078+
"mark_archive": "Archive",
1079+
"mark_unarchive": "Un archive",
1080+
"mark_snooze": "Snooze",
1081+
"mark_unsnooze": "Un snooze"
1082+
},
1083+
"toasts": {
1084+
"read": "Notification marked as read",
1085+
"unread": "Notification marked as unread",
1086+
"archived": "Notification marked as archived",
1087+
"unarchived": "Notification marked as un archived",
1088+
"snoozed": "Notification snoozed",
1089+
"unsnoozed": "Notification un snoozed"
1090+
},
10671091
"empty_state": {
10681092
"detail": {
10691093
"title": "Select to view details."

web/app/[workspaceSlug]/(projects)/notifications/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ const WorkspaceDashboardPage = observer(() => {
3434
const { fetchUserProjectInfo } = useUserPermissions();
3535
const { setPeekIssue } = useIssueDetail();
3636
// derived values
37-
const pageTitle = currentWorkspace?.name ? `${currentWorkspace?.name} - Inbox` : undefined;
37+
const pageTitle = currentWorkspace?.name
38+
? t("notification.page_label", { workspace: currentWorkspace?.name })
39+
: undefined;
3840
const { workspace_slug, project_id, issue_id, is_inbox_issue } =
3941
notificationLiteByNotificationId(currentSelectedNotificationId);
4042
const resolvedPath = useResolvedAssetPath({ basePath: "/empty-state/intake/issue-detail" });

web/ce/components/workspace-notifications/notification-card/root.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { observer } from "mobx-react";
55
// plane imports
66
import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants";
77
// components
8+
import { useTranslation } from "@plane/i18n";
89
import { NotificationItem } from "@/components/workspace-notifications";
910
// constants
1011
// hooks
@@ -20,6 +21,7 @@ export const NotificationCardListRoot: FC<TNotificationCardListRoot> = observer(
2021
// hooks
2122
const { loader, paginationInfo, getNotifications, notificationIdsByWorkspaceId } = useWorkspaceNotifications();
2223
const notificationIds = notificationIdsByWorkspaceId(workspaceId);
24+
const { t } = useTranslation();
2325

2426
const getNextNotifications = async () => {
2527
try {
@@ -41,12 +43,12 @@ export const NotificationCardListRoot: FC<TNotificationCardListRoot> = observer(
4143
<>
4244
{loader === ENotificationLoader.PAGINATION_LOADER ? (
4345
<div className="py-4 flex justify-center items-center text-sm font-medium">
44-
<div className="text-custom-primary-90">Loading...</div>
46+
<div className="text-custom-primary-90">{t("loading")}...</div>
4547
</div>
4648
) : (
4749
<div className="py-4 flex justify-center items-center text-sm font-medium" onClick={getNextNotifications}>
4850
<div className="text-custom-primary-90 hover:text-custom-primary-100 transition-all cursor-pointer">
49-
Load more
51+
{t("load_more")}
5052
</div>
5153
</div>
5254
)}

web/core/components/workspace-notifications/sidebar/filters/applied-filter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const AppliedFilters: FC<TAppliedFilters> = observer((props) => {
5858
})}
5959
<button type="button" onClick={handleClearFilters}>
6060
<Tag>
61-
Clear all
61+
{t("common.clear_all")}
6262
<X size={12} strokeWidth={2} />
6363
</Tag>
6464
</button>

web/core/components/workspace-notifications/sidebar/filters/menu/root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const NotificationFilter: FC = observer(() => {
2727
<PopoverMenu
2828
data={translatedFilterTypeOptions}
2929
button={
30-
<Tooltip tooltipContent="Inbox Filters" isMobile={isMobile} position="bottom">
30+
<Tooltip tooltipContent={t("notification.options.filters")} isMobile={isMobile} position="bottom">
3131
<div className="flex-shrink-0 w-5 h-5 flex justify-center items-center overflow-hidden cursor-pointer transition-all hover:bg-custom-background-80 rounded-sm outline-none">
3232
<ListFilter className="h-3 w-3" />
3333
</div>

web/core/components/workspace-notifications/sidebar/header/options/menu-option/root.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { FC, ReactNode } from "react";
44
import { observer } from "mobx-react";
55
import { Check, CheckCircle, Clock } from "lucide-react";
6+
import { useTranslation } from "@plane/i18n";
67
import { TNotificationFilter } from "@plane/types";
78
import { ArchiveIcon, PopoverMenu } from "@plane/ui";
89
// components
@@ -24,6 +25,7 @@ export type TPopoverMenuOptions = {
2425
export const NotificationHeaderMenuOption = observer(() => {
2526
// hooks
2627
const { filters, updateFilters, updateBulkFilters } = useWorkspaceNotifications();
28+
const { t } = useTranslation();
2729

2830
const handleFilterChange = (filterType: keyof TNotificationFilter, filterValue: boolean) =>
2931
updateFilters(filterType, filterValue);
@@ -34,7 +36,7 @@ export const NotificationHeaderMenuOption = observer(() => {
3436
{
3537
key: "menu-unread",
3638
type: "menu-item",
37-
label: "Show unread",
39+
label: t("notification.options.show_unread"),
3840
isActive: filters?.read,
3941
prependIcon: <CheckCircle className="flex-shrink-0 h-3 w-3" />,
4042
appendIcon: filters?.read ? <Check className="w-3 h-3" /> : undefined,
@@ -43,7 +45,7 @@ export const NotificationHeaderMenuOption = observer(() => {
4345
{
4446
key: "menu-archived",
4547
type: "menu-item",
46-
label: "Show archived",
48+
label: t("notification.options.show_archived"),
4749
isActive: filters?.archived,
4850
prependIcon: <ArchiveIcon className="flex-shrink-0 h-3 w-3" />,
4951
appendIcon: filters?.archived ? <Check className="w-3 h-3" /> : undefined,
@@ -56,7 +58,7 @@ export const NotificationHeaderMenuOption = observer(() => {
5658
{
5759
key: "menu-snoozed",
5860
type: "menu-item",
59-
label: "Show snoozed",
61+
label: t("notification.options.show_snoozed"),
6062
isActive: filters?.snoozed,
6163
prependIcon: <Clock className="flex-shrink-0 h-3 w-3" />,
6264
appendIcon: filters?.snoozed ? <Check className="w-3 h-3" /> : undefined,

web/core/components/workspace-notifications/sidebar/header/options/root.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { observer } from "mobx-react";
33
import { CheckCheck, RefreshCw } from "lucide-react";
44
// plane imports
55
import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants";
6+
import { useTranslation } from "@plane/i18n";
67
import { Spinner, Tooltip } from "@plane/ui";
78
// components
89
import { NotificationFilter, NotificationHeaderMenuOption } from "@/components/workspace-notifications";
@@ -22,6 +23,7 @@ export const NotificationSidebarHeaderOptions: FC<TNotificationSidebarHeaderOpti
2223
const { isMobile } = usePlatformOS();
2324
const { loader, getNotifications, markAllNotificationsAsRead } = useWorkspaceNotifications();
2425
const { captureEvent } = useEventTracker();
26+
const { t } = useTranslation();
2527

2628
const refreshNotifications = async () => {
2729
if (loader) return;
@@ -45,7 +47,7 @@ export const NotificationSidebarHeaderOptions: FC<TNotificationSidebarHeaderOpti
4547
return (
4648
<div className="relative flex justify-center items-center gap-2 text-sm">
4749
{/* mark all notifications as read*/}
48-
<Tooltip tooltipContent="Mark all as read" isMobile={isMobile} position="bottom">
50+
<Tooltip tooltipContent={t("notification.options.mark_all_as_read")} isMobile={isMobile} position="bottom">
4951
<div
5052
className="flex-shrink-0 w-5 h-5 flex justify-center items-center overflow-hidden cursor-pointer transition-all hover:bg-custom-background-80 rounded-sm"
5153
onClick={() => {
@@ -62,7 +64,7 @@ export const NotificationSidebarHeaderOptions: FC<TNotificationSidebarHeaderOpti
6264
</Tooltip>
6365

6466
{/* refetch current notifications */}
65-
<Tooltip tooltipContent="Refresh" isMobile={isMobile} position="bottom">
67+
<Tooltip tooltipContent={t("notification.options.refresh")} isMobile={isMobile} position="bottom">
6668
<div
6769
className="flex-shrink-0 w-5 h-5 flex justify-center items-center overflow-hidden cursor-pointer transition-all hover:bg-custom-background-80 rounded-sm"
6870
onClick={refreshNotifications}

web/core/components/workspace-notifications/sidebar/header/root.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { FC } from "react";
44
import { observer } from "mobx-react";
55
import { Inbox } from "lucide-react";
6+
import { useTranslation } from "@plane/i18n";
67
import { Breadcrumbs, Header } from "@plane/ui";
78
// components
89
import { BreadcrumbLink } from "@/components/common";
@@ -15,6 +16,7 @@ type TNotificationSidebarHeader = {
1516

1617
export const NotificationSidebarHeader: FC<TNotificationSidebarHeader> = observer((props) => {
1718
const { workspaceSlug } = props;
19+
const { t } = useTranslation();
1820

1921
if (!workspaceSlug) return <></>;
2022
return (
@@ -27,7 +29,11 @@ export const NotificationSidebarHeader: FC<TNotificationSidebarHeader> = observe
2729
<Breadcrumbs.BreadcrumbItem
2830
type="text"
2931
link={
30-
<BreadcrumbLink label="Inbox" icon={<Inbox className="h-4 w-4 text-custom-text-300" />} disableTooltip />
32+
<BreadcrumbLink
33+
label={t("notification.label")}
34+
icon={<Inbox className="h-4 w-4 text-custom-text-300" />}
35+
disableTooltip
36+
/>
3137
}
3238
/>
3339
</Breadcrumbs>

web/core/components/workspace-notifications/sidebar/notification-card/options/archive.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { FC } from "react";
44
import { observer } from "mobx-react";
55
import { ArchiveRestore } from "lucide-react";
6+
import { useTranslation } from "@plane/i18n";
67
import { ArchiveIcon, TOAST_TYPE, setToast } from "@plane/ui";
78
// components
89
import { NotificationItemOptionButton } from "@/components/workspace-notifications";
@@ -24,6 +25,7 @@ export const NotificationItemArchiveOption: FC<TNotificationItemArchiveOption> =
2425
const { captureEvent } = useEventTracker();
2526
const { currentNotificationTab } = useWorkspaceNotifications();
2627
const { asJson: data, archiveNotification, unArchiveNotification } = notification;
28+
const { t } = useTranslation();
2729

2830
const handleNotificationUpdate = async () => {
2931
try {
@@ -35,7 +37,7 @@ export const NotificationItemArchiveOption: FC<TNotificationItemArchiveOption> =
3537
state: "SUCCESS",
3638
});
3739
setToast({
38-
title: data.archived_at ? "Notification un-archived" : "Notification archived",
40+
title: data.archived_at ? t("notification.toasts.unarchived") : t("notification.toasts.archived"),
3941
type: TOAST_TYPE.SUCCESS,
4042
});
4143
} catch (e) {
@@ -45,7 +47,9 @@ export const NotificationItemArchiveOption: FC<TNotificationItemArchiveOption> =
4547

4648
return (
4749
<NotificationItemOptionButton
48-
tooltipContent={data.archived_at ? "Un archive" : "Archive"}
50+
tooltipContent={
51+
data.archived_at ? t("notification.options.mark_unarchive") : t("notification.options.mark_archive")
52+
}
4953
callBack={handleNotificationUpdate}
5054
>
5155
{data.archived_at ? (

web/core/components/workspace-notifications/sidebar/notification-card/options/read.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { FC } from "react";
44
import { observer } from "mobx-react";
55
import { MessageSquare } from "lucide-react";
6+
import { useTranslation } from "@plane/i18n";
67
import { TOAST_TYPE, setToast } from "@plane/ui";
78
// components
89
import { NotificationItemOptionButton } from "@/components/workspace-notifications";
@@ -24,6 +25,7 @@ export const NotificationItemReadOption: FC<TNotificationItemReadOption> = obser
2425
const { captureEvent } = useEventTracker();
2526
const { currentNotificationTab } = useWorkspaceNotifications();
2627
const { asJson: data, markNotificationAsRead, markNotificationAsUnRead } = notification;
28+
const { t } = useTranslation();
2729

2830
const handleNotificationUpdate = async () => {
2931
try {
@@ -35,7 +37,7 @@ export const NotificationItemReadOption: FC<TNotificationItemReadOption> = obser
3537
state: "SUCCESS",
3638
});
3739
setToast({
38-
title: data.read_at ? "Notification marked as unread" : "Notification marked as read",
40+
title: data.read_at ? t("notification.toasts.unread") : t("notification.toasts.read"),
3941
type: TOAST_TYPE.SUCCESS,
4042
});
4143
} catch (e) {
@@ -45,7 +47,7 @@ export const NotificationItemReadOption: FC<TNotificationItemReadOption> = obser
4547

4648
return (
4749
<NotificationItemOptionButton
48-
tooltipContent={data.read_at ? "Mark as unread" : "Mark as read"}
50+
tooltipContent={data.read_at ? t("notification.options.mark_unread") : t("notification.options.mark_read")}
4951
callBack={handleNotificationUpdate}
5052
>
5153
<MessageSquare className="h-3 w-3 text-custom-text-300" />

0 commit comments

Comments
 (0)