diff --git a/src/dict/settings-pages-dict.ts b/src/dict/settings-pages-dict.ts index 0d1f8a2..86bba89 100644 --- a/src/dict/settings-pages-dict.ts +++ b/src/dict/settings-pages-dict.ts @@ -1,5 +1,4 @@ import { - Bell, BookOpen, Bot, CpuAi, @@ -47,11 +46,6 @@ export const SettingsPages: SettingsPage[] = [ Icon: SlidersHorizontal, }, { title: "Profile", url: "/admin/settings/profile", Icon: UserRound }, - { - title: "Notifications", - url: "/admin/settings/notifications", - Icon: Bell, - }, { title: "Change password", url: "/admin/settings/change-password", diff --git a/src/pages/admin/settings/notifications/(partials)/notification-device-row.tsx b/src/pages/admin/settings/general/(partials)/notification-device-row.tsx similarity index 100% rename from src/pages/admin/settings/notifications/(partials)/notification-device-row.tsx rename to src/pages/admin/settings/general/(partials)/notification-device-row.tsx diff --git a/src/pages/admin/settings/notifications/(partials)/notifications-device-group.tsx b/src/pages/admin/settings/general/(partials)/notifications-device-group.tsx similarity index 100% rename from src/pages/admin/settings/notifications/(partials)/notifications-device-group.tsx rename to src/pages/admin/settings/general/(partials)/notifications-device-group.tsx diff --git a/src/pages/admin/settings/notifications/(partials)/notifications-devices-group.tsx b/src/pages/admin/settings/general/(partials)/notifications-devices-group.tsx similarity index 100% rename from src/pages/admin/settings/notifications/(partials)/notifications-devices-group.tsx rename to src/pages/admin/settings/general/(partials)/notifications-devices-group.tsx diff --git a/src/pages/admin/settings/notifications/(sections)/notifications-section.tsx b/src/pages/admin/settings/general/(sections)/notifications-section.tsx similarity index 100% rename from src/pages/admin/settings/notifications/(sections)/notifications-section.tsx rename to src/pages/admin/settings/general/(sections)/notifications-section.tsx diff --git a/src/pages/admin/settings/general/index.server.ts b/src/pages/admin/settings/general/index.server.ts index a4139c7..ae14297 100644 --- a/src/pages/admin/settings/general/index.server.ts +++ b/src/pages/admin/settings/general/index.server.ts @@ -1,7 +1,27 @@ import type { PagePropsType } from "@/src/types"; import type { BunextPageServerFn } from "@moduletrace/bunext/types"; +import grabPushOverview from "@/src/functions/backend/db/push/grab-push-overview"; +import { ensureVapidKeys } from "@/src/push/vapid"; import grabSettingsServerProps from "../(functions)/grab-settings-server-props"; +/** + * The General page: app appearance and behavior, plus this user's + * notification devices and the public key a new device subscribes with. + */ export const server: BunextPageServerFn = async (params) => { - return await grabSettingsServerProps(params); + const settings = await grabSettingsServerProps(params); + + if (!settings.props?.person?.id) return settings; + + const keys = await ensureVapidKeys().catch(() => null); + + return { + props: { + ...settings.props, + push_overview: await grabPushOverview({ + user_id: settings.props.person.id, + public_key: keys?.public_key || null, + }), + }, + }; }; diff --git a/src/pages/admin/settings/general/index.tsx b/src/pages/admin/settings/general/index.tsx index e67b20e..db80572 100644 --- a/src/pages/admin/settings/general/index.tsx +++ b/src/pages/admin/settings/general/index.tsx @@ -1,4 +1,5 @@ import AppearanceSection from "./(sections)/appearance-section"; +import NotificationsSection from "./(sections)/notifications-section"; import PromptSection from "./(sections)/prompt-section"; import StorageSection from "./(sections)/storage-section"; import VersionSection from "./(sections)/version-section"; @@ -12,6 +13,7 @@ export default function AdminSettingsGeneralPage() { description="How the app looks and behaves." > + diff --git a/src/pages/admin/settings/notifications/index.server.ts b/src/pages/admin/settings/notifications/index.server.ts deleted file mode 100644 index c0f6a5c..0000000 --- a/src/pages/admin/settings/notifications/index.server.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { PagePropsType } from "@/src/types"; -import type { BunextPageServerFn } from "@moduletrace/bunext/types"; -import grabPushOverview from "@/src/functions/backend/db/push/grab-push-overview"; -import { ensureVapidKeys } from "@/src/push/vapid"; -import grabSettingsServerProps from "../(functions)/grab-settings-server-props"; - -/** - * The Notifications page: this user's devices and the public key a new - * device subscribes with. - */ -export const server: BunextPageServerFn = async (params) => { - const settings = await grabSettingsServerProps(params); - - if (!settings.props?.person?.id) return settings; - - const keys = await ensureVapidKeys().catch(() => null); - - return { - props: { - ...settings.props, - push_overview: await grabPushOverview({ - user_id: settings.props.person.id, - public_key: keys?.public_key || null, - }), - }, - }; -}; diff --git a/src/pages/admin/settings/notifications/index.tsx b/src/pages/admin/settings/notifications/index.tsx deleted file mode 100644 index 5998034..0000000 --- a/src/pages/admin/settings/notifications/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import NotificationsSection from "./(sections)/notifications-section"; -import SettingsShell from "../(partials)/settings-shell"; -import settingsPageMeta from "../(functions)/settings-page-meta"; - -export default function AdminSettingsNotificationsPage() { - return ( - - - - ); -} - -export const meta = settingsPageMeta({ label: "Notifications" }); diff --git a/src/pages/api/admin/push/test.ts b/src/pages/api/admin/push/test.ts index 5f0230d..e0b24d9 100644 --- a/src/pages/api/admin/push/test.ts +++ b/src/pages/api/admin/push/test.ts @@ -42,7 +42,7 @@ export const handler: BunextAPIRouteHandler = async ({ payload: { title: `${SiteData["SiteName"]} notifications are on`, body: "This is what a bot's message will look like.", - url: "/admin/settings/notifications", + url: "/admin/settings/general", tag: "cobble-test", }, });