Skip to content

Commit a7113cd

Browse files
committed
refactor(site-status): 🔄 remove site status module and related components
- Deleted the `site-status` module, including its routes, screens, and content components. - Updated references in the sidebar navigation and debug sections to remove links to the deleted module. - Introduced a new `SiteOfflineStaffChip` component to manage offline site notifications. - Refactored the debug overview to include site status management.
1 parent 065452a commit a7113cd

22 files changed

Lines changed: 696 additions & 672 deletions

File tree

‎apps/web/content/docs/dev/events/built-in-events.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ cached status is expired.
745745

746746
| Event | Payload | Fires when |
747747
| --------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------- |
748-
| `site.status.updated` | `{ offline, switched, opensAt, changedById }` | An admin saves **AdminCP → System → Site status**: switches the site off or on, or edits its message |
748+
| `site.status.updated` | `{ offline, switched, opensAt, changedById }` | An admin switches the site off or on, or edits its message, in the **Site status** card on **AdminCP → Debug Panel** |
749749

750750
<Accordions>
751751
<Accordion title="site.status.updated">
-95.8 KB
Loading

‎apps/web/content/docs/dev/site-offline-mode.mdx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ Site offline mode swaps the public site for a "We'll be right back" page while y
1616

1717
<Step>
1818

19-
### Open the site status page
19+
### Open the site status card
2020

21-
Go to **AdminCP → System → Site status**. You need the **Site status → View** staff permission to see the page and **Manage** to change it.
21+
Go to **AdminCP → Debug Panel**. The **Site status** card sits at the top of **Overview**. To see it you need two staff permissions, **Debug Panel → View debug panel** and **Site status → View**. Changing it takes **Site status → Manage**.
2222

2323
</Step>
2424

2525
<Step>
2626

2727
### Switch it off and write the message
2828

29-
Turn on **Take the site offline**, then write why in **Message**. The editor has a language switcher: write the default language at least. A visitor whose language has no message gets the default one. The **Live preview** beside the form updates as you type.
29+
Turn on **Take the site offline**, and the **Message** and **Opening time** fields unfold below the switch. Write why the site is off in **Message**. The editor has a language switcher, and the default language is the one you can't skip. A visitor whose language has no message gets the default one.
3030

3131
</Step>
3232

@@ -44,20 +44,20 @@ The site **never opens by itself**. Once the opening time has passed, visitors s
4444

4545
### Save
4646

47-
A bar appears at the bottom once something changes. Select **Turn off site** in it. The status card turns to **Offline**, and the preview now shows what visitors see.
47+
A footer slides in at the bottom of the card once something changes. Select **Turn off site** in it, or **Discard** to drop your changes. The card turns to **Site is offline**.
4848

4949
<ImgDocs
5050
src={siteOfflineAdmin}
51-
alt="Site status page in the AdminCP: the Take the site offline switch, the message editor and the opening time on the left, and a live preview of the offline page on the right"
51+
alt="Site status card at the top of the Debug Panel overview: the Take the site offline switch turned on, the message editor and the opening time unfolded below it, and a footer with Discard and Turn off site"
5252
/>
5353

5454
</Step>
5555

5656
</Steps>
5757

58-
While the site is offline, **AdminCP → Debug Panel** lists it as a warning (with the opening time) and counts it in the warning badge next to your name, so nobody forgets it is off. Select the warning to jump to **Site status**.
58+
While the site is offline, **AdminCP → Debug Panel** lists it as a warning (with the opening time) and counts it in the warning badge next to your name, so nobody forgets it is off. Select the warning to jump to the **Site status** card.
5959

60-
To open the site, turn off **Take the site offline** and select **Turn on site** in the save bar. Offline pages that are still open check the status every minute and load the site on their own.
60+
To open the site, turn off **Take the site offline** and select **Turn on site** in the card's footer. Offline pages that are still open check the status every minute and load the site on their own.
6161

6262
## What visitors and staff see
6363

