This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7444913
commit 317736f
Showing
3 changed files
with
49 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,33 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import GCSettingsAPI from "../modules/api/SettingsParsingAPI"; | ||
|
||
export default function Home() { | ||
const settingsAPI = new GCSettingsAPI(); | ||
console.log(`${settingsAPI.getUILanguage()}`) | ||
const [metadata, setMetadata] = useState([]); | ||
|
||
useEffect(() => { | ||
const settingsAPI = new GCSettingsAPI(); | ||
const homePageRepository = settingsAPI.getHomePageRepository(); | ||
|
||
fetch(homePageRepository) | ||
.then(res => res.json()) | ||
.then(data => { | ||
setMetadata(data.items); // Set metadata to data.items | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching metadata:', error); | ||
}); | ||
}, []); // Empty dependency array ensures this effect runs only once after the component mounts | ||
|
||
return ( | ||
<div> | ||
<h1>Welcome back!</h1> | ||
<h3> | ||
language: {settingsAPI.getUILanguage()} | ||
<br></br> | ||
homeURL: {settingsAPI.getHomePageRepository()} | ||
<br></br> | ||
styleURL: {settingsAPI.getStyleURL()} | ||
</h3> | ||
{metadata.map(metadataItem => ( | ||
<div className='gcui-recommend-fragment' style={{backgroundImage: `url(${metadataItem.banner})`}}> | ||
<img className='gcui-image-generic' src={metadataItem.banner}></img> | ||
<p className='gcui-fragmented-p'>{metadataItem.name.length > 13 ? `${metadataItem.name.substring(0, 13)}...` : metadataItem.name}</p> | ||
{/* Render other metadata properties here */} | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} | ||
|