Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add MicMuteButton and PauseResumeButton controls

Richie McIlroya45481ff9618
diff --git a/apps/web/app/s/[videoId]/_components/timeline/recording/MicMuteButton.tsx b/apps/web/app/s/[videoId]/_components/timeline/recording/MicMuteButton.tsx
new file mode 100644
index 000000000..8523808a5
--- /dev/null
+++ b/apps/web/app/s/[videoId]/_components/timeline/recording/MicMuteButton.tsx
@@ -0,0 +1,36 @@
+"use client";
+
+/**
+ * Mic mute toggle for the camera and screen recorder cards. A labeled pill,
+ * not an icon: the mic glyph already appears on the device pill right above,
+ * and two identical mics reading differently was genuinely confusing. Red
+ * carries the live-mic association — tinted while the mic is on ("Mute"),
+ * solid while it's off ("Unmute", the state that deserves attention).
+ */
+export function MicMuteButton({
+ muted,
+ onToggle,
+ shape,
+}: {
+ muted: boolean;
+ onToggle: () => void;
+ shape: "square" | "round";
+}) {
+ return (
+ <button
+ type="button"
+ onClick={onToggle}
+ aria-label={muted ? "Unmute microphone" : "Mute microphone"}
+ aria-pressed={muted}
+ className={`flex items-center justify-center text-xs font-medium transition-colors ${
+ shape === "round" ? "h-8 rounded-full px-3" : "h-7 rounded-lg px-2.5"
+ } ${
+ muted
+ ? "bg-red-500 text-white hover:bg-red-600"
+ : "bg-red-50 text-red-600 ring-1 ring-red-200 hover:bg-red-100"
+ }`}
+ >
+ {muted ? "Unmute" : "Mute"}
+ </button>
+ );
+}
diff --git a/apps/web/app/s/[videoId]/_components/timeline/recording/PauseResumeButton.tsx b/apps/web/app/s/[videoId]/_components/timeline/recording/PauseResumeButton.tsx
new file mode 100644
index 000000000..98a061c77
--- /dev/null
+++ b/apps/web/app/s/[videoId]/_components/timeline/recording/PauseResumeButton.tsx
@@ -0,0 +1,45 @@
+"use client";
+
+/** Pause/resume toggle shared by the voice bar, camera panel and screen card. */
+export function PauseResumeButton({
+ paused,
+ onToggle,
+ shape,
+}: {
+ paused: boolean;
+ onToggle: () => void;
+ shape: "square" | "round";
+}) {
+ return (
+ <button
+ type="button"
+ onClick={onToggle}
+ aria-label={paused ? "Resume recording" : "Pause recording"}
+ aria-pressed={paused}
+ className={`flex items-center justify-center ring-1 ring-gray-4 transition-colors ${
+ shape === "round" ? "size-8 rounded-full" : "size-7 rounded-lg"
+ } ${paused ? "bg-gray-3 text-gray-9" : "bg-gray-2 text-gray-12"}`}
+ >
+ {paused ? (
+ <svg
+ viewBox="0 0 16 16"
+ className="size-3.5"
+ fill="currentColor"
+ aria-hidden="true"
+ >
+ <path d="M4.5 3.06c0-.84.92-1.36 1.64-.93l7.02 4.19a1.08 1.08 0 0 1 0 1.86l-7.02 4.19a1.08 1.08 0 0 1-1.64-.93V3.06Z" />
+ </svg>
+ ) : (
+ <svg
+ viewBox="0 0 16 16"
+ className="size-3.5"
+ fill="currentColor"
+ aria-hidden="true"
+ >
+ <rect x="3.5" y="2.5" width="3.4" height="11" rx="1" />
+ <rect x="9.1" y="2.5" width="3.4" height="11" rx="1" />
+ </svg>
+ )}
+ </button>
+ );
+}