Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

feat: redesign settings page with icon card layout

Luis Ortiz9a20099baa66
diff --git a/src/ui/shared/SettingsView.tsx b/src/ui/shared/SettingsView.tsx
index 8f7eb54..ca5fcc8 100644
--- a/src/ui/shared/SettingsView.tsx
+++ b/src/ui/shared/SettingsView.tsx
@@ -1,4 +1,4 @@
-import { ArrowLeft, Check, EyeOff, Shield } from 'lucide-react';
+import { ArrowLeft, Check, EyeOff, Shield, Sparkles } from 'lucide-react';
import { useEffect, useState } from 'react';
import { PRESET_LABELS, type PresetKey } from '@/core/blur/regexes';
import { AI_PROVIDERS, type AIProviderKey } from '@/core/capture/ai/models';
@@ -23,6 +23,7 @@ export default function SettingsView({ onBack }: SettingsViewProps) {
ipAddress: false,
macAddress: false,
});
+
useEffect(() => {
localStorage.get(['aiApiKey', 'aiProvider', 'aiModel', 'blurPresets']).then((result) => {
const p = (result.aiProvider as AIProviderKey) || 'openai';
@@ -60,84 +61,93 @@ export default function SettingsView({ onBack }: SettingsViewProps) {
<h1 className="text-[15px] font-bold text-foreground">Settings</h1>
</div>
- <div className="flex-1 px-4 py-5 space-y-5">
- <div>
- <label className="block text-xs font-semibold text-foreground mb-1.5">AI Provider</label>
- <select
- value={provider}
- onChange={(e) => handleProviderChange(e.target.value as AIProviderKey)}
- className="w-full border border-border rounded-lg px-3 py-2 text-sm text-foreground bg-card font-medium outline-none focus:border-ring focus:ring-2 focus:ring-ring/10"
- >
- {Object.entries(AI_PROVIDERS).map(([key, cfg]) => (
- <option key={key} value={key}>
- {cfg.label}
- </option>
- ))}
- </select>
- </div>
+ <div className="flex-1 px-3 py-4 space-y-3">
+ <div className="border border-border rounded-[10px] p-3.5 space-y-3">
+ <div className="flex items-center gap-2.5">
+ <div className="w-7 h-7 rounded-lg bg-secondary flex items-center justify-center">
+ <Sparkles size={14} className="text-accent" />
+ </div>
+ <span className="text-xs font-bold text-foreground">AI Descriptions</span>
+ </div>
- <div>
- <label className="block text-xs font-semibold text-foreground mb-1.5">Model</label>
- <select
- value={model}
- onChange={(e) => setModel(e.target.value)}
- className="w-full border border-border rounded-lg px-3 py-2 text-sm text-foreground bg-card font-medium outline-none focus:border-ring focus:ring-2 focus:ring-ring/10"
- >
- {providerConfig.models.map((m) => (
- <option key={m.id} value={m.id}>
- {m.label}
- </option>
- ))}
- </select>
+ <div>
+ <label className="block text-[11px] font-semibold text-foreground mb-1">Provider</label>
+ <select
+ value={provider}
+ onChange={(e) => handleProviderChange(e.target.value as AIProviderKey)}
+ className="w-full border border-border rounded-lg px-3 py-2 text-[13px] text-foreground bg-card font-medium outline-none focus:border-ring focus:ring-2 focus:ring-ring/10"
+ >
+ {Object.entries(AI_PROVIDERS).map(([key, cfg]) => (
+ <option key={key} value={key}>
+ {cfg.label}
+ </option>
+ ))}
+ </select>
+ </div>
+
+ <div>
+ <label className="block text-[11px] font-semibold text-foreground mb-1">Model</label>
+ <select
+ value={model}
+ onChange={(e) => setModel(e.target.value)}
+ className="w-full border border-border rounded-lg px-3 py-2 text-[13px] text-foreground bg-card font-medium outline-none focus:border-ring focus:ring-2 focus:ring-ring/10"
+ >
+ {providerConfig.models.map((m) => (
+ <option key={m.id} value={m.id}>
+ {m.label}
+ </option>
+ ))}
+ </select>
+ </div>
+
+ <div>
+ <label className="block text-[11px] font-semibold text-foreground mb-1">API Key</label>
+ <Input type="password" value={apiKey} onChange={(e) => setApiKey(e.target.value)} placeholder="sk-..." />
+ </div>
</div>
- <div>
- <label className="block text-xs font-semibold text-foreground mb-1.5">API Key</label>
- <Input type="password" value={apiKey} onChange={(e) => setApiKey(e.target.value)} placeholder="sk-..." />
- <p className="mt-1.5 text-[10px] text-muted-foreground">
- Used for generating step descriptions automatically.
- </p>
+ <div className="border border-border rounded-[10px] p-3.5 space-y-1">
+ <div className="flex items-center gap-2.5 mb-2">
+ <div className="w-7 h-7 rounded-lg bg-secondary flex items-center justify-center">
+ <EyeOff size={14} className="text-accent" />
+ </div>
+ <span className="text-xs font-bold text-foreground">Smart Blur</span>
+ </div>
+
+ {(Object.entries(PRESET_LABELS) as [PresetKey, string][]).map(([key, label], i, arr) => (
+ <div
+ key={key}
+ className={`flex items-center justify-between py-2 ${i < arr.length - 1 ? 'border-b border-secondary' : ''}`}
+ >
+ <span className="text-xs font-medium text-foreground">{label}</span>
+ <button
+ onClick={() => setBlurPresets((prev) => ({ ...prev, [key]: !prev[key] }))}
+ className={`w-9 h-5 rounded-full transition-colors relative ${
+ blurPresets[key] ? 'bg-accent' : 'bg-border'
+ }`}
+ >
+ <span
+ className={`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${
+ blurPresets[key] ? 'translate-x-4' : 'translate-x-0'
+ }`}
+ />
+ </button>
+ </div>
+ ))}
</div>
<Button
onClick={handleSave}
disabled={saved}
className="w-full transition-all duration-300"
- style={saved ? { backgroundColor: '#2d5a27', color: '#d4edda', opacity: 0.9 } : undefined}
+ style={saved ? { backgroundColor: '#059669', color: '#d4edda', opacity: 0.9 } : undefined}
>
{saved && <Check size={16} />}
{saved ? 'Saved' : 'Save Settings'}
</Button>
- <div className="border-t border-border pt-5">
- <div className="flex items-center gap-2 mb-4">
- <EyeOff size={14} className="text-foreground" />
- <h2 className="text-xs font-bold text-foreground uppercase tracking-wide">Smart Blur</h2>
- </div>
-
- <div className="space-y-3">
- {(Object.entries(PRESET_LABELS) as [PresetKey, string][]).map(([key, label]) => (
- <div key={key} className="flex items-center justify-between">
- <span className="text-[13px] font-medium text-foreground">{label}</span>
- <button
- onClick={() => setBlurPresets((prev) => ({ ...prev, [key]: !prev[key] }))}
- className={`w-9 h-5 rounded-full transition-colors relative ${
- blurPresets[key] ? 'bg-amber' : 'bg-border'
- }`}
- >
- <span
- className={`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${
- blurPresets[key] ? 'translate-x-4' : 'translate-x-0'
- }`}
- />
- </button>
- </div>
- ))}
- </div>
- </div>
-
<div className="flex items-start gap-2 px-3 py-2.5 rounded-lg bg-secondary text-[10px] text-muted-foreground leading-relaxed">
- <Shield size={12} className="shrink-0 mt-0.5 text-violet" />
+ <Shield size={12} className="shrink-0 mt-0.5 text-accent" />
<span>
Your API key is stored locally and only sent to the selected AI provider. No data leaves your browser
otherwise.