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 34x | import { create } from 'zustand'; import { devtools } from 'zustand/middleware'; import { Types } from '@ohif/core'; const PRESENTATION_TYPE_ID = 'toggleHangingProtocolId'; const DEBUG_STORE = false; /** * Represents the state and actions for managing toggle hanging protocols. */ type ToggleHangingProtocolState = { /** * Stores a mapping from key to `HPInfo`. */ toggleHangingProtocol: Record<string, Types.HangingProtocol.HPInfo>; /** * Sets the toggle hanging protocol for a given key. * * @param key - The key . * @param value - The `HPInfo` to associate with the key. */ setToggleHangingProtocol: (key: string, value: Types.HangingProtocol.HPInfo) => void; /** * Clears all toggle hanging protocols. */ clearToggleHangingProtocol: () => void; /** * Type identifier for the store. */ type: string; }; /** * Creates the Toggle Hanging Protocol store. * * @param set - The zustand set function. * @returns The toggle hanging protocol store state and actions. */ const createToggleHangingProtocolStore = (set): ToggleHangingProtocolState => ({ toggleHangingProtocol: {}, type: PRESENTATION_TYPE_ID, /** * Sets the toggle hanging protocol for a given key. */ setToggleHangingProtocol: (key, value) => set( state => ({ toggleHangingProtocol: { ...state.toggleHangingProtocol, [key]: value, }, }), false, 'setToggleHangingProtocol' ), /** * Clears all toggle hanging protocols. */ clearToggleHangingProtocol: () => set({ toggleHangingProtocol: {} }, false, 'clearToggleHangingProtocol'), }); /** * Zustand store for managing toggle hanging protocols. * Applies devtools middleware when DEBUG_STORE is enabled. */ export const useToggleHangingProtocolStore = create<ToggleHangingProtocolState>()( DEBUG_STORE ? devtools(createToggleHangingProtocolStore, { name: 'ToggleHangingProtocolStore' }) : createToggleHangingProtocolStore ); |