1+ import LandingText from "./landingText" ;
2+ import { BlogPost } from "../../types/blogPost" ;
3+ import { BlogPostsResponse } from "../../types/blogPostsResponse" ;
4+ import FetchOfType from "../../utils/fetchOfType" ;
5+ import PageSection from "../common/uiLibrary/pageSection" ;
6+ import LandingButtonsServer from "./LandingButtonsServer" ;
7+ import DownloadButtonClient from "./DownloadButtonClient" ;
8+ import LatestNews from "./latestNews" ;
9+ import ContactInformation from "./contactInformation" ;
10+ import FeaturesList , { FeatureData } from "./featuresList" ;
11+ import React from "react" ;
12+ import { RiGamepadLine , RiRefreshLine , RiRocket2Line , RiTeamLine } from "react-icons/ri" ;
13+
14+ const mainText = "Welcome to Unitystation!" ;
15+ const secondaryText = "Free and open-source remake of the cult classic Space Station 13, made in Unity Engine." ;
16+
17+ const features : FeatureData [ ] = [
18+ {
19+ title : "Player-driven gameplay" ,
20+ description : "Every round plays out differently. Almost anything on the station can be picked up, examined or vandalized" ,
21+ icon : RiGamepadLine ,
22+ imageUrl : "https://unitystationfile.b-cdn.net/CommunityStuff/1/chicken.png"
23+ } ,
24+ {
25+ title : "Slapstick Simulation" ,
26+ description : "Fly a shuttle into the station, breaching the hull and venting everyone into space." ,
27+ icon : RiRocket2Line ,
28+ imageUrl : "https://unitystationfile.b-cdn.net/CommunityStuff/1/production.gif"
29+ } ,
30+ {
31+ title : "Dozens of jobs" ,
32+ description : "Want to play a cook? A janitor? Law enforcement? Or maybe the captain? Even lawyers have a place on the outpost." ,
33+ icon : RiTeamLine ,
34+ imageUrl : "https://unitystationfile.b-cdn.net/WeeklyBlogUpdates/8/60.png"
35+ } ,
36+ {
37+ title : "Finally Remade" ,
38+ description : "No more dealing with BYOND to play your favorite spessman game." ,
39+ icon : RiRefreshLine ,
40+ imageUrl : "https://unitystationfile.b-cdn.net/WeeklyBlogUpdates/1/25.png"
41+ }
42+ ]
43+
44+ const fetchLatestBlogPost = async ( ) : Promise < BlogPost [ ] > => {
45+ const revalidateConfig = { next : { revalidate : 60 } } ;
46+ const resPage1 = await FetchOfType < BlogPostsResponse > ( 'https://changelog.unitystation.org/posts/' , revalidateConfig ) ;
47+ const resPage2 = await FetchOfType < BlogPostsResponse > ( 'https://changelog.unitystation.org/posts/?page=2' , revalidateConfig ) ;
48+ return resPage1 . results . concat ( resPage2 . results ) ;
49+ }
50+
51+
52+ const HomePage : ( ) => Promise < JSX . Element > = async ( ) => {
53+
54+ const latestBlogPosts : BlogPost [ ] = await fetchLatestBlogPost ( ) ;
55+
56+ return (
57+ < >
58+ < PageSection className = "gap-16" >
59+ < div >
60+ < LandingText mainText = { mainText } secondaryText = { secondaryText } />
61+ < DownloadButtonClient />
62+ < LandingButtonsServer />
63+ </ div >
64+ < FeaturesList features = { features } />
65+ </ PageSection >
66+ < PageSection verticalCenter = { false } >
67+ < LatestNews posts = { latestBlogPosts } />
68+ </ PageSection >
69+ < ContactInformation />
70+ </ >
71+ )
72+ }
73+
74+ export default HomePage ;
0 commit comments