Skip to content

Commit 6f763e5

Browse files
authored
Merge pull request #47 from wildjames/dev
Mobile version partially implemented
2 parents 6adc240 + a3e36da commit 6f763e5

File tree

16 files changed

+267
-139
lines changed

16 files changed

+267
-139
lines changed

todoqueue_frontend/src/App.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ h1 {
1010
color: #333;
1111
text-align: left;
1212
}
13-

todoqueue_frontend/src/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { fetchHouseholds } from './api/households';
1616
import { Navigation } from './components/navbar/navigation';
1717
import { ResetPassword } from './components/resetPassword';
1818
import { SignUp } from './components/signup';
19-
import { ManageHouseholds } from './households/households';
19+
import { ManageHouseholds } from './components/households/households';
2020

2121

2222
const App = () => {
@@ -38,12 +38,12 @@ const App = () => {
3838
const fetchedHouseholds = await fetchHouseholds();
3939

4040
setHouseholds(fetchedHouseholds);
41-
41+
4242
if (selectedHousehold === null && fetchedHouseholds.length === 1) {
4343
console.log("Setting selected household to: ", fetchedHouseholds[0].id);
4444
setSelectedHousehold(fetchedHouseholds[0].id);
4545
}
46-
46+
4747
} catch (error) {
4848
console.error("An error occurred while fetching data:", error);
4949
}

todoqueue_frontend/src/components/ConfirmRegistration.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@
2828
top: calc(50px + 2.5em);
2929
width: 30%;
3030
font-family: 'Arial', sans-serif;
31+
}
32+
33+
.confirm-registration-heading {
34+
margin-left: "0px";
35+
text-align: "center"
3136
}

todoqueue_frontend/src/components/ConfirmRegistration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const ConfirmRegistration = () => {
88
<div className="ConfirmRegistration">
99

1010
<div className="confirm-registration-container">
11-
<h1 style={{ marginLeft: "0px", textAlign: "center" }}>Account activated!</h1>
11+
<h1 className="confirm-registration-heading">Account activated!</h1>
1212
<h3>You many now log in.</h3>
1313
</div>
1414

todoqueue_frontend/src/households/households.css renamed to todoqueue_frontend/src/components/households/households.css

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,23 @@
22
text-align: center;
33
font-family: 'Arial', sans-serif;
44
display: block;
5-
width: 40vw;
6-
font-family: 'Arial', sans-serif;
5+
width: 90vw;
76
margin: calc(56px + 3vh) auto;
87
}
98

109
.household-wrapper {
1110
display: flex;
11+
flex-direction: column;
1212
justify-content: space-between;
1313
align-items: center;
1414
border: 1px solid #ccc;
1515
border-radius: 4px;
1616
padding: 8px;
1717
margin-top: 10px;
18-
margin-left: auto;
19-
margin-right: auto;
2018
}
2119

2220
.household-name {
23-
font-size: 1.5rem;
21+
font-size: 1.2rem;
2422
font-weight: bold;
2523
}
2624

@@ -35,15 +33,31 @@
3533
}
3634

3735
.household-user-name {
38-
padding-left: 2rem;
3936
font-weight: normal;
37+
padding-left: 2rem;
4038
font-size: 1.2rem;
4139
}
4240

4341
.household-user-content {
4442
display: flex;
43+
flex-direction: row;
4544
justify-content: space-between;
4645
align-items: center;
4746
background-color: #e8e8e8;
4847
border-radius: 8px;
48+
}
49+
50+
/* Media query for larger screens */
51+
@media (min-width: 768px) {
52+
.Households {
53+
width: 40vw;
54+
}
55+
56+
.household-wrapper {
57+
flex-direction: row;
58+
}
59+
60+
.household-name {
61+
font-size: 1.5rem;
62+
}
4963
}

todoqueue_frontend/src/households/households.js renamed to todoqueue_frontend/src/components/households/households.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import { useEffect, useState, useRef } from "react";
2-
import useAuthCheck from '../hooks/authCheck';
2+
import useAuthCheck from '../../hooks/authCheck';
33

