generated from coulomb/repo-seed
CE-WP-0006/0007: Capture view polish, workplans, and UX refinements
- Blob URL stability, scroll centre, strip-only visual guide - Focus-gated linking, unlink clears overlay, field badge tooltips - Capture layout (viewer centre), grey guide lines, Add field button - Workplans CE-WP-0006 (done) and CE-WP-0007 (T01-T09 done, T10-T12 todo) - Integration tests and viewer-url helpers
This commit is contained in:
@@ -54,6 +54,7 @@ type Action =
|
||||
evidenceItemId: EvidenceItemId;
|
||||
annotationId: AnnotationId | null;
|
||||
}
|
||||
| { type: "clear-active-evidence" }
|
||||
| { type: "clear" };
|
||||
|
||||
function reducer(state: ActiveState, action: Action): ActiveState {
|
||||
@@ -78,6 +79,12 @@ function reducer(state: ActiveState, action: Action): ActiveState {
|
||||
activeEvidenceItemId: action.evidenceItemId,
|
||||
activeAnnotationId: action.annotationId,
|
||||
};
|
||||
case "clear-active-evidence":
|
||||
return {
|
||||
activeTarget: state.activeTarget,
|
||||
activeEvidenceItemId: null,
|
||||
activeAnnotationId: null,
|
||||
};
|
||||
case "clear":
|
||||
return EMPTY_ACTIVE_STATE;
|
||||
}
|
||||
@@ -90,6 +97,7 @@ export interface ActiveStateApi {
|
||||
evidenceItemId: EvidenceItemId,
|
||||
annotationId?: AnnotationId | null,
|
||||
): void;
|
||||
clearActiveEvidence(): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
@@ -144,13 +152,17 @@ export function ActiveStateProvider(props: ActiveStateProviderProps) {
|
||||
[props.bus],
|
||||
);
|
||||
|
||||
const clearActiveEvidence = useCallback(() => {
|
||||
dispatch({ type: "clear-active-evidence" });
|
||||
}, []);
|
||||
|
||||
const clear = useCallback(() => {
|
||||
dispatch({ type: "clear" });
|
||||
}, []);
|
||||
|
||||
const value = useMemo<ActiveStateApi>(
|
||||
() => ({ state, focusTarget, setActiveEvidence, clear }),
|
||||
[state, focusTarget, setActiveEvidence, clear],
|
||||
() => ({ state, focusTarget, setActiveEvidence, clearActiveEvidence, clear }),
|
||||
[state, focusTarget, setActiveEvidence, clearActiveEvidence, clear],
|
||||
);
|
||||
|
||||
return createElement(ActiveStateContext.Provider, { value }, props.children);
|
||||
|
||||
Reference in New Issue
Block a user