Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fbfb12e

Browse files
authored
Cleanup Settings (avgupta456#255)
1 parent 6d2a602 commit fbfb12e

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

‎frontend/src/pages/App/AppTrends.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ function App() {
9494
element={<WrappedRedirectScreen />}
9595
/>
9696
<Route path="/wrapped" element={<WrappedRedirectScreen />} />
97-
{isAuthenticated && (
98-
<Route path="/settings" element={<SettingsScreen />} />
99-
)}
97+
<Route path="/settings" element={<SettingsScreen />} />
10098
<Route path="/:userId" element={<WrappedRedirectScreen />} />
10199
<Route exact path="/" element={<LandingScreen />} />
102100
<Route path="*" element={<NoMatchScreen />} />

‎frontend/src/pages/Auth/SignUp.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,25 @@ const SignUpScreen = () => {
2727
<div
2828
className={classnames(
2929
'bg-gray-100 rounded-sm w-full h-full m-auto p-8 shadow',
30-
'lg:w-96 lg:h-auto 2xl:w-1/2 2xl:h-1/2 2xl:flex 2xl:flex-col 2xl:justify-between',
30+
'lg:w-80 lg:h-auto',
3131
)}
3232
>
33-
<h3 className="text-3xl 2xl:text-4xl font-semibold text-gray-900 mb-12 text-center">
33+
<h3 className="text-3xl font-semibold text-gray-900 mb-12 text-center">
3434
Sign up for <br />
3535
GitHub Trends
3636
</h3>
3737
<div>
3838
<a href={GITHUB_PUBLIC_AUTH_URL} className="flex justify-center">
3939
<Button className="h-12 flex justify-center items-center text-white bg-blue-500 hover:bg-blue-600">
40-
<GithubIcon className="w-4 h-4 2xl:w-6 2xl:h-6" />
41-
<span className="ml-2 xl:text-lg 2xl:text-xl">
42-
GitHub Public Access
43-
</span>
40+
<GithubIcon className="w-4 h-4" />
41+
<span className="ml-2 xl:text-lg">GitHub Public Access</span>
4442
</Button>
4543
</a>
4644
<div className="mt-4" />
4745
<a href={GITHUB_PRIVATE_AUTH_URL} className="flex justify-center">
4846
<Button className="h-12 flex justify-center items-center text-black border border-black bg-white hover:bg-gray-100">
49-
<GithubIcon className="w-4 h-4 2xl:w-6 2xl:h-6" />
50-
<span className="ml-2 xl:text-lg 2xl:text-xl">
51-
GitHub Private Access
52-
</span>
47+
<GithubIcon className="w-4 h-4" />
48+
<span className="ml-2 xl:text-lg">GitHub Private Access</span>
5349
</Button>
5450
</a>
5551
</div>

‎frontend/src/pages/Settings/Settings.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,28 @@ const SettingsScreen = () => {
7474
useOutsideAlerter(wrapperRef, closeDeleteModal);
7575

7676
const userId = useSelector((state) => state.user.userId);
77+
const isAuthenticated = userId && userId.length > 0;
7778
const userKey = useSelector((state) => state.user.userKey);
7879
const privateAccess = useSelector((state) => state.user.privateAccess);
7980
const accountTier = privateAccess ? 'Private Workflow' : 'Public Workflow';
8081

8182
const dispatch = useDispatch();
8283
const logout = () => dispatch(_logout());
8384

85+
console.log(isAuthenticated, userId, userKey, privateAccess, accountTier);
86+
87+
if (!isAuthenticated) {
88+
return (
89+
<div className="h-full py-8 flex justify-center items-center">
90+
<div className="text-center">
91+
<h1 className="text-3xl font-bold">
92+
Please sign in to access this page
93+
</h1>
94+
</div>
95+
</div>
96+
);
97+
}
98+
8499
return (
85100
<div className="h-full w-full">
86101
<div className={classnames('h-full flex', deleteModal && 'opacity-25')}>

0 commit comments

Comments
 (0)