'GitHub Trends' -> 'GitHub Stats Extended', clean up unused code

This commit is contained in:
martin-mfg
2025-12-29 22:28:06 +01:00
parent 015620aabb
commit 92f96b902d
13 changed files with 73 additions and 157 deletions
-3
View File
@@ -21,6 +21,3 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# custom
public/index.html
+2 -3
View File
@@ -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"
},
+45
View File
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="title" content="GitHub Stats Extended" />
<meta
name="description"
content="Dynamically generate GitHub stats for your READMEs."
/>
<meta property="og:type" content="website" />
<meta property="og:url" content="https://monorepo-test-backend-seven.vercel.app/frontend" />
<meta property="og:title" content="GitHub Stats Extended" />
<meta
property="og:description"
content="Dynamically generate GitHub stats for your READMEs."
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>GitHub Stats Extended</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
+4 -4
View File
@@ -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",
-77
View File
@@ -1,77 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="title" content="Github Trends" />
<meta
name="description"
content="Discover and display statistics about your code contributions. Level up your GitHub profile readme with customizable cards including LOC statistics!"
/>
<meta property="og:type" content="website" />
<meta property="og:url" content="https://githubtrends.io/" />
<meta property="og:title" content="Github Trends" />
<meta
property="og:description"
content="Discover and display statistics about your code contributions. Level up your GitHub profile readme with customizable cards including LOC statistics!"
/>
<meta
property="og:image"
content="https://www.githubtrends.io/preview_trends.png"
/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:creator" content="@avgupta456" />
<meta name="twitter:url" content="https://githubtrends.io" />
<meta name="twitter:title" content="Github Trends" />
<meta
name="twitter:description"
content="Discover and display statistics about your code contributions. Level up your GitHub profile readme with customizable cards including LOC statistics!"
/>
<meta
name="twitter:image"
content="https://www.githubtrends.io/preview_trends.png"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-FT096DX9CK"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-FT096DX9CK');
</script>
<title>GitHub Trends</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
+2 -7
View File
@@ -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 };
+2 -17
View File
@@ -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 };
+2 -10
View File
@@ -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';
+5 -12
View File
@@ -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(
<Provider store={store}>
<AppTrends />
</Provider>,
);
} 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(
<Provider store={store}>
<AppTrends />
</Provider>,
);
+1 -1
View File
@@ -79,7 +79,7 @@ function App() {
return (
<div className="min-h-screen flex flex-col">
<Router basename="/frontend">
<Header mode="trends" stage={stage} setStage={setStage} />
<Header stage={stage} setStage={setStage} />
<section className="bg-white text-gray-700 flex-grow">
<HomeScreen stage={stage} setStage={setStage} />
<ToastContainer />
+3 -16
View File
@@ -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 (
<>
<div className="text-gray-100 bg-gray-800 shadow-md body-font z-50">
<div className="px-5 py-2 flex flex-wrap">
{/* GitHub Trends Logo */}
{/* Logo */}
<Link
to="/"
className="flex items-center title-font font-medium text-gray-50 mb-0 md:mr-8"
>
<img src={appIcon} alt="logo" className="w-6 h-6" />
{mode === 'trends' && (
<span className="ml-2 text-xl">GitHub Trends</span>
)}
<span className="ml-2 text-xl">GitHub Stats Extended</span>
</Link>
{/* Star on GitHub */}
<div className="flex ml-auto items-center text-base justify-center">
@@ -116,7 +104,6 @@ const Header = ({ mode, stage, setStage }) => {
};
Header.propTypes = {
mode: PropTypes.string.isRequired,
stage: PropTypes.number.isRequired,
setStage: PropTypes.func.isRequired,
};
+4 -4
View File
@@ -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 }) => {
<p>
{privateAccess ? (
<>
You granted GitHub Trends access to both your{' '}
You granted GitHub-Stats-Extended access to both your{' '}
<b>public and private</b> contributions.
</>
) : (
<>
You granted GitHub Trends access to your <b>public</b>{' '}
contributions.
You granted GitHub-Stats-Extended access to your{' '}
<b>public</b> contributions.
</>
)}
</p>
@@ -157,7 +157,7 @@ const LoginStage = ({ setCurrItem }) => {
</span>
</Button>
<p className="text-sm text-gray-600 flex-1">
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.
</p>
@@ -172,7 +172,7 @@ const LoginStage = ({ setCurrItem }) => {
<span className="xl:text-lg">Log Out</span>
</Button>
<p className="text-sm text-gray-600 flex-1">
Log out from GitHub Trends.
Log out from GitHub-Stats-Extended.
</p>
</div>
</>
@@ -217,7 +217,7 @@ const LoginStage = ({ setCurrItem }) => {
<span className="ml-2 xl:text-lg">Continue as Guest</span>
</Button>
<p className="text-sm text-gray-600 flex-1">
Try out Github Trends with data from an example
Try out GitHub-Stats-Extended with data from an example
user/repository.
</p>
</div>