Skip to content

Commit

Permalink
feat: Sort feed entries descending
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Junk committed Nov 29, 2023
1 parent 6b9e827 commit 5706a0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/lib/feedview/entries/Entries.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
acc[published.getFullYear()].push(entry);
return acc;
}, {});
const years = Object.keys(entriesByYear).sort();
const years = Object.keys(entriesByYear).sort((entry1: any, entry2: any) => {
if (entry1 < entry2) return 1;
if (entry1 > entry2) return -1;
return 0;
});
</script>

{#each years as year}
Expand Down
7 changes: 5 additions & 2 deletions src/lib/feedview/entries/EntriesByYear.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
<script lang="ts">
import Collapsible from "$lib/Collapsible.svelte";
import UrlCollapsible from "$lib/feedview/entries/URLCollapsible.svelte";
import { appStore } from "$lib/store";
import { tick } from "svelte";
import Entry from "./Entry.svelte";
import type { EntryIDURLLookup, EntryType, Link } from "./entrytypes";
export let entries: EntryType[] = [];
export let year: string;
entries.sort((entry1: any, entry2: any) => {
if (entry1.updated < entry2.updated) return 1;
if (entry1.updated > entry2.updated) return -1;
return 0;
});
/**
* entryIDURLLookup is a Lookup to link entry IDs to the URL referenced with "self".
*/
Expand Down

0 comments on commit 5706a0e

Please sign in to comment.