markupr 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/review-feedback.md +47 -0
- package/.eslintrc.json +35 -0
- package/.github/CODEOWNERS +16 -0
- package/.github/FUNDING.yml +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +56 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +54 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +89 -0
- package/.github/dependabot.yml +70 -0
- package/.github/workflows/ci.yml +184 -0
- package/.github/workflows/deploy-landing.yml +134 -0
- package/.github/workflows/nightly.yml +288 -0
- package/.github/workflows/release.yml +318 -0
- package/CHANGELOG.md +127 -0
- package/CLAUDE.md +137 -0
- package/CODE_OF_CONDUCT.md +9 -0
- package/CONTRIBUTING.md +390 -0
- package/LICENSE +21 -0
- package/PRODUCT_VISION.md +277 -0
- package/README.md +517 -0
- package/SECURITY.md +51 -0
- package/SIGNING_INSTRUCTIONS.md +284 -0
- package/assets/DMG_BACKGROUND_INSTRUCTIONS.md +130 -0
- package/assets/svg-source/dmg-background.svg +70 -0
- package/assets/svg-source/icon.svg +20 -0
- package/assets/svg-source/tray-icon-processing.svg +7 -0
- package/assets/svg-source/tray-icon-recording.svg +7 -0
- package/assets/svg-source/tray-icon.svg +6 -0
- package/assets/tray-complete.png +0 -0
- package/assets/tray-complete@2x.png +0 -0
- package/assets/tray-completeTemplate.png +0 -0
- package/assets/tray-completeTemplate@2x.png +0 -0
- package/assets/tray-error.png +0 -0
- package/assets/tray-error@2x.png +0 -0
- package/assets/tray-errorTemplate.png +0 -0
- package/assets/tray-errorTemplate@2x.png +0 -0
- package/assets/tray-icon-processing.png +0 -0
- package/assets/tray-icon-processing@2x.png +0 -0
- package/assets/tray-icon-processingTemplate.png +0 -0
- package/assets/tray-icon-processingTemplate@2x.png +0 -0
- package/assets/tray-icon-recording.png +0 -0
- package/assets/tray-icon-recording@2x.png +0 -0
- package/assets/tray-icon-recordingTemplate.png +0 -0
- package/assets/tray-icon-recordingTemplate@2x.png +0 -0
- package/assets/tray-icon.png +0 -0
- package/assets/tray-icon@2x.png +0 -0
- package/assets/tray-iconTemplate.png +0 -0
- package/assets/tray-iconTemplate@2x.png +0 -0
- package/assets/tray-idle.png +0 -0
- package/assets/tray-idle@2x.png +0 -0
- package/assets/tray-idleTemplate.png +0 -0
- package/assets/tray-idleTemplate@2x.png +0 -0
- package/assets/tray-processing-0.png +0 -0
- package/assets/tray-processing-0@2x.png +0 -0
- package/assets/tray-processing-0Template.png +0 -0
- package/assets/tray-processing-0Template@2x.png +0 -0
- package/assets/tray-processing-1.png +0 -0
- package/assets/tray-processing-1@2x.png +0 -0
- package/assets/tray-processing-1Template.png +0 -0
- package/assets/tray-processing-1Template@2x.png +0 -0
- package/assets/tray-processing-2.png +0 -0
- package/assets/tray-processing-2@2x.png +0 -0
- package/assets/tray-processing-2Template.png +0 -0
- package/assets/tray-processing-2Template@2x.png +0 -0
- package/assets/tray-processing-3.png +0 -0
- package/assets/tray-processing-3@2x.png +0 -0
- package/assets/tray-processing-3Template.png +0 -0
- package/assets/tray-processing-3Template@2x.png +0 -0
- package/assets/tray-processing.png +0 -0
- package/assets/tray-processing@2x.png +0 -0
- package/assets/tray-processingTemplate.png +0 -0
- package/assets/tray-processingTemplate@2x.png +0 -0
- package/assets/tray-recording.png +0 -0
- package/assets/tray-recording@2x.png +0 -0
- package/assets/tray-recordingTemplate.png +0 -0
- package/assets/tray-recordingTemplate@2x.png +0 -0
- package/build/DMG_BACKGROUND_SPEC.md +50 -0
- package/build/dmg-background.png +0 -0
- package/build/dmg-background@2x.png +0 -0
- package/build/entitlements.mac.inherit.plist +27 -0
- package/build/entitlements.mac.plist +41 -0
- package/build/favicon-16.png +0 -0
- package/build/favicon-180.png +0 -0
- package/build/favicon-192.png +0 -0
- package/build/favicon-32.png +0 -0
- package/build/favicon-48.png +0 -0
- package/build/favicon-512.png +0 -0
- package/build/favicon-64.png +0 -0
- package/build/icon-128.png +0 -0
- package/build/icon-16.png +0 -0
- package/build/icon-24.png +0 -0
- package/build/icon-256.png +0 -0
- package/build/icon-32.png +0 -0
- package/build/icon-48.png +0 -0
- package/build/icon-64.png +0 -0
- package/build/icon.icns +0 -0
- package/build/icon.ico +0 -0
- package/build/icon.iconset/icon_128x128.png +0 -0
- package/build/icon.iconset/icon_128x128@2x.png +0 -0
- package/build/icon.iconset/icon_16x16.png +0 -0
- package/build/icon.iconset/icon_16x16@2x.png +0 -0
- package/build/icon.iconset/icon_256x256.png +0 -0
- package/build/icon.iconset/icon_256x256@2x.png +0 -0
- package/build/icon.iconset/icon_32x32.png +0 -0
- package/build/icon.iconset/icon_32x32@2x.png +0 -0
- package/build/icon.iconset/icon_512x512.png +0 -0
- package/build/icon.iconset/icon_512x512@2x.png +0 -0
- package/build/icon.png +0 -0
- package/build/installer-header.bmp +0 -0
- package/build/installer-header.png +0 -0
- package/build/installer-sidebar.bmp +0 -0
- package/build/installer-sidebar.png +0 -0
- package/build/installer.nsh +45 -0
- package/build/overlay-processing.png +0 -0
- package/build/overlay-recording.png +0 -0
- package/build/toolbar-record.png +0 -0
- package/build/toolbar-screenshot.png +0 -0
- package/build/toolbar-settings.png +0 -0
- package/build/toolbar-stop.png +0 -0
- package/dist/main/index.mjs +12612 -0
- package/dist/preload/index.mjs +907 -0
- package/dist/renderer/assets/index-CCmUjl9K.js +19495 -0
- package/dist/renderer/assets/index-CUqz_Gs6.css +2270 -0
- package/dist/renderer/index.html +27 -0
- package/docs/AI_AGENT_QUICKSTART.md +42 -0
- package/docs/AI_PIPELINE_DESIGN.md +595 -0
- package/docs/API.md +514 -0
- package/docs/ARCHITECTURE.md +460 -0
- package/docs/CONFIGURATION.md +336 -0
- package/docs/DEVELOPMENT.md +508 -0
- package/docs/EXPORT_FORMATS.md +451 -0
- package/docs/GETTING_STARTED.md +236 -0
- package/docs/KEYBOARD_SHORTCUTS.md +334 -0
- package/docs/TROUBLESHOOTING.md +418 -0
- package/docs/landing/index.html +672 -0
- package/docs/landing/script.js +342 -0
- package/docs/landing/styles.css +1543 -0
- package/electron-builder.yml +140 -0
- package/electron.vite.config.ts +63 -0
- package/package.json +108 -0
- package/railway.json +12 -0
- package/scripts/build.mjs +51 -0
- package/scripts/generate-icons.mjs +314 -0
- package/scripts/generate-installer-images.cjs +253 -0
- package/scripts/generate-tray-icons.mjs +258 -0
- package/scripts/notarize.cjs +180 -0
- package/scripts/one-click-clean-test.sh +147 -0
- package/scripts/postinstall.mjs +36 -0
- package/scripts/setup-markupr.sh +55 -0
- package/setup +17 -0
- package/site/index.html +1835 -0
- package/site/package.json +11 -0
- package/site/railway.json +12 -0
- package/site/server.js +31 -0
- package/src/main/AutoUpdater.ts +392 -0
- package/src/main/CrashRecovery.ts +655 -0
- package/src/main/ErrorHandler.ts +703 -0
- package/src/main/HotkeyManager.ts +399 -0
- package/src/main/MenuManager.ts +529 -0
- package/src/main/PermissionManager.ts +420 -0
- package/src/main/SessionController.ts +1465 -0
- package/src/main/TrayManager.ts +540 -0
- package/src/main/ai/AIPipelineManager.ts +199 -0
- package/src/main/ai/ClaudeAnalyzer.ts +339 -0
- package/src/main/ai/ImageOptimizer.ts +176 -0
- package/src/main/ai/StructuredMarkdownBuilder.ts +379 -0
- package/src/main/ai/index.ts +16 -0
- package/src/main/ai/types.ts +258 -0
- package/src/main/analysis/ClarificationGenerator.ts +385 -0
- package/src/main/analysis/FeedbackAnalyzer.ts +531 -0
- package/src/main/analysis/index.ts +19 -0
- package/src/main/audio/AudioCapture.ts +978 -0
- package/src/main/audio/audioUtils.ts +100 -0
- package/src/main/audio/index.ts +20 -0
- package/src/main/capture/index.ts +1 -0
- package/src/main/index.ts +1693 -0
- package/src/main/ipc/captureHandlers.ts +272 -0
- package/src/main/ipc/index.ts +45 -0
- package/src/main/ipc/outputHandlers.ts +302 -0
- package/src/main/ipc/sessionHandlers.ts +56 -0
- package/src/main/ipc/settingsHandlers.ts +471 -0
- package/src/main/ipc/types.ts +56 -0
- package/src/main/ipc/windowHandlers.ts +277 -0
- package/src/main/output/ClipboardService.ts +369 -0
- package/src/main/output/ExportService.ts +539 -0
- package/src/main/output/FileManager.ts +416 -0
- package/src/main/output/MarkdownGenerator.ts +791 -0
- package/src/main/output/MarkdownPatcher.ts +299 -0
- package/src/main/output/index.ts +186 -0
- package/src/main/output/sessionAdapter.ts +207 -0
- package/src/main/output/templates/html-template.ts +553 -0
- package/src/main/pipeline/FrameExtractor.ts +330 -0
- package/src/main/pipeline/PostProcessor.ts +399 -0
- package/src/main/pipeline/TranscriptAnalyzer.ts +226 -0
- package/src/main/pipeline/index.ts +36 -0
- package/src/main/platform/WindowsTaskbar.ts +600 -0
- package/src/main/platform/index.ts +16 -0
- package/src/main/settings/SettingsManager.ts +730 -0
- package/src/main/settings/index.ts +19 -0
- package/src/main/transcription/ModelDownloadManager.ts +494 -0
- package/src/main/transcription/TierManager.ts +219 -0
- package/src/main/transcription/TranscriptionRecoveryService.ts +340 -0
- package/src/main/transcription/WhisperService.ts +748 -0
- package/src/main/transcription/index.ts +56 -0
- package/src/main/transcription/types.ts +135 -0
- package/src/main/windows/PopoverManager.ts +284 -0
- package/src/main/windows/TaskbarIntegration.ts +452 -0
- package/src/main/windows/index.ts +23 -0
- package/src/preload/index.ts +1047 -0
- package/src/renderer/App.tsx +515 -0
- package/src/renderer/AppWrapper.tsx +28 -0
- package/src/renderer/assets/logo-dark.svg +7 -0
- package/src/renderer/assets/logo.svg +7 -0
- package/src/renderer/audio/AudioCaptureRenderer.ts +454 -0
- package/src/renderer/capture/ScreenRecordingRenderer.ts +492 -0
- package/src/renderer/components/AnnotationOverlay.tsx +836 -0
- package/src/renderer/components/AudioWaveform.tsx +811 -0
- package/src/renderer/components/ClarificationQuestions.tsx +656 -0
- package/src/renderer/components/CountdownTimer.tsx +495 -0
- package/src/renderer/components/CrashRecoveryDialog.tsx +632 -0
- package/src/renderer/components/DonateButton.tsx +127 -0
- package/src/renderer/components/ErrorBoundary.tsx +308 -0
- package/src/renderer/components/ExportDialog.tsx +872 -0
- package/src/renderer/components/HotkeyHint.tsx +261 -0
- package/src/renderer/components/KeyboardShortcuts.tsx +787 -0
- package/src/renderer/components/ModelDownloadDialog.tsx +844 -0
- package/src/renderer/components/Onboarding.tsx +1830 -0
- package/src/renderer/components/ProcessingOverlay.tsx +157 -0
- package/src/renderer/components/RecordingOverlay.tsx +423 -0
- package/src/renderer/components/SessionHistory.tsx +1746 -0
- package/src/renderer/components/SessionReview.tsx +1321 -0
- package/src/renderer/components/SettingsPanel.tsx +217 -0
- package/src/renderer/components/Skeleton.tsx +347 -0
- package/src/renderer/components/StatusIndicator.tsx +86 -0
- package/src/renderer/components/ThemeProvider.tsx +429 -0
- package/src/renderer/components/Tooltip.tsx +370 -0
- package/src/renderer/components/TranscriptionPreview.tsx +183 -0
- package/src/renderer/components/TranscriptionTierSelector.tsx +640 -0
- package/src/renderer/components/UpdateNotification.tsx +377 -0
- package/src/renderer/components/WindowSelector.tsx +947 -0
- package/src/renderer/components/index.ts +99 -0
- package/src/renderer/components/primitives/ApiKeyInput.tsx +98 -0
- package/src/renderer/components/primitives/ColorPicker.tsx +65 -0
- package/src/renderer/components/primitives/DangerButton.tsx +45 -0
- package/src/renderer/components/primitives/DirectoryPicker.tsx +41 -0
- package/src/renderer/components/primitives/Dropdown.tsx +34 -0
- package/src/renderer/components/primitives/KeyRecorder.tsx +117 -0
- package/src/renderer/components/primitives/SettingsSection.tsx +32 -0
- package/src/renderer/components/primitives/Slider.tsx +43 -0
- package/src/renderer/components/primitives/Toggle.tsx +36 -0
- package/src/renderer/components/primitives/index.ts +10 -0
- package/src/renderer/components/settings/AdvancedTab.tsx +174 -0
- package/src/renderer/components/settings/AppearanceTab.tsx +77 -0
- package/src/renderer/components/settings/GeneralTab.tsx +40 -0
- package/src/renderer/components/settings/HotkeysTab.tsx +79 -0
- package/src/renderer/components/settings/RecordingTab.tsx +84 -0
- package/src/renderer/components/settings/index.ts +9 -0
- package/src/renderer/components/settings/settingsStyles.ts +673 -0
- package/src/renderer/components/settings/tabConfig.tsx +85 -0
- package/src/renderer/components/settings/useSettingsPanel.ts +447 -0
- package/src/renderer/contexts/ProcessingContext.tsx +227 -0
- package/src/renderer/contexts/RecordingContext.tsx +683 -0
- package/src/renderer/contexts/UIContext.tsx +326 -0
- package/src/renderer/contexts/index.ts +24 -0
- package/src/renderer/donateMessages.ts +69 -0
- package/src/renderer/hooks/index.ts +75 -0
- package/src/renderer/hooks/useAnimation.tsx +544 -0
- package/src/renderer/hooks/useTheme.ts +313 -0
- package/src/renderer/index.html +26 -0
- package/src/renderer/main.tsx +52 -0
- package/src/renderer/styles/animations.css +1093 -0
- package/src/renderer/styles/app-shell.css +662 -0
- package/src/renderer/styles/globals.css +515 -0
- package/src/renderer/styles/theme.ts +578 -0
- package/src/renderer/types/electron.d.ts +385 -0
- package/src/shared/hotkeys.ts +283 -0
- package/src/shared/types.ts +809 -0
- package/tests/clipboard.test.ts +228 -0
- package/tests/e2e/criticalPaths.test.ts +594 -0
- package/tests/feedbackAnalyzer.test.ts +303 -0
- package/tests/integration/sessionFlow.test.ts +583 -0
- package/tests/markdownGenerator.test.ts +418 -0
- package/tests/output.test.ts +96 -0
- package/tests/setup.ts +486 -0
- package/tests/unit/appIntegration.test.ts +676 -0
- package/tests/unit/appViewState.test.ts +281 -0
- package/tests/unit/audioIpcChannels.test.ts +17 -0
- package/tests/unit/exportService.test.ts +492 -0
- package/tests/unit/hotkeys.test.ts +92 -0
- package/tests/unit/navigationPreload.test.ts +94 -0
- package/tests/unit/onboardingFlow.test.ts +345 -0
- package/tests/unit/permissionManager.test.ts +175 -0
- package/tests/unit/permissionManagerExpanded.test.ts +296 -0
- package/tests/unit/screenRecordingRenderer.test.ts +368 -0
- package/tests/unit/sessionController.test.ts +515 -0
- package/tests/unit/tierManager.test.ts +61 -0
- package/tests/unit/tierManagerExpanded.test.ts +142 -0
- package/tests/unit/transcriptAnalyzer.test.ts +64 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +46 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* markupr UI Components
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all components for clean imports:
|
|
5
|
+
* import { RecordingOverlay, StatusIndicator, SessionReview, Onboarding, ErrorBoundary, AnnotationOverlay, AudioWaveform } from './components';
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { RecordingOverlay } from './RecordingOverlay';
|
|
9
|
+
export { ProcessingOverlay } from './ProcessingOverlay';
|
|
10
|
+
export { CountdownTimer } from './CountdownTimer';
|
|
11
|
+
export { default as StatusIndicator } from './StatusIndicator';
|
|
12
|
+
export { SessionReview } from './SessionReview';
|
|
13
|
+
export { Onboarding } from './Onboarding';
|
|
14
|
+
export { ErrorBoundary, MinimalErrorBoundary } from './ErrorBoundary';
|
|
15
|
+
export { AnnotationOverlay } from './AnnotationOverlay';
|
|
16
|
+
export { AudioWaveform, CompactAudioIndicator, AudioLevelMeter } from './AudioWaveform';
|
|
17
|
+
export { WindowSelector } from './WindowSelector';
|
|
18
|
+
export { UpdateNotification } from './UpdateNotification';
|
|
19
|
+
export { CrashRecoveryDialog, useCrashRecovery } from './CrashRecoveryDialog';
|
|
20
|
+
export { ExportDialog } from './ExportDialog';
|
|
21
|
+
export { ClarificationQuestions } from './ClarificationQuestions';
|
|
22
|
+
|
|
23
|
+
// Theme components
|
|
24
|
+
export { ThemeProvider, ThemeToggle, AccentColorPicker } from './ThemeProvider';
|
|
25
|
+
|
|
26
|
+
// Animation components
|
|
27
|
+
export { default as Skeleton } from './Skeleton';
|
|
28
|
+
export {
|
|
29
|
+
SkeletonText,
|
|
30
|
+
SkeletonAvatar,
|
|
31
|
+
SkeletonThumbnail,
|
|
32
|
+
SkeletonButton,
|
|
33
|
+
SkeletonCard,
|
|
34
|
+
SkeletonListItem,
|
|
35
|
+
SkeletonFeedbackItem,
|
|
36
|
+
SkeletonWindowSource,
|
|
37
|
+
} from './Skeleton';
|
|
38
|
+
|
|
39
|
+
export { default as Tooltip } from './Tooltip';
|
|
40
|
+
export { Tooltip as TooltipComponent, HotkeyTooltip, StatusTooltip } from './Tooltip';
|
|
41
|
+
|
|
42
|
+
// Keyboard shortcuts panel
|
|
43
|
+
export { KeyboardShortcuts, default as KeyboardShortcutsPanel } from './KeyboardShortcuts';
|
|
44
|
+
|
|
45
|
+
// Hotkey hint component (platform-aware)
|
|
46
|
+
export { HotkeyHint, ToggleRecordingHint, ManualScreenshotHint, getHotkeyText } from './HotkeyHint';
|
|
47
|
+
|
|
48
|
+
// Transcription tier selector
|
|
49
|
+
export { TranscriptionTierSelector, type TranscriptionTier } from './TranscriptionTierSelector';
|
|
50
|
+
|
|
51
|
+
// Settings panel
|
|
52
|
+
export { SettingsPanel, default as SettingsPanelDefault } from './SettingsPanel';
|
|
53
|
+
|
|
54
|
+
// Donate button
|
|
55
|
+
export { DonateButton, default as DonateButtonDefault } from './DonateButton';
|
|
56
|
+
|
|
57
|
+
// Session history
|
|
58
|
+
export { SessionHistory } from './SessionHistory';
|
|
59
|
+
|
|
60
|
+
// Transcription preview (post-processing results viewer)
|
|
61
|
+
export { TranscriptionPreview, TranscriptionPreviewAnimated } from './TranscriptionPreview';
|
|
62
|
+
export type { TranscriptSegment, TranscriptionPreviewProps } from './TranscriptionPreview';
|
|
63
|
+
|
|
64
|
+
// Model download dialog
|
|
65
|
+
export { ModelDownloadDialog, useModelCheck } from './ModelDownloadDialog';
|
|
66
|
+
|
|
67
|
+
// Type exports for external use
|
|
68
|
+
export type { default as RecordingOverlayType } from './RecordingOverlay';
|
|
69
|
+
export type { SessionReviewProps } from './SessionReview';
|
|
70
|
+
export type { AudioWaveformProps } from './AudioWaveform';
|
|
71
|
+
export type { TooltipProps, TooltipPlacement, TooltipStatus } from './Tooltip';
|
|
72
|
+
export type {
|
|
73
|
+
CrashRecoveryDialogProps,
|
|
74
|
+
RecoverableSession,
|
|
75
|
+
RecoverableFeedbackItem,
|
|
76
|
+
UseCrashRecoveryReturn,
|
|
77
|
+
} from './CrashRecoveryDialog';
|
|
78
|
+
export type {
|
|
79
|
+
KeyboardShortcutsProps,
|
|
80
|
+
Shortcut,
|
|
81
|
+
ShortcutCategory,
|
|
82
|
+
} from './KeyboardShortcuts';
|
|
83
|
+
export type {
|
|
84
|
+
ExportDialogProps,
|
|
85
|
+
ExportOptions as ExportDialogOptions,
|
|
86
|
+
ExportFormat as DialogExportFormat,
|
|
87
|
+
} from './ExportDialog';
|
|
88
|
+
export type { CountdownTimerProps } from './CountdownTimer';
|
|
89
|
+
export type {
|
|
90
|
+
ThemeProviderProps,
|
|
91
|
+
ThemeToggleProps,
|
|
92
|
+
AccentColorPickerProps,
|
|
93
|
+
} from './ThemeProvider';
|
|
94
|
+
export type {
|
|
95
|
+
ClarificationQuestionsProps,
|
|
96
|
+
ClarificationQuestion,
|
|
97
|
+
ClarificationType,
|
|
98
|
+
} from './ClarificationQuestions';
|
|
99
|
+
export type { DonateButtonProps } from './DonateButton';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
3
|
+
import { styles } from '../settings/settingsStyles';
|
|
4
|
+
|
|
5
|
+
export interface ApiKeyState {
|
|
6
|
+
value: string;
|
|
7
|
+
visible: boolean;
|
|
8
|
+
testing: boolean;
|
|
9
|
+
valid: boolean | null;
|
|
10
|
+
error: string | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ApiKeyInput: React.FC<{
|
|
14
|
+
label: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
serviceName: string;
|
|
17
|
+
apiKey: ApiKeyState;
|
|
18
|
+
onApiKeyChange: (value: string) => void;
|
|
19
|
+
onToggleVisibility: () => void;
|
|
20
|
+
onTest: () => void;
|
|
21
|
+
}> = ({ label, description, serviceName, apiKey, onApiKeyChange, onToggleVisibility, onTest }) => {
|
|
22
|
+
const { colors } = useTheme();
|
|
23
|
+
return (
|
|
24
|
+
<div style={styles.settingRowVertical}>
|
|
25
|
+
<div style={styles.settingInfo}>
|
|
26
|
+
<span style={styles.settingLabel}>{label}</span>
|
|
27
|
+
{description && <span style={styles.settingDescription}>{description}</span>}
|
|
28
|
+
</div>
|
|
29
|
+
<div style={styles.apiKeyContainer}>
|
|
30
|
+
<div style={styles.apiKeyInputWrapper}>
|
|
31
|
+
<input
|
|
32
|
+
type={apiKey.visible ? 'text' : 'password'}
|
|
33
|
+
value={apiKey.value}
|
|
34
|
+
onChange={(e) => onApiKeyChange(e.target.value)}
|
|
35
|
+
placeholder={`Enter your ${serviceName} API key`}
|
|
36
|
+
style={{
|
|
37
|
+
...styles.apiKeyInput,
|
|
38
|
+
borderColor: apiKey.error ? colors.status.error : apiKey.valid ? colors.status.success : colors.border.default,
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
<button style={styles.apiKeyVisibilityButton} onClick={onToggleVisibility} title={apiKey.visible ? 'Hide' : 'Show'}>
|
|
42
|
+
{apiKey.visible ? (
|
|
43
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
44
|
+
<path
|
|
45
|
+
d="M2.636 9.364S4.91 5.182 9 5.182s6.364 4.182 6.364 4.182-2.273 4.182-6.364 4.182-6.364-4.182-6.364-4.182z"
|
|
46
|
+
stroke="currentColor"
|
|
47
|
+
strokeWidth="1.5"
|
|
48
|
+
strokeLinecap="round"
|
|
49
|
+
/>
|
|
50
|
+
<circle cx="9" cy="9" r="2" stroke="currentColor" strokeWidth="1.5" />
|
|
51
|
+
</svg>
|
|
52
|
+
) : (
|
|
53
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
54
|
+
<path
|
|
55
|
+
d="M2 2l14 14M7.455 7.455a2 2 0 002.828 2.828M14.182 10.727c.6-.527.975-.961 1.182-1.363-1.636-3.273-4.364-5.182-6.364-5.182-.545 0-1.09.127-1.636.382M3.818 5.273C2.818 6.073 2.273 6.909 2 7.636c1.636 3.273 4.364 5.182 6.364 5.182.818 0 1.636-.255 2.454-.727"
|
|
56
|
+
stroke="currentColor"
|
|
57
|
+
strokeWidth="1.5"
|
|
58
|
+
strokeLinecap="round"
|
|
59
|
+
/>
|
|
60
|
+
</svg>
|
|
61
|
+
)}
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
<button
|
|
65
|
+
style={{
|
|
66
|
+
...styles.apiKeyTestButton,
|
|
67
|
+
backgroundColor: apiKey.testing ? colors.bg.tertiary : apiKey.valid ? colors.status.success : colors.accent.default,
|
|
68
|
+
cursor: !apiKey.value ? 'not-allowed' : 'pointer',
|
|
69
|
+
opacity: !apiKey.value ? 0.5 : 1,
|
|
70
|
+
}}
|
|
71
|
+
onClick={onTest}
|
|
72
|
+
disabled={!apiKey.value}
|
|
73
|
+
>
|
|
74
|
+
{apiKey.testing ? (
|
|
75
|
+
<span style={styles.spinner} />
|
|
76
|
+
) : apiKey.valid ? (
|
|
77
|
+
<>
|
|
78
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
79
|
+
<path
|
|
80
|
+
d="M7 2.25a4.75 4.75 0 104.39 2.92"
|
|
81
|
+
stroke="currentColor"
|
|
82
|
+
strokeWidth="1.4"
|
|
83
|
+
strokeLinecap="round"
|
|
84
|
+
/>
|
|
85
|
+
<path d="M10.7 2.3h1.2v1.2" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" />
|
|
86
|
+
</svg>
|
|
87
|
+
Retest
|
|
88
|
+
</>
|
|
89
|
+
) : (
|
|
90
|
+
'Test Connection'
|
|
91
|
+
)}
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
94
|
+
{apiKey.error && <span style={styles.apiKeyError}>{apiKey.error}</span>}
|
|
95
|
+
{apiKey.valid && <span style={styles.apiKeySuccess}>API key verified and saved securely.</span>}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { accentColors } from '../../styles/theme';
|
|
3
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
4
|
+
import { styles } from '../settings/settingsStyles';
|
|
5
|
+
|
|
6
|
+
export const ACCENT_COLORS = [
|
|
7
|
+
{ name: accentColors.blue.name, value: accentColors.blue.default },
|
|
8
|
+
{ name: accentColors.violet.name, value: accentColors.violet.default },
|
|
9
|
+
{ name: accentColors.pink.name, value: accentColors.pink.default },
|
|
10
|
+
{ name: accentColors.red.name, value: accentColors.red.default },
|
|
11
|
+
{ name: accentColors.orange.name, value: accentColors.orange.default },
|
|
12
|
+
{ name: accentColors.amber.name, value: accentColors.amber.default },
|
|
13
|
+
{ name: accentColors.emerald.name, value: accentColors.emerald.default },
|
|
14
|
+
{ name: accentColors.teal.name, value: accentColors.teal.default },
|
|
15
|
+
{ name: accentColors.cyan.name, value: accentColors.cyan.default },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export const ColorPicker: React.FC<{
|
|
19
|
+
label: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
value: string;
|
|
22
|
+
onChange: (value: string) => void;
|
|
23
|
+
}> = ({ label, description, value, onChange }) => {
|
|
24
|
+
const [customColor, setCustomColor] = useState(value);
|
|
25
|
+
const { colors } = useTheme();
|
|
26
|
+
|
|
27
|
+
const isPreset = ACCENT_COLORS.some((c) => c.value === value);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div style={styles.settingRowVertical}>
|
|
31
|
+
<div style={styles.settingInfo}>
|
|
32
|
+
<span style={styles.settingLabel}>{label}</span>
|
|
33
|
+
{description && <span style={styles.settingDescription}>{description}</span>}
|
|
34
|
+
</div>
|
|
35
|
+
<div style={styles.colorPickerContainer}>
|
|
36
|
+
{ACCENT_COLORS.map((color) => (
|
|
37
|
+
<button
|
|
38
|
+
key={color.value}
|
|
39
|
+
style={{
|
|
40
|
+
...styles.colorSwatch,
|
|
41
|
+
backgroundColor: color.value,
|
|
42
|
+
boxShadow: value === color.value ? `0 0 0 2px ${colors.bg.primary}, 0 0 0 4px ${color.value}` : 'none',
|
|
43
|
+
}}
|
|
44
|
+
onClick={() => onChange(color.value)}
|
|
45
|
+
title={color.name}
|
|
46
|
+
aria-label={`Select ${color.name} accent color`}
|
|
47
|
+
/>
|
|
48
|
+
))}
|
|
49
|
+
<div style={styles.customColorContainer}>
|
|
50
|
+
<input
|
|
51
|
+
type="color"
|
|
52
|
+
value={isPreset ? customColor : value}
|
|
53
|
+
onChange={(e) => {
|
|
54
|
+
setCustomColor(e.target.value);
|
|
55
|
+
onChange(e.target.value);
|
|
56
|
+
}}
|
|
57
|
+
style={styles.customColorInput}
|
|
58
|
+
title="Custom color"
|
|
59
|
+
/>
|
|
60
|
+
<span style={styles.customColorLabel}>Custom</span>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
3
|
+
import { styles } from '../settings/settingsStyles';
|
|
4
|
+
|
|
5
|
+
export const DangerButton: React.FC<{
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
buttonText: string;
|
|
9
|
+
onConfirm: () => void;
|
|
10
|
+
confirmText?: string;
|
|
11
|
+
}> = ({ label, description, buttonText, onConfirm, confirmText }) => {
|
|
12
|
+
const [confirming, setConfirming] = useState(false);
|
|
13
|
+
const { colors } = useTheme();
|
|
14
|
+
|
|
15
|
+
const handleClick = useCallback(() => {
|
|
16
|
+
if (confirming) {
|
|
17
|
+
onConfirm();
|
|
18
|
+
setConfirming(false);
|
|
19
|
+
} else {
|
|
20
|
+
setConfirming(true);
|
|
21
|
+
// Auto-reset after 3 seconds
|
|
22
|
+
setTimeout(() => setConfirming(false), 3000);
|
|
23
|
+
}
|
|
24
|
+
}, [confirming, onConfirm]);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div style={styles.settingRow}>
|
|
28
|
+
<div style={styles.settingInfo}>
|
|
29
|
+
<span style={styles.settingLabel}>{label}</span>
|
|
30
|
+
{description && <span style={styles.settingDescription}>{description}</span>}
|
|
31
|
+
</div>
|
|
32
|
+
<button
|
|
33
|
+
style={{
|
|
34
|
+
...styles.dangerButton,
|
|
35
|
+
backgroundColor: confirming ? colors.status.error : colors.status.errorSubtle,
|
|
36
|
+
color: confirming ? colors.text.inverse : colors.status.error,
|
|
37
|
+
borderColor: confirming ? colors.status.error : colors.status.errorSubtle,
|
|
38
|
+
}}
|
|
39
|
+
onClick={handleClick}
|
|
40
|
+
>
|
|
41
|
+
{confirming ? confirmText || 'Click again to confirm' : buttonText}
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { styles } from '../settings/settingsStyles';
|
|
3
|
+
|
|
4
|
+
export const DirectoryPicker: React.FC<{
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
}> = ({ label, description, value, onChange }) => {
|
|
10
|
+
const handleBrowse = useCallback(async () => {
|
|
11
|
+
try {
|
|
12
|
+
const result = await window.markupr.settings.selectDirectory();
|
|
13
|
+
if (result) {
|
|
14
|
+
onChange(result);
|
|
15
|
+
}
|
|
16
|
+
} catch {
|
|
17
|
+
// User cancelled or error
|
|
18
|
+
}
|
|
19
|
+
}, [onChange]);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div style={styles.settingRow}>
|
|
23
|
+
<div style={styles.settingInfo}>
|
|
24
|
+
<span style={styles.settingLabel}>{label}</span>
|
|
25
|
+
{description && <span style={styles.settingDescription}>{description}</span>}
|
|
26
|
+
</div>
|
|
27
|
+
<div style={styles.directoryPicker}>
|
|
28
|
+
<input
|
|
29
|
+
type="text"
|
|
30
|
+
value={value}
|
|
31
|
+
readOnly
|
|
32
|
+
style={styles.directoryInput}
|
|
33
|
+
placeholder="Select output directory..."
|
|
34
|
+
/>
|
|
35
|
+
<button style={styles.browseButton} onClick={handleBrowse}>
|
|
36
|
+
Browse...
|
|
37
|
+
</button>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styles } from '../settings/settingsStyles';
|
|
3
|
+
|
|
4
|
+
export const DropdownSetting: React.FC<{
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
options: { value: string | number; label: string }[];
|
|
9
|
+
onChange: (value: string | number) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}> = ({ label, description, value, options, onChange, disabled }) => (
|
|
12
|
+
<div style={styles.settingRow}>
|
|
13
|
+
<div style={styles.settingInfo}>
|
|
14
|
+
<span style={styles.settingLabel}>{label}</span>
|
|
15
|
+
{description && <span style={styles.settingDescription}>{description}</span>}
|
|
16
|
+
</div>
|
|
17
|
+
<select
|
|
18
|
+
style={{
|
|
19
|
+
...styles.select,
|
|
20
|
+
opacity: disabled ? 0.5 : 1,
|
|
21
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
22
|
+
}}
|
|
23
|
+
value={value}
|
|
24
|
+
onChange={(e) => onChange(e.target.value)}
|
|
25
|
+
disabled={disabled}
|
|
26
|
+
>
|
|
27
|
+
{options.map((opt) => (
|
|
28
|
+
<option key={opt.value} value={opt.value}>
|
|
29
|
+
{opt.label}
|
|
30
|
+
</option>
|
|
31
|
+
))}
|
|
32
|
+
</select>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { useState, useRef, useCallback, useEffect } from 'react';
|
|
2
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
3
|
+
import { styles } from '../settings/settingsStyles';
|
|
4
|
+
|
|
5
|
+
export const KeyRecorder: React.FC<{
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
conflict?: string | null;
|
|
11
|
+
}> = ({ label, description, value, onChange, conflict }) => {
|
|
12
|
+
const [recording, setRecording] = useState(false);
|
|
13
|
+
const { colors } = useTheme();
|
|
14
|
+
const inputRef = useRef<HTMLButtonElement>(null);
|
|
15
|
+
const isMac = typeof navigator !== 'undefined' && navigator.platform.toLowerCase().includes('mac');
|
|
16
|
+
|
|
17
|
+
const formatHotkey = useCallback((hotkey: string): string => {
|
|
18
|
+
return hotkey
|
|
19
|
+
.replace('CommandOrControl', isMac ? 'Cmd' : 'Ctrl')
|
|
20
|
+
.replace('Command', 'Cmd')
|
|
21
|
+
.replace('Control', 'Ctrl')
|
|
22
|
+
.replace('Alt', isMac ? 'Option' : 'Alt')
|
|
23
|
+
.replace('Shift', 'Shift')
|
|
24
|
+
.replace(/\+/g, ' + ');
|
|
25
|
+
}, [isMac]);
|
|
26
|
+
|
|
27
|
+
const handleKeyDown = useCallback(
|
|
28
|
+
(e: KeyboardEvent) => {
|
|
29
|
+
if (!recording) return;
|
|
30
|
+
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
|
|
34
|
+
const modifiers: string[] = [];
|
|
35
|
+
if (e.metaKey || e.ctrlKey) modifiers.push('CommandOrControl');
|
|
36
|
+
if (e.altKey) modifiers.push('Alt');
|
|
37
|
+
if (e.shiftKey) modifiers.push('Shift');
|
|
38
|
+
|
|
39
|
+
// Ignore modifier-only keys
|
|
40
|
+
const key = e.key;
|
|
41
|
+
if (['Meta', 'Control', 'Alt', 'Shift'].includes(key)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Build hotkey string
|
|
46
|
+
const hotkeyKey = key.length === 1 ? key.toUpperCase() : key;
|
|
47
|
+
const hotkey = [...modifiers, hotkeyKey].join('+');
|
|
48
|
+
|
|
49
|
+
onChange(hotkey);
|
|
50
|
+
setRecording(false);
|
|
51
|
+
},
|
|
52
|
+
[recording, onChange]
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (recording) {
|
|
57
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
58
|
+
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
59
|
+
}
|
|
60
|
+
}, [recording, handleKeyDown]);
|
|
61
|
+
|
|
62
|
+
// Cancel recording on click outside
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!recording) return;
|
|
65
|
+
|
|
66
|
+
const handleClickOutside = (e: MouseEvent) => {
|
|
67
|
+
if (inputRef.current && !inputRef.current.contains(e.target as Node)) {
|
|
68
|
+
setRecording(false);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
73
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
74
|
+
}, [recording]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div style={styles.settingRow}>
|
|
78
|
+
<div style={styles.settingInfo}>
|
|
79
|
+
<span style={styles.settingLabel}>{label}</span>
|
|
80
|
+
{description && <span style={styles.settingDescription}>{description}</span>}
|
|
81
|
+
{conflict && (
|
|
82
|
+
<span style={styles.conflictWarning}>
|
|
83
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
84
|
+
<path
|
|
85
|
+
d="M7 4.5v3M7 9.5h.005"
|
|
86
|
+
stroke={colors.status.warning}
|
|
87
|
+
strokeWidth="1.5"
|
|
88
|
+
strokeLinecap="round"
|
|
89
|
+
/>
|
|
90
|
+
<path
|
|
91
|
+
d="M6.134 1.944L1.06 10.5a1 1 0 00.866 1.5h10.148a1 1 0 00.866-1.5L7.866 1.944a1 1 0 00-1.732 0z"
|
|
92
|
+
stroke={colors.status.warning}
|
|
93
|
+
strokeWidth="1.5"
|
|
94
|
+
/>
|
|
95
|
+
</svg>
|
|
96
|
+
Conflicts with: {conflict}
|
|
97
|
+
</span>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
<button
|
|
101
|
+
ref={inputRef}
|
|
102
|
+
style={{
|
|
103
|
+
...styles.keyRecorder,
|
|
104
|
+
borderColor: recording ? colors.accent.default : conflict ? colors.status.warning : colors.border.default,
|
|
105
|
+
backgroundColor: recording ? colors.accent.subtle : colors.surface.inset,
|
|
106
|
+
}}
|
|
107
|
+
onClick={() => setRecording(true)}
|
|
108
|
+
>
|
|
109
|
+
{recording ? (
|
|
110
|
+
<span style={styles.keyRecorderRecording}>Press keys...</span>
|
|
111
|
+
) : (
|
|
112
|
+
<span style={styles.keyRecorderValue}>{formatHotkey(value)}</span>
|
|
113
|
+
)}
|
|
114
|
+
</button>
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styles } from '../settings/settingsStyles';
|
|
3
|
+
|
|
4
|
+
export const SettingsSection: React.FC<{
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
onReset?: () => void;
|
|
9
|
+
}> = ({ title, description, children, onReset }) => (
|
|
10
|
+
<div style={styles.section}>
|
|
11
|
+
<div style={styles.sectionHeader}>
|
|
12
|
+
<div>
|
|
13
|
+
<h3 style={styles.sectionTitle}>{title}</h3>
|
|
14
|
+
{description && <p style={styles.sectionDescription}>{description}</p>}
|
|
15
|
+
</div>
|
|
16
|
+
{onReset && (
|
|
17
|
+
<button style={styles.resetSectionButton} onClick={onReset} title="Reset section to defaults">
|
|
18
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
19
|
+
<path
|
|
20
|
+
d="M1.75 7a5.25 5.25 0 109.006-3.668M7 3.5V1.75L9.625 4.375 7 7"
|
|
21
|
+
stroke="currentColor"
|
|
22
|
+
strokeWidth="1.25"
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
strokeLinejoin="round"
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
</button>
|
|
28
|
+
)}
|
|
29
|
+
</div>
|
|
30
|
+
<div style={styles.sectionContent}>{children}</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styles } from '../settings/settingsStyles';
|
|
3
|
+
|
|
4
|
+
export const SliderSetting: React.FC<{
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
value: number;
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
step: number;
|
|
11
|
+
unit?: string;
|
|
12
|
+
onChange: (value: number) => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
formatValue?: (value: number) => string;
|
|
15
|
+
}> = ({ label, description, value, min, max, step, unit = '', onChange, disabled, formatValue }) => {
|
|
16
|
+
const displayValue = formatValue ? formatValue(value) : `${value}${unit}`;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div style={styles.settingRow}>
|
|
20
|
+
<div style={styles.settingInfo}>
|
|
21
|
+
<span style={styles.settingLabel}>{label}</span>
|
|
22
|
+
{description && <span style={styles.settingDescription}>{description}</span>}
|
|
23
|
+
</div>
|
|
24
|
+
<div style={styles.sliderContainer}>
|
|
25
|
+
<span style={styles.sliderValue}>{displayValue}</span>
|
|
26
|
+
<input
|
|
27
|
+
type="range"
|
|
28
|
+
min={min}
|
|
29
|
+
max={max}
|
|
30
|
+
step={step}
|
|
31
|
+
value={value}
|
|
32
|
+
onChange={(e) => onChange(Number(e.target.value))}
|
|
33
|
+
disabled={disabled}
|
|
34
|
+
style={{
|
|
35
|
+
...styles.slider,
|
|
36
|
+
opacity: disabled ? 0.5 : 1,
|
|
37
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styles } from '../settings/settingsStyles';
|
|
3
|
+
|
|
4
|
+
export const ToggleSetting: React.FC<{
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
value: boolean;
|
|
8
|
+
onChange: (value: boolean) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}> = ({ label, description, value, onChange, disabled }) => (
|
|
11
|
+
<div style={styles.settingRow}>
|
|
12
|
+
<div style={styles.settingInfo}>
|
|
13
|
+
<span style={styles.settingLabel}>{label}</span>
|
|
14
|
+
{description && <span style={styles.settingDescription}>{description}</span>}
|
|
15
|
+
</div>
|
|
16
|
+
<button
|
|
17
|
+
style={{
|
|
18
|
+
...styles.toggle,
|
|
19
|
+
backgroundColor: value ? 'var(--accent-default)' : 'var(--bg-tertiary)',
|
|
20
|
+
opacity: disabled ? 0.5 : 1,
|
|
21
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
22
|
+
}}
|
|
23
|
+
onClick={() => !disabled && onChange(!value)}
|
|
24
|
+
disabled={disabled}
|
|
25
|
+
role="switch"
|
|
26
|
+
aria-checked={value}
|
|
27
|
+
>
|
|
28
|
+
<span
|
|
29
|
+
style={{
|
|
30
|
+
...styles.toggleKnob,
|
|
31
|
+
transform: value ? 'translateX(18px)' : 'translateX(2px)',
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { SettingsSection } from './SettingsSection';
|
|
2
|
+
export { ToggleSetting } from './Toggle';
|
|
3
|
+
export { SliderSetting } from './Slider';
|
|
4
|
+
export { DropdownSetting } from './Dropdown';
|
|
5
|
+
export { DirectoryPicker } from './DirectoryPicker';
|
|
6
|
+
export { ColorPicker, ACCENT_COLORS } from './ColorPicker';
|
|
7
|
+
export { KeyRecorder } from './KeyRecorder';
|
|
8
|
+
export { ApiKeyInput } from './ApiKeyInput';
|
|
9
|
+
export type { ApiKeyState } from './ApiKeyInput';
|
|
10
|
+
export { DangerButton } from './DangerButton';
|