feat: show Magic Notes update times

The Magic Notes list previously showed only each title, content preview, and
entry count, making similarly named or recently changed notes harder to scan.
Each note now shows its localized update time beside the entry count, with a
semantic timestamp and bounded single-line layout for the narrow list pane.

Release note: 魔法笔记左侧列表现在显示每篇笔记的本地化更新时间,便于快速找到最近修改的内容。
This commit is contained in:
mesalogo
2026-08-30 10:09:39 +08:00
parent edba31e873
commit 8e08ab0bac
6 changed files with 39 additions and 6 deletions
@@ -399,6 +399,11 @@ describe('MagicNotesWorkspace', () => {
expect(
screen.getByRole('button', { name: /发布笔记/ })
).toHaveAttribute('aria-pressed', 'true')
const updatedTime = screen
.getByRole('button', { name: /发布笔记/ })
.querySelector('time')
expect(updatedTime).toHaveAttribute('datetime', detail.updatedAt)
expect(updatedTime).toHaveTextContent('更新于')
fireEvent.click(screen.getByRole('tab', { name: '待办' }))
expect(screen.getByText('准备演示')).toBeInTheDocument()
const selectedTodoButton = screen
+15 -6
View File
@@ -1657,12 +1657,21 @@ export function MagicNotesWorkspace({
{note.preview || t('notes.noPreview')}
</span>
<span className="magic-note-list-item__meta">
{t(
note.entryCount === 1
? 'notes.entryCountOne'
: 'notes.entryCountOther',
{ count: note.entryCount }
)}
<span>
{t(
note.entryCount === 1
? 'notes.entryCountOne'
: 'notes.entryCountOther',
{ count: note.entryCount }
)}
</span>
<time dateTime={note.updatedAt}>
{t('notes.updatedAt', {
date: dateFormatter.format(
new Date(note.updatedAt)
)
})}
</time>
</span>
</button>
))
@@ -82,6 +82,7 @@ export const magicNotes = {
noPreview: 'No entries yet',
entryCountOne: '{{count}} entry',
entryCountOther: '{{count}} entries',
updatedAt: 'Updated {{date}}',
emptySelectionTitle: 'No note selected',
emptySelectionDescription:
'Select a note on the left, or create a note to start writing.',
@@ -77,6 +77,7 @@ export const magicNotes = {
noPreview: '还没有记录',
entryCountOne: '{{count}} 条记录',
entryCountOther: '{{count}} 条记录',
updatedAt: '更新于 {{date}}',
emptySelectionTitle: '还没有选择笔记',
emptySelectionDescription: '从左侧选择笔记,或新建一篇笔记开始记录。',
newEntryLabel: '新记录内容',
+16
View File
@@ -1609,8 +1609,24 @@
}
.magic-note-list-item__meta {
display: flex;
min-width: 0;
align-items: center;
justify-content: space-between;
color: var(--text-muted);
font-size: var(--font-caption);
gap: var(--space-2);
}
.magic-note-list-item__meta > :where(span, time) {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.magic-note-list-item__meta time {
flex-shrink: 1;
text-align: right;
}
.magic-notes-stream-pane {