4-
import Spinner from '../components/spinner/Spinner';
5-
import AlertMessage from "../components/popups/AlertPopup";
4+
import Spinner from '../spinner/Spinner';
5+
import AlertMessage from "../popups/AlertPopup";
6+
7+
import { createHousehold, deleteHousehold } from '../../api/households';
8+
import HouseholdDetailsPopup from "../popups/HouseholdDetailsPopup";
69

7-
import { createHousehold, deleteHousehold } from '../api/households';
8-
import HouseholdDetailsPopup from "../components/popups/HouseholdDetailsPopup";
910
import './households.css';
11+
import '../../utils/inputs.css';
1012

1113
export const ManageHouseholds = ({ households, setShowHouseholdSelector }) => {
1214
const [selectedHousehold, setSelectedHousehold] = useState(null);
1315

1416
const [name, setName] = useState("");
1517

16-
const [showSpinner, setShowSpinner] = useState(false);
1718
const [errorMessage, setErrorMessage] = useState("");
1819

1920
const PopupType = {
@@ -36,10 +37,8 @@ export const ManageHouseholds = ({ households, setShowHouseholdSelector }) => {
3637
console.log("Creating household:", name);
3738
const promise = createHousehold(name);
3839

39-
setShowSpinner(true);
4040
setErrorMessage("");
4141
const data = await promise;
42-
setShowSpinner(false);
4342
setName("");
4443

4544
if (data.error) {
@@ -54,10 +53,8 @@ export const ManageHouseholds = ({ households, setShowHouseholdSelector }) => {
5453
console.log("Deleting household:", id);
5554
const promise = deleteHousehold(id);
5655

57-
setShowSpinner(true);
5856
setErrorMessage("");
5957
const data = await promise;
60-
setShowSpinner(false);
6158

6259

6360
if (data.error) {
@@ -105,6 +102,11 @@ export const ManageHouseholds = ({ households, setShowHouseholdSelector }) => {
105102

106103
<h2>Manage Households</h2>
107104

105+
{
106+
errorMessage !== '' &&
107+
<AlertMessage message={errorMessage} />
108+
}
109+
108110
{
109111
(() => {
110112
switch (currentPopup) {
@@ -151,13 +153,6 @@ export const ManageHouseholds = ({ households, setShowHouseholdSelector }) => {
151153
))}
152154
</div>
153155

154-
{
155-
errorMessage !== '' &&
156-
<AlertMessage message={errorMessage} />
157-
}
158-
159-
{showSpinner && <Spinner />}
160-
161156
</div>
162157
);
163158

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
1-
21
.todoqueue-auth-form {
3-
max-width: 400px;
4-
margin: 10% auto;
2+
max-width: 400px;
3+
margin: 80px auto;
4+
padding: 20px;
5+
box-sizing: border-box;
6+
}
7+
8+
/* Styles for tablets and larger mobile devices */
9+
@media (max-width: 768px) {
10+
.todoqueue-auth-form {
11+
max-width: 350px;
12+
margin: 80px auto;
13+
}
14+
}
15+
16+
/* Styles for smaller mobile devices */
17+
@media (max-width: 480px) {
18+
.todoqueue-auth-form {
19+
max-width: 300px;
20+
margin: 80px auto;
521
}
6-
22+
}
23+
24+
/* Additional styles to make the form elements look better on mobile devices */
25+
.form-control {
26+
font-size: 16px; /* Larger font size for better readability on small screens */
27+
}
28+
29+
.button, .button-secondary {
30+
font-size: 16px; /* Larger font size for better tap targets */
31+
padding: 10px 20px; /* Increased padding for better touch experience */
32+
}
33+
34+
.Auth-form-title {
35+
font-size: 24px; /* Adjust the title size for smaller screens */
36+
}

todoqueue_frontend/src/components/navbar/navigation.css

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,27 @@
1010
.navbar-center-panel {
1111
display: flex;
1212
align-items: center;
13-
position: absolute;
14-
top: 50%;
15-
left: 50%;
16-
transform: translateX(-50%) translateY(-50%);
13+
flex-direction: row;
14+
align-items: center;
15+
gap: 20px;
16+
}
17+
18+
/* Adjustments for smaller screens (less than 800px) */
19+
@media (max-width: 800px) {
20+
.navbar-center-panel {
21+
margin-top: 10px;
22+
/* Add some space above the household selector */
23+
}
24+
}
25+
26+
/* Adjustments for larger screens (more than 800px) */
27+
@media (min-width: 800px) {
28+
.navbar-center-panel {
29+
position: absolute;
30+
top: 50%;
31+
left: 50%;
32+
transform: translateX(-50%) translateY(-50%);
33+
}
1734
}
1835

1936
.fullscreen-icon {
@@ -27,7 +44,7 @@
2744
}
2845

2946
.household-select {
30-
width: 20vw;
47+
width: 15rem;
3148
padding: 3px;
3249
border: 1px solid #8d8d8d;
3350
border-radius: 5px;
@@ -48,6 +65,34 @@
4865
}
4966

5067
.navbar-link {
51-
padding-left: 2vw !important;
52-
padding-right: 2vw !important;
68+
padding-left: 2vw;
69+
padding-right: 2vw;
70+
}
71+
72+
.navbar-logo-fullscreen-container {
73+
display: flex;
74+
align-items: center;
75+
}
76+
77+
.navbar-links-container {
78+
display: flex;
79+
align-items: center;
80+
flex-wrap: wrap;
81+
}
82+
83+
/* Adjustments for large screens */
84+
@media (min-width: 800px) {
85+
.navbar-links-container {
86+
justify-content: space-between;
87+
}
88+
}
89+
90+
@media (max-width: 800px) {
91+
.logout-link {
92+
margin-top: 25px;
93+
}
94+
}
95+
96+
.burger-button {
97+
margin-right: 0.75rem;
5398
}

todoqueue_frontend/src/components/navbar/navigation.js

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,47 +40,52 @@ export function Navigation({ households, selectedHousehold, setSelectedHousehold
4040
}
4141
}
4242

43-
4443
return (
4544
<div>
46-
<Navbar className="navbar" bg="dark" variant="dark" sticky="left">
47-
<Navbar.Brand href="/" style={{ paddingLeft: '4vw' }}>ToDoQu</Navbar.Brand>
45+
<Navbar className="navbar" bg="dark" variant="dark" sticky="left" expand="lg">
46+
<div className="navbar-logo-fullscreen-container">
47+
<Navbar.Brand href="/" style={{ paddingLeft: '1rem' }}>ToDoQu</Navbar.Brand>
4848

49-
{isAuth && (
50-
<Nav className="me-auto">
51-
<Nav.Link href="/" style={{ paddingLeft: '2vw', paddingRight: '2vw' }}>Tasks</Nav.Link>
52-
<Nav.Link href="/manage_households" style={{ paddingLeft: '2vw', paddingRight: '2vw' }}>Manage Households</Nav.Link>
53-
</Nav>
54-
)}
49+
<button
50+
onClick={toggleFullScreen}
51+
className="fullscreen-icon"
52+
>
53+
<svg fill="#ffffff" height="20px" width="20px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" viewBox="0 0 384.97 384.97" xmlSpace="preserve" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g id="Fullscreen_1_"> <path d="M372.939,216.545c-6.123,0-12.03,5.269-12.03,12.03v132.333H24.061V24.061h132.333c6.388,0,12.03-5.642,12.03-12.03 S162.409,0,156.394,0H24.061C10.767,0,0,10.767,0,24.061v336.848c0,13.293,10.767,24.061,24.061,24.061h336.848 c13.293,0,24.061-10.767,24.061-24.061V228.395C384.97,221.731,380.085,216.545,372.939,216.545z"></path> <path d="M372.939,0H252.636c-6.641,0-12.03,5.39-12.03,12.03s5.39,12.03,12.03,12.03h91.382L99.635,268.432 c-4.668,4.668-4.668,12.235,0,16.903c4.668,4.668,12.235,4.668,16.891,0L360.909,40.951v91.382c0,6.641,5.39,12.03,12.03,12.03 s12.03-5.39,12.03-12.03V12.03l0,0C384.97,5.558,379.412,0,372.939,0z"></path> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> </g> </g></svg>
54+
</button>
55+
</div>
56+
57+
<Navbar.Toggle aria-controls="responsive-navbar-nav" className="burger-button" />
5558

56-
{isAuth && showHouseholdSelector && (
57-
<Nav className="mx-auto">
58-
<div className="navbar-center-panel">
59-
<select className="household-select" onChange={e => setSelectedHousehold(e.target.value === "Select a household" ? null : e.target.value)} value={selectedHousehold}>
60-
<option value={null}>Select a household</option>
61-
{households.map(household => (
62-
<option key={household.id} value={household.id}>{household.name}</option>
63-
))}
64-
</select>
65-
<button
66-
onClick={toggleFullScreen}
67-
className="fullscreen-icon"
68-
>
69-
<svg fill="#ffffff" height="20px" width="20px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" viewBox="0 0 384.97 384.97" xmlSpace="preserve" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g id="Fullscreen_1_"> <path d="M372.939,216.545c-6.123,0-12.03,5.269-12.03,12.03v132.333H24.061V24.061h132.333c6.388,0,12.03-5.642,12.03-12.03 S162.409,0,156.394,0H24.061C10.767,0,0,10.767,0,24.061v336.848c0,13.293,10.767,24.061,24.061,24.061h336.848 c13.293,0,24.061-10.767,24.061-24.061V228.395C384.97,221.731,380.085,216.545,372.939,216.545z"></path> <path d="M372.939,0H252.636c-6.641,0-12.03,5.39-12.03,12.03s5.39,12.03,12.03,12.03h91.382L99.635,268.432 c-4.668,4.668-4.668,12.235,0,16.903c4.668,4.668,12.235,4.668,16.891,0L360.909,40.951v91.382c0,6.641,5.39,12.03,12.03,12.03 s12.03-5.39,12.03-12.03V12.03l0,0C384.97,5.558,379.412,0,372.939,0z"></path> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> </g> </g></svg>
70-
</button>
71-
</div>
59+
<Navbar.Collapse id="responsive-navbar-nav">
60+
<Nav className="me-auto navbar-links-container">
61+
{isAuth && (
62+
<>
63+
<Nav.Link href="/" style={{ paddingLeft: '2vw', paddingRight: '2vw' }}>Tasks</Nav.Link>
64+
<Nav.Link href="/manage_households" style={{ paddingLeft: '2vw', paddingRight: '2vw' }}>Manage Households</Nav.Link>
65+
66+
{showHouseholdSelector && (
67+
<a className="navbar-center-panel">
68+
<select className="household-select" onChange={e => setSelectedHousehold(e.target.value === "Select a household" ? null : e.target.value)} value={selectedHousehold}>
69+
<option value={null}>Select a household</option>
70+
{households.map(household => (
71+
<option key={household.id} value={household.id}>{household.name}</option>
72+
))}
73+
</select>
74+
</a>
75+
)}
76+
</>
77+
)}
7278
</Nav>
73-
)}
7479

75-
<Nav className="me-right">
76-
{!isAuth && <Nav.Link href="/signup" className="navbar-link">Sign Up</Nav.Link>}
77-
{isAuth ?
78-
<Nav.Link href="/logout" className="navbar-link">Log Out</Nav.Link> :
79-
<Nav.Link href="/login" className="navbar-link">Login</Nav.Link>
80-
}
81-
</Nav>
80+
<Nav className="me-right navbar-links-container">
81+
{!isAuth && <Nav.Link href="/signup" className="navbar-link">Sign Up</Nav.Link>}
82+
{isAuth ?
83+
<Nav.Link href="/logout" className="navbar-link logout-link">Log Out</Nav.Link> :
84+
<Nav.Link href="/login" className="navbar-link">Login</Nav.Link>
85+
}
86+
</Nav>
87+
</Navbar.Collapse>
8288
</Navbar>
8389
</div>
84-
8590
);
8691
}

0 commit comments

Comments
 (0)