(note: ZenNote)
| 408 | } |
| 409 | |
| 410 | function noteAccessories(note: ZenNote): List.Item.Accessory[] { |
| 411 | const accessories: List.Item.Accessory[] = [ |
| 412 | { text: note.folder }, |
| 413 | { text: formatRelativeAge(note.updatedAt) }, |
| 414 | ]; |
| 415 | |
| 416 | if (note.hasAttachments) { |
| 417 | accessories.splice(1, 0, { |
| 418 | icon: { source: Icon.Paperclip, tintColor: Color.SecondaryText }, |
| 419 | tooltip: "Has attachments", |
| 420 | }); |
| 421 | } |
| 422 | |
| 423 | for (const tag of note.tags.slice(0, 2)) { |
| 424 | accessories.splice(accessories.length - 1, 0, { |
| 425 | tag: { value: `#${tag}`, color: Color.SecondaryText }, |
| 426 | }); |
| 427 | } |
| 428 | |
| 429 | return accessories; |
| 430 | } |
| 431 | |
| 432 | function formatRelativeAge(updatedAt: number): string { |
| 433 | if (!updatedAt) return ""; |
no test coverage detected