Skip to content

Commit 34637e5

Browse files
feat: sort by date
1 parent 3b77ac0 commit 34637e5

1 file changed

Lines changed: 39 additions & 37 deletions

File tree

src/argo-archive-list.ts

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -163,43 +163,45 @@ export class ArgoArchiveList extends LitElement {
163163
<span class="md-typescale-label-large">${dateLabel}</span>
164164
</summary>
165165
<md-list>
166-
${pages.map((page) => {
167-
const u = new URL(page.url);
168-
return html`
169-
<md-list-item type="button" @click=${() => this._openPage(page)}>
170-
<div slot="start" class="leading-group">
171-
<md-checkbox
172-
slot="start"
173-
touch-target="wrapper"
174-
@click=${(e: Event) => e.stopPropagation()}
175-
></md-checkbox>
176-
177-
${page.favIconUrl
178-
? html`
179-
<img
180-
slot="start"
181-
class="favicon"
182-
src=${page.favIconUrl}
183-
alt="favicon of ${u.hostname}"
184-
/>
185-
`
186-
: html`<md-icon slot="start">article</md-icon>`}
187-
</div>
188-
<div slot="headline" class="title-url">
189-
<span
190-
class="md-typescale-body-small title-text"
191-
style="--md-sys-typescale-body-small-weight: 700"
192-
>${page.title || page.url}</span
193-
>
194-
<a
195-
class="md-typescale-body-small base-url"
196-
style="--md-sys-typescale-body-small-weight: 700; color: gray"
197-
>${u.hostname}</a
198-
>
199-
</div>
200-
</md-list-item>
201-
`;
202-
})}
166+
${pages
167+
.sort((a, b) => Number(b.ts) - Number(a.ts))
168+
.map((page) => {
169+
const u = new URL(page.url);
170+
return html`
171+
<md-list-item type="button" @click=${() => this._openPage(page)}>
172+
<div slot="start" class="leading-group">
173+
<md-checkbox
174+
slot="start"
175+
touch-target="wrapper"
176+
@click=${(e: Event) => e.stopPropagation()}
177+
></md-checkbox>
178+
179+
${page.favIconUrl
180+
? html`
181+
<img
182+
slot="start"
183+
class="favicon"
184+
src=${page.favIconUrl}
185+
alt="favicon of ${u.hostname}"
186+
/>
187+
`
188+
: html`<md-icon slot="start">article</md-icon>`}
189+
</div>
190+
<div slot="headline" class="title-url">
191+
<span
192+
class="md-typescale-body-small title-text"
193+
style="--md-sys-typescale-body-small-weight: 700"
194+
>${page.title || page.url}</span
195+
>
196+
<a
197+
class="md-typescale-body-small base-url"
198+
style="--md-sys-typescale-body-small-weight: 700; color: gray"
199+
>${u.hostname}</a
200+
>
201+
</div>
202+
</md-list-item>
203+
`;
204+
})}
203205
</md-list>
204206
</details>
205207
</md-elevated-card>

0 commit comments

Comments
 (0)