mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 09:51:13 -05:00
feat: Make Novu settings public
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user