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(ui): share the camera mascot between the extension and the desktop

Luis Ortiz4378cd8c70d3
diff --git a/packages/ui/src/common/components/CameraMascot.tsx b/packages/ui/src/common/components/CameraMascot.tsx
new file mode 100644
index 0000000..4177130
--- /dev/null
+++ b/packages/ui/src/common/components/CameraMascot.tsx
@@ -0,0 +1,50 @@
+import {
+ CAMERA_MASCOT_DROP,
+ CAMERA_MASCOT_PARTS,
+ CAMERA_MASCOT_VIEW_BOX,
+ MASCOT_BODY,
+ MASCOT_CROWN,
+ MASCOT_FACES,
+ MASCOT_SEAM,
+} from '../lib/mascot-shapes';
+
+export function CameraMascot({ size = 64 }: { size?: number }) {
+ const face = MASCOT_FACES.happy;
+ const camera = CAMERA_MASCOT_PARTS;
+ return (
+ <svg viewBox={CAMERA_MASCOT_VIEW_BOX} width={size} height={size} fill="none" aria-hidden="true">
+ <g transform={`translate(0 ${CAMERA_MASCOT_DROP})`}>
+ <rect {...MASCOT_BODY} className="fill-primary" />
+ <path d={MASCOT_CROWN} className="fill-violet-mid" />
+ <rect {...MASCOT_SEAM} className="fill-lavender" />
+ {face.eyes.map((d) => (
+ <path
+ key={d}
+ d={d}
+ className="stroke-lavender"
+ strokeWidth={face.eyeWidth}
+ fill="none"
+ strokeLinecap="round"
+ />
+ ))}
+ <path
+ d={face.mouth}
+ className="stroke-lavender"
+ strokeWidth={face.mouthWidth}
+ fill="none"
+ strokeLinecap="round"
+ />
+ </g>
+ <rect {...camera.body} className="fill-violet-mid stroke-violet-mid" strokeWidth={2} />
+ <circle {...camera.lensRing} className="fill-primary stroke-violet-mid" strokeWidth={2} />
+ <circle {...camera.lens} fill="#080818" />
+ <circle {...camera.glint} className="fill-lavender" opacity={0.4} />
+ <rect {...camera.flashUnit} className="fill-lavender" opacity={0.7} />
+ <circle {...camera.flash} className="fill-lavender animate-[cam-flash_3s_ease_infinite]" />
+ <circle {...camera.light} className="fill-accent" />
+ {camera.hands.map((hand) => (
+ <ellipse key={hand.cx} {...hand} className="fill-primary" />
+ ))}
+ </svg>
+ );
+}
diff --git a/packages/ui/src/common/lib/mascot-shapes.ts b/packages/ui/src/common/lib/mascot-shapes.ts
index 232fbb3..ae94e7c 100644
--- a/packages/ui/src/common/lib/mascot-shapes.ts
+++ b/packages/ui/src/common/lib/mascot-shapes.ts
@@ -24,3 +24,20 @@ export const MASCOT_FACES = {
} as const;
export type MascotPose = keyof typeof MASCOT_FACES;
+
+export const CAMERA_MASCOT_VIEW_BOX = '0 0 200 200';
+export const CAMERA_MASCOT_DROP = 10;
+
+export const CAMERA_MASCOT_PARTS = {
+ body: { x: 60, y: 38, width: 80, height: 50, rx: 8 },
+ lensRing: { cx: 100, cy: 62, r: 16 },
+ lens: { cx: 100, cy: 62, r: 9 },
+ glint: { cx: 100, cy: 62, r: 4 },
+ flashUnit: { x: 112, y: 42, width: 18, height: 8, rx: 3 },
+ flash: { cx: 121, cy: 38, r: 20 },
+ light: { cx: 80, cy: 42, r: 5 },
+ hands: [
+ { cx: 54, cy: 64, rx: 10, ry: 8 },
+ { cx: 146, cy: 64, rx: 10, ry: 8 },
+ ],
+} as const;
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index e0c1f93..231d0df 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -6,10 +6,14 @@ export { SecretInput } from './ai/components/SecretInput';
export { useAiSettings } from './ai/hooks/use-ai-settings';
export { useKeyCheck } from './ai/hooks/use-key-check';
export { ColorPicker } from './annotation/components/ColorPicker';
+export { CameraMascot } from './common/components/CameraMascot';
export { FaviconImg } from './common/components/FaviconImg';
export { getDomainInitial } from './common/lib/domain-initial';
export { formatRelativeTime } from './common/lib/format-relative-time';
export {
+ CAMERA_MASCOT_DROP,
+ CAMERA_MASCOT_PARTS,
+ CAMERA_MASCOT_VIEW_BOX,
MASCOT_ASPECT,
MASCOT_BODY,
MASCOT_CROWN,
diff --git a/src/ui/sidepanel/RecordingView.tsx b/src/ui/sidepanel/RecordingView.tsx
index 552e921..5fb65dc 100644
--- a/src/ui/sidepanel/RecordingView.tsx
+++ b/src/ui/sidepanel/RecordingView.tsx
@@ -1,5 +1,13 @@
import { extractDomain } from '@mimik/core/guides/domain';
-import { Button, ScreenshotView, StepSourceBadge, Tooltip, TooltipContent, TooltipTrigger } from '@mimik/ui';
+import {
+ Button,
+ CameraMascot,
+ ScreenshotView,
+ StepSourceBadge,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@mimik/ui';
import { Check, EyeOff, Loader2, X } from 'lucide-react';
import { useCallback, useEffect, useRef, useState } from 'react';
import { browser, i18n } from '#imports';
@@ -129,23 +137,7 @@ export function RecordingView({ guideId, onStop, voice, aiFailure }: RecordingVi
<div className="flex-1 overflow-y-auto pt-12">
{steps.length === 0 ? (
<div className="flex flex-col items-center justify-center h-full gap-3">
- <svg width="64" height="64" viewBox="0 0 200 200" fill="none">
- <rect x="30" y="105" width="140" height="68" rx="5" fill="#1E1B4B" />
- <path d="M30 105 L30 90 Q30 70, 100 70 Q170 70, 170 90 L170 105 Z" fill="#3730A3" />
- <rect x="30" y="103" width="140" height="3" fill="#C7D2FE" />
- <path d="M68 132 Q76 122 84 132" stroke="#C7D2FE" strokeWidth="5" fill="none" strokeLinecap="round" />
- <path d="M116 132 Q124 122 132 132" stroke="#C7D2FE" strokeWidth="5" fill="none" strokeLinecap="round" />
- <path d="M84 148 Q100 158 116 148" stroke="#C7D2FE" strokeWidth="3.5" fill="none" strokeLinecap="round" />
- <rect x="60" y="38" width="80" height="50" rx="8" fill="#3730A3" stroke="#3730A3" strokeWidth="2" />
- <circle cx="100" cy="62" r="16" fill="#1E1B4B" stroke="#3730A3" strokeWidth="2" />
- <circle cx="100" cy="62" r="9" fill="#080818" />
- <circle cx="100" cy="62" r="4" fill="#C7D2FE" opacity="0.4" />
- <rect x="112" y="42" width="18" height="8" rx="3" fill="#C7D2FE" opacity="0.7" />
- <circle cx="121" cy="38" r="20" fill="#C7D2FE" className="animate-[cam-flash_3s_ease_infinite]" />
- <circle cx="80" cy="42" r="5" fill="#4F46E5" />
- <ellipse cx="54" cy="64" rx="10" ry="8" fill="#1E1B4B" />
- <ellipse cx="146" cy="64" rx="10" ry="8" fill="#1E1B4B" />
- </svg>
+ <CameraMascot size={64} />
<div className="text-center">
<p className="text-sm font-semibold text-foreground">{i18n.t('recording.readyTitle')}</p>
<p className="text-xs text-muted-foreground mt-0.5">{i18n.t('recording.readySub')}</p>