-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend: rework how fetching tasks works, stop fetching each complet…
…ed task on page load
- Loading branch information
1 parent
008e8f2
commit cca882e
Showing
6 changed files
with
81 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
zettelkasten-front/src/components/tasks/TaskPageOptionsMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { useState } from "react"; | ||
import { useTaskContext } from "../../contexts/TaskContext"; | ||
|
||
interface TaskPageOptionsMenu {} | ||
|
||
export function TaskPageOptionsMenu({}: TaskPageOptionsMenu) { | ||
const [showMenu, setShowMenu] = useState<boolean>(false); | ||
const { setRefreshTasks, showCompleted, setShowCompleted } = useTaskContext(); | ||
|
||
function toggleMenu() { | ||
setShowMenu(!showMenu); | ||
} | ||
|
||
function toggleViewCompleted() { | ||
setShowCompleted(!showCompleted); | ||
setRefreshTasks(true); | ||
} | ||
|
||
return ( | ||
<div> | ||
<div className="dropdown"> | ||
<button | ||
onClick={toggleMenu} | ||
className="font-semibold rounded focus:outline-none focus:ring-2 focus:ring-offset-2 bg-palette-dark text-white hover:bg-palette-darkest focus:ring-blue-500" | ||
> | ||
Actions | ||
</button> | ||
{showMenu && ( | ||
<div className="popup-menu w-64"> | ||
{showCompleted ? ( | ||
<button onClick={toggleViewCompleted}>Hide Completed</button> | ||
) : ( | ||
<button onClick={toggleViewCompleted}>View Completed</button> | ||
)} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters