diff --git a/todoqueue_frontend/src/App.js b/todoqueue_frontend/src/App.js index 70b4a92..bcd2b15 100644 --- a/todoqueue_frontend/src/App.js +++ b/todoqueue_frontend/src/App.js @@ -79,7 +79,13 @@ const App = () => { } /> } /> + } /> } /> } /> } /> @@ -88,7 +94,12 @@ const App = () => { } /> } /> } /> - } /> + } /> diff --git a/todoqueue_frontend/src/components/navbar/HouseholdSelector.js b/todoqueue_frontend/src/components/navbar/HouseholdSelector.js new file mode 100644 index 0000000..28f531e --- /dev/null +++ b/todoqueue_frontend/src/components/navbar/HouseholdSelector.js @@ -0,0 +1,20 @@ +import React from 'react'; + +export function HouseholdSelector({ households, selectedHousehold, setSelectedHousehold }) { + return ( +
+ +
+ ); +} diff --git a/todoqueue_frontend/src/components/navbar/navigation.css b/todoqueue_frontend/src/components/navbar/navigation.css index 9f7c880..65fdfc0 100644 --- a/todoqueue_frontend/src/components/navbar/navigation.css +++ b/todoqueue_frontend/src/components/navbar/navigation.css @@ -15,23 +15,6 @@ gap: 20px; } -/* Adjustments for smaller screens (less than 800px) */ -@media (max-width: 1000px) { - .navbar-center-panel { - margin-top: 15px; - margin-bottom: 15px; - } -} - -/* Adjustments for larger screens (more than 800px) */ -@media (min-width: 1000px) { - .navbar-center-panel { - position: absolute; - top: 50%; - left: 50%; - transform: translateX(-50%) translateY(-50%); - } -} .fullscreen-icon { display: flex; @@ -80,20 +63,38 @@ flex-wrap: wrap; } +/* Adjustments for smaller screens (less than 800px) */ +@media (max-width: 992px) { + .navbar-center-panel { + margin-top: 15px; + margin-bottom: 15px; + } +} + +/* Adjustments for larger screens (more than 800px) */ +@media (min-width: 992px) { + .navbar-center-panel { + position: absolute; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%); + } +} + /* Adjustments for large screens */ -@media (min-width: 1000px) { +@media (min-width: 992px) { .navbar-expand-lg .navbar-toggler { display: none; } } -@media (min-width: 1000px) { +@media (min-width: 992px) { .navbar-links-container { justify-content: space-between; } } -@media (max-width: 1000px) { +@media (max-width: 992px) { .logout-link { margin-top: 25px; } @@ -103,7 +104,7 @@ margin-right: 0.75rem; } -@media (min-width: 1000px) { +@media (min-width: 992px) { .navbar-links-right { margin-right: 1em; } diff --git a/todoqueue_frontend/src/components/navbar/navigation.js b/todoqueue_frontend/src/components/navbar/navigation.js index 45fe919..430c241 100644 --- a/todoqueue_frontend/src/components/navbar/navigation.js +++ b/todoqueue_frontend/src/components/navbar/navigation.js @@ -1,5 +1,6 @@ import Nav from 'react-bootstrap/Nav'; import Navbar from 'react-bootstrap/Navbar'; +import { HouseholdSelector } from './HouseholdSelector'; import React, { useState, useEffect, useRef } from 'react'; // My component CSS @@ -89,20 +90,12 @@ export function Navigation({ households, selectedHousehold, setSelectedHousehold Manage Households {showHouseholdSelector && ( -
- -
+ // Replace this part with the HouseholdSelector component + )} diff --git a/todoqueue_frontend/src/components/popups/CreateFlexibleTaskPopup.js b/todoqueue_frontend/src/components/popups/CreateFlexibleTaskPopup.js index fee52b2..42c6f01 100644 --- a/todoqueue_frontend/src/components/popups/CreateFlexibleTaskPopup.js +++ b/todoqueue_frontend/src/components/popups/CreateFlexibleTaskPopup.js @@ -17,10 +17,16 @@ const CreateFlexibleTaskPopup = React.forwardRef((props, ref) => { max_interval_minutes: 0, }); const [inputError, setInputError] = useState(false); + const [enableSubmit, setEnableSubmit] = useState(true); const handleCreateTask = async (event) => { event.preventDefault(); + if (!enableSubmit) { + return + } + + setEnableSubmit(false); // Convert max_interval and min_interval to minutes const max_interval_in_minutes = @@ -75,6 +81,7 @@ const CreateFlexibleTaskPopup = React.forwardRef((props, ref) => { min_interval, newTask.description, ); + setEnableSubmit(true); if (response.status !== 201) { console.error("Error creating task. Response:", response.data); setInputError(true); @@ -97,6 +104,7 @@ const CreateFlexibleTaskPopup = React.forwardRef((props, ref) => { const handleCreateInputChange = (e) => { + setEnableSubmit(true); const { name, value } = e.target; console.log("Setting new task in handleCreateInputChange"); @@ -131,6 +139,7 @@ const CreateFlexibleTaskPopup = React.forwardRef((props, ref) => { const handlePopupTypeChange = (e) => { const selectedType = e.target.value; + setEnableSubmit(true); props.setCurrentPopup(selectedType); }; @@ -224,7 +233,7 @@ const CreateFlexibleTaskPopup = React.forwardRef((props, ref) => {
-
diff --git a/todoqueue_frontend/src/components/tasks/Tasks.css b/todoqueue_frontend/src/components/tasks/Tasks.css index cc132b7..8e535de 100644 --- a/todoqueue_frontend/src/components/tasks/Tasks.css +++ b/todoqueue_frontend/src/components/tasks/Tasks.css @@ -21,6 +21,19 @@ white-space: initial; } +.empty-state.hide { + top: -300px; +} + +.empty-state.show { + top: 100px; +} + +.empty-state h3 { + word-wrap: break-word; + word-break: break-word; +} + .arrow-up { width: 0; height: 0; @@ -34,19 +47,6 @@ margin-top: 20px; } -.empty-state.hide { - top: -100px; -} - -.empty-state.show { - top: 100px; -} - -.empty-state h3 { - word-wrap: break-word; - word-break: break-word; -} - @keyframes bounce-select-prompt { 0%, @@ -122,15 +122,6 @@ flex-shrink: 0; } -.task-wrapper::after { - position: relative; - top: 0; - bottom: 0; - right: 0; - width: 1px; - background-color: lightgrey; -} - @media (max-width: 800px) { .Tasks .task-container { flex-direction: column; diff --git a/todoqueue_frontend/src/components/tasks/Tasks.js b/todoqueue_frontend/src/components/tasks/Tasks.js index ffdc72c..e8f5f84 100644 --- a/todoqueue_frontend/src/components/tasks/Tasks.js +++ b/todoqueue_frontend/src/components/tasks/Tasks.js @@ -4,6 +4,7 @@ import useAuthCheck from '../../hooks/authCheck'; import './Tasks.css'; import UserStatsBox from '../user_stats_box/UserStatsBox'; +import { HouseholdSelector } from '../navbar/HouseholdSelector'; import TaskDetailsPopup from '../popups/TaskDetailsPopup'; import CompleteTaskPopup from '../popups/CompleteTaskPopup'; @@ -19,7 +20,7 @@ import { fetchTasks } from '../../api/tasks'; import { fetchHouseholdUsers } from '../../api/users'; -const Tasks = ({ selectedHousehold, showSelectedHouseholdSelector, setShowHouseholdSelector }) => { +const Tasks = ({ households, selectedHousehold, setSelectedHousehold, showSelectedHouseholdSelector, setShowHouseholdSelector }) => { const [tasks, setTasks] = useState([]); const [users, setUsers] = useState([]); @@ -283,10 +284,22 @@ const Tasks = ({ selectedHousehold, showSelectedHouseholdSelector, setShowHouseh return (
-
-
-
Select a household
-
+ {windowWidth > 992 + ? +
+
+
Select a household
+
+ : +
+ +
+ } + { // Popups