mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 08:02:12 +00:00
Mood has been a first-class module here for a long time, with entries,
structured tags, rated factors and notes. The bridge to the external moodLog
service had nothing left to add, and its Settings card was withdrawn in
a56e6fe61 on the promise of a dedicated removal. This delivers it.
Removed: the hourly `moodlog-sync` queue, cron and handler binding; the
inbound webhook and its shared-secret handling; the reverse push and its four
call sites; the pull-sync module; the per-user credential routes and the
instance-wide toggle; the entry on the `/api/integrations/status` envelope,
the `IntegrationKey` union, the cadence map and the display-name table; the
boot-time secret rotation pass; 22 message keys per locale.
Migration 0271 drops the five `users` credential columns and
`app_settings.mood_log_global`, clears the ledger row for the provider, and
deletes the retired pg-boss schedule so no cron keeps enqueuing work no
handler drains.
Mood data is untouched. `mood_entries` is not named anywhere in the migration
and cannot be reached from it: the dropped columns carry no index, constraint
or foreign key, and `mood_entries.user_id` references `users(id)`, not any of
them. Rows the bridge imported keep `source = 'MOODLOG'`, and every read path
- list filter, source badge, exports, backups - still resolves that value.
`src/lib/validations/moodlog.ts` held the native mood-entry schemas alongside
the bridge's own; it is now `validations/mood.ts` and carries only the former.
87 lines
3.2 KiB
TypeScript
87 lines
3.2 KiB
TypeScript
"use client";
|
|
|
|
/**
|
|
* `<NotificationChannelsPanel>` — the delivery-provider half of Settings →
|
|
* Integrations.
|
|
*
|
|
* v1.18.0 (S3) — the notification CHANNELS (Telegram / ntfy / Web Push /
|
|
* Webhook / Email, plus the live per-channel status surface) moved out of
|
|
* Settings → Notifications and into Integrations. Channels are delivery
|
|
* providers — the same conceptual family as Withings / WHOOP / a connected
|
|
* device — not notification preferences. The reminder-TYPE content (which
|
|
* events fire) stays under Settings → Reminders / Notifications.
|
|
*
|
|
* Renders inside the Integrations "Channels" sub-tab. Owns no page header of
|
|
* its own; the parent section supplies it.
|
|
*/
|
|
|
|
import { useQuery } from "@tanstack/react-query";
|
|
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
import { queryKeys } from "@/lib/query-keys";
|
|
import { NotificationStatusCard } from "@/components/settings/notification-status-card";
|
|
import { NtfyCard } from "@/components/settings/ntfy-card";
|
|
import { TelegramCard } from "@/components/settings/telegram-card";
|
|
import { WebPushCard } from "@/components/settings/web-push-card";
|
|
import { WebhookCard } from "@/components/settings/webhook-card";
|
|
import { EmailCard } from "@/components/settings/email-card";
|
|
import { apiGet } from "@/lib/api/api-fetch";
|
|
|
|
interface GlobalServiceAvailability {
|
|
telegramGlobal: boolean;
|
|
ntfyGlobal: boolean;
|
|
webPushGlobal: boolean;
|
|
apiGlobal: boolean;
|
|
}
|
|
|
|
export function NotificationChannelsPanel() {
|
|
const { isAuthenticated } = useAuth();
|
|
|
|
const { data: globalServices } = useQuery({
|
|
queryKey: queryKeys.settingsGlobalServices(),
|
|
queryFn: async () => {
|
|
return apiGet<GlobalServiceAvailability>("/api/settings/global-services");
|
|
},
|
|
enabled: isAuthenticated,
|
|
});
|
|
|
|
const showTelegram = globalServices?.telegramGlobal ?? true;
|
|
const showNtfy = globalServices?.ntfyGlobal ?? true;
|
|
const showWebPush = globalServices?.webPushGlobal ?? true;
|
|
|
|
return (
|
|
<div className="space-y-6" data-slot="notification-channels-panel">
|
|
<NotificationStatusCard />
|
|
|
|
{/* v1.4.27 MB3 — `scroll-mt-28` keeps each channel card's anchor
|
|
target below the safe-area sticky page header when the user lands
|
|
on `/settings/integrations#telegram` or similar. */}
|
|
{showTelegram && (
|
|
<div id="telegram" className="scroll-mt-28">
|
|
<TelegramCard isAuthenticated={isAuthenticated} />
|
|
</div>
|
|
)}
|
|
{showNtfy && (
|
|
<div id="ntfy" className="scroll-mt-28">
|
|
<NtfyCard isAuthenticated={isAuthenticated} />
|
|
</div>
|
|
)}
|
|
{showWebPush && (
|
|
<div id="web-push" className="scroll-mt-28">
|
|
<WebPushCard />
|
|
</div>
|
|
)}
|
|
{/* v1.17.1 — generic outbound webhook (Gotify / Discord / Slack /
|
|
Matrix / Home Assistant in one channel). */}
|
|
<div id="webhook" className="scroll-mt-28">
|
|
<WebhookCard isAuthenticated={isAuthenticated} />
|
|
</div>
|
|
{/* v1.17.1 — SMTP / email. The card hides itself when the operator
|
|
hasn't configured SMTP_* env, so it never shows a dead toggle. */}
|
|
<div id="email" className="scroll-mt-28">
|
|
<EmailCard isAuthenticated={isAuthenticated} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|