Loading packages/client/src/components/Header/HeaderRight.tsx +3 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,7 @@ export const HeaderRight = () => { <Button className="justify-start" onPress={handleCaptureCanvas} silent role="menuitem" size="sm" > Loading @@ -180,6 +181,7 @@ export const HeaderRight = () => { <Button className="justify-start" onPress={handleCaptureView} silent role="menuitem" size="sm" > Loading @@ -199,6 +201,7 @@ export const HeaderRight = () => { <Button className="justify-start" onPress={handleCaptureTemplateArea} silent role="menuitem" size="sm" > Loading packages/client/src/components/Settings/AudioSettings.tsx +14 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import African1 from "../../sounds/African1.mp3"; import African2 from "../../sounds/African2.mp3"; import African3 from "../../sounds/African3.mp3"; import African4 from "../../sounds/African4.mp3"; import Camera from "../../sounds/Camera.mp3"; import Coffee1 from "../../sounds/Coffee1.mp3"; import Coffee2 from "../../sounds/Coffee2.mp3"; import Retro6 from "../../sounds/Retro6.mp3"; Loading Loading @@ -45,6 +46,7 @@ export const AudioSettings = () => { const [African3Sound] = useSound(African3, { volume: 0.5 }); const [African4Sound] = useSound(African4, { volume: 0.5 }); const [CameraSound] = useSound(Camera, { volume: 0.25 }); const [Retro6Sound] = useSound(Retro6, { volume: 0.3 }); Loading Loading @@ -440,6 +442,18 @@ export const AudioSettings = () => { > UI Click </Switch> <Switch silent isSelected={state.cameraShutter} onValueChange={(v) => { dispatch([_(v), "cameraShutter"]); if (v) { CameraSound(); } }} > Camera Shutter </Switch> <Switch silent isSelected={state.disconnected} Loading packages/client/src/components/Toolbar/Palette.tsx +3 −0 Original line number Diff line number Diff line Loading @@ -906,6 +906,7 @@ export const Palette = () => { <Button className="mobile-action-sheet-item" onPress={handleMobileCaptureCanvas} silent role="menuitem" size="sm" > Loading @@ -915,6 +916,7 @@ export const Palette = () => { <Button className="mobile-action-sheet-item" onPress={handleMobileCaptureView} silent role="menuitem" size="sm" > Loading @@ -934,6 +936,7 @@ export const Palette = () => { <Button className="mobile-action-sheet-item" onPress={handleMobileCaptureTemplateArea} silent role="menuitem" size="sm" > Loading packages/client/src/contexts/AudioContext.tsx +8 −3 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import React, { import useSound from "use-sound"; import African3 from "../sounds/African3.mp3"; import Camera from "../sounds/Camera.mp3"; interface IAudioState { place: boolean; Loading @@ -17,6 +18,7 @@ interface IAudioState { pixelBucketFull: boolean; pixelUndo: boolean; uiClick: boolean; cameraShutter: boolean; } const Defaults: IAudioState = { Loading @@ -28,6 +30,7 @@ const Defaults: IAudioState = { pixelBucketFull: false, pixelUndo: false, uiClick: false, cameraShutter: false, }; type AudioActions = Loading @@ -35,7 +38,7 @@ type AudioActions = | ["disable", keyof IAudioState]; interface IPlay { (type: "UI_CLICK"): unknown; (type: "UI_CLICK" | "CAMERA_SHUTTER"): unknown; } const context = createContext<{ Loading @@ -58,12 +61,14 @@ const AudioContext = ({ children }: React.PropsWithChildren) => { ); const [African3Sound] = useSound(African3, { volume: 0.5 }); const [CameraSound] = useSound(Camera, { volume: 0.25 }); const play: IPlay = useCallback( (type: "UI_CLICK") => { (type) => { if (type === "UI_CLICK" && state.uiClick) African3Sound(); if (type === "CAMERA_SHUTTER" && state.cameraShutter) CameraSound(); }, [African3Sound, state], [African3Sound, CameraSound, state], ); return ( Loading packages/client/src/contexts/CaptureContext.tsx +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import { import { Template as TemplateRenderer } from "@/lib/template"; import { useAppContext } from "./AppContext"; import { useAudio } from "./AudioContext"; import { useTemplateContext } from "./TemplateContext"; const TEMPLATE_CAPTURE_PADDING = 2; Loading Loading @@ -104,6 +105,7 @@ const createSnapshotPreview = (snapshot: CanvasSnapshot): SnapshotPreview => { const CaptureSnapshotFeedback = () => { const prefersReducedMotion = useReducedMotion(); const { settings } = useAppContext(); const { play } = useAudio(); const cameraFlashEnabled = settings.get["capture.cameraFlash"]; const pendingSnapshot = useRef<CanvasSnapshot | null>(null); const snapshotDelay = useRef<number | undefined>(undefined); Loading @@ -120,6 +122,7 @@ const CaptureSnapshotFeedback = () => { snapshotDelay.current = undefined; }; const handleSnapshot = (snapshot: CanvasSnapshot) => { play("CAMERA_SHUTTER"); setSnapshotFlashId(cameraFlashEnabled ? snapshot.id : undefined); pendingSnapshot.current?.save(); pendingSnapshot.current = null; Loading Loading @@ -155,7 +158,7 @@ const CaptureSnapshotFeedback = () => { pendingSnapshot.current?.save(); pendingSnapshot.current = null; }; }, [cameraFlashEnabled, prefersReducedMotion]); }, [cameraFlashEnabled, play, prefersReducedMotion]); const handlePolaroidComplete = (snapshot: CanvasSnapshot) => { snapshot.save(); Loading Loading
packages/client/src/components/Header/HeaderRight.tsx +3 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,7 @@ export const HeaderRight = () => { <Button className="justify-start" onPress={handleCaptureCanvas} silent role="menuitem" size="sm" > Loading @@ -180,6 +181,7 @@ export const HeaderRight = () => { <Button className="justify-start" onPress={handleCaptureView} silent role="menuitem" size="sm" > Loading @@ -199,6 +201,7 @@ export const HeaderRight = () => { <Button className="justify-start" onPress={handleCaptureTemplateArea} silent role="menuitem" size="sm" > Loading
packages/client/src/components/Settings/AudioSettings.tsx +14 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import African1 from "../../sounds/African1.mp3"; import African2 from "../../sounds/African2.mp3"; import African3 from "../../sounds/African3.mp3"; import African4 from "../../sounds/African4.mp3"; import Camera from "../../sounds/Camera.mp3"; import Coffee1 from "../../sounds/Coffee1.mp3"; import Coffee2 from "../../sounds/Coffee2.mp3"; import Retro6 from "../../sounds/Retro6.mp3"; Loading Loading @@ -45,6 +46,7 @@ export const AudioSettings = () => { const [African3Sound] = useSound(African3, { volume: 0.5 }); const [African4Sound] = useSound(African4, { volume: 0.5 }); const [CameraSound] = useSound(Camera, { volume: 0.25 }); const [Retro6Sound] = useSound(Retro6, { volume: 0.3 }); Loading Loading @@ -440,6 +442,18 @@ export const AudioSettings = () => { > UI Click </Switch> <Switch silent isSelected={state.cameraShutter} onValueChange={(v) => { dispatch([_(v), "cameraShutter"]); if (v) { CameraSound(); } }} > Camera Shutter </Switch> <Switch silent isSelected={state.disconnected} Loading
packages/client/src/components/Toolbar/Palette.tsx +3 −0 Original line number Diff line number Diff line Loading @@ -906,6 +906,7 @@ export const Palette = () => { <Button className="mobile-action-sheet-item" onPress={handleMobileCaptureCanvas} silent role="menuitem" size="sm" > Loading @@ -915,6 +916,7 @@ export const Palette = () => { <Button className="mobile-action-sheet-item" onPress={handleMobileCaptureView} silent role="menuitem" size="sm" > Loading @@ -934,6 +936,7 @@ export const Palette = () => { <Button className="mobile-action-sheet-item" onPress={handleMobileCaptureTemplateArea} silent role="menuitem" size="sm" > Loading
packages/client/src/contexts/AudioContext.tsx +8 −3 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import React, { import useSound from "use-sound"; import African3 from "../sounds/African3.mp3"; import Camera from "../sounds/Camera.mp3"; interface IAudioState { place: boolean; Loading @@ -17,6 +18,7 @@ interface IAudioState { pixelBucketFull: boolean; pixelUndo: boolean; uiClick: boolean; cameraShutter: boolean; } const Defaults: IAudioState = { Loading @@ -28,6 +30,7 @@ const Defaults: IAudioState = { pixelBucketFull: false, pixelUndo: false, uiClick: false, cameraShutter: false, }; type AudioActions = Loading @@ -35,7 +38,7 @@ type AudioActions = | ["disable", keyof IAudioState]; interface IPlay { (type: "UI_CLICK"): unknown; (type: "UI_CLICK" | "CAMERA_SHUTTER"): unknown; } const context = createContext<{ Loading @@ -58,12 +61,14 @@ const AudioContext = ({ children }: React.PropsWithChildren) => { ); const [African3Sound] = useSound(African3, { volume: 0.5 }); const [CameraSound] = useSound(Camera, { volume: 0.25 }); const play: IPlay = useCallback( (type: "UI_CLICK") => { (type) => { if (type === "UI_CLICK" && state.uiClick) African3Sound(); if (type === "CAMERA_SHUTTER" && state.cameraShutter) CameraSound(); }, [African3Sound, state], [African3Sound, CameraSound, state], ); return ( Loading
packages/client/src/contexts/CaptureContext.tsx +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import { import { Template as TemplateRenderer } from "@/lib/template"; import { useAppContext } from "./AppContext"; import { useAudio } from "./AudioContext"; import { useTemplateContext } from "./TemplateContext"; const TEMPLATE_CAPTURE_PADDING = 2; Loading Loading @@ -104,6 +105,7 @@ const createSnapshotPreview = (snapshot: CanvasSnapshot): SnapshotPreview => { const CaptureSnapshotFeedback = () => { const prefersReducedMotion = useReducedMotion(); const { settings } = useAppContext(); const { play } = useAudio(); const cameraFlashEnabled = settings.get["capture.cameraFlash"]; const pendingSnapshot = useRef<CanvasSnapshot | null>(null); const snapshotDelay = useRef<number | undefined>(undefined); Loading @@ -120,6 +122,7 @@ const CaptureSnapshotFeedback = () => { snapshotDelay.current = undefined; }; const handleSnapshot = (snapshot: CanvasSnapshot) => { play("CAMERA_SHUTTER"); setSnapshotFlashId(cameraFlashEnabled ? snapshot.id : undefined); pendingSnapshot.current?.save(); pendingSnapshot.current = null; Loading Loading @@ -155,7 +158,7 @@ const CaptureSnapshotFeedback = () => { pendingSnapshot.current?.save(); pendingSnapshot.current = null; }; }, [cameraFlashEnabled, prefersReducedMotion]); }, [cameraFlashEnabled, play, prefersReducedMotion]); const handlePolaroidComplete = (snapshot: CanvasSnapshot) => { snapshot.save(); Loading