Skip to content

Instantly share code, notes, and snippets.

@waldothedeveloper
Created May 25, 2023 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waldothedeveloper/f367b5d16ee55c81e8ee98d904291b6a to your computer and use it in GitHub Desktop.
Save waldothedeveloper/f367b5d16ee55c81e8ee98d904291b6a to your computer and use it in GitHub Desktop.
configuring the novu notification center
import {
NotificationBell,
NovuProvider,
PopoverNotificationCenter,
} from "@novu/notification-center";
import { novuSubscriberId } from "@/utils/novuSubscriberId";
const appIdentified =
process.env.NODE_ENV === "development"
? process.env.NEXT_PUBLIC_DEVELOPMENT_applicationIdentifier
: process.env.NEXT_PUBLIC_PRODUCTION_applicationIdentifier;
//
export const NovuNotificationsCenter = () => {
// your logic to handle the notification click
function onNotificationClick(message) {
return message;
}
return (
<NovuProvider
// TODO: check how to change this
styles={{
root: {
bellButton: {
":firstChild": {
width: "12px !important",
height: "12px !important",
},
},
},
}}
stores={[
{ storeId: "mensajes", query: { feedIdentifier: "mensajes" } },
{ storeId: "general", query: { feedIdentifier: "general" } },
]}
subscriberId={novuSubscriberId}
applicationIdentifier={appIdentified}
initialFetchingStrategy={{
fetchNotifications: true,
}}
i18n={"es"}
>
<PopoverNotificationCenter
tabs={[
{ name: "Mensajes", storeId: "mensajes" },
{ name: "General", storeId: "general" },
]}
showUserPreferences={false}
colorScheme={"light"}
onNotificationClick={onNotificationClick}
>
{({ unseenCount }) => <NotificationBell unseenCount={unseenCount} />}
</PopoverNotificationCenter>
</NovuProvider>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment