Skip to content

Commit 79846d2

Browse files
committed
conclude trunk merge
2 parents c583a29 + 109371c commit 79846d2

File tree

12 files changed

+253
-219
lines changed

12 files changed

+253
-219
lines changed

client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React</title>
7+
<title>Zin Volunteers</title>
88
</head>
99
<body>
1010
<div id="root"></div>

client/src/App.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,20 @@ label.total_volunteers_label{
77
padding: 4px;
88

99
}
10+
11+
.button-grp-margin {
12+
margin: 10px;
13+
}
14+
15+
/* 992px expand:lg */
16+
@media screen and (max-width: 992px) {
17+
18+
.header-nav{
19+
display: flex;
20+
flex-direction: column;
21+
align-items: center;
22+
justify-content: center;
23+
}
24+
25+
26+
}

client/src/app/store.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { configureStore } from "@reduxjs/toolkit";
22
import { apiSlice } from "./api/apiSlice";
3-
import authReducer from "../features/auth/authSlice"
4-
import eventsReducer from "../features/event/eventsSlice"
3+
import authReducer from "../features/auth/authSlice";
4+
import eventsReducer from "../features/event/eventsSlice";
55
import { setupListeners } from "@reduxjs/toolkit/dist/query";
6-
import volunteersReducer from "../features/volun/volunteersSlice"
7-
export const store = configureStore({
8-
9-
reducer: {
10-
[apiSlice.reducerPath] : apiSlice.reducer,
11-
auth: authReducer,
12-
events: eventsReducer,
13-
volunteers: volunteersReducer,
6+
import volunteersReducer from "../features/volun/volunteersSlice";
147

15-
},
16-
middleware: getDefaultMiddleware =>
8+
export const store = configureStore({
9+
reducer: {
10+
[apiSlice.reducerPath]: apiSlice.reducer,
11+
auth: authReducer,
12+
events: eventsReducer,
13+
volunteers: volunteersReducer,
14+
},
15+
middleware: (getDefaultMiddleware) =>
1716
getDefaultMiddleware().concat(apiSlice.middleware),
18-
devTools: true
19-
})
2017

21-
setupListeners(store.dispatch)
18+
devTools: process.env.NODE_ENV === "production" ? false : true,
19+
});
20+
21+
setupListeners(store.dispatch);

client/src/components/DashFooter.jsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
import React from 'react'
22
import useAuth from '../hooks/useAuth'
33
import { useGetUserByIdQuery } from '../features/volun/volunteersApiSlice'
4-
import { Col, Container, Row } from 'react-bootstrap'
5-
import { LinkContainer } from 'react-router-bootstrap'
4+
import { Button, Col, Container, Row } from 'react-bootstrap'
65
import { Link } from 'react-router-dom'
76

87
const DashFooter = () => {
98

10-
const {volunId, role, isAdmin, isVolunteer} = useAuth()
9+
const {volunId, role} = useAuth()
1110

1211
console.log('volunID from DashFooter w useAuth: ', volunId);
1312

14-
//canNOT use memoized cuz /users is NOT called for a volunteer
15-
//when admin logged in, the input result arr DNC the adm's info
16-
17-
// const volunteer = useSelector(state => selectVolunteerById(state, volunId))
18-
1913
const {data: user, isSuccess, isLoading, isError, error} = useGetUserByIdQuery(volunId)
2014

2115
let content
@@ -43,22 +37,22 @@ const DashFooter = () => {
4337

4438
content = (
4539

46-
<footer className='bg-secondary text-white position-relative bottom-0 w-100 h-auto border-top'>
47-
<Container >
40+
<footer className='bg-secondary text-white position-relative bottom-0 w-100 h-auto'>
41+
<Container className=' pt-4' >
4842
<Row className='py-2'>
4943
<Col>
5044

51-
<Link to={'/dash'}> Home </Link>
45+
<Button as={Link} to='/dash' variant='warning' >
46+
Home
47+
</Button>
5248

5349
</Col>
5450

5551

5652
<Col>
57-
<section>
58-
<article>Hey! {username} | Status : {role}</article>
59-
<p>isAdmin: {isAdmin.toString()} </p>
60-
<p>isVolunteer: {isVolunteer.toString()}</p>
61-
</section>
53+
<p>Hey! {username} | Status : {role}</p>
54+
{/* <p>isAdmin: {isAdmin.toString()} </p>
55+
<p>isVolunteer: {isVolunteer.toString()}</p> */}
6256
</Col>
6357
<Col>
6458
<p> Copyright &copy; KZH 2023</p>

client/src/components/DashHeader.jsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
import React, { useEffect } from "react";
2-
import { Button, Container, Nav, Navbar } from "react-bootstrap";
1+
import React from "react";
2+
import { Container, Nav, Navbar } from "react-bootstrap";
33
import { LinkContainer } from "react-router-bootstrap";
44
import Logout from "./Logout";
5-
// emulate Public Header
5+
import { FaHome } from "react-icons/fa";
66

77
const DashHeader = () => {
88
const content = (
99
<header>
1010
<Navbar bg="dark" variant="dark" expand="lg" collapseOnSelect>
11-
<Container className="mx-auto">
11+
<Container className="mx-auto py-3">
1212
<LinkContainer to={"/dash"}>
1313
<Navbar.Brand> VolunteerHub Home</Navbar.Brand>
1414
</LinkContainer>
1515
<Navbar.Toggle aria-controls="basic-navbar-nav"></Navbar.Toggle>
1616
<Navbar.Collapse id="basic-navbar-nav">
17-
<Nav className="ms-auto">
17+
<Nav className="ms-auto header-nav">
18+
<LinkContainer to={"/dash/home"}>
19+
<Nav.Link><FaHome/> Home</Nav.Link>
20+
</LinkContainer>
1821
<Logout />
1922
</Nav>
2023
</Navbar.Collapse>

client/src/components/PublicPage.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Badge, Button, Card, Container } from "react-bootstrap";
2+
import { Link } from "react-router-dom";
23

34
const PublicPage = () => {
45
const content = (
@@ -12,13 +13,13 @@ const PublicPage = () => {
1213
This space is for student volunteers at ...
1314
</p>
1415
<div className="d-flex">
15-
<Button variant="primary" href="/login" className=" me-3">
16+
<Button as={Link} variant="primary" to="/login" className=" me-3">
1617
Sign In
1718
</Button>
1819
<Badge className="me-3" bg="info" pill>
1920
or
2021
</Badge>
21-
<Button variant="secondary" href="/register">
22+
<Button as={Link} variant="secondary" to="/register">
2223
Register
2324
</Button>
2425
</div>

client/src/features/auth/Login.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,9 @@ const Login =() => {
3939
try {
4040
const {accessToken} = await login({userId, password}).unwrap()
4141

42-
// console.log(accessToken, " accessToken from Login compo - /auth route");
4342

44-
const data = dispatch( setCredentials({accessToken}))
43+
dispatch( setCredentials({accessToken}))
4544

46-
// console.log("setCredentials data: ", data);
47-
48-
//store role in authHook
4945

5046

5147
} catch (error) {

0 commit comments

Comments
 (0)