@@ -69,7 +69,7 @@ To open the site, turn off **Take the site offline** and select **Turn on site**
6969
| Who | What they get |
7070
| --- | --- |
7171
| Guests and members | The offline page on every public URL, with an HTTP `503` status |
72-
| Admins | The full site, with a banner reminding them it is offline |
72+
| Admins | The full site, with an **Offline** pill in the bottom corner (click it for details and a link to the site status) and an `(Offline)` prefix on every page title |
7373
| Moderators with **Access the site while it's offline** | The same as admins |
7474
| Other moderators | The offline page, like any member |
7575
| Anyone on `/login` | The sign-in pages. The offline page has no sign-in link, so staff open `/login` or `/admin` directly |

‎apps/web/src/locales/@vitnode/core/pl.json‎

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,7 @@
528528
"integrations": "Integracje",
529529
"plugins": "Wtyczki",
530530
"title": "System",
531-
"notifications": "Powiadomienia",
532-
"site_status": "Status strony"
531+
"notifications": "Powiadomienia"
533532
},
534533
"user_bar": {
535534
"debug": "Panel debugowania",
@@ -1563,16 +1562,11 @@
15631562
},
15641563
"site_status": {
15651564
"title": "Status strony",
1566-
"desc": "Wyłącz publiczną stronę z komunikatem dla odwiedzających i odliczaj czas do otwarcia.",
15671565
"retry": "Spróbuj ponownie",
15681566
"load_error": {
15691567
"title": "Nie udało się wczytać statusu strony",
15701568
"desc": "Nie mogliśmy sprawdzić, czy strona jest dostępna. Sprawdź połączenie i spróbuj ponownie."
15711569
},
1572-
"badge": {
1573-
"online": "Dostępna",
1574-
"offline": "Wyłączona"
1575-
},
15761570
"status": {
15771571
"online": "Strona jest dostępna",
15781572
"offline": "Strona jest wyłączona",
@@ -1581,11 +1575,6 @@
15811575
"by": "przez {name}",
15821576
"never": "Nigdy nie była wyłączona"
15831577
},
1584-
"preview": {
1585-
"title": "Podgląd na żywo",
1586-
"now": "To widzÄ… teraz odwiedzajÄ…cy",
1587-
"offline_only": "Widoczne, gdy strona jest wyłączona"
1588-
},
15891578
"save_bar": {
15901579
"unsaved": "Masz niezapisane zmiany",
15911580
"discard": "Odrzuć",
@@ -1614,14 +1603,8 @@
16141603
},
16151604
"message": {
16161605
"label": "Komunikat",
1617-
"desc": "Dlaczego strona jest wyłączona. Napisz go co najmniej w języku domyślnym; pozostałe języki go przejmą.",
1618-
"placeholder": "Aktualizujemy forum. Zaraz wracamy!",
16191606
"required": "Napisz komunikat w języku domyślnym, aby każdy odwiedzający wiedział, co się dzieje."
16201607
},
1621-
"opening": {
1622-
"title": "Otwarcie",
1623-
"desc": "Opcjonalne. Pokazuje odwiedzającym, kiedy wrócić."
1624-
},
16251608
"opens_at": {
16261609
"label": "Czas otwarcia",
16271610
"desc": "Strona nigdy nie otworzy się sama. Po upływie czasu odwiedzający widzą \"Wkrótce otwarcie\", dopóki jej nie włączysz.",
@@ -6130,8 +6113,12 @@
61306113
}
61316114
},
61326115
"staff_banner": {
6116+
"trigger": "Offline",
6117+
"trigger_label": "Strona jest wyłączona dla odwiedzających. Pokaż szczegóły",
61336118
"title": "Strona jest wyłączona",
6134-
"desc": "Widzisz ją dzięki uprawnieniom zespołu. Odwiedzający dostają stronę przerwy. <link>Zarządzaj statusem strony</link>"
6119+
"desc": "Odwiedzający dostają stronę przerwy. Możesz ją przeglądać dzięki uprawnieniom zespołu.",
6120+
"manage": "ZarzÄ…dzaj statusem strony",
6121+
"document_title": "(Offline) {title}"
61356122
}
61366123
}
61376124
},

