Commit 3d03fc5
authored
feat: file icon preview redesign (#3458)
This pull request refactors file attachment icon rendering and related
components to improve consistency and extensibility. The main changes
include standardizing the icon size prop, simplifying icon selection
logic, updating icon mappings for file types, and revising the `Audio`
icon implementation. These updates make it easier to manage file icons
and ensure consistent visuals across file attachments.
### File Icon System Refactor
* The `FileIcon` component's `size` prop is now standardized to accept
`'sm' | 'md' | 'lg'` instead of a number, with a helper function for
pixel values. All usages and related props in `FileAttachment` and
`FilePreview` components have been updated accordingly.
[[1]](diffhunk://#diff-f09731000017089225ce75654729be49248377cebfe66c4b1acd92060e357f84L9-R9)
[[2]](diffhunk://#diff-f09731000017089225ce75654729be49248377cebfe66c4b1acd92060e357f84L27-R27)
[[3]](diffhunk://#diff-da00da93e87c5e0879e43ba5dcecef0891feb4fc91eca0a3943f57bf15706082L6-R6)
[[4]](diffhunk://#diff-da00da93e87c5e0879e43ba5dcecef0891feb4fc91eca0a3943f57bf15706082L18-R18)
[[5]](diffhunk://#diff-8e25408ab804f1b2ad561399ec92344540cf74a28f80759bd6dfb372f5b765b7L81)
[[6]](diffhunk://#diff-19b4d2fb6effabd571003e401f381502efc609a1bce8bf57172da36c533352a6L70-R70)
* The icon mapping logic in `FileIcon.tsx` is simplified: several
specific file icons (e.g., CSV, DOCX, XLSX, PPTX, RAR, etc.) are removed
and replaced with broader categories (`SpreadSheet`, `Presentation`,
`Code`, `OtherFileIcon`). This reduces complexity and improves
maintainability.
[[1]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L6-L24)
[[2]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L206-L208)
[[3]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832R205-R212)
[[4]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L232-L234)
[[5]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L249-L258)
[[6]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L273-L275)
[[7]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L292-R278)
[[8]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L317-L323)
[[9]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832R343-L372)
[[10]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L383-R369)
[[11]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832R380-R421)
### Icon Component Updates
* The default fallback icon for unknown file types is changed from
`GenericFile` to `OtherFileIcon`, ensuring a more consistent look for
unsupported types.
* The `Audio` icon is reimplemented to use direct SVG markup, updating
its appearance and making it easier to maintain.
### File Type Handling Improvements
* File type lists and mappings are consolidated and expanded to cover
more document, spreadsheet, presentation, and code file types, improving
file icon accuracy for various MIME types.
[[1]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832R205-R212)
[[2]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L249-L258)
[[3]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832L292-R278)
[[4]](diffhunk://#diff-17b7d01b94b1997008ef984446c4095c828b05d0c3a6c570d7f5a0b5ddeb3832R343-L372)
These changes collectively streamline the file attachment icon system,
enhance visual consistency, and simplify future updates.1 parent 9324ba6 commit 3d03fc5
File tree
30 files changed
+309
-775
lines changed- package/src
- components
- Attachment
- MessageInput/components/AttachmentPreview
- Reply
- icons
30 files changed
+309
-775
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 8 | + | |
13 | 9 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 10 | + | |
| 11 | + | |
21 | 12 | | |
22 | 13 | | |
23 | | - | |
24 | | - | |
25 | 14 | | |
26 | 15 | | |
27 | 16 | | |
| |||
203 | 192 | | |
204 | 193 | | |
205 | 194 | | |
206 | | - | |
207 | 195 | | |
208 | | - | |
209 | 196 | | |
210 | 197 | | |
211 | 198 | | |
| |||
215 | 202 | | |
216 | 203 | | |
217 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
218 | 213 | | |
219 | 214 | | |
220 | 215 | | |
| |||
229 | 224 | | |
230 | 225 | | |
231 | 226 | | |
232 | | - | |
233 | 227 | | |
234 | | - | |
235 | 228 | | |
236 | 229 | | |
237 | 230 | | |
| |||
246 | 239 | | |
247 | 240 | | |
248 | 241 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | 242 | | |
260 | 243 | | |
261 | 244 | | |
| |||
270 | 253 | | |
271 | 254 | | |
272 | 255 | | |
273 | | - | |
274 | 256 | | |
275 | | - | |
276 | 257 | | |
277 | 258 | | |
278 | 259 | | |
| |||
289 | 270 | | |
290 | 271 | | |
291 | 272 | | |
292 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
293 | 279 | | |
294 | 280 | | |
295 | 281 | | |
| |||
314 | 300 | | |
315 | 301 | | |
316 | 302 | | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | 303 | | |
325 | 304 | | |
326 | 305 | | |
| |||
361 | 340 | | |
362 | 341 | | |
363 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
364 | 352 | | |
365 | 353 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | 354 | | |
374 | 355 | | |
375 | 356 | | |
| |||
380 | 361 | | |
381 | 362 | | |
382 | 363 | | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | 364 | | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
| 365 | + | |
397 | 366 | | |
398 | 367 | | |
399 | 368 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 369 | + | |
409 | 370 | | |
410 | 371 | | |
411 | 372 | | |
| |||
416 | 377 | | |
417 | 378 | | |
418 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
419 | 384 | | |
420 | 385 | | |
421 | | - | |
| 386 | + | |
422 | 387 | | |
423 | 388 | | |
424 | 389 | | |
425 | 390 | | |
426 | 391 | | |
427 | 392 | | |
428 | 393 | | |
429 | | - | |
| 394 | + | |
430 | 395 | | |
431 | 396 | | |
432 | 397 | | |
433 | 398 | | |
434 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
435 | 419 | | |
436 | 420 | | |
437 | | - | |
| 421 | + | |
438 | 422 | | |
439 | 423 | | |
440 | 424 | | |
| |||
445 | 429 | | |
446 | 430 | | |
447 | 431 | | |
448 | | - | |
| 432 | + | |
449 | 433 | | |
450 | 434 | | |
451 | 435 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
13 | 9 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
19 | 13 | | |
20 | 14 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
24 | 21 | | |
25 | | - | |
26 | 22 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
30 | 27 | | |
31 | 28 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
37 | 32 | | |
38 | | - | |
| 33 | + | |
39 | 34 | | |
This file was deleted.
0 commit comments