Add CameraSettings context and provider; integrate into AppProviders and VideoFeed

This commit is contained in:
2025-12-22 16:10:34 +00:00
parent 6879e30b9c
commit 70083d9c60
10 changed files with 118 additions and 13 deletions

View File

@@ -0,0 +1,16 @@
import { createContext, useContext } from "react";
import type { CameraSettings, CameraSettingsAction } from "../../utils/types";
type CameraSettingsContextType = {
state: CameraSettings;
dispatch: (state: CameraSettingsAction) => void;
};
export const CameraSettingsContext = createContext<CameraSettingsContextType | null>(null);
export const useCameraSettingsContext = () => {
const context = useContext(CameraSettingsContext);
if (!context) {
throw new Error("useCameraSettingsContext must be used within a CameraSettingsProvider");
}
return context;
};