@striae-org/striae 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/.env.example +100 -0
  2. package/LICENSE +190 -0
  3. package/NOTICE +18 -0
  4. package/README.md +133 -0
  5. package/app/components/actions/case-export/core-export.ts +328 -0
  6. package/app/components/actions/case-export/data-processing.ts +167 -0
  7. package/app/components/actions/case-export/download-handlers.ts +900 -0
  8. package/app/components/actions/case-export/index.ts +41 -0
  9. package/app/components/actions/case-export/metadata-helpers.ts +107 -0
  10. package/app/components/actions/case-export/types-constants.ts +56 -0
  11. package/app/components/actions/case-export/validation-utils.ts +25 -0
  12. package/app/components/actions/case-export.ts +4 -0
  13. package/app/components/actions/case-import/annotation-import.ts +35 -0
  14. package/app/components/actions/case-import/confirmation-import.ts +363 -0
  15. package/app/components/actions/case-import/image-operations.ts +61 -0
  16. package/app/components/actions/case-import/index.ts +39 -0
  17. package/app/components/actions/case-import/orchestrator.ts +420 -0
  18. package/app/components/actions/case-import/storage-operations.ts +270 -0
  19. package/app/components/actions/case-import/validation.ts +189 -0
  20. package/app/components/actions/case-import/zip-processing.ts +413 -0
  21. package/app/components/actions/case-manage.ts +524 -0
  22. package/app/components/actions/case-review.ts +4 -0
  23. package/app/components/actions/confirm-export.ts +351 -0
  24. package/app/components/actions/generate-pdf.ts +210 -0
  25. package/app/components/actions/image-manage.ts +385 -0
  26. package/app/components/actions/notes-manage.ts +33 -0
  27. package/app/components/actions/signout.module.css +15 -0
  28. package/app/components/actions/signout.tsx +50 -0
  29. package/app/components/audit/user-audit-viewer.tsx +975 -0
  30. package/app/components/audit/user-audit.module.css +568 -0
  31. package/app/components/auth/auth-provider.tsx +78 -0
  32. package/app/components/auth/mfa-enrollment.module.css +268 -0
  33. package/app/components/auth/mfa-enrollment.tsx +398 -0
  34. package/app/components/auth/mfa-verification.module.css +251 -0
  35. package/app/components/auth/mfa-verification.tsx +295 -0
  36. package/app/components/button/button.module.css +63 -0
  37. package/app/components/button/button.tsx +46 -0
  38. package/app/components/canvas/box-annotations/box-annotations.module.css +170 -0
  39. package/app/components/canvas/box-annotations/box-annotations.tsx +634 -0
  40. package/app/components/canvas/canvas.module.css +314 -0
  41. package/app/components/canvas/canvas.tsx +449 -0
  42. package/app/components/canvas/confirmation/confirmation.module.css +187 -0
  43. package/app/components/canvas/confirmation/confirmation.tsx +214 -0
  44. package/app/components/colors/colors.module.css +59 -0
  45. package/app/components/colors/colors.tsx +68 -0
  46. package/app/components/form/base-form.tsx +21 -0
  47. package/app/components/form/form-button.tsx +28 -0
  48. package/app/components/form/form-field.tsx +53 -0
  49. package/app/components/form/form-message.tsx +17 -0
  50. package/app/components/form/form-toggle.tsx +23 -0
  51. package/app/components/form/form.module.css +427 -0
  52. package/app/components/form/index.ts +6 -0
  53. package/app/components/icon/icon.module.css +3 -0
  54. package/app/components/icon/icon.tsx +27 -0
  55. package/app/components/icon/icons.svg +102 -0
  56. package/app/components/icon/manifest.json +110 -0
  57. package/app/components/sidebar/case-export/case-export.module.css +386 -0
  58. package/app/components/sidebar/case-export/case-export.tsx +317 -0
  59. package/app/components/sidebar/case-import/case-import.module.css +626 -0
  60. package/app/components/sidebar/case-import/case-import.tsx +404 -0
  61. package/app/components/sidebar/case-import/components/CasePreviewSection.tsx +72 -0
  62. package/app/components/sidebar/case-import/components/ConfirmationDialog.tsx +72 -0
  63. package/app/components/sidebar/case-import/components/ConfirmationPreviewSection.tsx +71 -0
  64. package/app/components/sidebar/case-import/components/ExistingCaseSection.tsx +40 -0
  65. package/app/components/sidebar/case-import/components/FileSelector.tsx +161 -0
  66. package/app/components/sidebar/case-import/components/ProgressSection.tsx +46 -0
  67. package/app/components/sidebar/case-import/hooks/useFilePreview.ts +101 -0
  68. package/app/components/sidebar/case-import/hooks/useImportExecution.ts +152 -0
  69. package/app/components/sidebar/case-import/hooks/useImportState.ts +88 -0
  70. package/app/components/sidebar/case-import/index.ts +18 -0
  71. package/app/components/sidebar/case-import/utils/file-validation.ts +43 -0
  72. package/app/components/sidebar/cases/case-sidebar.tsx +827 -0
  73. package/app/components/sidebar/cases/cases-modal.module.css +166 -0
  74. package/app/components/sidebar/cases/cases-modal.tsx +201 -0
  75. package/app/components/sidebar/cases/cases.module.css +713 -0
  76. package/app/components/sidebar/files/files-modal.module.css +209 -0
  77. package/app/components/sidebar/files/files-modal.tsx +239 -0
  78. package/app/components/sidebar/hash/hash-utility.module.css +366 -0
  79. package/app/components/sidebar/hash/hash-utility.tsx +982 -0
  80. package/app/components/sidebar/notes/notes-modal.tsx +51 -0
  81. package/app/components/sidebar/notes/notes-sidebar.tsx +491 -0
  82. package/app/components/sidebar/notes/notes.module.css +360 -0
  83. package/app/components/sidebar/sidebar-container.tsx +149 -0
  84. package/app/components/sidebar/sidebar.module.css +321 -0
  85. package/app/components/sidebar/sidebar.tsx +215 -0
  86. package/app/components/sidebar/upload/image-upload-zone.module.css +123 -0
  87. package/app/components/sidebar/upload/image-upload-zone.tsx +330 -0
  88. package/app/components/theme-provider/theme-provider.tsx +131 -0
  89. package/app/components/theme-provider/theme.ts +155 -0
  90. package/app/components/toast/toast.module.css +137 -0
  91. package/app/components/toast/toast.tsx +56 -0
  92. package/app/components/toolbar/toolbar-color-selector.module.css +171 -0
  93. package/app/components/toolbar/toolbar-color-selector.tsx +129 -0
  94. package/app/components/toolbar/toolbar.module.css +42 -0
  95. package/app/components/toolbar/toolbar.tsx +167 -0
  96. package/app/components/user/delete-account.module.css +274 -0
  97. package/app/components/user/delete-account.tsx +471 -0
  98. package/app/components/user/inactivity-warning.module.css +145 -0
  99. package/app/components/user/inactivity-warning.tsx +84 -0
  100. package/app/components/user/manage-profile.module.css +190 -0
  101. package/app/components/user/manage-profile.tsx +253 -0
  102. package/app/components/user/mfa-phone-update.tsx +739 -0
  103. package/app/config-example/admin-service.json +13 -0
  104. package/app/config-example/config.json +17 -0
  105. package/app/config-example/firebase.ts +21 -0
  106. package/app/config-example/inactivity.ts +13 -0
  107. package/app/config-example/meta-config.json +6 -0
  108. package/app/contexts/auth.context.ts +12 -0
  109. package/app/entry.client.tsx +12 -0
  110. package/app/entry.server.tsx +44 -0
  111. package/app/hooks/useInactivityTimeout.ts +110 -0
  112. package/app/root.tsx +170 -0
  113. package/app/routes/_index.tsx +16 -0
  114. package/app/routes/auth/emailActionHandler.module.css +232 -0
  115. package/app/routes/auth/emailActionHandler.tsx +405 -0
  116. package/app/routes/auth/emailVerification.tsx +120 -0
  117. package/app/routes/auth/login.module.css +523 -0
  118. package/app/routes/auth/login.tsx +654 -0
  119. package/app/routes/auth/passwordReset.module.css +274 -0
  120. package/app/routes/auth/passwordReset.tsx +154 -0
  121. package/app/routes/auth/route.ts +16 -0
  122. package/app/routes/mobile-prevented/mobilePrevented.module.css +47 -0
  123. package/app/routes/mobile-prevented/mobilePrevented.tsx +26 -0
  124. package/app/routes/mobile-prevented/route.ts +14 -0
  125. package/app/routes/striae/striae.module.css +30 -0
  126. package/app/routes/striae/striae.tsx +417 -0
  127. package/app/services/audit-export.service.ts +755 -0
  128. package/app/services/audit.service.ts +1454 -0
  129. package/app/services/firebase-errors.ts +106 -0
  130. package/app/services/firebase.ts +15 -0
  131. package/app/styles/legal-pages.module.css +113 -0
  132. package/app/styles/root.module.css +146 -0
  133. package/app/tailwind.css +225 -0
  134. package/app/types/annotations.ts +45 -0
  135. package/app/types/audit.ts +301 -0
  136. package/app/types/case.ts +90 -0
  137. package/app/types/export.ts +8 -0
  138. package/app/types/file.ts +30 -0
  139. package/app/types/import.ts +107 -0
  140. package/app/types/index.ts +24 -0
  141. package/app/types/user.ts +38 -0
  142. package/app/utils/SHA256.ts +461 -0
  143. package/app/utils/annotation-timestamp.ts +25 -0
  144. package/app/utils/audit-export-signature.ts +117 -0
  145. package/app/utils/auth-action-settings.ts +48 -0
  146. package/app/utils/auth.ts +34 -0
  147. package/app/utils/batch-operations.ts +135 -0
  148. package/app/utils/confirmation-signature.ts +193 -0
  149. package/app/utils/data-operations.ts +871 -0
  150. package/app/utils/device-detection.ts +5 -0
  151. package/app/utils/html-sanitizer.ts +80 -0
  152. package/app/utils/id-generator.ts +36 -0
  153. package/app/utils/meta.ts +48 -0
  154. package/app/utils/mfa-phone.ts +97 -0
  155. package/app/utils/mfa.ts +79 -0
  156. package/app/utils/password-policy.ts +28 -0
  157. package/app/utils/permissions.ts +562 -0
  158. package/app/utils/signature-utils.ts +160 -0
  159. package/app/utils/style.ts +83 -0
  160. package/app/utils/version.ts +5 -0
  161. package/firebase.json +11 -0
  162. package/functions/[[path]].ts +10 -0
  163. package/package.json +138 -0
  164. package/postcss.config.js +6 -0
  165. package/public/.well-known/publickey.info@striae.org.asc +17 -0
  166. package/public/.well-known/security.txt +7 -0
  167. package/public/_headers +28 -0
  168. package/public/_routes.json +13 -0
  169. package/public/assets/striae.jpg +0 -0
  170. package/public/clear.jpg +0 -0
  171. package/public/favicon.ico +0 -0
  172. package/public/favicon.svg +9 -0
  173. package/public/icon-256.png +0 -0
  174. package/public/icon-512.png +0 -0
  175. package/public/logo-dark.png +0 -0
  176. package/public/manifest.json +25 -0
  177. package/public/oin-badge.png +0 -0
  178. package/public/shortcut.png +0 -0
  179. package/public/social-image.png +0 -0
  180. package/public/striae-ascii.txt +10 -0
  181. package/scripts/deploy-all.sh +100 -0
  182. package/scripts/deploy-config.sh +940 -0
  183. package/scripts/deploy-pages.sh +34 -0
  184. package/scripts/deploy-worker-secrets.sh +215 -0
  185. package/scripts/dev.cjs +23 -0
  186. package/scripts/install-workers.sh +88 -0
  187. package/scripts/run-eslint.cjs +35 -0
  188. package/scripts/update-compatibility-dates.cjs +124 -0
  189. package/scripts/update-markdown-versions.cjs +43 -0
  190. package/tailwind.config.ts +22 -0
  191. package/tsconfig.json +33 -0
  192. package/vite.config.ts +35 -0
  193. package/worker-configuration.d.ts +7490 -0
  194. package/workers/audit-worker/package.json +17 -0
  195. package/workers/audit-worker/src/audit-worker.example.ts +195 -0
  196. package/workers/audit-worker/worker-configuration.d.ts +7448 -0
  197. package/workers/audit-worker/wrangler.jsonc.example +29 -0
  198. package/workers/data-worker/package.json +17 -0
  199. package/workers/data-worker/src/data-worker.example.ts +267 -0
  200. package/workers/data-worker/src/signature-utils.ts +79 -0
  201. package/workers/data-worker/src/signing-payload-utils.ts +290 -0
  202. package/workers/data-worker/worker-configuration.d.ts +7448 -0
  203. package/workers/data-worker/wrangler.jsonc.example +30 -0
  204. package/workers/image-worker/package.json +17 -0
  205. package/workers/image-worker/src/image-worker.example.ts +180 -0
  206. package/workers/image-worker/worker-configuration.d.ts +7447 -0
  207. package/workers/image-worker/wrangler.jsonc.example +22 -0
  208. package/workers/keys-worker/package.json +17 -0
  209. package/workers/keys-worker/src/keys.example.ts +66 -0
  210. package/workers/keys-worker/src/keys.ts +66 -0
  211. package/workers/keys-worker/worker-configuration.d.ts +7447 -0
  212. package/workers/keys-worker/wrangler.jsonc.example +22 -0
  213. package/workers/pdf-worker/package.json +17 -0
  214. package/workers/pdf-worker/src/format-striae.ts +534 -0
  215. package/workers/pdf-worker/src/pdf-worker.example.ts +119 -0
  216. package/workers/pdf-worker/src/report-types.ts +69 -0
  217. package/workers/pdf-worker/worker-configuration.d.ts +7448 -0
  218. package/workers/pdf-worker/wrangler.jsonc.example +26 -0
  219. package/workers/user-worker/package.json +17 -0
  220. package/workers/user-worker/src/user-worker.example.ts +636 -0
  221. package/workers/user-worker/worker-configuration.d.ts +7448 -0
  222. package/workers/user-worker/wrangler.jsonc.example +29 -0
  223. package/wrangler.toml.example +8 -0
