From ef8b993810b46c1ab9f0833c0feb1cb3751a3788 Mon Sep 17 00:00:00 2001 From: martin-mfg <2026226+martin-mfg@users.noreply.github.com> Date: Sun, 16 Nov 2025 11:35:58 +0100 Subject: [PATCH] step 1: add cards preview and more icons, start at step 2 if authenticated --- frontend/frontend/src/pages/Home/Home.js | 2 +- .../frontend/src/pages/Home/stages/Login.js | 118 +++++++++++++++++- 2 files changed, 116 insertions(+), 4 deletions(-) diff --git a/frontend/frontend/src/pages/Home/Home.js b/frontend/frontend/src/pages/Home/Home.js index ee2e3c03..0f2775f8 100644 --- a/frontend/frontend/src/pages/Home/Home.js +++ b/frontend/frontend/src/pages/Home/Home.js @@ -33,7 +33,7 @@ const HomeScreen = () => { const login = (newUserId, userKey) => dispatch(_login(newUserId, userKey)); // for all stages - const [stage, setStage] = useState(0); + const [stage, setStage] = useState(isAuthenticated ? 1 : 0); // for stage one const [selectedCard, setSelectedCard] = useState('stats'); diff --git a/frontend/frontend/src/pages/Home/stages/Login.js b/frontend/frontend/src/pages/Home/stages/Login.js index d33991a0..f373c61c 100644 --- a/frontend/frontend/src/pages/Home/stages/Login.js +++ b/frontend/frontend/src/pages/Home/stages/Login.js @@ -1,6 +1,6 @@ /* eslint-disable react/no-array-index-key */ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { useDispatch, useSelector } from 'react-redux'; @@ -24,6 +24,70 @@ const LoginStage = ({ setCurrItem }) => { const logout = () => { dispatch(_logout()); }; + + // Card data + const cards = [ + { + title: 'GitHub Stats Card', + description: 'your overall GitHub statistics', + imageSrc: `?&username=anuraghazra`, + demoCustomization: '&include_all_commits=true', + cardType: 'stats', + }, + { + title: 'Top Languages Card', + description: 'your most frequently used languages', + imageSrc: `/top-langs?&username=anuraghazra`, + demoCustomization: '&langs_count=4', + cardType: 'top-langs', + }, + { + title: 'GitHub Extra Pin', + description: + 'pin more than 6 repositories in your profile using a GitHub profile readme', + imageSrc: '/pin?repo=anuraghazra/github-readme-stats', + demoCustomization: '', + cardType: 'pin', + }, + { + title: 'GitHub Gist Pin', + description: + 'pin gists in your GitHub profile using a GitHub profile readme', + imageSrc: '/gist?id=bbfce31e0217a3689c8d961a356cb10d', + demoCustomization: '', + cardType: 'gist', + }, + { + title: 'WakaTime Stats Card', + description: 'your coding activity from WakaTime', + imageSrc: '/wakatime?username=ffflabs', + demoCustomization: '&langs_count=6&card_width=450', + cardType: 'wakatime', + }, + ]; + + // Animation state for each card + const [cardOffsets, setCardOffsets] = useState( + cards.map(() => ({ x: 0, y: 0 })), + ); + + // Subtle floating animation + useEffect(() => { + const intervals = cards.map((_, index) => { + return setInterval(() => { + setCardOffsets((prev) => { + const newOffsets = [...prev]; + newOffsets[index] = { + x: Math.sin(Date.now() / 1000 + index) * 3, + y: Math.cos(Date.now() / 1500 + index * 0.5) * 3, + }; + return newOffsets; + }); + }, 50); + }); + + return () => intervals.forEach(clearInterval); + }, []); return (