Commit f8cbc60 1 parent 34ccd0d commit f8cbc60 Copy full SHA for f8cbc60
File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ async function AnnoucementPosts() {
22
22
23
23
const announcements = await PullForumData ( 'https://forum.vatsim-scandinavia.org/api/discussions?filter[tag]=announcements' ) ;
24
24
25
+ announcements . sort ( ( a : any , b :any ) => {
26
+ const dateA = new Date ( a . attributes . createdAt ) ;
27
+ const dateB = new Date ( b . attributes . createdAt ) ;
28
+ return dateB . getTime ( ) - dateA . getTime ( ) ;
29
+ } ) ;
30
+
25
31
for ( const post of await announcements ) {
26
32
const firstPost = await PullForumData ( 'https://forum.vatsim-scandinavia.org/api/posts?filter[id]=' + post . relationships . firstPost . data . id ) ;
27
33
const firstPostContent = await firstPost [ 0 ] . attributes . contentHtml ;
@@ -41,7 +47,7 @@ const Annoucements = () => {
41
47
42
48
return (
43
49
< >
44
- { data . map ( ( post ) => (
50
+ { data . splice ( 0 , 2 ) . map ( ( post ) => (
45
51
< div className = "p-2 mt-2 mb-4 hover:bg-white dark:hover:bg-black hover:brightness-[95%]" key = { post . slug } >
46
52
< a href = { 'https://forum.vatsim-scandinavia.org/d/' + post . slug } target = "_blank" >
47
53
< div className = "flex" >
You can’t perform that action at this time.
0 commit comments