@@ -0,0 +1,449 @@
1
+ import { useEffect, useState, useRef, useContext } from 'react';
2
+ import { BoxAnnotations } from './box-annotations/box-annotations';
3
+ import { ConfirmationModal } from './confirmation/confirmation';
4
+ import { AnnotationData, BoxAnnotation, ConfirmationData } from '~/types/annotations';
5
+ import { AuthContext } from '~/contexts/auth.context';
6
+ import { storeConfirmation } from '~/components/actions/confirm-export';
7
+ import { auditService } from '~/services/audit.service';
8
+ import styles from './canvas.module.css';
9
+
10
+ interface CanvasProps {
11
+ imageUrl?: string;
12
+ filename?: string;
13
+ company?: string;
14
+ firstName?: string;
15
+ error?: string;
16
+ activeAnnotations?: Set<string>;
17
+ annotationData?: AnnotationData | null;
18
+ onAnnotationUpdate?: (annotationData: AnnotationData) => void;
19
+ isBoxAnnotationMode?: boolean;
20
+ boxAnnotationColor?: string;
21
+ isReadOnly?: boolean;
22
+ // Confirmation data for storing case-level confirmations
23
+ caseNumber: string; // Required for audit logging
24
+ currentImageId?: string;
25
+ }
26
+
27
+ type ImageLoadError = {
28
+ type: 'load' | 'network' | 'invalid';
29
+ message: string;
30
+ }
31
+
32
+ export const Canvas = ({
33
+ imageUrl,
34
+ filename,
35
+ company,
36
+ firstName,
37
+ error,
38
+ activeAnnotations,
39
+ annotationData,
40
+ onAnnotationUpdate,
41
+ isBoxAnnotationMode = false,
42
+ boxAnnotationColor = '#FF0000',
43
+ isReadOnly = false,
44
+ caseNumber,
45
+ currentImageId
46
+ }: CanvasProps) => {
47
+ const { user } = useContext(AuthContext);
48
+ const [isLoading, setIsLoading] = useState(false);
49
+ const [loadError, setLoadError] = useState<ImageLoadError | undefined>();
50
+ const [isFlashing, setIsFlashing] = useState(false);
51
+ const [isConfirmationModalOpen, setIsConfirmationModalOpen] = useState(false);
52
+ const imageRef = useRef<HTMLImageElement>(null);
53
+
54
+ // Handle box annotation changes
55
+ const handleBoxAnnotationsChange = (boxAnnotations: BoxAnnotation[]) => {
56
+ if (!onAnnotationUpdate || !annotationData || isReadOnly || annotationData.confirmationData) return;
57
+
58
+ const updatedAnnotationData: AnnotationData = {
59
+ ...annotationData,
60
+ boxAnnotations
61
+ };
62
+
63
+ onAnnotationUpdate(updatedAnnotationData);
64
+ };
65
+
66
+ // Handle annotation data changes (for additional notes updates)
67
+ const handleAnnotationDataChange = (data: { additionalNotes?: string; boxAnnotations?: BoxAnnotation[]; earliestAnnotationTimestamp?: string }) => {
68
+ if (!onAnnotationUpdate || !annotationData || isReadOnly || annotationData.confirmationData) return;
69
+
70
+ const updatedAnnotationData: AnnotationData = {
71
+ ...annotationData,
72
+ ...data
73
+ };
74
+
75
+ onAnnotationUpdate(updatedAnnotationData);
76
+ };
77
+
78
+ // Handle confirmation
79
+ const handleConfirmation = async (confirmationData: ConfirmationData) => {
80
+ if (!onAnnotationUpdate || !annotationData) return;
81
+
82
+ // Store in annotation data
83
+ const updatedAnnotationData: AnnotationData = {
84
+ ...annotationData,
85
+ confirmationData
86
+ };
87
+
88
+ onAnnotationUpdate(updatedAnnotationData);
89
+ console.log('Confirmation data saved to annotation:', confirmationData);
90
+
91
+ // Store at case level for original analyst tracking
92
+ if (user && caseNumber && currentImageId) {
93
+ const success = await storeConfirmation(
94
+ user,
95
+ caseNumber,
96
+ currentImageId,
97
+ confirmationData,
98
+ filename
99
+ );
100
+
101
+ if (success) {
102
+ console.log('Confirmation stored at case level for original image tracking');
103
+ } else {
104
+ console.error('Failed to store confirmation at case level');
105
+ }
106
+ } else {
107
+ console.warn('Missing required data for case-level confirmation storage:', {
108
+ hasUser: !!user,
109
+ caseNumber,
110
+ currentImageId
111
+ });
112
+ }
113
+ };
114
+
115
+ useEffect(() => {
116
+ if (!imageUrl) {
117
+ setLoadError(undefined);
118
+ setIsLoading(false);
119
+ return;
120
+ }
121
+
122
+ setIsLoading(true);
123
+ setLoadError(undefined);
124
+
125
+ const img = new Image();
126
+
127
+ img.onload = () => {
128
+ setIsLoading(false);
129
+ setLoadError(undefined);
130
+ };
131
+
132
+ img.onerror = (e) => {
133
+ setLoadError({
134
+ type: 'load',
135
+ message: `Failed to load image: ${e instanceof Error ? e.message : 'Unknown error'}`
136
+ });
137
+ setIsLoading(false);
138
+ };
139
+
140
+ try {
141
+ img.src = imageUrl;
142
+ } catch (e) {
143
+ setLoadError({
144
+ type: 'invalid',
145
+ message: 'Invalid image URL provided'
146
+ });
147
+ setIsLoading(false);
148
+ }
149
+
150
+ return () => {
151
+ img.onload = null;
152
+ img.onerror = null;
153
+ setLoadError(undefined);
154
+ setIsLoading(false);
155
+ };
156
+ }, [imageUrl]);
157
+
158
+ useEffect(() => {
159
+ if (!activeAnnotations?.has('class') || !annotationData?.hasSubclass) {
160
+ setIsFlashing(false);
161
+ return;
162
+ }
163
+
164
+ const flashInterval = setInterval(() => {
165
+ setIsFlashing(true);
166
+ setTimeout(() => setIsFlashing(false), 200);
167
+ setTimeout(() => {
168
+ setIsFlashing(true);
169
+ setTimeout(() => setIsFlashing(false), 200);
170
+ }, 300);
171
+ }, 60000);
172
+
173
+ return () => clearInterval(flashInterval);
174
+ }, [activeAnnotations, annotationData?.hasSubclass]);
175
+
176
+ const getErrorMessage = () => {
177
+ if (error) return error;
178
+ if (loadError) return loadError.message;
179
+ return 'An error occurred';
180
+ };
181
+
182
+ // Programmatically determine if a color is dark and needs a light background
183
+ const needsLightBackground = (color: string) => {
184
+ if (!color) return false;
185
+
186
+ // Handle named colors
187
+ const namedColors: { [key: string]: string } = {
188
+ 'black': '#000000',
189
+ 'white': '#ffffff',
190
+ 'red': '#ff0000',
191
+ 'green': '#008000',
192
+ 'blue': '#0000ff',
193
+ 'yellow': '#ffff00',
194
+ 'cyan': '#00ffff',
195
+ 'magenta': '#ff00ff',
196
+ 'silver': '#c0c0c0',
197
+ 'gray': '#808080',
198
+ 'maroon': '#800000',
199
+ 'olive': '#808000',
200
+ 'lime': '#00ff00',
201
+ 'aqua': '#00ffff',
202
+ 'teal': '#008080',
203
+ 'navy': '#000080',
204
+ 'fuchsia': '#ff00ff',
205
+ 'purple': '#800080'
206
+ };
207
+
208
+ let hexColor = color.toLowerCase().trim();
209
+
210
+ // Convert named color to hex
211
+ if (namedColors[hexColor]) {
212
+ hexColor = namedColors[hexColor];
213
+ }
214
+
215
+ // Remove # if present
216
+ hexColor = hexColor.replace('#', '');
217
+
218
+ // Handle 3-digit hex codes
219
+ if (hexColor.length === 3) {
220
+ hexColor = hexColor.split('').map(char => char + char).join('');
221
+ }
222
+
223
+ // Validate hex color
224
+ if (!/^[0-9a-f]{6}$/i.test(hexColor)) {
225
+ return false; // Invalid color, don't apply background
226
+ }
227
+
228
+ // Convert to RGB
229
+ const r = parseInt(hexColor.substr(0, 2), 16);
230
+ const g = parseInt(hexColor.substr(2, 2), 16);
231
+ const b = parseInt(hexColor.substr(4, 2), 16);
232
+
233
+ // Calculate relative luminance using WCAG formula
234
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
235
+
236
+ // Colors with luminance < 0.5 are considered dark
237
+ return luminance < 0.5;
238
+ };
239
+
240
+ return (
241
+ <div className={styles.canvasContainer}>
242
+ {/* Filename & Connfirmation Field Display - Upper Left */}
243
+ {filename && (
244
+ <div className={styles.filenameDisplay}>
245
+ File: {filename}
246
+ {annotationData?.includeConfirmation && (
247
+ <>
248
+ {/* Show confirmation status based on whether confirmation data exists */}
249
+ {annotationData?.confirmationData ? (
250
+ <div className={styles.confirmationRow}>
251
+ <div className={styles.confirmationConfirmed}>
252
+ Identification Confirmed
253
+ </div>
254
+ <button
255
+ className={styles.viewConfirmationButton}
256
+ onClick={() => setIsConfirmationModalOpen(true)}
257
+ >
258
+ View Confirmation Data
259
+ </button>
260
+ </div>
261
+ ) : (
262
+ <div className={styles.confirmationRow}>
263
+ <div className={styles.confirmationIncluded}>
264
+ {isReadOnly ? 'Confirmation Requested' : 'Confirmation Field Included'}
265
+ </div>
266
+ {isReadOnly && (
267
+ <button
268
+ className={styles.confirmButton}
269
+ onClick={() => setIsConfirmationModalOpen(true)}
270
+ >
271
+ Confirm
272
+ </button>
273
+ )}
274
+ </div>
275
+ )}
276
+ </>
277
+ )}
278
+ </div>
279
+ )}
280
+
281
+ {/* Company Display - Upper Right */}
282
+ {company && (
283
+ <div className={styles.companyDisplay}>
284
+ {isReadOnly ? 'CASE REVIEW ONLY' : company}
285
+ </div>
286
+ )}
287
+
288
+ {(loadError || error) ? (
289
+ <p className={styles.error}>{getErrorMessage()}</p>
290
+ ) : isLoading ? (
291
+ <p className={styles.loading}>Loading image...</p>
292
+ ) : imageUrl && imageUrl !== '/clear.jpg' ? (
293
+ <div className={styles.imageAndNotesContainer}>
294
+ <div className={styles.imageContainer}>
295
+ {/* Class Characteristics - Above Image */}
296
+ {activeAnnotations?.has('class') && annotationData && (annotationData.customClass || annotationData.classType) && (
297
+ <div className={styles.classCharacteristics}>
298
+ <div className={styles.classText}>
299
+ {annotationData.customClass || annotationData.classType}
300
+ {annotationData.classNote && ` (${annotationData.classNote})`}
301
+ </div>
302
+ </div>
303
+ )}
304
+
305
+ <img
306
+ ref={imageRef}
307
+ src={imageUrl}
308
+ alt="Case evidence"
309
+ className={styles.image}
310
+ style={{
311
+ border: activeAnnotations?.has('index') && annotationData?.indexType === 'color' && annotationData?.indexColor
312
+ ? `6px solid ${annotationData.indexColor}`
313
+ : undefined,
314
+ userSelect: 'none'
315
+ }}
316
+ onError={() => setLoadError({
317
+ type: 'network',
318
+ message: 'Failed to load image from network'
319
+ })}
320
+ draggable={false}
321
+ />
322
+
323
+ {/* Box Annotations Component - Show when box tool is active for visibility */}
324
+ {activeAnnotations?.has('box') && (
325
+ <BoxAnnotations
326
+ imageRef={imageRef}
327
+ annotations={annotationData?.boxAnnotations || []}
328
+ onAnnotationsChange={handleBoxAnnotationsChange}
329
+ isAnnotationMode={isBoxAnnotationMode && !annotationData?.confirmationData}
330
+ annotationColor={boxAnnotationColor}
331
+ annotationData={annotationData ? { additionalNotes: annotationData.additionalNotes, earliestAnnotationTimestamp: annotationData.earliestAnnotationTimestamp } : undefined}
332
+ onAnnotationDataChange={handleAnnotationDataChange}
333
+ isReadOnly={isReadOnly || !!annotationData?.confirmationData}
334
+ caseNumber={caseNumber}
335
+ imageFileId={currentImageId}
336
+ originalImageFileName={filename}
337
+ />
338
+ )}
339
+
340
+ {/* Annotations Overlay */}
341
+ {activeAnnotations?.has('number') && annotationData && (
342
+ <div className={styles.annotationsOverlay}>
343
+ {/* Left side case and item numbers */}
344
+ <div
345
+ className={styles.leftAnnotation}
346
+ style={{
347
+ color: annotationData.caseFontColor || '#FFDE21',
348
+ backgroundColor: needsLightBackground(annotationData.caseFontColor || '#FFDE21')
349
+ ? 'rgba(255, 255, 255, 0.9)' : undefined
350
+ }}
351
+ >
352
+ <div className={styles.caseText}>
353
+ {annotationData.leftCase}
354
+ {annotationData.leftItem && ` ${annotationData.leftItem}`}
355
+ </div>
356
+ </div>
357
+
358
+ {/* Right side case and item numbers */}
359
+ <div
360
+ className={styles.rightAnnotation}
361
+ style={{
362
+ color: annotationData.caseFontColor || '#FFDE21',
363
+ backgroundColor: needsLightBackground(annotationData.caseFontColor || '#FFDE21')
364
+ ? 'rgba(255, 255, 255, 0.9)' : undefined
365
+ }}
366
+ >
367
+ <div className={styles.caseText}>
368
+ {annotationData.rightCase}
369
+ {annotationData.rightItem && ` ${annotationData.rightItem}`}
370
+ </div>
371
+ </div>
372
+ </div>
373
+ )}
374
+
375
+ {/* Index Number Overlay */}
376
+ {activeAnnotations?.has('index') && annotationData?.indexType === 'number' && annotationData?.indexNumber && (
377
+ <div className={styles.annotationsOverlay}>
378
+ <div
379
+ className={styles.indexAnnotation}
380
+ style={{
381
+ color: annotationData.caseFontColor || '#FFDE21',
382
+ backgroundColor: needsLightBackground(annotationData.caseFontColor || '#FFDE21')
383
+ ? 'rgba(255, 255, 255, 0.9)' : undefined
384
+ }}
385
+ >
386
+ <div className={styles.caseText}>
387
+ Index: {annotationData.indexNumber}
388
+ </div>
389
+ </div>
390
+ </div>
391
+ )}
392
+ </div>
393
+
394
+ {/* Additional Notes - Below Image */}
395
+ {activeAnnotations?.has('notes') && annotationData?.additionalNotes && (
396
+ <div className={styles.additionalNotesContainer}>
397
+ <div className={styles.additionalNotesBox}>
398
+ {annotationData.additionalNotes}
399
+ </div>
400
+ </div>
401
+ )}
402
+ </div>
403
+ ) : (
404
+ <p
405
+ className={styles.placeholder}
406
+ dangerouslySetInnerHTML={{
407
+ __html: firstName
408
+ ? `Hello, ${firstName}<br>Upload or select an image to get started`
409
+ : 'Upload or select an image to get started'
410
+ }}
411
+ />
412
+ )}
413
+
414
+ {/* Support Level - Bottom Left of Canvas */}
415
+ {activeAnnotations?.has('id') && annotationData && annotationData.supportLevel && (
416
+ <div className={styles.supportLevelAnnotation}>
417
+ <div
418
+ className={styles.supportLevelText}
419
+ style={{
420
+ color: annotationData.supportLevel === 'ID' ? '#28a745' :
421
+ annotationData.supportLevel === 'Exclusion' ? '#dc3545' :
422
+ '#ffc107'
423
+ }}
424
+ >
425
+ {annotationData.supportLevel === 'ID' ? 'Identification' : annotationData.supportLevel}
426
+ </div>
427
+ </div>
428
+ )}
429
+
430
+ {/* Subclass Warning - Bottom Right of Canvas */}
431
+ {activeAnnotations?.has('class') && annotationData?.hasSubclass && (
432
+ <div className={`${styles.subclassWarning} ${isFlashing ? styles.flashing : ''}`}>
433
+ <div className={styles.subclassText}>
434
+ POTENTIAL SUBCLASS
435
+ </div>
436
+ </div>
437
+ )}
438
+
439
+ {/* Confirmation Modal */}
440
+ <ConfirmationModal
441
+ isOpen={isConfirmationModalOpen}
442
+ onClose={() => setIsConfirmationModalOpen(false)}
443
+ onConfirm={handleConfirmation}
444
+ company={company}
445
+ existingConfirmation={annotationData?.confirmationData || null}
446
+ />
447
+ </div>
448
+ );
449
+ };
@@ -0,0 +1,187 @@
1
+ .overlay {
2
+ position: fixed;
3
+ inset: 0;
4
+ background-color: color-mix(in lab, var(--background) 50%, transparent);
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ z-index: var(--zIndex5);
9
+ transition: background-color var(--durationM) var(--bezierFastoutSlowin);
10
+ }
11
+
12
+ .modal {
13
+ background: var(--backgroundLight);
14
+ border-radius: var(--spaceXS);
15
+ width: 90%;
16
+ max-width: 400px;
17
+ max-height: 90vh;
18
+ box-shadow: 0 var(--spaceXS) var(--spaceL) color-mix(in lab, var(--black) 10%, transparent);
19
+ transition: background-color var(--durationM) var(--bezierFastoutSlowin);
20
+ }
21
+
22
+ .header {
23
+ display: flex;
24
+ font-size: var(--fontSizeBodyM);
25
+ justify-content: space-between;
26
+ align-items: center;
27
+ padding: var(--spaceM);
28
+ border-bottom: 1px solid color-mix(in lab, var(--text) 10%, transparent);
29
+ color: var(--textTitle);
30
+ }
31
+
32
+ .title {
33
+ margin: 0;
34
+ font-size: var(--fontSizeBodyM);
35
+ font-weight: 600;
36
+ color: var(--textTitle);
37
+ }
38
+
39
+ .closeButton {
40
+ background: none;
41
+ border: none;
42
+ font-size: var(--fontSizeBodyL);
43
+ cursor: pointer;
44
+ padding: var(--spaceXS);
45
+ color: var(--textLight);
46
+ transition: color var(--durationS) var(--bezierFastoutSlowin);
47
+ }
48
+
49
+ .closeButton:hover {
50
+ color: var(--text);
51
+ }
52
+
53
+ .content {
54
+ padding: var(--spaceM);
55
+ overflow-y: auto;
56
+ max-height: calc(90vh - var(--space3XL));
57
+ }
58
+
59
+ .fieldGroup {
60
+ display: flex;
61
+ flex-direction: column;
62
+ gap: var(--spaceS);
63
+ }
64
+
65
+ .field {
66
+ display: flex;
67
+ flex-direction: column;
68
+ gap: var(--spaceXS);
69
+ }
70
+
71
+ .label {
72
+ font-size: var(--fontSizeBodyXS);
73
+ font-weight: var(--fontWeightMedium);
74
+ color: var(--textTitle);
75
+ margin: 0;
76
+ }
77
+
78
+ .input {
79
+ width: 100%;
80
+ padding: var(--spaceS);
81
+ border: 1px solid color-mix(in lab, var(--text) 20%, transparent);
82
+ border-radius: var(--spaceXS);
83
+ font-size: var(--fontSizeBodyXS);
84
+ color: var(--text);
85
+ background: var(--background);
86
+ transition: border-color var(--durationS) var(--bezierFastoutSlowin);
87
+ box-sizing: border-box;
88
+ }
89
+
90
+ .input:focus {
91
+ outline: none;
92
+ border-color: var(--primary);
93
+ box-shadow: 0 0 0 2px color-mix(in lab, var(--primary) 20%, transparent);
94
+ }
95
+
96
+ .input:disabled {
97
+ background: color-mix(in lab, var(--background) 50%, var(--backgroundLight));
98
+ color: var(--textLight);
99
+ cursor: not-allowed;
100
+ }
101
+
102
+ .readOnlyValue {
103
+ padding: var(--spaceS);
104
+ background: color-mix(in lab, var(--background) 50%, var(--backgroundLight));
105
+ border: 1px solid color-mix(in lab, var(--text) 10%, transparent);
106
+ border-radius: var(--spaceXS);
107
+ font-size: var(--fontSizeBodyXS);
108
+ color: var(--text);
109
+ font-family: 'Inter', monospace;
110
+ }
111
+
112
+ .error {
113
+ color: var(--error);
114
+ font-size: var(--fontSizeBodyXS);
115
+ margin-top: var(--spaceS);
116
+ padding: var(--spaceS);
117
+ background: color-mix(in lab, var(--error) 5%, transparent);
118
+ border: 1px solid color-mix(in lab, var(--error) 20%, transparent);
119
+ border-radius: var(--spaceXS);
120
+ }
121
+
122
+ .footer {
123
+ display: flex;
124
+ justify-content: flex-end;
125
+ gap: var(--spaceS);
126
+ padding: var(--spaceM);
127
+ border-top: 1px solid color-mix(in lab, var(--text) 10%, transparent);
128
+ background: color-mix(in lab, var(--backgroundLight) 95%, var(--background));
129
+ }
130
+
131
+ .cancelButton {
132
+ padding: var(--spaceS) var(--spaceM);
133
+ border: 1px solid color-mix(in lab, var(--text) 20%, transparent);
134
+ border-radius: var(--spaceXS);
135
+ background: var(--background);
136
+ color: var(--text);
137
+ font-size: var(--fontSizeBodyXS);
138
+ font-weight: var(--fontWeightMedium);
139
+ cursor: pointer;
140
+ transition: all var(--durationS) var(--bezierFastoutSlowin);
141
+ min-width: 70px;
142
+ }
143
+
144
+ .cancelButton:hover:not(:disabled) {
145
+ background: color-mix(in lab, var(--text) 5%, var(--background));
146
+ border-color: color-mix(in lab, var(--text) 30%, transparent);
147
+ }
148
+
149
+ .cancelButton:disabled {
150
+ opacity: 0.6;
151
+ cursor: not-allowed;
152
+ }
153
+
154
+ .confirmButton {
155
+ padding: var(--spaceS) var(--spaceM);
156
+ border: none;
157
+ border-radius: var(--spaceXS);
158
+ background: var(--success);
159
+ color: white;
160
+ font-size: var(--fontSizeBodyXS);
161
+ font-weight: var(--fontWeightMedium);
162
+ cursor: pointer;
163
+ transition: all var(--durationS) var(--bezierFastoutSlowin);
164
+ min-width: 70px;
165
+ box-shadow: 0 1px 3px color-mix(in lab, var(--success) 30%, transparent);
166
+ }
167
+
168
+ .confirmButton:hover:not(:disabled) {
169
+ background: color-mix(in lab, var(--success) 85%, var(--black));
170
+ box-shadow: 0 2px 6px color-mix(in lab, var(--success) 40%, transparent);
171
+ }
172
+
173
+ .confirmButton:disabled {
174
+ opacity: 0.6;
175
+ cursor: not-allowed;
176
+ box-shadow: none;
177
+ }
178
+
179
+ .existingConfirmationBanner {
180
+ background: color-mix(in lab, var(--success) 90%, white);
181
+ color: color-mix(in lab, var(--success) 20%, var(--black));
182
+ padding: var(--spaceS) var(--spaceM);
183
+ text-align: center;
184
+ font-size: var(--fontSizeBodyXS);
185
+ font-weight: var(--fontWeightMedium);
186
+ border-bottom: 1px solid color-mix(in lab, var(--success) 20%, transparent);
187
+ }