Skip to content

Commit

Permalink
feat:Novu provider & novu notification initialize (#1315)
Browse files Browse the repository at this point in the history
  • Loading branch information
ertugrulcan-ays authored Feb 26, 2025
2 parents 859917c + 83787c6 commit e4c2dd3
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 273 deletions.
14 changes: 6 additions & 8 deletions apps/web/src/app/[lang]/(main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {Policy} from "@repo/utils/policies";
import {LogOut} from "lucide-react";
import {isRedirectError} from "next/dist/client/components/redirect";
import ErrorComponent from "@repo/ui/components/error-component";
import {Novu} from "@/utils/navbar/notification";
import {myProfileApi} from "@/actions/core/AccountService/actions";
import unirefund from "public/unirefund.png";
import {getResourceData} from "src/language-data/core/AbpUiNavigation";
Expand Down Expand Up @@ -73,13 +72,12 @@ export default async function Layout({children, params}: LayoutProps) {
lang={lang}
logo={logo}
navbarItems={navbarFromDB}
notification={
<Novu
appId={process.env.NOVU_APP_IDENTIFIER || ""}
appUrl={process.env.NOVU_APP_URL || ""}
subscriberId={session?.user?.novuSubscriberId || ""}
/>
}
notification={{
langugageData: languageData,
appUrl: process.env.NOVU_APP_URL || "",
appId: process.env.NOVU_APP_IDENTIFIER || "",
subscriberId: session?.user?.sub || "67b8674f58411ad400a054e9",
}}
prefix=""
profileMenu={profileMenuProps}
tenantData={undefined}
Expand Down
21 changes: 20 additions & 1 deletion apps/web/src/language-data/core/Default/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,24 @@
"Form.personalSummaries.religiousAffiliationName": "Religion",
"Form.personalSummaries.genderTypeCode": "Gender",
"Form.personalSummaries.genderTypeCode.male": "Male",
"Form.personalSummaries.genderTypeCode.female": "Female"
"Form.personalSummaries.genderTypeCode.female": "Female",

"inbox.filters.dropdownOptions.unread": "Unread only",
"inbox.filters.dropdownOptions.default": "Unread & read",
"inbox.filters.dropdownOptions.archived": "Archived",
"inbox.filters.labels.unread": "Unread",
"inbox.filters.labels.default": "Inbox",
"inbox.filters.labels.archived": "Archived",
"notifications.emptyNotice": "No notifications",
"notifications.actions.readAll": "Mark all as read",
"notifications.actions.archiveAll": "Archive all",
"notifications.actions.archiveRead": "Archive read",
"notification.actions.read.tooltip": "Mark as read",
"notification.actions.unread.tooltip": "Mark as unread",
"notification.actions.archive.tooltip": "Archive",
"notification.actions.unarchive.tooltip": "Unarchive",
"preferences.title": "Notification Preferences",
"preferences.global": "Global Preferences",
"preferences.workflow.disabled.notice": "Contact admin to enable subscription management for this critical notification.",
"preferences.workflow.disabled.tooltip": "Contact admin to edit"
}
21 changes: 20 additions & 1 deletion apps/web/src/language-data/core/Default/resources/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,24 @@
"Form.personalSummaries.religiousAffiliationName": "Din",
"Form.personalSummaries.genderTypeCode": "Cinsiyet",
"Form.personalSummaries.genderTypeCode.male": "Erkek",
"Form.personalSummaries.genderTypeCode.female": "Kadın"
"Form.personalSummaries.genderTypeCode.female": "Kadın",

"inbox.filters.dropdownOptions.unread": "Sadece okunmamış",
"inbox.filters.dropdownOptions.default": "Okunmamış & okunan",
"inbox.filters.dropdownOptions.archived": "Arşivlendi",
"inbox.filters.labels.unread": "Okunmamış",
"inbox.filters.labels.default": "Gelen Kutusu",
"inbox.filters.labels.archived": "Arşivlenmiş",
"notifications.emptyNotice": "Bildirim yok",
"notifications.actions.readAll": "Tümünü okundu olarak işaretle",
"notifications.actions.archiveAll": "Tümünü arşivle",
"notifications.actions.archiveRead": "Okunanları arşivle",
"notification.actions.read.tooltip": "Okundu olarak işaretle",
"notification.actions.unread.tooltip": "Okunmamış olarak işaretle",
"notification.actions.archive.tooltip": "Arşivle",
"notification.actions.unarchive.tooltip": "Arşivden çıkar",
"preferences.title": "Bildirim Tercihleri",
"preferences.global": "Genel Tercihler",
"preferences.workflow.disabled.notice": "Bu kritik bildirim için abonelik yönetimini etkinleştirmek için yöneticiyle iletişime geçin.",
"preferences.workflow.disabled.tooltip": "Düzenlemek için yöneticiyle iletişime geçin"
}
2 changes: 1 addition & 1 deletion apps/web/src/providers/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default async function Providers({children}: ProvidersProps) {
<NovuProvider
appId={process.env.NOVU_APP_IDENTIFIER || ""}
appUrl={process.env.NOVU_APP_URL || ""}
subscriberId={session?.user?.novuSubscriberId || ""}>
subscriberId={session?.user?.sub || "67b8674f58411ad400a054e9"}>
{children}
</NovuProvider>
</GrantedPoliciesProvider>
Expand Down
64 changes: 0 additions & 64 deletions apps/web/src/utils/navbar/notification.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/web/src/utils/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import "@repo/utils/auth";

declare module "@repo/utils/auth" {
interface MyUser {
novuSubscriberId?: string;
sub?: string;
}
}
2 changes: 1 addition & 1 deletion packages/ayasofyazilim-ui
6 changes: 3 additions & 3 deletions packages/ui/src/providers/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { NavbarItemsFromDB, ProfileMenuProps } from "@repo/ui/theme/types";
import { NavbarItemsFromDB, NotificationProps, ProfileMenuProps } from "@repo/ui/theme/types";
import { StaticImport } from "next/dist/shared/lib/get-img-props";
import { createContext, useContext } from "react";

Expand All @@ -14,7 +14,7 @@ interface ThemeProviderProps {
lang: string;
tenantData?: { tenantId: string; tenantName: string };
children: JSX.Element;
notification: JSX.Element;
notification: NotificationProps;
}
interface ThemeContextProps {
appName: string;
Expand All @@ -25,7 +25,7 @@ interface ThemeContextProps {
lang: string;
navbarItems: NavbarItemsFromDB[];
tenantData?: { tenantId: string; tenantName: string };
notification?: JSX.Element;
notification?: NotificationProps
}

const ThemeProviderContext = createContext<ThemeContextProps>({
Expand Down
8 changes: 5 additions & 3 deletions packages/ui/src/theme/main-admin-layout/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import { IdCardIcon } from "@radix-ui/react-icons";
import { Tooltip, TooltipContent, TooltipTrigger } from "@repo/ayasofyazilim-ui/atoms/tooltip";
import { BreadcrumbItemType, NavbarItemsFromDB } from "@repo/ui/theme/types";
import { BreadcrumbItemType, NavbarItemsFromDB, NotificationProps } from "@repo/ui/theme/types";
import { Notification } from "../components/notifications";

import {
BookA,
Box,
Expand Down Expand Up @@ -58,7 +60,7 @@ export default function Navbar({
navbarItems: NavbarItemsFromDB[];
navigation: BreadcrumbItemType[];
tenantData?: { tenantId: string; tenantName: string };
notification?: JSX.Element
notification?: NotificationProps;
}) {
return (
<div className="sticky left-0 right-0 top-0 z-50">
Expand Down Expand Up @@ -88,7 +90,7 @@ export default function Navbar({
<div className="flex items-center lg:order-2">
<SearchBar navbarItems={navbarItems} prefix={prefix} />
<LanguageSelector lang={lang} />
{notification && notification}
{notification && <Notification {...notification} />}
<ProfileMenu />
</div>
</div>
Expand Down
Loading

0 comments on commit e4c2dd3

Please sign in to comment.