Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 34x 34x 34x 15x 15x 34x | import { create } from 'zustand'; import { devtools } from 'zustand/middleware'; import { Types } from '@ohif/core'; const PRESENTATION_TYPE_ID = 'hangingProtocolStageIndexId'; const DEBUG_STORE = false; /** * Represents the state and actions for managing hanging protocol stage indexes. */ type HangingProtocolStageIndexState = { /** * Stores a mapping from key to `HPInfo`. */ hangingProtocolStageIndexMap: Record<string, Types.HangingProtocol.HPInfo>; /** * Sets the hanging protocol stage index for a given key. * * @param key - The key. * @param value - The `HPInfo` to associate with the key. */ setHangingProtocolStageIndex: (key: string, value: Types.HangingProtocol.HPInfo) => void; /** * Clears all hanging protocol stage indexes. */ clearHangingProtocolStageIndexMap: () => void; /** * Type identifier for the store. */ type: string; }; /** * Creates the Hanging Protocol Stage Index store. * * @param set - The zustand set function. * @returns The hanging protocol stage index store state and actions. */ const createHangingProtocolStageIndexStore = (set): HangingProtocolStageIndexState => ({ hangingProtocolStageIndexMap: {}, type: PRESENTATION_TYPE_ID, /** * Sets the hanging protocol stage index for a given key. */ setHangingProtocolStageIndex: (key, value) => set( state => ({ hangingProtocolStageIndexMap: { ...state.hangingProtocolStageIndexMap, [key]: value, }, }), false, 'setHangingProtocolStageIndex' ), /** * Clears all hanging protocol stage indexes. */ clearHangingProtocolStageIndexMap: () => set({ hangingProtocolStageIndexMap: {} }, false, 'clearHangingProtocolStageIndexMap'), }); /** * Zustand store for managing hanging protocol stage indexes. * Applies devtools middleware when DEBUG_STORE is enabled. */ export const useHangingProtocolStageIndexStore = create<HangingProtocolStageIndexState>()( DEBUG_STORE ? devtools(createHangingProtocolStageIndexStore, { name: 'HangingProtocolStageIndexStore' }) : createHangingProtocolStageIndexStore ); |