408 lines
13 KiB
TypeScript
408 lines
13 KiB
TypeScript
import { SideBarItem } from "./SidebarItem";
|
|
import { t as i18nT } from "i18next";
|
|
import { UI_ID_PATTERNS, UI_NAV_IDS, uiIdSegment } from "~/application/ui/uiRegistry";
|
|
|
|
function withDocsSidebarIds(items: SideBarItem[], seenIds = new Map<string, number>()): SideBarItem[] {
|
|
return items.map((item) => {
|
|
const baseId = item.id ?? (item.path ? `ui.nav.docs.${uiIdSegment(item.path.replace(/^\/docs\/?/, "") || "index")}` : `ui.nav.docs.group.${uiIdSegment(item.title)}`);
|
|
const seenCount = seenIds.get(baseId) ?? 0;
|
|
seenIds.set(baseId, seenCount + 1);
|
|
const id = seenCount === 0 ? baseId : `${baseId}.${seenCount + 1}`;
|
|
|
|
return {
|
|
...item,
|
|
id,
|
|
uiIdPattern: item.uiIdPattern ?? (item.path ? UI_ID_PATTERNS.docsRoute : undefined),
|
|
uiIdParams: item.uiIdParams ?? (item.path ? { routeSlug: item.path.replace(/^\/docs\/?/, "") || "index" } : undefined),
|
|
items: item.items ? withDocsSidebarIds(item.items, seenIds) : item.items,
|
|
};
|
|
});
|
|
}
|
|
|
|
export const DocsSidebar = (): SideBarItem[] => {
|
|
return withDocsSidebarIds([
|
|
{
|
|
id: "ui.nav.docs.primary",
|
|
title: "",
|
|
path: "/docs",
|
|
exact: true,
|
|
items: [
|
|
{
|
|
id: UI_NAV_IDS.docsIntroduction,
|
|
title: i18nT("docs.sidebar.introduction"),
|
|
path: "/docs",
|
|
|
|
exact: true,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: "ui.nav.docs.gettingStarted",
|
|
title: i18nT("docs.sidebar.gettingStarted"),
|
|
path: "",
|
|
|
|
items: [
|
|
{
|
|
title: i18nT("docs.sidebar.stack"),
|
|
path: "/docs/stack",
|
|
},
|
|
// {
|
|
// title: "Code structure",
|
|
// path: "/docs/code-structure",
|
|
//
|
|
// },
|
|
{
|
|
title: i18nT("docs.sidebar.roadmap"),
|
|
path: "/docs/roadmap",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.license"),
|
|
path: "/docs/license",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.contributing"),
|
|
path: "/docs/contributing",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.community"),
|
|
path: "/docs/community",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: "ui.nav.docs.product",
|
|
title: i18nT("docs.sidebar.product"),
|
|
path: "",
|
|
items: [
|
|
{
|
|
title: i18nT("docs.sidebar.features"),
|
|
path: "/docs/features",
|
|
|
|
items: [
|
|
{
|
|
title: i18nT("docs.sidebar.allFeatures"),
|
|
path: "/docs/features",
|
|
exact: true,
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.adminPortal"),
|
|
path: "/docs/features/admin-portal",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.appPortal"),
|
|
path: "/docs/features/app-portal",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.authentication"),
|
|
path: "/docs/features/authentication",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.subscriptions"),
|
|
path: "/docs/features/subscriptions",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.entityBuilder"),
|
|
path: "/docs/features/entity-builder",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.api"),
|
|
path: "/docs/features/api",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.webhooks"),
|
|
path: "/docs/features/webhooks",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.auditTrails"),
|
|
path: "/docs/features/audit-trails",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.rolesPermissions"),
|
|
path: "/docs/features/roles-and-permissions",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.eventsAndWebhooks"),
|
|
path: "/docs/features/events-and-webhooks",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.notifications"),
|
|
path: "/docs/features/notifications",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.components"),
|
|
path: "/docs/components",
|
|
|
|
items: [
|
|
{
|
|
title: i18nT("docs.sidebar.buttons"),
|
|
path: "/docs/components/buttons",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.badges"),
|
|
path: "/docs/components/badges",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.banners"),
|
|
path: "/docs/components/banners",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.breadcrumbs"),
|
|
path: "/docs/components/breadcrumbs",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.commandPalette"),
|
|
path: "/docs/components/command-palette",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.dropdowns"),
|
|
path: "/docs/components/dropdowns",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.emptyStates"),
|
|
path: "/docs/components/empty-states",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.forms"),
|
|
path: "/docs/components/forms",
|
|
},
|
|
// {
|
|
// title: "Layouts",
|
|
// path: "/docs/components/layouts",
|
|
//
|
|
// },
|
|
{
|
|
title: i18nT("docs.sidebar.loaders"),
|
|
path: "/docs/components/loaders",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.modals"),
|
|
path: "/docs/components/modals",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.pdfViewer"),
|
|
path: "/docs/components/pdf-viewer",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.tables"),
|
|
path: "/docs/components/tables",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.tabs"),
|
|
path: "/docs/components/tabs",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.tooltips"),
|
|
path: "/docs/components/tooltips",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.uploaders"),
|
|
path: "/docs/components/uploaders",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.logoAndIcon"),
|
|
path: "/docs/components/logo-and-icon",
|
|
},
|
|
// {
|
|
// title: "Inputs",
|
|
// path: "/docs/components/inputs",
|
|
//
|
|
// items: [
|
|
{
|
|
title: i18nT("docs.sidebar.inputText"),
|
|
path: "/docs/components/inputs/text",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.inputNumber"),
|
|
path: "/docs/components/inputs/number",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.inputDate"),
|
|
path: "/docs/components/inputs/date",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.inputSelector"),
|
|
path: "/docs/components/inputs/selector",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.inputCheckbox"),
|
|
path: "/docs/components/inputs/checkbox",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.inputRadioGroup"),
|
|
path: "/docs/components/inputs/radio-group",
|
|
},
|
|
// ],
|
|
// },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: "ui.nav.docs.learningCenter",
|
|
title: i18nT("docs.sidebar.learningCenter"),
|
|
path: "/docs/learning-center",
|
|
items: [
|
|
{ title: i18nT("docs.sidebar.learningCenter"), path: "/docs/learning-center", exact: true },
|
|
{
|
|
title: i18nT("docs.sidebar.quickStart"),
|
|
path: "/docs/learning-center/tutorials/quick-start",
|
|
exact: true,
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.quickGuides"),
|
|
path: "",
|
|
items: [
|
|
{
|
|
title: i18nT("docs.sidebar.productReleases"),
|
|
path: "/docs/learning-center/guides/upgrade/product-releases",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.customizeTheme"),
|
|
path: "/docs/learning-center/guides/branding/theme",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.customizeLogoIcon"),
|
|
path: "/docs/learning-center/guides/branding/logo-and-icon",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.generateFavicon"),
|
|
path: "/docs/learning-center/guides/branding/favicon",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.supportLanguageI18n"),
|
|
path: "/docs/learning-center/guides/localization/support-a-language",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.createCustomEntity"),
|
|
path: "/docs/learning-center/guides/entities/create-a-custom-entity",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.useCustomEntityApi"),
|
|
path: "/docs/learning-center/guides/entities/use-the-custom-entity-api",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.sharedEntityRows"),
|
|
path: "/docs/learning-center/guides/entities/shared-entity-rows",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.planEntityLimits"),
|
|
path: "/docs/learning-center/guides/entities/plan-entity-limits",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.extendExistingModels"),
|
|
path: "/docs/learning-center/guides/entities/extend-existing-models",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.singleSignOn"),
|
|
path: "/docs/learning-center/guides/sso/",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.vercel"),
|
|
path: "/docs/learning-center/guides/hosting/vercel",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.supabase"),
|
|
path: "/docs/learning-center/guides/database/supabase",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: "ui.nav.docs.coreModels",
|
|
title: i18nT("docs.sidebar.coreModels"),
|
|
path: "",
|
|
items: [
|
|
{
|
|
title: i18nT("docs.sidebar.prismaSchema"),
|
|
path: "/docs/core-models",
|
|
exact: true,
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.account"),
|
|
path: "/docs/core-models/account",
|
|
items: [
|
|
// {
|
|
// title: "Diagram",
|
|
// path: "/docs/core-models/account/diagram",
|
|
//
|
|
// },
|
|
{
|
|
title: i18nT("docs.sidebar.user"),
|
|
path: "/docs/core-models/account/user",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.tenant"),
|
|
path: "/docs/core-models/account/tenant",
|
|
|
|
exact: true,
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.tenantUser"),
|
|
path: "/docs/core-models/account/tenant-user",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.apiKey"),
|
|
path: "/docs/core-models/account/api-key",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.subscription"),
|
|
path: "/docs/core-models/subscription",
|
|
|
|
items: [
|
|
{
|
|
title: i18nT("docs.sidebar.product"),
|
|
path: "/docs/core-models/subscription/product",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.price"),
|
|
path: "/docs/core-models/subscription/price",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.feature"),
|
|
path: "/docs/core-models/subscription/feature",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.tenantSubscription"),
|
|
path: "/docs/core-models/subscription/tenant-subscription",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.customEntity"),
|
|
path: "/docs/core-models/custom-entity",
|
|
|
|
items: [
|
|
{
|
|
title: i18nT("docs.sidebar.entity"),
|
|
path: "/docs/core-models/custom-entity/entity",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.property"),
|
|
path: "/docs/core-models/custom-entity/property",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.row"),
|
|
path: "/docs/core-models/custom-entity/row",
|
|
|
|
exact: true,
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.rowValue"),
|
|
path: "/docs/core-models/custom-entity/row-value",
|
|
},
|
|
{
|
|
title: i18nT("docs.sidebar.webhook"),
|
|
path: "/docs/core-models/custom-entity/webhook",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]);
|
|
};
|