feat: Make Novu settings public

This commit is contained in:
gpt-engineer-app[bot]
2025-10-01 14:52:03 +00:00
parent b52d326f7b
commit ac543e82e9
4 changed files with 50 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import { useAuth } from "@/hooks/useAuth";
import { usePublicNovuSettings } from "@/hooks/usePublicNovuSettings";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
@@ -37,6 +38,7 @@ interface NotificationTemplate {
export function NotificationsTab() {
const { user } = useAuth();
const { isEnabled: isNovuEnabled, isLoading: isNovuLoading } = usePublicNovuSettings();
const [loading, setLoading] = useState(true);
const [templates, setTemplates] = useState<NotificationTemplate[]>([]);
const [channelPreferences, setChannelPreferences] = useState<ChannelPreferences>({
@@ -50,7 +52,6 @@ export function NotificationsTab() {
digest: 'daily',
max_per_hour: 10,
});
const isNovuEnabled = notificationService.isEnabled();
useEffect(() => {
if (user) {
@@ -168,16 +169,22 @@ export function NotificationsTab() {
return (
<div className="space-y-6">
{!isNovuEnabled && (
{isNovuLoading ? (
<Card>
<CardHeader>
<CardDescription>Loading notification settings...</CardDescription>
</CardHeader>
</Card>
) : !isNovuEnabled ? (
<Card className="border-yellow-500/50 bg-yellow-500/10">
<CardHeader>
<CardTitle className="text-yellow-600 dark:text-yellow-400">Novu Not Configured</CardTitle>
<CardDescription>
Novu notifications are not configured. To enable advanced notifications, add your Novu Application Identifier to the environment variables.
Novu notifications are not configured. Contact an administrator to configure the Novu Application Identifier in admin settings.
</CardDescription>
</CardHeader>
</Card>
)}
) : null}
<Card>
<CardHeader>