From 02047e75e7b838bfb32b0c85393a7579593ab5b8 Mon Sep 17 00:00:00 2001
From: martin-mfg <2026226+martin-mfg@users.noreply.github.com>
Date: Thu, 27 Nov 2025 14:07:18 +0100
Subject: [PATCH] remove top right buttons, move stars button to top right, add
delete account button, use mock data in step 1, change some descriptions
---
frontend/README.md | 3 +
frontend/frontend/src/axios-override.js | 6 +-
frontend/frontend/src/pages/App/AppTrends.js | 8 -
frontend/frontend/src/pages/App/Footer.js | 28 --
frontend/frontend/src/pages/App/Header.js | 44 +--
frontend/frontend/src/pages/Home/Home.js | 7 +-
.../frontend/src/pages/Home/stages/Login.js | 38 ++-
.../frontend/src/pages/Settings/Settings.js | 264 ------------------
frontend/frontend/src/pages/Settings/index.js | 3 -
9 files changed, 55 insertions(+), 346 deletions(-)
delete mode 100644 frontend/frontend/src/pages/App/Footer.js
delete mode 100644 frontend/frontend/src/pages/Settings/Settings.js
delete mode 100644 frontend/frontend/src/pages/Settings/index.js
diff --git a/frontend/README.md b/frontend/README.md
index 5aaadff6..c7be54e5 100644
--- a/frontend/README.md
+++ b/frontend/README.md
@@ -60,3 +60,6 @@ See [docs/CONTRIBUTING.md](https://github.com/avgupta456/github-trends/blob/main
## Acknowledgements
Much inspiration was taken from [GitHub Readme Stats](https://github.com/anuraghazra/github-readme-stats). If you haven't already, check it out and give it a star!
+
+## Other
+We use your GitHub API access token to make requests on your behalf. All of our code is open-source and visible on our GitHub repository.
\ No newline at end of file
diff --git a/frontend/frontend/src/axios-override.js b/frontend/frontend/src/axios-override.js
index da3ba872..b97f7aa3 100644
--- a/frontend/frontend/src/axios-override.js
+++ b/frontend/frontend/src/axios-override.js
@@ -44,12 +44,8 @@ export function setIsAuthenticated(newIsAuthenticated) {
const defaultAdapter = getAdapter(axios.defaults.adapter);
-// mock responses to unauthenticated "anuraghazra" requests
+// mock responses to "anuraghazra" requests
axios.defaults.adapter = async (config) => {
- if (isAuthenticated) {
- return defaultAdapter(config);
- }
-
const params = config.data ? JSON.parse(config.data) : {};
if (
diff --git a/frontend/frontend/src/pages/App/AppTrends.js b/frontend/frontend/src/pages/App/AppTrends.js
index 783b573e..d516821e 100644
--- a/frontend/frontend/src/pages/App/AppTrends.js
+++ b/frontend/frontend/src/pages/App/AppTrends.js
@@ -9,12 +9,9 @@ import {
import Header from './Header';
import LandingScreen from '../Landing';
-import { SignUpScreen } from '../Auth';
import HomeScreen from '../Home';
-import SettingsScreen from '../Settings';
import { NoMatchScreen } from '../Misc';
import { getUserMetadata } from '../../api';
-import Footer from './Footer';
import {
useIsAuthenticated,
useUserKey,
@@ -48,16 +45,11 @@ function App() {
{privateAccess ? ( <> - You have granted access to both{' '} - public and private repositories. + You granted GitHub Trends access to both your{' '} + public and private contributions. > ) : ( <> - You have granted access to public repositories. + You granted GitHub Trends 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 e72ca576..1b865e45 100644 --- a/frontend/frontend/src/pages/Home/stages/Login.js +++ b/frontend/frontend/src/pages/Home/stages/Login.js @@ -7,6 +7,7 @@ import { useDispatch } from 'react-redux'; import { Button, Image } from '../../../components'; import { classnames } from '../../../utils'; import { + CLIENT_ID, GITHUB_PRIVATE_AUTH_URL, GITHUB_PUBLIC_AUTH_URL, HOST, @@ -16,10 +17,13 @@ import { logout as _logout } from '../../../redux/actions/userActions'; import { useIsAuthenticated, usePrivateAccess, + useUserId, useUserKey, } from '../../../redux/selectors/userSelectors'; +import { deleteAccount } from '../../../api'; const LoginStage = ({ setCurrItem }) => { + const userId = useUserId(); const userKey = useUserKey(); const privateAccess = usePrivateAccess(); const isAuthenticated = useIsAuthenticated(); @@ -28,6 +32,13 @@ const LoginStage = ({ setCurrItem }) => { const logout = () => { dispatch(_logout()); }; + const deleteAccountHandler = async (myUserId, myUserKey) => { + const success = await deleteAccount(myUserId, myUserKey); + if (success) { + logout(); + window.location = `https://github.com/settings/connections/applications/${CLIENT_ID}`; + } + }; // Card data const cards = [ @@ -81,7 +92,7 @@ const LoginStage = ({ setCurrItem }) => {Switch to public access if you prefer not to share private - repository data. + contributions.
- Upgrade to include contributions from your private - repositories for more complete stats. + Upgrade to include contributions in private repositories + for more complete and accurate stats.
)} @@ -111,7 +122,21 @@ const LoginStage = ({ setCurrItem }) => { Log Out- Log out from your GitHub account. + Log out from GitHub Trends. +
+ + + {/* Delete Account Button */} ++ This will delete your GitHub Trends account and then redirect + you to a GitHub screen where you can revoke your access token.
- Generate stats based on your public repositories. + Generate stats based on your contributions in public + repositories.
@@ -142,7 +168,7 @@ const LoginStage = ({ setCurrItem }) => {- Includes contributions in your private repositories for more + Includes contributions from private repositories for more complete and accurate stats.
diff --git a/frontend/frontend/src/pages/Settings/Settings.js b/frontend/frontend/src/pages/Settings/Settings.js deleted file mode 100644 index 3eba8b8f..00000000 --- a/frontend/frontend/src/pages/Settings/Settings.js +++ /dev/null @@ -1,264 +0,0 @@ -import React, { useEffect, useRef, useState } from 'react'; -import PropTypes from 'prop-types'; -import { useDispatch } from 'react-redux'; - -import { Button } from '../../components'; -import { logout as _logout } from '../../redux/actions/userActions'; -import { - useUserId, - useUserKey, - useIsAuthenticated, - usePrivateAccess, -} from '../../redux/selectors/userSelectors'; -import { deleteAccount } from '../../api'; -import { classnames } from '../../utils'; -import { CLIENT_ID, GITHUB_PRIVATE_AUTH_URL, HOST } from '../../constants'; - -const SectionButton = ({ name, implemented, isSelected, setSelected }) => { - return ( -- Account Settings -
-Account Tier
-- Current Tier: - {accountTier} -
-- You have given GitHub Trends (read and write) access to all - public and private code contributions. We use your GitHub - API access token to make requests on your behalf. All of our - code is open-source and visible on our - - GitHub repository - -
- ) : ( -- You have given GitHub Trends read access to your public - repositories. Upgrading to the Private Workflow will allow - us to better represent your code contributions. We use your - GitHub API access token to make requests on your behalf. All - of our code is open-source and visible on our - - GitHub repository - -
- )} -Personalization
-Coming soon!
-Delete Account
-- Deleting your account is permanent and cannot be undone. If - you are sure you want to delete your account, click the button - below to remove your statistics from GitHub Trends. This will - redirect you to a GitHub screen where you can revoke your - access token. -
-Delete Account
-- Are you sure you want to continue? This action cannot be - undone. -
-