mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { createContext } from "react";
|
|
|
|
export type Theme = "dark" | "light" | "system";
|
|
|
|
export interface AppConfig {
|
|
/** Current theme */
|
|
theme: Theme;
|
|
/** Selected relay URL */
|
|
relayUrl: string;
|
|
/** Git repository URL to use as project template */
|
|
projectTemplate: string;
|
|
/** ESM CDN URL for package imports */
|
|
esmUrl: string;
|
|
/** HTTP proxy used to bypass CORS for AI and Git operations */
|
|
corsProxy: string;
|
|
/** Preview domain for iframe sandboxing (e.g., "local-shakespeare.dev") */
|
|
previewDomain: string;
|
|
/** Selected language */
|
|
language?: string;
|
|
/** Whether to show the showcase section */
|
|
showcaseEnabled: boolean;
|
|
/** Npub of the showcase moderator */
|
|
showcaseModerator: string;
|
|
/** Nostr Git Servers (hostnames) */
|
|
ngitServers: string[];
|
|
}
|
|
|
|
export interface AppContextType {
|
|
/** Current application configuration */
|
|
config: AppConfig;
|
|
/** Update configuration using a callback that receives current config and returns new config */
|
|
updateConfig: (updater: (currentConfig: Partial<AppConfig>) => Partial<AppConfig>) => void;
|
|
/** Optional list of preset relays to display in the RelaySelector */
|
|
presetRelays?: { name: string; url: string }[];
|
|
}
|
|
|
|
export const AppContext = createContext<AppContextType | undefined>(undefined);
|