-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add custom storybook for design system #784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
964d332
7b5fac5
fa41b32
71e4f22
e26cfd7
79ab5bf
e66a84e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .vite/ |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this references minor but would confuse someone opening the html file directly this will anyway get removed once we use storybook properly
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! The URL now correctly points to http://localhost:1422/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Handy Storybook</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"> | ||
| <div | ||
| style=" | ||
| max-width: 640px; | ||
| margin: 48px auto; | ||
| padding: 16px; | ||
| border: 1px solid #d9d9d9; | ||
| border-radius: 12px; | ||
| font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; | ||
| line-height: 1.5; | ||
| " | ||
| > | ||
| <h1 style="margin: 0 0 8px; font-size: 20px">Handy Storybook</h1> | ||
| <p style="margin: 0 0 8px"> | ||
| This page must be served with Vite. Opening this file directly will | ||
| not render React components. | ||
| </p> | ||
| <p style="margin: 0 0 8px">Run:</p> | ||
| <pre | ||
| style=" | ||
| margin: 0; | ||
| padding: 10px; | ||
| background: #f6f6f6; | ||
| border-radius: 8px; | ||
| overflow: auto; | ||
| " | ||
| ><code>bun install | ||
| bun run storybook</code></pre> | ||
| <p style="margin: 8px 0 0">Then open: <code>http://localhost:1422/</code></p> | ||
| </div> | ||
| </div> | ||
| <script type="module" src="./main.tsx"></script> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import React from "react"; | ||
| import ReactDOM from "react-dom/client"; | ||
| import "@/i18n"; | ||
| import "./storybook.css"; | ||
| import { StorybookApp } from "./storybook"; | ||
|
|
||
| ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( | ||
| <React.StrictMode> | ||
| <StorybookApp /> | ||
| </React.StrictMode>, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { | ||
| MOCK_APP_DIR, | ||
| MOCK_AUDIO_FILE, | ||
| MOCK_HISTORY, | ||
| MOCK_LOG_DIR, | ||
| MOCK_MODELS, | ||
| MOCK_POST_PROCESS_PROVIDERS, | ||
| MOCK_PROMPTS, | ||
| MOCK_RECORDINGS_DIR, | ||
| MOCK_SETTINGS, | ||
| } from "./data"; | ||
|
|
||
| const ok = <T>(data: T) => ({ status: "ok" as const, data }); | ||
|
|
||
| export const commands = { | ||
| // App + system | ||
| getAppSettings: async () => ok(MOCK_SETTINGS), | ||
| getDefaultSettings: async () => ok(MOCK_SETTINGS), | ||
| getAppDirPath: async () => ok(MOCK_APP_DIR), | ||
| openAppDataDir: async () => ok(null), | ||
| getLogDirPath: async () => ok(MOCK_LOG_DIR), | ||
| openLogDir: async () => ok(null), | ||
|
|
||
| // Permissions + shortcuts | ||
| initializeEnigo: async () => ok(null), | ||
| initializeShortcuts: async () => ok(null), | ||
| suspendBinding: async () => ok(null), | ||
| resumeBinding: async () => ok(null), | ||
| startHandyKeysRecording: async () => ok(null), | ||
| stopHandyKeysRecording: async () => ok(null), | ||
| changeKeyboardImplementationSetting: async () => | ||
| ok({ success: true, reset_bindings: [] }), | ||
|
|
||
| // Models | ||
| getTranscriptionModelStatus: async () => ok(MOCK_SETTINGS.selected_model), | ||
| isRecording: async () => false, | ||
|
|
||
| // Hardware + environment | ||
| isLaptop: async () => ok(true), | ||
|
|
||
| // Post-processing | ||
| addPostProcessPrompt: async (name: string, prompt: string) => | ||
| ok({ id: `prompt_${Date.now()}`, name, prompt }), | ||
| updatePostProcessPrompt: async () => ok(null), | ||
| deletePostProcessPrompt: async () => ok(null), | ||
| checkAppleIntelligenceAvailable: async () => false, | ||
|
|
||
| // History | ||
| getHistoryEntries: async () => ok(MOCK_HISTORY), | ||
| toggleHistoryEntrySaved: async () => ok(null), | ||
| getAudioFilePath: async () => ok(MOCK_AUDIO_FILE), | ||
| deleteHistoryEntry: async () => ok(null), | ||
| openRecordingsFolder: async () => ok(MOCK_RECORDINGS_DIR), | ||
|
|
||
| // Misc settings | ||
| setModelUnloadTimeout: async () => ok(null), | ||
|
|
||
| // Models list for storybook previews (not used by components directly) | ||
| getAvailableModels: async () => ok(MOCK_MODELS), | ||
|
|
||
| // Provider data for storybook previews (not used by components directly) | ||
| getPostProcessProviders: async () => ok(MOCK_POST_PROCESS_PROVIDERS), | ||
| getPostProcessPrompts: async () => ok(MOCK_PROMPTS), | ||
| }; | ||
|
|
||
| export type { | ||
| AppSettings, | ||
| AudioDevice, | ||
| ClipboardHandling, | ||
| EngineType, | ||
| HistoryEntry, | ||
| ImplementationChangeResult, | ||
| KeyboardImplementation, | ||
| LLMPrompt, | ||
| LogLevel, | ||
| ModelInfo, | ||
| ModelUnloadTimeout, | ||
| OverlayPosition, | ||
| PasteMethod, | ||
| PostProcessProvider, | ||
| RecordingRetentionPeriod, | ||
| Result, | ||
| ShortcutBinding, | ||
| SoundTheme, | ||
| } from "../../../src/bindings"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.mdandCLAUDE.mdshould be updated to document this new command and how to use the storybook. right now the only mention is in the PR descriptionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the bun run storybook command to both README.md and CLAUDE.md with a short description of what it does and the URL to open.