Skip to content

Commit d7748d3

Browse files
authored
Sort albums in descending order (#942)
* add gallery and albums * add album uploading, fix styling, remove unneeded * change swedish translation for gallery * make album responsive * add support for album metadata * do not kill the browser * remove unused code * remove unused code * fix syntax error * sort albums by date
1 parent e609648 commit d7748d3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/routes/(app)/gallery/+page.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
data.user,
1616
),
1717
);
18+
19+
const albums = data.albums.sort(
20+
(e1, e2) =>
21+
Date.parse(e2[0].split(" ")[0]!) - Date.parse(e1[0].split(" ")[0]!),
22+
);
1823
</script>
1924

2025
<SetPageTitle title={m.gallery()} />
@@ -34,7 +39,7 @@
3439
<div
3540
class="grid grid-cols-1 items-stretch justify-items-stretch gap-4 md:grid-cols-2 lg:grid-cols-3"
3641
>
37-
{#each data.albums as album (album)}
42+
{#each albums as album (album)}
3843
<AlbumCard {album} />
3944
{/each}
4045
</div>

0 commit comments

Comments
 (0)