diff --git a/docs/mobile-app.md b/docs/mobile-app.md
index d03cd0c3..5e9ad6ff 100644
--- a/docs/mobile-app.md
+++ b/docs/mobile-app.md
@@ -317,7 +317,7 @@ in there:
| `login` | Whether sign-in is available (false in open mode) |
| `loginProviders` | The configured logins, for example `["discord", "fluxer"]`; empty when `login` is false |
| `platforms` | The platforms the bot runs on, for example `["discord"]` |
-| `features` | What this version's app API supports, so the app can hide what an older Sylo lacks. Today: `app-login`, `live-access`, `changelog`, `collectibles`, `welcome-trigger`, `member-search`, `access-levels`, `health`, `app-connect`, `setup-wizard`, `config-history`, `inbox-search`, `config-import`, `duplicate`, `message-templates` and `message-move`, plus `push` and `push-pigeon` when this instance can send notifications. See the list below |
+| `features` | What this version's app API supports, so the app can hide what an older Sylo lacks. Today: `app-login`, `live-access`, `changelog`, `collectibles`, `welcome-trigger`, `member-search`, `access-levels`, `health`, `app-connect`, `setup-wizard`, `config-history`, `inbox-search`, `config-import`, `duplicate`, `message-templates`, `message-move` and `moderator-view`, plus `push` and `push-pigeon` when this instance can send notifications. See the list below |
The feature strings:
@@ -338,6 +338,7 @@ The feature strings:
- `duplicate`: the `duplicate` routes for reminders, embed messages, reaction-role sets, custom commands and shop items.
- `message-templates`: the built-in message templates and the raw message JSON import and export.
- `message-move`: when the channel of a posted **embed message**, the **Welcome channel** message or a **role panel** changes and is published, the server posts a fresh message in the new channel, stores it and then deletes the old one, so the app must not unpublish first. Other bot posts (verification, honeypot traps, applications and so on) are not covered. A publish that loses a race with another publish of the same embed message answers `409` with the current record.
+- `moderator-view`: the web dashboard gives a person whose level in a server is `inbox` a focused view: the server opens on the inbox, and the navigation lists only the moderation tools (Tickets, Appeals, Applications, Suggestions, Moderation hub, Member data; only the inboxes that are switched on), with a "Show everything" switch for the full, still locked, navigation. Nothing changes on the server side: the level is the `access` of each `GET /api/v2/guilds` entry (and `level` of `GET /api/v2/guilds/:id/access`). The app can follow the same rules for that level and keeps the full read-only app for `view`.
- `app-connect`: [adding the other login](#adding-the-other-login). Only where sign-in is on and both Discord and Fluxer logins are set up.
- `push`, `push-pigeon`: this instance can send notifications to signed-in apps.
diff --git a/docs/self-hosting.md b/docs/self-hosting.md
index 8e70e1b2..7bf571bc 100644
--- a/docs/self-hosting.md
+++ b/docs/self-hosting.md
@@ -176,7 +176,12 @@ require **Manage Server** (or Administrator / owner) in that server, or one of t
roles set under *Dashboard access* on that server's *Settings* page: **Edit**
(the bot-master roles: everything), **Inbox** (tickets, ban appeals, applications
and suggestions, and reading the rest) or **View** (the pages and settings, read
-only, without what the inboxes contain). Only the owner or someone with Manage
+only, without what the inboxes contain). A person with Inbox access gets a focused
+dashboard: the server opens on the first inbox that is switched on, and the sidebar lists only the moderation
+tools (the inboxes that are switched on: Tickets, Appeals, Applications,
+Suggestions; and the Moderation hub and Member data); a "Show everything" switch at the top of the sidebar brings back the full, still
+locked, navigation and is remembered in that browser. View and Edit see the full
+dashboard. Only the owner or someone with Manage
Server can change the Edit roles; anyone with Edit can change the Inbox and View
roles and save the rest of that page. With `INTENT_GUILD_MEMBERS=false` Sylo
fetches a member from Discord before their role decides access (on every change,
diff --git a/src/web/routes/mobile.js b/src/web/routes/mobile.js
index 1d5575c4..ba3781eb 100644
--- a/src/web/routes/mobile.js
+++ b/src/web/routes/mobile.js
@@ -312,6 +312,8 @@ export const mobileApiRouter = Router();
// sign-in is on and both Discord and Fluxer logins are set up. `access-levels`: View / Inbox / Edit
// dashboard access, with `access` on each GET /api/v2/guilds entry and GET/POST
// /api/v2/guilds/:id/access. `message-move`: a posted message moves to its new channel on publish.
+// `moderator-view`: the web dashboard's focused view for Inbox-level access (landing on the inbox, only the
+// moderation tools); the app can follow it with `access` from GET /api/v2/guilds.
const FEATURES = Object.freeze([
'app-login',
'live-access',
@@ -328,6 +330,7 @@ const FEATURES = Object.freeze([
'duplicate',
'message-templates',
'message-move',
+ 'moderator-view',
]);
// Public and ahead of the open-mode guard: the app calls it before anyone signs in, and an open-mode
diff --git a/test/mobileInfo.test.js b/test/mobileInfo.test.js
index efba5685..e7d23ee3 100644
--- a/test/mobileInfo.test.js
+++ b/test/mobileInfo.test.js
@@ -51,6 +51,7 @@ test('GET /api/mobile/info describes a server with login on, without a cookie or
assert.ok(info.features.includes(f), f);
}
assert.ok(info.features.includes('message-move'), 'a posted message moves when its channel changes');
+ assert.ok(info.features.includes('moderator-view'), 'the focused moderator view for Inbox access');
assert.ok(info.features.every((f) => typeof f === 'string'));
});
diff --git a/web-v2/src/App.jsx b/web-v2/src/App.jsx
index e824fb23..02bcefb2 100644
--- a/web-v2/src/App.jsx
+++ b/web-v2/src/App.jsx
@@ -12,7 +12,7 @@ import MemberShell from './components/MemberShell.jsx';
import RouteError from './components/RouteError.jsx';
import NotFound from './components/NotFound.jsx';
import GuildPicker from './pages/GuildPicker.jsx';
-import Overview from './pages/Overview.jsx';
+import GuildHome from './pages/GuildHome.jsx';
const Leaderboard = lazy(() => import('./pages/Leaderboard.jsx'));
const Settings = lazy(() => import('./pages/Settings.jsx'));
const Personalizer = lazy(() => import('./pages/Personalizer.jsx'));
@@ -63,7 +63,7 @@ const router = createBrowserRouter(
} errorElement={}>
}>
} />
- } />
+ } />
} />
} />
} />
diff --git a/web-v2/src/__tests__/inboxPages.test.jsx b/web-v2/src/__tests__/inboxPages.test.jsx
index 9e342fff..5474ea67 100644
--- a/web-v2/src/__tests__/inboxPages.test.jsx
+++ b/web-v2/src/__tests__/inboxPages.test.jsx
@@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import TicketsInbox from '../pages/TicketsInbox.jsx';
import TicketView from '../pages/TicketView.jsx';
import AppealsReview from '../pages/AppealsReview.jsx';
+import { AccessProvider } from '../access.jsx';
vi.mock('../api.js', () => ({
ApiError: class ApiError extends Error {},
@@ -15,6 +16,7 @@ vi.mock('../api.js', () => ({
ticketTranscriptUrl: (g, id) => `/api/v2/guilds/${g}/tickets/${id}/transcript`,
getAppealsReview: vi.fn(),
decideAppeal: vi.fn(),
+ getGuildAccess: vi.fn(),
}));
vi.mock('../notify.js', () => ({ notify: vi.fn() }));
vi.mock('../components/ConfirmDialog.jsx', () => ({ confirmDialog: vi.fn().mockResolvedValue(true) }));
@@ -60,6 +62,21 @@ describe('TicketsInbox', () => {
const link = await screen.findByRole('link', { name: /settings/i });
expect(link.getAttribute('href')).toBe(`/guilds/${GUILD}/m/tickets`);
});
+
+ it('has no link to the ticket settings for Inbox access: that page is locked for them', async () => {
+ api.getGuildAccess.mockResolvedValue({ level: 'inbox' });
+ api.getTickets.mockResolvedValue({ open: [], closed: [] });
+ renderAt(
+ `/guilds/${GUILD}/tickets`,
+ 'guilds/:guildId/tickets',
+
+
+
+ );
+ await screen.findByRole('heading', { name: 'Tickets' });
+ await waitFor(() => expect(api.getGuildAccess).toHaveBeenCalled());
+ expect(screen.queryByRole('link', { name: /settings/i })).toBeNull();
+ });
});
describe('TicketView', () => {
@@ -133,4 +150,25 @@ describe('AppealsReview', () => {
`/guilds/${GUILD}/m/appeals`
);
});
+
+ it('has no link to the appeal settings for Inbox access, and tells them who can set it up', async () => {
+ api.getGuildAccess.mockResolvedValue({ level: 'inbox' });
+ api.getAppealsReview.mockResolvedValue({
+ moduleEnabled: true,
+ configured: false,
+ open: 0,
+ appeals: [],
+ });
+ renderAt(
+ `/guilds/${GUILD}/appeals`,
+ 'guilds/:guildId/appeals',
+
+
+
+ );
+ await screen.findByText(/No appeal questions are set up yet/);
+ await waitFor(() => expect(api.getGuildAccess).toHaveBeenCalled());
+ expect(screen.queryByRole('link', { name: /Appeal settings/ })).toBeNull();
+ expect(screen.getByText(/Ask a server admin to set it up\./)).toBeTruthy();
+ });
});
diff --git a/web-v2/src/__tests__/moderatorView.test.jsx b/web-v2/src/__tests__/moderatorView.test.jsx
new file mode 100644
index 00000000..b502a0e6
--- /dev/null
+++ b/web-v2/src/__tests__/moderatorView.test.jsx
@@ -0,0 +1,405 @@
+import { act, cleanup, fireEvent, render, screen, within } from '@testing-library/react';
+import { RouterProvider, createMemoryRouter } from 'react-router-dom';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import Shell from '../components/Shell.jsx';
+import GuildHome from '../pages/GuildHome.jsx';
+import { focusedLanding, navModel, switchSubpath } from '../overviewModel.js';
+import { paletteItems } from '../paletteModel.js';
+
+const G = '123456789012345678';
+const H = '223456789012345678';
+
+vi.mock('../pages/Overview.jsx', () => ({ default: () =>
},
+ ],
+ },
+ ],
+ { initialEntries: [path] }
+ );
+ await act(async () => {
+ render();
+ });
+ return router;
+}
+
+const hasLink = (name) => screen.queryByRole('link', { name: new RegExp(`^${name}`) }) !== null;
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ resetOperatorCache();
+ localStorage.clear();
+ window.scrollTo = vi.fn();
+ Element.prototype.scrollIntoView = vi.fn();
+ window.matchMedia = vi.fn().mockReturnValue({
+ matches: false,
+ addEventListener: vi.fn(),
+ removeEventListener: vi.fn(),
+ });
+ api.getGuilds.mockResolvedValue([
+ { id: G, name: 'Home', icon: null, platform: 'discord', access: 'inbox' },
+ { id: H, name: 'Other', icon: null, platform: 'discord', access: 'edit' },
+ ]);
+ api.getOverview.mockResolvedValue(overview);
+ api.getAccount.mockResolvedValue({ open: false, operator: false, platforms: [], devices: [] });
+});
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe('the focused moderator view', () => {
+ it('opens an Inbox person on the inbox, with only the moderation tools in the sidebar', async () => {
+ setLevel('inbox');
+ const router = await open();
+ expect(router.state.location.pathname).toBe(`/guilds/${G}/tickets`);
+ expect(screen.getByText('tickets page')).toBeTruthy();
+ const nav = screen.getByRole('navigation', { name: 'Dashboard' });
+ for (const name of MOD_TOOLS) {
+ expect(within(nav).getByRole('link', { name: new RegExp(`^${name}`) })).toBeTruthy();
+ }
+ for (const name of SETUP_PAGES) expect(hasLink(name), name).toBe(false);
+ expect(within(nav).queryByText('Modules')).toBeNull();
+ expect(within(nav).queryByRole('group', { name: 'Server' })).toBeNull();
+ expect(within(nav).getByRole('button', { name: 'Show everything' })).toBeTruthy();
+ });
+
+ it('shows the full navigation after "Show everything", keeps the choice and can undo it', async () => {
+ setLevel('inbox');
+ const router = await open();
+ await act(async () => {
+ fireEvent.click(screen.getByRole('button', { name: 'Show everything' }));
+ });
+ for (const name of [...MOD_TOOLS, ...SETUP_PAGES]) expect(hasLink(name), name).toBe(true);
+ expect(localStorage.getItem('sylo:v2:showEverything')).toBe('1');
+ expect(screen.getByRole('button', { name: 'Show only moderation' })).toBeTruthy();
+ // The overview link now stays on the overview.
+ await act(async () => {
+ fireEvent.click(screen.getByRole('link', { name: 'Overview' }));
+ });
+ expect(router.state.location.pathname).toBe(`/guilds/${G}`);
+ expect(screen.getByText('overview page')).toBeTruthy();
+
+ // A new visit (a reload) keeps the choice.
+ cleanup();
+ const again = await open();
+ expect(again.state.location.pathname).toBe(`/guilds/${G}`);
+ expect(screen.getByText('overview page')).toBeTruthy();
+ expect(hasLink('Server settings')).toBe(true);
+
+ await act(async () => {
+ fireEvent.click(screen.getByRole('button', { name: 'Show only moderation' }));
+ });
+ expect(hasLink('Server settings')).toBe(false);
+ expect(localStorage.getItem('sylo:v2:showEverything')).toBeNull();
+ });
+
+ it('puts the switch first in the menu, in the focused view and in the full one', async () => {
+ setLevel('inbox');
+ await open();
+ const nav = screen.getByRole('navigation', { name: 'Dashboard' });
+ const firstInteractive = () => nav.querySelector('button, a[href]');
+ expect(firstInteractive().textContent).toBe('Show everything');
+ await act(async () => {
+ fireEvent.click(within(nav).getByRole('button', { name: 'Show everything' }));
+ });
+ expect(firstInteractive().textContent).toBe('Show only moderation');
+ expect(within(nav).getByText('Everything is shown')).toBeTruthy();
+ });
+
+ it('still switches when the browser has no usable storage', async () => {
+ setLevel('inbox');
+ const blocked = () => {
+ throw new Error('blocked');
+ };
+ vi.spyOn(Storage.prototype, 'getItem').mockImplementation(blocked);
+ vi.spyOn(Storage.prototype, 'setItem').mockImplementation(blocked);
+ vi.spyOn(Storage.prototype, 'removeItem').mockImplementation(blocked);
+ await open();
+ await act(async () => {
+ fireEvent.click(screen.getByRole('button', { name: 'Show everything' }));
+ });
+ expect(hasLink('Server settings')).toBe(true);
+ });
+
+ it.each(['view', 'edit'])(
+ '%s keeps the overview and the full navigation, with no switch',
+ async (level) => {
+ setLevel(level);
+ const router = await open();
+ expect(router.state.location.pathname).toBe(`/guilds/${G}`);
+ expect(screen.getByText('overview page')).toBeTruthy();
+ for (const name of [...MOD_TOOLS, ...SETUP_PAGES]) expect(hasLink(name), name).toBe(true);
+ expect(screen.queryByRole('button', { name: /Show everything|Show only moderation/ })).toBeNull();
+ }
+ );
+
+ it("opens another server on its own level, not the previous server's", async () => {
+ // Inbox in G, Edit in H.
+ setLevel('inbox');
+ const router = await open(`/guilds/${H}`);
+ expect(router.state.location.pathname).toBe(`/guilds/${H}`);
+ expect(screen.getByText('overview page')).toBeTruthy();
+ expect(hasLink('Server settings')).toBe(true);
+ });
+
+ it('keeps the bot pages of an operator', async () => {
+ setLevel('inbox');
+ api.getAccount.mockResolvedValue({ open: false, operator: true, platforms: [], devices: [] });
+ await open();
+ expect(hasLink('Health')).toBe(true);
+ expect(hasLink('Server settings')).toBe(false);
+ });
+
+ it('lists only what the focused view can open in the command palette', async () => {
+ setLevel('inbox');
+ await open();
+ fireEvent.click(screen.getByRole('button', { name: 'Search the dashboard' }));
+ const labels = () => screen.getAllByRole('option').map((o) => o.textContent);
+ for (const name of MOD_TOOLS)
+ expect(
+ labels().some((l) => l.startsWith(name)),
+ name
+ ).toBe(true);
+ for (const name of SETUP_PAGES)
+ expect(
+ labels().some((l) => l.startsWith(name)),
+ name
+ ).toBe(false);
+ // A typed text finds no module or settings page either.
+ fireEvent.change(screen.getByRole('combobox'), { target: { value: 'welcome' } });
+ expect(screen.queryAllByRole('option').filter((o) => /Welcome/.test(o.textContent))).toHaveLength(0);
+ fireEvent.change(screen.getByRole('combobox'), { target: { value: 'settings' } });
+ expect(screen.queryAllByRole('option').filter((o) => /settings/i.test(o.textContent))).toHaveLength(0);
+ });
+
+ it('lists the modules in the palette for Edit', async () => {
+ setLevel('edit');
+ await open();
+ fireEvent.click(screen.getByRole('button', { name: 'Search the dashboard' }));
+ fireEvent.change(screen.getByRole('combobox'), { target: { value: 'welcome' } });
+ expect(screen.getAllByRole('option').some((o) => /Welcome/.test(o.textContent))).toBe(true);
+ });
+});
+
+describe('landing, flash and server switching', () => {
+ it('lands on the first inbox that is on: appeals when tickets are off, and the sidebar leaves tickets out', async () => {
+ setLevel('inbox');
+ api.getOverview.mockResolvedValue(overviewOf(['tickets']));
+ const router = await open();
+ expect(router.state.location.pathname).toBe(`/guilds/${G}/appeals`);
+ expect(screen.getByText('appeals page')).toBeTruthy();
+ expect(hasLink('Tickets')).toBe(false);
+ expect(hasLink('Appeals')).toBe(true);
+ });
+
+ it('lands on the Moderation hub when no inbox is on', async () => {
+ setLevel('inbox');
+ api.getOverview.mockResolvedValue(overviewOf(INBOX_CARDS));
+ const router = await open();
+ expect(router.state.location.pathname).toBe(`/guilds/${G}/moderation`);
+ const nav = screen.getByRole('navigation', { name: 'Dashboard' });
+ expect(within(nav).queryByRole('group', { name: 'Inbox' })).toBeNull();
+ expect(hasLink('Moderation hub')).toBe(true);
+ });
+
+ it('falls back to the tickets when the overview does not load', async () => {
+ setLevel('inbox');
+ api.getOverview.mockRejectedValue(new Error('down'));
+ const router = await open();
+ expect(router.state.location.pathname).toBe(`/guilds/${G}/tickets`);
+ });
+
+ it('does not show the full navigation while the level is still being read, when the list says Inbox', async () => {
+ api.getGuildAccess.mockReturnValue(new Promise(() => {}));
+ await open();
+ expect(hasLink('Tickets')).toBe(true);
+ for (const name of SETUP_PAGES) expect(hasLink(name), name).toBe(false);
+ expect(screen.queryByText('overview page')).toBeNull();
+ });
+
+ it('holds the setup groups back while neither the list nor the server has given the level', async () => {
+ api.getGuildAccess.mockReturnValue(new Promise(() => {}));
+ api.getGuilds.mockReturnValue(new Promise(() => {}));
+ await open();
+ for (const name of SETUP_PAGES) expect(hasLink(name), name).toBe(false);
+ });
+
+ it('opens the overview at once for Edit when the list gives the level, before the access call answers', async () => {
+ api.getGuildAccess.mockReturnValue(new Promise(() => {}));
+ api.getGuilds.mockResolvedValue([
+ { id: G, name: 'Home', icon: null, platform: 'discord', access: 'edit' },
+ ]);
+ await open();
+ expect(screen.getByText('overview page')).toBeTruthy();
+ expect(hasLink('Server settings')).toBe(true);
+ });
+
+ it('switching from an Inbox server to an Edit server in the session shows the overview, and back lands on the inbox', async () => {
+ setLevel('inbox');
+ const router = await open();
+ expect(router.state.location.pathname).toBe(`/guilds/${G}/tickets`);
+ await act(async () => {
+ await router.navigate(`/guilds/${H}`);
+ });
+ expect(router.state.location.pathname).toBe(`/guilds/${H}`);
+ expect(screen.getByText('overview page')).toBeTruthy();
+ expect(hasLink('Server settings')).toBe(true);
+ await act(async () => {
+ await router.navigate(`/guilds/${G}`);
+ });
+ expect(router.state.location.pathname).toBe(`/guilds/${G}/tickets`);
+ expect(hasLink('Server settings')).toBe(false);
+ });
+
+ it('the server switcher does not carry a page the focused view hides into an Inbox server', async () => {
+ setLevel('inbox');
+ const router = await open(`/guilds/${H}/settings`);
+ expect(screen.getByText('settings page')).toBeTruthy();
+ await act(async () => {
+ fireEvent.click(screen.getByRole('link', { name: /Home/ }));
+ });
+ expect(router.state.location.pathname).toBe(`/guilds/${G}/tickets`);
+ });
+
+ it('the switcher keeps a page the focused view lists, and every page for the other levels', () => {
+ expect(switchSubpath('/appeals', { access: 'inbox' })).toBe('/appeals');
+ expect(switchSubpath('/m/applications', { access: 'inbox' })).toBe('/m/applications');
+ expect(switchSubpath('/applications/12', { access: 'inbox' })).toBe('/applications/12');
+ expect(switchSubpath('/settings', { access: 'inbox' })).toBe('');
+ expect(switchSubpath('/m/welcome', { access: 'inbox' })).toBe('');
+ expect(switchSubpath('/settings', { access: 'inbox', showEverything: true })).toBe('/settings');
+ expect(switchSubpath('/settings', { access: 'edit' })).toBe('/settings');
+ expect(switchSubpath('/settings', { access: 'view' })).toBe('/settings');
+ expect(switchSubpath('', { access: 'inbox' })).toBe('');
+ });
+});
+
+describe('the models of the focused view', () => {
+ const nav = (focused) => navModel({ guildId: G, data: overview, operator: false, focused });
+
+ it('keeps the inboxes and three moderation tools, and drops the rest', () => {
+ const n = nav(true);
+ expect(n.top).toEqual([]);
+ expect(n.inbox.map((i) => i.key)).toEqual(['tickets', 'appeals', 'applications', 'suggestions']);
+ expect(n.people.map((i) => i.key)).toEqual(['moderation', 'member-data']);
+ expect(n.modules).toEqual([]);
+ expect(n.server).toEqual([]);
+ expect(n.more).toEqual([]);
+ });
+
+ it('lists only the inboxes whose module is on, keeping the Moderation hub', () => {
+ const d = overviewOf(['suggestions', 'appeals']);
+ const n = navModel({ guildId: G, data: d, operator: false, focused: true });
+ expect(n.inbox.map((i) => i.key)).toEqual(['tickets', 'applications']);
+ expect(n.people.map((i) => i.key)).toContain('moderation');
+ // The full view still lists them all, so an admin can find where to switch them on.
+ expect(navModel({ guildId: G, data: d, operator: false }).inbox).toHaveLength(4);
+ // A card the overview does not list counts as on.
+ expect(navModel({ guildId: G, data: { groups: [] }, operator: false, focused: true }).inbox).toHaveLength(
+ 4
+ );
+ });
+
+ it('picks the landing from the modules that are on', () => {
+ expect(focusedLanding(G, overviewOf())).toBe(`/guilds/${G}/tickets`);
+ expect(focusedLanding(G, overviewOf(['tickets']))).toBe(`/guilds/${G}/appeals`);
+ expect(focusedLanding(G, overviewOf(['tickets', 'appeals']))).toBe(`/guilds/${G}/m/applications`);
+ expect(focusedLanding(G, overviewOf(['tickets', 'appeals', 'applications']))).toBe(
+ `/guilds/${G}/m/suggestions`
+ );
+ expect(focusedLanding(G, overviewOf(INBOX_CARDS))).toBe(`/guilds/${G}/moderation`);
+ expect(focusedLanding(G, null)).toBe(`/guilds/${G}/tickets`);
+ });
+
+ it('is unchanged when not focused', () => {
+ const n = nav(false);
+ expect(n.top).toHaveLength(1);
+ expect(n.people).toHaveLength(4);
+ expect(n.modules.length).toBeGreaterThan(0);
+ // The server group is whatever the nav model lists (other changes add pages to it), so it is not counted:
+ // it keeps the pages the focused view hides.
+ expect(n.server.map((i) => i.key)).toEqual(expect.arrayContaining(['settings', 'commands']));
+ expect(n.server).toEqual(navModel({ guildId: G, data: overview, operator: false }).server);
+ });
+
+ it('gives the palette no module pages and no setup pages', () => {
+ const keys = paletteItems({ guildId: G, data: overview, operator: false, focused: true }).map(
+ (i) => i.key
+ );
+ expect(keys.some((k) => k.startsWith('module:'))).toBe(false);
+ expect(keys).not.toContain('page:settings');
+ expect(keys).not.toContain('page:overview');
+ expect(keys).toContain('page:tickets');
+ });
+});
diff --git a/web-v2/src/__tests__/permissionHealth.test.jsx b/web-v2/src/__tests__/permissionHealth.test.jsx
index ef99448c..fdfdf0c9 100644
--- a/web-v2/src/__tests__/permissionHealth.test.jsx
+++ b/web-v2/src/__tests__/permissionHealth.test.jsx
@@ -2,6 +2,7 @@
// picker, the "Needs attention" items (one per module), a module page's list, and the shared read.
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { AccessProvider } from '../access.jsx';
import { HealthProvider } from '../HealthContext.jsx';
import PickerHealth from '../components/PickerHealth.jsx';
import ChipPicker from '../components/ChipPicker.jsx';
@@ -17,11 +18,12 @@ vi.mock('../api.js', () => ({
setModuleEnabled: vi.fn(),
setModulesEnabledBulk: vi.fn(),
getAccount: vi.fn(),
+ getGuildAccess: vi.fn(),
}));
vi.mock('../notify.js', () => ({ notify: vi.fn() }));
vi.mock('../moduleForms/index.js', () => ({ v2Href: (card, guildId) => `/guilds/${guildId}/m/${card.id}` }));
vi.mock('../OverviewContext.jsx', () => ({ useOverview: vi.fn() }));
-const { getGuildHealth } = await import('../api.js');
+const { getGuildHealth, getGuildAccess } = await import('../api.js');
const { useOverview } = await import('../OverviewContext.jsx');
const GUILD = '123456789012345678';
@@ -198,7 +200,7 @@ describe('Needs attention', () => {
expect(attentionItems({ groups: [], attention: { problems: [], waiting: {} } }, GUILD)).toEqual([]);
});
- it('shows the module with its problems and a Fix link', () => {
+ const mockProblemOverview = () =>
useOverview.mockReturnValue({
data: {
guild: { name: 'Hedgerow', icon: null, memberCount: 12 },
@@ -240,6 +242,9 @@ describe('Needs attention', () => {
error: null,
setData: vi.fn(),
});
+
+ it('shows the module with its problems and a Fix link', () => {
+ mockProblemOverview();
renderAtGuild(, GUILD);
expect(screen.getByText("Verification: Sylo can't do everything it needs")).toBeTruthy();
expect(screen.getByText(/Sylo's role is not above it\./)).toBeTruthy();
@@ -248,6 +253,21 @@ describe('Needs attention', () => {
screen.getByRole('link', { name: /^Fix Verification: Sylo can't do everything it needs/ })
).toBeTruthy();
});
+
+ it('gives someone with Inbox access no Fix link to a settings page they cannot open', async () => {
+ getGuildAccess.mockResolvedValue({ level: 'inbox' });
+ mockProblemOverview();
+ renderAtGuild(
+
+
+ ,
+ GUILD
+ );
+ expect(await screen.findByText('Ask a server admin')).toBeTruthy();
+ expect(screen.getByText("Verification: Sylo can't do everything it needs")).toBeTruthy();
+ await waitFor(() => expect(getGuildAccess).toHaveBeenCalled());
+ expect(screen.queryByRole('link', { name: /^Fix / })).toBeNull();
+ });
});
describe('the shared read', () => {
diff --git a/web-v2/src/access.jsx b/web-v2/src/access.jsx
index c3bb8e0c..4f5958ca 100644
--- a/web-v2/src/access.jsx
+++ b/web-v2/src/access.jsx
@@ -1,5 +1,6 @@
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
import { getGuildAccess } from './api.js';
+import { readShowEverything, writeShowEverything } from './util.js';
// The signed-in person's dashboard access level in the selected server (src/web/middleware/access.js
// on the server): 'view' reads only, 'inbox' may also act on tickets, appeals, applications and
@@ -12,12 +13,30 @@ const RANK = { view: 1, inbox: 2, edit: 3 };
export const LEVEL_LABEL = { view: 'View only', inbox: 'Inbox only' };
-const AccessContext = createContext({ level: 'edit', guildId: null, reload: () => {} });
+// `ready` is false while the level of the selected server is still being read. `showEverything` is the
+// Inbox person's choice to see the full navigation instead of the focused view (see useAccess).
+const AccessContext = createContext({
+ level: 'edit',
+ guildId: null,
+ reload: () => {},
+ ready: true,
+ hintLevel: null,
+ showEverything: false,
+ setShowEverything: () => {},
+});
-export function AccessProvider({ guildId, children }) {
+// `hint` is the level the server list already gave for this server (`access` on each entry): it stands in
+// until the server's own answer is in, so a person with Inbox access never sees the full navigation flash
+// before it narrows. Only the answer itself sets `ready`.
+export function AccessProvider({ guildId, hint, children }) {
const [state, setState] = useState({ guildId: null, level: 'edit' });
const [tick, setTick] = useState(0);
const reload = useCallback(() => setTick((t) => t + 1), []);
+ const [showEverything, setShow] = useState(readShowEverything);
+ const setShowEverything = useCallback((on) => {
+ setShow(Boolean(on));
+ writeShowEverything(Boolean(on));
+ }, []);
useEffect(() => {
if (!guildId) return undefined;
@@ -37,8 +56,18 @@ export function AccessProvider({ guildId, children }) {
}, [guildId, tick]);
// The level of another server (the previous one, while the new one loads) is not used.
- const level = state.guildId === guildId ? state.level : 'edit';
- return {children};
+ const known = state.guildId === guildId;
+ const hintLevel = RANK[hint] ? hint : null;
+ const level = known ? state.level : (hintLevel ?? 'edit');
+ // Without a server there is nothing to wait for.
+ const ready = !guildId || known;
+ return (
+
+ {children}
+
+ );
}
/**
@@ -46,8 +75,26 @@ export function AccessProvider({ guildId, children }) {
* const { can } = useAccess();
*/
export function useAccess() {
- const { level, guildId, reload } = useContext(AccessContext);
- return { level, guildId, reload, can: (need) => (RANK[level] ?? 0) >= RANK[need] };
+ const { level, guildId, reload, ready, hintLevel, showEverything, setShowEverything } =
+ useContext(AccessContext);
+ return {
+ level,
+ guildId,
+ reload,
+ ready,
+ // The level is settled enough to draw the navigation: the answer is in, or the server list gave it.
+ levelKnown: ready || Boolean(hintLevel),
+ hintLevel,
+ can: (need) => (RANK[level] ?? 0) >= RANK[need],
+ // The focused moderator view: a person whose level here is exactly Inbox gets the moderation tools
+ // instead of the whole dashboard, unless they chose "Show everything". View keeps the full read-only
+ // dashboard (observers need the whole picture) and Edit is unchanged. `canFocus` is whether the choice
+ // is theirs to make at all.
+ canFocus: level === 'inbox',
+ focused: level === 'inbox' && !showEverything,
+ showEverything,
+ setShowEverything,
+ };
}
/**
diff --git a/web-v2/src/components/CommandPalette.jsx b/web-v2/src/components/CommandPalette.jsx
index a0b646eb..de742a91 100644
--- a/web-v2/src/components/CommandPalette.jsx
+++ b/web-v2/src/components/CommandPalette.jsx
@@ -1,8 +1,10 @@
import { useEffect, useId, useMemo, useRef, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { searchInbox, searchMembers } from '../api.js';
+import { useAccess } from '../access.jsx';
import { useOverview } from '../OverviewContext.jsx';
import { useOperator } from '../useOperator.js';
+import { switchSubpath } from '../overviewModel.js';
import { groupItems, paletteItems, rankItems, readRecent, rememberRecent } from '../paletteModel.js';
import { parseMemberIds } from './MemberPicker.jsx';
import { Icon } from './icons.jsx';
@@ -105,6 +107,7 @@ function PaletteDialog({ onClose, guildId, guilds }) {
const { data: shared, dataGuildId } = useOverview();
const data = dataGuildId === guildId ? shared : null;
const operator = useOperator();
+ const { focused, showEverything } = useAccess();
const dialogRef = useRef(null);
const settled = useRef(false);
const closeTimer = useRef(null);
@@ -116,8 +119,8 @@ function PaletteDialog({ onClose, guildId, guilds }) {
const [recent] = useState(readRecent);
const items = useMemo(
- () => paletteItems({ guildId, data, operator, guilds }),
- [guildId, data, operator, guilds]
+ () => paletteItems({ guildId, data, operator, guilds, focused }),
+ [guildId, data, operator, guilds, focused]
);
const found = useServerMatches(guildId, text);
// A pasted member id (or a mention) is a place to open without asking the server.
@@ -182,7 +185,7 @@ function PaletteDialog({ onClose, guildId, guilds }) {
let href = item.href;
if (item.key.startsWith('guild:')) {
const m = pathname.match(GUILD_PAGE);
- if (m) href = `${item.href}${m[1] ?? ''}`;
+ if (m) href = `${item.href}${switchSubpath(m[1], { access: item.access, showEverything })}`;
}
navigate(href);
finish();
diff --git a/web-v2/src/components/ServerSwitcher.jsx b/web-v2/src/components/ServerSwitcher.jsx
index c0be89b3..44bc6296 100644
--- a/web-v2/src/components/ServerSwitcher.jsx
+++ b/web-v2/src/components/ServerSwitcher.jsx
@@ -3,6 +3,8 @@ import { Link, useLocation } from 'react-router-dom';
import PlatformBadge from './PlatformBadge.jsx';
import { getInvites } from '../api.js';
import { useApiData } from '../useApiData.js';
+import { useAccess } from '../access.jsx';
+import { switchSubpath } from '../overviewModel.js';
import { initial } from '../util.js';
// Matches /guilds/:id or /guilds/:id/ — captures the subpath (or ''
@@ -19,6 +21,7 @@ export default function ServerSwitcher({ guilds, activeGuildId, onSelectGuild })
const multiPlatform = new Set(guilds.map((g) => g.platform)).size > 1;
const { data: invites } = useApiData(() => getInvites(), []);
const addLinks = invites ?? [];
+ const { showEverything } = useAccess();
const detailsRef = useRef(null);
const { pathname } = useLocation();
const guildPageMatch = pathname.match(GUILD_PAGE);
@@ -83,7 +86,12 @@ export default function ServerSwitcher({ guilds, activeGuildId, onSelectGuild })
// picker) there's no guild-scoped page to jump to, so just update
// the selection in place — no navigation.
return subpath !== null ? (
-
+
{inner}
) : (
diff --git a/web-v2/src/components/Shell.jsx b/web-v2/src/components/Shell.jsx
index e856c0f0..9305f3cf 100644
--- a/web-v2/src/components/Shell.jsx
+++ b/web-v2/src/components/Shell.jsx
@@ -94,7 +94,7 @@ function SignedInShell() {
const { guilds, loading, error } = state;
return (
-
+ g.id === lastGuildId)?.access}>
) : null}
-
+ {nav.more.length ? (
+
+ ) : null}
{nav.bot.length ? (
) : null}
diff --git a/web-v2/src/main.jsx b/web-v2/src/main.jsx
index e97b7ce7..bdd2a5d2 100644
--- a/web-v2/src/main.jsx
+++ b/web-v2/src/main.jsx
@@ -22,6 +22,7 @@ import './styles/setup-wizard.css';
import './styles/access.css';
import './styles/history.css';
import './styles/health.css';
+import './styles/moderator-view.css';
createRoot(document.getElementById('root')).render(
diff --git a/web-v2/src/overviewModel.js b/web-v2/src/overviewModel.js
index 4069a3fc..5b68a4f7 100644
--- a/web-v2/src/overviewModel.js
+++ b/web-v2/src/overviewModel.js
@@ -195,12 +195,17 @@ const INBOX_SAME_PAGE = new Set(['applications', 'suggestions']);
// Inbox entries whose queue is another page than the module's settings: the settings keep an entry.
const SETTINGS_SUFFIX = new Set(['tickets', 'appeals']);
+// What the focused moderator view keeps of "Members & moderation": every page here only needs View to
+// read, and its actions are guarded by the server; the leaderboard is not a moderation tool.
+const FOCUSED_PEOPLE = new Set(['moderation', 'member-data']);
+
/**
* The sidebar as groups. `guildId` is null before a server is picked (links are then null and shown
* disabled). `operator` is whether the server marks the viewer as the bot owner (OWNER_IDS): the bot
- * pages (Bot personalizer, Health, Roadmap admin, Stats cache) only exist for them.
+ * pages (Bot personalizer, Health, Roadmap admin, Stats cache) only exist for them. `focused` is the
+ * moderator view for an Inbox-level person (see useAccess in access.jsx).
*/
-export function navModel({ guildId, data, operator }) {
+export function navModel({ guildId, data, operator, focused = false }) {
const g = (path) => (guildId ? `/guilds/${guildId}${path}` : null);
const waiting = data?.attention?.waiting ?? {};
const count = (n) => (Number(n) > 0 ? Number(n) : 0);
@@ -281,5 +286,55 @@ export function navModel({ guildId, data, operator }) {
{ key: 'stats', label: 'Game stats cache', icon: 'chart', href: '/stats' },
]
: [];
+ if (focused) {
+ // The focused moderator view (an Inbox-level person): the inboxes whose module is on and the moderation
+ // tools, nothing about setting the server up. A card the overview does not list counts as on. Operators
+ // keep their bot pages.
+ const cards = new Map((data?.groups ?? []).flatMap((grp) => grp.cards ?? []).map((c) => [c.id, c]));
+ const off = (key) => Boolean(cards.get(key)?.hasToggle && !cards.get(key).enabled);
+ return {
+ top: [],
+ inbox: inbox.filter((it) => !off(it.key)),
+ people: people.filter((it) => FOCUSED_PEOPLE.has(it.key)),
+ modules: [],
+ server: [],
+ more: [],
+ bot,
+ };
+ }
return { top, inbox, people, modules, server, more, bot };
}
+
+/**
+ * Where a server opens for a person in the focused moderator view: the first inbox whose module is on
+ * (tickets, appeals, applications, suggestions); the Moderation hub when none is; the tickets while the
+ * overview is not known (it did not load), as the default.
+ * @returns {string} an address relative to the dashboard base
+ */
+export function focusedLanding(guildId, data) {
+ const first = navModel({ guildId, data, operator: false, focused: true }).inbox[0];
+ if (first) return first.href;
+ return `/guilds/${guildId}${data ? '/moderation' : '/tickets'}`;
+}
+
+// The pages of the focused view; a server switch keeps the page only when the focused view lists it.
+const FOCUSED_SUBPATHS = [
+ '/tickets',
+ '/appeals',
+ '/applications',
+ '/m/applications',
+ '/m/suggestions',
+ '/moderation',
+ '/member-data',
+];
+
+/**
+ * The page to open in another server when switching from a server page: the same page, except in a
+ * server where the person is in the focused view and that view does not list it (then the server opens
+ * on its own landing).
+ */
+export function switchSubpath(subpath, { access, showEverything = false } = {}) {
+ if (!subpath || access !== 'inbox' || showEverything) return subpath ?? '';
+ const ok = FOCUSED_SUBPATHS.some((p) => subpath === p || subpath.startsWith(`${p}/`));
+ return ok ? subpath : '';
+}
diff --git a/web-v2/src/pages/AppealsReview.jsx b/web-v2/src/pages/AppealsReview.jsx
index 9d3d399b..ec254c46 100644
--- a/web-v2/src/pages/AppealsReview.jsx
+++ b/web-v2/src/pages/AppealsReview.jsx
@@ -8,7 +8,7 @@ import LoadError from '../components/LoadError.jsx';
import Meta from '../components/Meta.jsx';
import { formatCount } from '../util.js';
import Time from '../components/Time.jsx';
-import { AccessLock, NeedsInbox } from '../access.jsx';
+import { AccessLock, NeedsInbox, useAccess } from '../access.jsx';
const STATUS_LABEL = { open: 'Open', accepted: 'Accepted', denied: 'Denied' };
@@ -100,6 +100,8 @@ function AppealCard({ appeal, onDecide }) {
export default function AppealsReview() {
const { guildId } = useParams();
const { data, error, setData } = useApiData(() => getAppealsReview(guildId), [guildId]);
+ // The settings page needs Edit access: an Inbox person is not sent to a page they cannot open.
+ const canEdit = useAccess().can('edit');
if (error) return ;
if (!data) return
{!data.moduleEnabled ? 'The Appeals module is off. ' : ''}
{!data.configured ? 'No appeal questions are set up yet. ' : ''}
- Set it up under Appeal settings.
+ {canEdit ? (
+ <>
+ Set it up under Appeal settings.
+ >
+ ) : (
+ 'Ask a server admin to set it up.'
+ )}
) : null}
diff --git a/web-v2/src/pages/GuildHome.jsx b/web-v2/src/pages/GuildHome.jsx
new file mode 100644
index 00000000..6808d87c
--- /dev/null
+++ b/web-v2/src/pages/GuildHome.jsx
@@ -0,0 +1,28 @@
+import { Navigate, useParams } from 'react-router-dom';
+import { useAccess } from '../access.jsx';
+import { useOverview } from '../OverviewContext.jsx';
+import { focusedLanding } from '../overviewModel.js';
+import Overview from './Overview.jsx';
+
+// Where a server opens. Most people land on the overview; an Inbox-level person lands on the first inbox
+// that is switched on (the focused moderator view, access.jsx; there is no combined inbox page). Their
+// "Show everything" choice brings the overview back.
+export default function GuildHome() {
+ const { guildId } = useParams();
+ const { ready, focused, hintLevel, guildId: accessGuildId } = useAccess();
+ const overview = useOverview();
+ const loading =
Loading…
;
+
+ // Not before the level of this server is known: the previous server's level must not decide.
+ if (accessGuildId && accessGuildId !== guildId) return loading;
+ if (!ready) {
+ // The server list already says View or Edit: neither can be focused, so the overview need not wait.
+ return hintLevel === 'view' || hintLevel === 'edit' ? : loading;
+ }
+ if (!focused) return ;
+
+ // The landing depends on which modules are on, so wait for this server's overview (or its failure).
+ const mine = overview?.dataGuildId === guildId;
+ if (overview && !mine && (overview.loading || !overview.error)) return loading;
+ return ;
+}
diff --git a/web-v2/src/pages/Overview.jsx b/web-v2/src/pages/Overview.jsx
index e9689b6d..b24f4f10 100644
--- a/web-v2/src/pages/Overview.jsx
+++ b/web-v2/src/pages/Overview.jsx
@@ -56,7 +56,7 @@ function BetaTag() {
// rows after it and the button on a wider screen).
const PHONE_ROWS = 3;
-function NeedsAttention({ items }) {
+function NeedsAttention({ items, canFix = true }) {
const [all, setAll] = useState(false);
if (!items.length) {
return (
@@ -115,7 +115,7 @@ function NeedsAttention({ items }) {
)}
- {item.href ? (
+ {item.href && (canFix || item.kind === 'waiting') ? (
{item.kind === 'waiting' ? 'Open' : 'Fix'}
+ ) : item.href ? (
+ // The page that fixes it is a settings page this person cannot open.
+ Ask a server admin
) : null}
))}
@@ -386,7 +389,7 @@ export default function Overview() {
{needsSetupOffer(groups, problemIds) ? : null}
-
+
getTickets(guildId), [guildId]);
+ // The settings page needs Edit access: an Inbox person is not sent to a page they cannot open.
+ const canEdit = useAccess().can('edit');
if (error) return ;
if (!data) return
Loading…
;
@@ -41,9 +43,11 @@ export default function TicketsInbox() {
Members open a ticket by sending the bot a DM. Replies you write here reach them as an anonymous
diff --git a/web-v2/src/paletteModel.js b/web-v2/src/paletteModel.js
index f75536a1..f25ad51f 100644
--- a/web-v2/src/paletteModel.js
+++ b/web-v2/src/paletteModel.js
@@ -70,10 +70,11 @@ const ALIASES = { tickets: 'modmail' };
* Every place the palette can open for the picked server: the pages of the sidebar, every module page (also a
* module that is switched off: the person may be looking for where to switch it on), and the other servers.
* An item is `{ key, group, label, hint, href, icon, keywords }`; `href` is relative to the dashboard base.
- * @param {{ guildId: string|null, data: object|null, operator: boolean, guilds?: Array<{id: string, name: string}> }} src
+ * In the focused moderator view (`focused`) it lists only what that view's sidebar shows, and no module pages.
+ * @param {{ guildId: string|null, data: object|null, operator: boolean, focused?: boolean, guilds?: Array<{id: string, name: string}> }} src
*/
-export function paletteItems({ guildId, data, operator, guilds = [] }) {
- const nav = navModel({ guildId, data, operator });
+export function paletteItems({ guildId, data, operator, guilds = [], focused = false }) {
+ const nav = navModel({ guildId, data, operator, focused });
const items = [];
const seen = new Set();
const add = (item) => {
@@ -97,7 +98,7 @@ export function paletteItems({ guildId, data, operator, guilds = [] }) {
}
const problems = new Set((data?.attention?.problems ?? []).map((p) => p.id));
- for (const grp of data?.groups ?? []) {
+ for (const grp of focused ? [] : (data?.groups ?? [])) {
for (const card of grp.cards ?? []) {
const href = guildId ? v2Href(card, guildId) : null;
const tone = cardTone(card, problems);
@@ -137,6 +138,7 @@ export function paletteItems({ guildId, data, operator, guilds = [] }) {
label: `Switch to ${g.name}`,
icon: 'grid',
href: `/guilds/${g.id}`,
+ access: g.access,
keywords: `server ${g.name}`,
});
}
diff --git a/web-v2/src/styles/moderator-view.css b/web-v2/src/styles/moderator-view.css
new file mode 100644
index 00000000..82520142
--- /dev/null
+++ b/web-v2/src/styles/moderator-view.css
@@ -0,0 +1,55 @@
+/* The focused moderator view (Sidebar.jsx): the switch at the top of the sidebar, which says which view it is
+ and changes to the other one. It stays at the top so the way back is never below a long list of links. */
+.v2-sidebar-viewswitch {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: space-between;
+ gap: 2px 8px;
+ margin: 0 0 12px;
+ padding: 8px 10px;
+ border: 1px solid var(--border-subtle);
+ border-radius: var(--radius-sm);
+ background: var(--bg-surface);
+}
+.v2-sidebar-viewswitch-label {
+ color: var(--text-muted);
+ font-size: var(--fs-xs);
+ font-weight: 600;
+}
+.v2-sidebar-focus-toggle {
+ display: inline-flex;
+ align-items: center;
+ min-height: 24px;
+ padding: 2px 0;
+ border: 0;
+ background: none;
+ color: var(--accent-text);
+ font: inherit;
+ font-size: var(--fs-sm);
+ font-weight: 600;
+ text-decoration: underline;
+ text-underline-offset: 3px;
+ cursor: pointer;
+}
+/* A touch screen gets a full-size tap target; the look stays the same. */
+@media (pointer: coarse) {
+ .v2-sidebar-focus-toggle {
+ min-height: 44px;
+ }
+}
+.v2-sidebar-focus-toggle:hover {
+ color: var(--text);
+}
+.v2-sidebar-focus-toggle:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 2px;
+ border-radius: 4px;
+}
+
+/* The Overview's "Needs attention" for someone who cannot change settings: no Fix link to a locked page. */
+.v2-attention-ask {
+ flex: none;
+ color: var(--text-muted);
+ font-size: var(--fs-sm);
+}
diff --git a/web-v2/src/util.js b/web-v2/src/util.js
index bf6d012a..a6b7777a 100644
--- a/web-v2/src/util.js
+++ b/web-v2/src/util.js
@@ -24,6 +24,27 @@ export function writeLastGuildId(guildId) {
}
}
+// An Inbox person's choice to see the whole dashboard instead of the focused moderator view. One choice
+// for this browser, which belongs to one person.
+const SHOW_EVERYTHING_KEY = 'sylo:v2:showEverything';
+
+export function readShowEverything() {
+ try {
+ return localStorage.getItem(SHOW_EVERYTHING_KEY) === '1';
+ } catch {
+ return false;
+ }
+}
+
+export function writeShowEverything(on) {
+ try {
+ if (on) localStorage.setItem(SHOW_EVERYTHING_KEY, '1');
+ else localStorage.removeItem(SHOW_EVERYTHING_KEY);
+ } catch {
+ // ignore — this is just a convenience
+ }
+}
+
const THEME_KEY = 'sylo:v2:theme';
/** 'light' or 'dark' — null means "no explicit choice yet", so the default applies. */