Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
import {
ArrowLeftRightIcon,
AstroidIcon,
BarChart3Icon,
CogIcon,
DatabaseIcon,
FileCogIcon,
GaugeIcon,
HeartHandshakeIcon,
KeyIcon,
KeyRoundIcon,
LibraryIcon,
type LucideIcon,
MailIcon,
Settings2Icon,
SquarePenIcon,
TagsIcon,
UserIcon,
UsersIcon,
WebhookIcon,
} from "lucide-react";
import { type ComponentType } from "react";
import AccessTokenSection from "@/components/Settings/AccessTokenSection";
import AISection from "@/components/Settings/AISection";
import ConfigurationSection from "@/components/Settings/ConfigurationSection";
import EditorSection from "@/components/Settings/EditorSection";
import InstanceSection from "@/components/Settings/InstanceSection";
import MemberSection from "@/components/Settings/MemberSection";
import MemoExportSection from "@/components/Settings/MemoExportSection";
import MemoRelatedSettings from "@/components/Settings/MemoRelatedSettings";
import MyAccountSection from "@/components/Settings/MyAccountSection";
import NotificationSection from "@/components/Settings/NotificationSection";
import PreferencesSection from "@/components/Settings/PreferencesSection";
import ResourceStatsSection from "@/components/Settings/ResourceStatsSection";
import SpacesSection from "@/components/Settings/SpacesSection";
import SSOSection from "@/components/Settings/SSOSection";
import StorageSection from "@/components/Settings/StorageSection";
import TagsSection from "@/components/Settings/TagsSection";
import UsageLimitsSection from "@/components/Settings/UsageLimitsSection";
import WebhookSection from "@/components/Settings/WebhookSection";
import { InstanceSetting_Key } from "@/types/proto/api/instance_service_pb";
export type SettingSectionKey =
| "my-account"
| "memo-export"
| "spaces"
| "access-token"
| "preference"
| "editor"
| "webhook"
| "member"
| "system"
| "memo"
| "storage"
| "usage-limits"
| "notification"
| "sso"
| "tags"
| "ai"
| "resource-stats"
| "configuration";
type SettingSectionScope = "basic" | "admin";
export interface SettingSectionDefinition {
key: SettingSectionKey;
scope: SettingSectionScope;
labelKey: `setting.${SettingSectionKey}.label`;
icon: LucideIcon;
component: ComponentType;
preloadSettingKeys?: InstanceSetting_Key[];
}
export const SETTINGS_SECTIONS: SettingSectionDefinition[] = [
{
key: "my-account",
scope: "basic",
labelKey: "setting.my-account.label",
icon: UserIcon,
component: MyAccountSection,
},
{
key: "spaces",
scope: "basic",
labelKey: "setting.spaces.label",
icon: AstroidIcon,
component: SpacesSection,
},
{
key: "access-token",
scope: "basic",
labelKey: "setting.access-token.label",
icon: KeyRoundIcon,
component: AccessTokenSection,
},
{
key: "preference",
scope: "basic",
labelKey: "setting.preference.label",
icon: CogIcon,
component: PreferencesSection,
},
{
key: "editor",
scope: "basic",
labelKey: "setting.editor.label",
icon: SquarePenIcon,
component: EditorSection,
},
{
key: "webhook",
scope: "basic",
labelKey: "setting.webhook.label",
icon: WebhookIcon,
component: WebhookSection,
},
{
key: "member",
scope: "admin",
labelKey: "setting.member.label",
icon: UsersIcon,
component: MemberSection,
},
{
key: "system",
scope: "admin",
labelKey: "setting.system.label",
icon: Settings2Icon,
component: InstanceSection,
},
{
key: "memo",
scope: "admin",
labelKey: "setting.memo.label",
icon: LibraryIcon,
component: MemoRelatedSettings,
},
{
key: "tags",
scope: "basic",
labelKey: "setting.tags.label",
icon: TagsIcon,
component: TagsSection,
},
{
key: "memo-export",
scope: "basic",
labelKey: "setting.memo-export.label",
icon: ArrowLeftRightIcon,
component: MemoExportSection,
},
{
key: "storage",
scope: "admin",
labelKey: "setting.storage.label",
icon: DatabaseIcon,
component: StorageSection,
preloadSettingKeys: [InstanceSetting_Key.STORAGE],
},
{
key: "usage-limits",
scope: "admin",
labelKey: "setting.usage-limits.label",
icon: GaugeIcon,
component: UsageLimitsSection,
},
{
key: "notification",
scope: "admin",
labelKey: "setting.notification.label",
icon: MailIcon,
component: NotificationSection,
preloadSettingKeys: [InstanceSetting_Key.NOTIFICATION],
},
{
key: "sso",
scope: "admin",
labelKey: "setting.sso.label",
icon: KeyIcon,
component: SSOSection,
},
{
key: "ai",
scope: "admin",
labelKey: "setting.ai.label",
icon: HeartHandshakeIcon,
component: AISection,
preloadSettingKeys: [InstanceSetting_Key.AI],
},
{
key: "resource-stats",
scope: "admin",
labelKey: "setting.resource-stats.label",
icon: BarChart3Icon,
component: ResourceStatsSection,
},
{
key: "configuration",
scope: "admin",
labelKey: "setting.configuration.label",
icon: FileCogIcon,
component: ConfigurationSection,
},
];
export const DEFAULT_SETTING_SECTION: SettingSectionKey = "my-account";
export const isSettingSectionKey = (value: string): value is SettingSectionKey => {
return SETTINGS_SECTIONS.some((section) => section.key === value);
};