Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Some quality of life changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zeankundev committed Mar 29, 2024
1 parent 7444913 commit 317736f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
24 changes: 24 additions & 0 deletions src/renderer/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,27 @@ h3, h4, h5 {
.gcui-window-button:hover {
background-color: var(--main-hover-color);
}
.gcui-recommend-fragment {
padding: 10px;
background-size: cover;
background-color: rgba(0, 0, 0, 0.5);
background-blend-mode: multiply;
display: inline-flex;
flex-direction: column;
margin-right: 10px;
margin-bottom: 10px;
}
.gcui-fragmented-p {
font-size: 15pt;
font-weight: bold;
user-select: none;
}
.gcui-image-generic {
width: 30px;
height: 30px;
display: block;
user-select: none;
image-rendering: optimizeQuality;
image-resolution: 1;
object-fit: cover;
}
2 changes: 1 addition & 1 deletion src/renderer/modules/api/SettingsParsingAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class GCSettingsAPI {
return this.language;
}

public getHomePageRepository(): String {
public getHomePageRepository(): RequestInfo {
return this.homePageRepository;
}

Expand Down
34 changes: 24 additions & 10 deletions src/renderer/pages/Home.tsx
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);

Check warning on line 17 in src/renderer/pages/Home.tsx

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Unexpected console statement
});
}, []); // 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>
);
}

0 comments on commit 317736f

Please sign in to comment.