Skip to content

Commit ad8958c

Browse files
Merge pull request #46 from the-collab-lab/dtp-teampage
Issue #16: Create Team Component and Loading Screen
2 parents f798bb6 + cc1e08d commit ad8958c

File tree

13 files changed

+198
-18
lines changed

13 files changed

+198
-18
lines changed

package-lock.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
2-
import { Home, Layout, ManageList } from './views';
2+
import { Suspense } from 'react';
3+
import { Home, Layout, ManageList, Team } from './views';
4+
import { Loading } from './components/Loading';
35
import { ProtectedRoute } from './components/ProtectedRoute';
46
import { useAuth, useShoppingListData, useShoppingLists } from './api';
57
import { useStateWithStorage } from './utils';
@@ -64,6 +66,14 @@ export function App() {
6466
</ProtectedRoute>
6567
}
6668
/>
69+
<Route
70+
path="developers"
71+
element={
72+
<Suspense fallback={<Loading />}>
73+
<Team />
74+
</Suspense>
75+
}
76+
/>
6777
</Route>
6878
</Routes>
6979
</Router>

src/api/useAuth.jsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,23 @@ import { useNavigate } from 'react-router-dom';
99
* the button redirects the user to the Google OAuth sign-in page.
1010
* After the user signs in, they are redirected back to the app.
1111
*/
12-
export const SignInButton = ({ children, className }) => (
13-
<button
14-
type="button"
15-
className={className}
16-
onClick={() => signInWithPopup(auth, new GoogleAuthProvider())}
17-
>
18-
{children}
19-
</button>
20-
);
12+
13+
export const SignInButton = ({ children, className }) => {
14+
const navigate = useNavigate();
15+
const handleSignIn = async () => {
16+
try {
17+
await signInWithPopup(auth, new GoogleAuthProvider());
18+
navigate('/');
19+
} catch (error) {
20+
console.error('Error signing in: ', error);
21+
}
22+
};
23+
return (
24+
<button type="button" className={className} onClick={handleSignIn}>
25+
{children}
26+
</button>
27+
);
28+
};
2129

2230
/**
2331
* A button that signs the user out of the app using Firebase Auth.
2.2 MB
Loading
256 KB
Loading
110 KB
Loading

src/assets/avatars/stacyAvatar.jpg

28.7 KB
Loading
File renamed without changes.

src/components/Loading.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function Loading() {
2+
return (
3+
<div style={{ textAlign: 'center', padding: '20px' }}>
4+
<img
5+
src={`${import.meta.env.BASE_URL}logo.png`}
6+
alt="Loading..."
7+
style={{ width: '150px' }}
8+
/>
9+
<h2>Please hold on while we prepare your experience.</h2>
10+
</div>
11+
);
12+
}

src/views/LandingPage.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import './LandingPage.css';
2+
import logo from '../assets/logo.png';
23

34
export function LandingPage() {
45
return (
56
<div className="landing-container">
6-
<img
7-
src={`${import.meta.env.BASE_URL}logo.png`}
8-
alt="Logo"
9-
className="logo"
10-
/>
7+
<img src={logo} alt="Logo" className="logo" />
118
<h1 className="main-heading">
129
<strong>CollabShop</strong> is more than just a grocery app—it&apos;s a
1310
tool that embodies the spirit of teamwork and collaboration. Created by

0 commit comments

Comments
 (0)