‎apps/web/src/page-cache.gen.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export const pageCacheRoutes: PageCacheRouteTable = [
4545
{ path: '/admin/core/system/integrations' },
4646
{ path: '/admin/core/system/notifications' },
4747
{ path: '/admin/core/system/plugins' },
48-
{ path: '/admin/core/system/site-status' },
4948
{ path: '/admin/core/users/reactions' },
5049
{ path: '/admin/core/users/roles' },
5150
{ path: '/admin/core/users/:id' },

‎packages/vitnode/src/locales/en.json‎

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,8 +3831,12 @@
38313831
}
38323832
},
38333833
"staff_banner": {
3834+
"trigger": "Offline",
3835+
"trigger_label": "The site is offline for visitors. Show details",
38343836
"title": "The site is offline",
3835-
"desc": "You can see it because of your staff permissions. Visitors get the offline page. <link>Manage site status</link>"
3837+
"desc": "Visitors get the offline page. You can browse it because of your staff permissions.",
3838+
"manage": "Manage site status",
3839+
"document_title": "(Offline) {title}"
38363840
}
38373841
}
38383842
},
@@ -4026,8 +4030,7 @@
40264030
"integrations": "Integrations",
40274031
"files": "Files",
40284032
"notifications": "Notifications",
4029-
"plugins": "Plugins",
4030-
"site_status": "Site status"
4033+
"plugins": "Plugins"
40314034
},
40324035
"ai": {
40334036
"title": "Artificial Intelligence (AI)",
@@ -5583,16 +5586,11 @@
55835586
},
55845587
"site_status": {
55855588
"title": "Site status",
5586-
"desc": "Take the public site offline with a message for your visitors, and count down to the opening.",
55875589
"retry": "Try again",
55885590
"load_error": {
55895591
"title": "Site status didn't load",
55905592
"desc": "We couldn't read whether the site is online. Check your connection and try again."
55915593
},
5592-
"badge": {
5593-
"online": "Online",
5594-
"offline": "Offline"
5595-
},
55965594
"status": {
55975595
"online": "Site is online",
55985596
"offline": "Site is offline",
@@ -5601,11 +5599,6 @@
56015599
"by": "by {name}",
56025600
"never": "Never switched off"
56035601
},
5604-
"preview": {
5605-
"title": "Live preview",
5606-
"now": "What visitors see now",
5607-
"offline_only": "Shown while offline"
5608-
},
56095602
"save_bar": {
56105603
"unsaved": "You have unsaved changes",
56115604
"discard": "Discard",
@@ -5634,14 +5627,8 @@
56345627
},
56355628
"message": {
56365629
"label": "Message",
5637-
"desc": "Why the site is offline. Write it in the default language at least; other languages fall back to it.",
5638-
"placeholder": "We're upgrading the forum. Back shortly!",
56395630
"required": "Write the message in the default language so every visitor knows what's going on."
56405631
},
5641-
"opening": {
5642-
"title": "Opening",
5643-
"desc": "Optional. Shows visitors when to come back."
5644-
},
56455632
"opens_at": {
56465633
"label": "Opening time",
56475634
"desc": "The site never opens by itself. When the time is up, visitors see \"Opening soon\" until you turn it on.",

‎packages/vitnode/src/pages/admin/system/site-status.tsx‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎packages/vitnode/src/routes.tsx‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import { normalizeRolesRouteSearch } from "./tanstack/admin/roles/route-search";
3838
import { normalizeSearchIndexRouteSearch } from "./tanstack/admin/search-index/route-search";
3939
import { ADMIN_SIGN_IN_NAMESPACES } from "./tanstack/admin/sign-in-route";
4040
import { normalizeAdminSignInSearch } from "./tanstack/admin/sign-in-search";
41-
import { ADMIN_SITE_STATUS_NAMESPACES } from "./tanstack/admin/site-status/route";
4241
import { ADMIN_STAFF_CREATE_NAMESPACES } from "./tanstack/admin/staff/create-route";
4342
import { ADMIN_STAFF_EDIT_NAMESPACES } from "./tanstack/admin/staff/edit-route";
4443
import { ADMIN_STAFF_LOGS_NAMESPACES } from "./tanstack/admin/staff/logs-route";
@@ -385,13 +384,6 @@ export const routes = defineRoutes([
385384
pendingComponent: CardsPendingSkeleton,
386385
}),
387386

388-
page("/admin/core/system/site-status", {
389-
area: "admin",
390-
component: lazy(() => import("./pages/admin/system/site-status")),
391-
messages: ADMIN_SITE_STATUS_NAMESPACES,
392-
pendingComponent: CardsPendingSkeleton,
393-
}),
394-
395387
page("/admin/core/system/plugins", {
396388
area: "admin",
397389
component: lazy(() => import("./pages/admin/system/plugins")),

‎packages/vitnode/src/tanstack/admin/debug/query.ts‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@ import {
2424
import { integrationsQueryOptions } from "@/views/admin/views/core/system/integrations/integrations-query";
2525
import { pluginUpdatesQueryOptions } from "@/views/admin/views/core/system/plugins/plugin-updates-query";
2626
import { installedPluginsQueryOptions } from "@/views/admin/views/core/system/plugins/plugins-query";
27+
import {
28+
type AdminSiteStatusInput,
29+
adminSiteStatusQueryOptions,
30+
updateAdminSiteStatus,
31+
} from "@/views/admin/views/core/system/site-status/site-status-query";
2732
import { accountDeletionsSummaryQueryOptions } from "@/views/admin/views/core/users/deletions/deletions-query";
28-
import { adminSiteStatusQueryOptions } from "@/views/admin/views/core/system/site-status/site-status-query";
2933

30-
import { useAdminPermissions } from "../permissions";
34+
import { siteStatusQueryKey } from "../../site-status/query";
35+
import { useAdminPermission, useAdminPermissions } from "../permissions";
3136
import { searchIndexQuery } from "../search-index/query";
3237

3338
export const debugLogsQuery = ({ params }: { params: DebugLogsParams }) =>
@@ -208,3 +213,34 @@ export const useClearAdminCache = (): (() => Promise<void>) => {
208213
[queryClient, router],
209214
);
210215
};
216+
217+
export const useDebugSiteStatus = () => {
218+
const queryClient = useQueryClient();
219+
const canView = useAdminPermission(ADMIN_DEBUG_PERMISSIONS.siteStatus);
220+
const canManage = useAdminPermission(
221+
ADMIN_DEBUG_PERMISSIONS.manageSiteStatus,
222+
);
223+
const query = useQuery({
224+
...adminSiteStatusQueryOptions(),
225+
enabled: canView,
226+
});
227+
228+
const onSave = React.useCallback(
229+
async (values: AdminSiteStatusInput) => {
230+
const result = await updateAdminSiteStatus(values);
231+
if ("data" in result) {
232+
await Promise.all([
233+
queryClient.invalidateQueries({
234+
queryKey: adminSiteStatusQueryOptions().queryKey,
235+
}),
236+
queryClient.invalidateQueries({ queryKey: siteStatusQueryKey }),
237+
]);
238+
}
239+
240+
return result;
241+
},
242+
[queryClient],
243+
);
244+
245+
return { canManage, canView, onSave, query };
246+
};

‎packages/vitnode/src/tanstack/admin/debug/route.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const ADMIN_DEBUG_NAMESPACES = [
5050
"admin.user.deletions",
5151
"admin.system.integrations",
5252
"admin.system.plugins",
53+
"admin.system.site_status",
5354
"ai_actions",
5455
"core.global",
5556
"core.search",

0 commit comments

Comments
 (0)