From 92f96b902dad4ff0b1ca513d3de408caf0d5eca2 Mon Sep 17 00:00:00 2001 From: martin-mfg <2026226+martin-mfg@users.noreply.github.com> Date: Mon, 29 Dec 2025 22:15:59 +0100 Subject: [PATCH] 'GitHub Trends' -> 'GitHub Stats Extended', clean up unused code --- frontend/frontend/.gitignore | 3 - frontend/frontend/package.json | 5 +- frontend/frontend/public/index.html | 45 +++++++++++ frontend/frontend/public/manifest.json | 8 +- frontend/frontend/public/trends.html | 77 ------------------- frontend/frontend/src/api/index.js | 9 +-- frontend/frontend/src/api/user.js | 19 +---- frontend/frontend/src/constants.js | 12 +-- frontend/frontend/src/index.js | 17 ++-- frontend/frontend/src/pages/App/AppTrends.js | 2 +- frontend/frontend/src/pages/App/Header.js | 19 +---- frontend/frontend/src/pages/Home/Home.js | 8 +- .../frontend/src/pages/Home/stages/Login.js | 6 +- 13 files changed, 73 insertions(+), 157 deletions(-) create mode 100644 frontend/frontend/public/index.html delete mode 100644 frontend/frontend/public/trends.html diff --git a/frontend/frontend/.gitignore b/frontend/frontend/.gitignore index 1130e8b8..4d29575d 100644 --- a/frontend/frontend/.gitignore +++ b/frontend/frontend/.gitignore @@ -21,6 +21,3 @@ npm-debug.log* yarn-debug.log* yarn-error.log* - -# custom -public/index.html \ No newline at end of file diff --git a/frontend/frontend/package.json b/frontend/frontend/package.json index cf74821b..2f27613e 100644 --- a/frontend/frontend/package.json +++ b/frontend/frontend/package.json @@ -56,9 +56,8 @@ "webpack-dev-server": "^5.2.2" }, "scripts": { - "setup-trends": "cp ./public/trends.html ./public/index.html", - "start-trends": "yarn setup-trends && REACT_APP_MODE=trends craco start", - "build-trends": "yarn setup-trends && REACT_APP_MODE=trends craco build", + "start-trends": "craco start", + "build-trends": "craco build", "test": "craco test", "eject": "react-scripts eject" }, diff --git a/frontend/frontend/public/index.html b/frontend/frontend/public/index.html new file mode 100644 index 00000000..eca8d8f5 --- /dev/null +++ b/frontend/frontend/public/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + GitHub Stats Extended + + + +
+ + diff --git a/frontend/frontend/public/manifest.json b/frontend/frontend/public/manifest.json index 080d6c77..ff1da606 100644 --- a/frontend/frontend/public/manifest.json +++ b/frontend/frontend/public/manifest.json @@ -1,11 +1,11 @@ { - "short_name": "React App", - "name": "Create React App Sample", + "short_name": "GitHub-Stats-Extended", + "name": "GitHub-Stats-Extended", "icons": [ { "src": "favicon.ico", - "sizes": "64x64 32x32 24x24 16x16", - "type": "image/x-icon" + "type": "image/x-icon", + "sizes": "64x64 32x32 24x24 16x16" }, { "src": "logo192.png", diff --git a/frontend/frontend/public/trends.html b/frontend/frontend/public/trends.html deleted file mode 100644 index 79c20254..00000000 --- a/frontend/frontend/public/trends.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GitHub Trends - - - -
- - diff --git a/frontend/frontend/src/api/index.js b/frontend/frontend/src/api/index.js index acb34390..dc09de07 100644 --- a/frontend/frontend/src/api/index.js +++ b/frontend/frontend/src/api/index.js @@ -1,8 +1,3 @@ -import { - setUserKey, - authenticate, - getUserMetadata, - deleteAccount, -} from './user'; +import { authenticate, getUserMetadata, deleteAccount } from './user'; -export { setUserKey, authenticate, getUserMetadata, deleteAccount }; +export { authenticate, getUserMetadata, deleteAccount }; diff --git a/frontend/frontend/src/api/user.js b/frontend/frontend/src/api/user.js index 36aa1c68..955276b2 100644 --- a/frontend/frontend/src/api/user.js +++ b/frontend/frontend/src/api/user.js @@ -1,21 +1,6 @@ import axios from 'axios'; -import { v4 as uuidv4 } from 'uuid'; -import { BACKEND_URL, HOST } from '../constants'; - -const URL_PREFIX = BACKEND_URL; - -const setUserKey = async (code) => { - try { - const key = uuidv4(); - const fullUrl = `${URL_PREFIX}/auth/web/set_user_key/${code}/${key}`; - await axios.post(fullUrl); - return key; - } catch (error) { - console.error(error); - return ''; - } -}; +import { HOST } from '../constants'; const authenticate = async (code, privateAccess, userKey) => { try { @@ -50,4 +35,4 @@ const deleteAccount = async (userId, userKey) => { } }; -export { setUserKey, authenticate, getUserMetadata, deleteAccount }; +export { authenticate, getUserMetadata, deleteAccount }; diff --git a/frontend/frontend/src/constants.js b/frontend/frontend/src/constants.js index bca64ce9..26cbff36 100644 --- a/frontend/frontend/src/constants.js +++ b/frontend/frontend/src/constants.js @@ -5,25 +5,17 @@ export const USE_LOGGER = true; export const CLIENT_ID = 'Ov23liZSweT9LJrck9i8'; -export const MODE = 'trends'; - export const HOST = PROD ? 'monorepo-test-backend-seven.vercel.app' : 'localhost:3000'; export const REDIRECT_URI = PROD - ? `https://${HOST}/frontend/user` - : `http://${HOST}/frontend/user`; + ? `https://${HOST}/frontend` + : `http://${HOST}/frontend`; export const GITHUB_PRIVATE_AUTH_URL = `https://github.com/login/oauth/authorize?scope=user,repo&client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}/private`; export const GITHUB_PUBLIC_AUTH_URL = `https://github.com/login/oauth/authorize?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}/public`; -export const BACKEND_URL = PROD - ? 'https://api.githubtrends.io' - : 'http://localhost:8000'; - -export const CURR_YEAR = 2024; - export const DEMO_USER = 'anuraghazra'; export const DEMO_REPO = 'anuraghazra/github-readme-stats'; export const DEMO_GIST = 'bbfce31e0217a3689c8d961a356cb10d'; diff --git a/frontend/frontend/src/index.js b/frontend/frontend/src/index.js index 69052507..7a06e01a 100644 --- a/frontend/frontend/src/index.js +++ b/frontend/frontend/src/index.js @@ -7,19 +7,12 @@ import configureStore from './redux/store'; import { AppTrends } from './pages/App'; import './index.css'; -import { MODE } from './constants'; - export const store = configureStore(); const root = ReactDOM.createRoot(document.getElementById('root')); -if (MODE === 'trends') { - root.render( - - - , - ); -} else { - // Throw an error if the mode is not set correctly. - throw new Error('REACT_APP_MODE must be set to "trends" in your .env file.'); -} +root.render( + + + , +); diff --git a/frontend/frontend/src/pages/App/AppTrends.js b/frontend/frontend/src/pages/App/AppTrends.js index c6d95506..bbedee4c 100644 --- a/frontend/frontend/src/pages/App/AppTrends.js +++ b/frontend/frontend/src/pages/App/AppTrends.js @@ -79,7 +79,7 @@ function App() { return (
-
+
diff --git a/frontend/frontend/src/pages/App/Header.js b/frontend/frontend/src/pages/App/Header.js index b6548f35..7e5309b5 100644 --- a/frontend/frontend/src/pages/App/Header.js +++ b/frontend/frontend/src/pages/App/Header.js @@ -4,13 +4,8 @@ import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; -import { GiHamburgerMenu as HamburgerIcon } from 'react-icons/gi'; - -import { logout as _logout } from '../../redux/actions/userActions'; -import { useIsAuthenticated } from '../../redux/selectors/userSelectors'; import appIcon from '../../assets/appLogo64.png'; import { classnames } from '../../utils'; -import { GITHUB_PUBLIC_AUTH_URL } from '../../constants'; import { FaGithub as GithubIcon } from 'react-icons/fa'; import { ProgressBar } from '../../components'; @@ -60,27 +55,20 @@ MobileLink.propTypes = propTypes; MobileLink.defaultProps = defaultProps; -const Header = ({ mode, stage, setStage }) => { - const [toggle, setToggle] = useState(false); - - const isAuthenticated = useIsAuthenticated(); - +const Header = ({ stage, setStage }) => { const dispatch = useDispatch(); - const logout = () => dispatch(_logout()); return ( <>
- {/* GitHub Trends Logo */} + {/* Logo */} logo - {mode === 'trends' && ( - GitHub Trends - )} + GitHub Stats Extended {/* Star on GitHub */}
@@ -116,7 +104,6 @@ const Header = ({ mode, stage, setStage }) => { }; Header.propTypes = { - mode: PropTypes.string.isRequired, stage: PropTypes.number.isRequired, setStage: PropTypes.func.isRequired, }; diff --git a/frontend/frontend/src/pages/Home/Home.js b/frontend/frontend/src/pages/Home/Home.js index 173cc390..bdfdc6f3 100644 --- a/frontend/frontend/src/pages/Home/Home.js +++ b/frontend/frontend/src/pages/Home/Home.js @@ -261,7 +261,7 @@ const HomeScreen = ({ stage, setStage }) => { if (url.includes('code=')) { const tempPrivateAccess = url.includes('private'); const newUrl = url.split('?code='); - const redirect = `${url.split(HOST)[0]}${HOST}/frontend/user`; + const redirect = `${url.split(HOST)[0]}${HOST}/frontend`; window.history.pushState({}, null, redirect); setIsLoading(true); const userKey = uuidv4(); @@ -322,13 +322,13 @@ const HomeScreen = ({ stage, setStage }) => {

{privateAccess ? ( <> - You granted GitHub Trends access to both your{' '} + You granted GitHub-Stats-Extended access to both your{' '} public and private contributions. ) : ( <> - You granted GitHub Trends access to your public{' '} - contributions. + You granted GitHub-Stats-Extended access to your{' '} + public contributions. )}

diff --git a/frontend/frontend/src/pages/Home/stages/Login.js b/frontend/frontend/src/pages/Home/stages/Login.js index 4b49ada5..723be850 100644 --- a/frontend/frontend/src/pages/Home/stages/Login.js +++ b/frontend/frontend/src/pages/Home/stages/Login.js @@ -157,7 +157,7 @@ const LoginStage = ({ setCurrItem }) => {

- This will delete your GitHub Trends account and then + This will delete your GitHub-Stats-Extended account and then redirect you to a GitHub screen where you can revoke your access token.

@@ -172,7 +172,7 @@ const LoginStage = ({ setCurrItem }) => { Log Out

- Log out from GitHub Trends. + Log out from GitHub-Stats-Extended.

@@ -217,7 +217,7 @@ const LoginStage = ({ setCurrItem }) => { Continue as Guest

- Try out Github Trends with data from an example + Try out GitHub-Stats-Extended with data from an example user/repository.