Add dedicated bot, workspace and user settings pages

This commit is contained in:
2026-10-19 13:17:17 +01:00
parent 731ea73486
commit 7667f2bc2f
74 changed files with 2183 additions and 358 deletions
+32
View File
@@ -0,0 +1,32 @@
export type SettingsRecordKind = "bots" | "workspaces" | "users";
export type SettingsRecordPath = {
kind: SettingsRecordKind;
id: string;
};
type Params = {
pathname?: string | null;
};
/**
* The record a nested settings page manages, e.g.
* `/admin/settings/bots/3` -> `{ kind: "bots", id: "3" }`. Null on the
* settings list pages and everywhere else.
*/
export default function parseSettingsRecordPath({
pathname,
}: Params): SettingsRecordPath | null {
if (!pathname) return null;
const match = pathname
.replace(/\/$/, "")
.match(/^\/admin\/settings\/(bots|workspaces|users)\/([^/]+)$/);
if (!match) return null;
return {
kind: match[1] as SettingsRecordKind,
id: match[2]!,
};
}