diff --git a/.env.development b/.env.development index cb4cb40..24848d3 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,3 @@ # For local development (npm run dev) -VITE_API_URL=http://localhost:8080 \ No newline at end of file +VITE_API_URL=http://localhost:8080 +VITE_CORE_API_URL=http://localhost:8090 \ No newline at end of file diff --git a/.env.production b/.env.production index 658e57e..8bf2a6d 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,4 @@ # For the docker image on the server # Uses the variable AUTH_HOST from your docker structure [cite: 3] -VITE_API_URL=https://auth.tbp.andreas-dahm.eu \ No newline at end of file +VITE_API_URL=https://auth.tbp.andreas-dahm.eu +VITE_CORE_API_URL=https://api.tbp.andreas-dahm.eu \ No newline at end of file diff --git a/public/i18n/de.json b/public/i18n/de.json index 1db8fe8..0b4999e 100644 --- a/public/i18n/de.json +++ b/public/i18n/de.json @@ -68,7 +68,8 @@ }, "DASHBOARD": { "LOADING": "Lade Dashboard ...", - "HELLO": "Hallo" + "HELLO": "Hallo", + "STEAM_GAMES": "Steam Spiele" }, "MAIN": { "WELCOME": "Dein Game-Backlog unter Kontrolle", diff --git a/public/i18n/en.json b/public/i18n/en.json index 703bcdf..aa9ddff 100644 --- a/public/i18n/en.json +++ b/public/i18n/en.json @@ -68,7 +68,8 @@ }, "DASHBOARD": { "LOADING": "Loading dashboard ...", - "HELLO": "Hello" + "HELLO": "Hello", + "STEAM_GAMES": "Steam Games" }, "MAIN": { "WELCOME": "Control your game backlog", diff --git a/src/components/SteamGameCount.jsx b/src/components/SteamGameCount.jsx new file mode 100644 index 0000000..092bcc8 --- /dev/null +++ b/src/components/SteamGameCount.jsx @@ -0,0 +1,40 @@ +import React, {useState, useEffect} from 'react'; +import {useTranslation} from 'react-i18next'; + +const SteamGameCount = ({targetCount}) => { + const {t} = useTranslation(); + const [count, setCount] = useState(0); + + useEffect(() => { + let startTime; + const duration = 1000; // 1 second + const startCount = 0; + + const animate = (timestamp) => { + if (!startTime) startTime = timestamp; + const progress = Math.min((timestamp - startTime) / duration, 1); + + const currentCount = Math.floor(progress * (targetCount - startCount) + startCount); + setCount(currentCount); + + if (progress < 1) { + requestAnimationFrame(animate); + } + }; + + requestAnimationFrame(animate); + }, [targetCount]); + + return ( +