mirror of
https://github.com/Steffo99/todocolors.git
synced 2024-11-23 00:34:19 +00:00
Tweak more task stuff
I seems like I can't do atomic commits right in this project
This commit is contained in:
parent
16d2d5f98b
commit
39083c13b1
5 changed files with 61 additions and 34 deletions
|
@ -1,23 +1,36 @@
|
||||||
.taskDiv {
|
.taskDiv {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
align-items: center;
|
||||||
|
min-width: unset;
|
||||||
|
width: 240px;
|
||||||
|
height: 44px;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.taskDivFront {
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"icon description"
|
"icon description"
|
||||||
;
|
;
|
||||||
grid-template-columns: auto 1fr;
|
grid-template-columns: auto 1fr;
|
||||||
align-items: center;
|
}
|
||||||
min-width: unset;
|
|
||||||
|
.taskDivBack {
|
||||||
|
grid-template-areas:
|
||||||
|
"buttons"
|
||||||
|
;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.taskIcon {
|
.taskIcon {
|
||||||
grid-area: icon;
|
grid-area: icon;
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.taskDescription {
|
.taskDescription {
|
||||||
grid-area: description;
|
grid-area: description;
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.taskDescriptionComplete {
|
.taskDescriptionComplete {
|
||||||
|
@ -89,16 +102,7 @@
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes inProgress {
|
.taskButtons {
|
||||||
0% {
|
grid-area: buttons;
|
||||||
filter: brightness(100%);
|
justify-self: end;
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
filter: brightness(150%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.taskStatusInProgress {
|
|
||||||
animation: 1.7s inProgress ease-out infinite alternate-reverse;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
import {TaskIconEl} from "@/app/board/[board]/TaskIconEl"
|
import {TaskIconEl} from "@/app/board/[board]/TaskIconEl"
|
||||||
import {Task, TaskWithId} from "@/app/board/[board]/Types"
|
import {Task, TaskWithId} from "@/app/board/[board]/Types"
|
||||||
import {useBoardContext} from "@/app/board/[board]/useBoardContext"
|
import {useBoardContext} from "@/app/board/[board]/useBoardContext"
|
||||||
import {useCallback} from "react"
|
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"
|
||||||
|
import {useCallback, useState, MouseEvent} from "react"
|
||||||
|
import {faArrowTurnRight, faTrashCanArrowUp} from "@fortawesome/free-solid-svg-icons"
|
||||||
import style from "./TaskDiv.module.css"
|
import style from "./TaskDiv.module.css"
|
||||||
import cn from "classnames"
|
import cn from "classnames"
|
||||||
|
|
||||||
export function TaskDiv({task}: {task: TaskWithId}) {
|
export function TaskDiv({task}: {task: TaskWithId}) {
|
||||||
const {send} = useBoardContext()
|
const {send} = useBoardContext()
|
||||||
|
const [isDisplayingActions, setDisplayingActions] = useState<boolean>(false)
|
||||||
|
|
||||||
const toggleStatus = useCallback(() => {
|
const toggleStatus = useCallback((e: MouseEvent<HTMLDivElement>) => {
|
||||||
|
e.stopPropagation();
|
||||||
if(task.status === "Unfinished") {
|
if(task.status === "Unfinished") {
|
||||||
|
send({"Task": [task.id, {...task, status: "InProgress"}]})
|
||||||
|
}
|
||||||
|
if(task.status === "InProgress") {
|
||||||
send({"Task": [task.id, {...task, status: "Complete"}]})
|
send({"Task": [task.id, {...task, status: "Complete"}]})
|
||||||
}
|
}
|
||||||
else if(task.status === "Complete") {
|
else if(task.status === "Complete") {
|
||||||
|
@ -17,10 +24,34 @@ export function TaskDiv({task}: {task: TaskWithId}) {
|
||||||
}
|
}
|
||||||
}, [send, task])
|
}, [send, task])
|
||||||
|
|
||||||
|
let contents;
|
||||||
|
if(isDisplayingActions) {
|
||||||
|
contents = <div className={style.taskButtons}>
|
||||||
|
<button>
|
||||||
|
<FontAwesomeIcon icon={faTrashCanArrowUp}/> Ricrea
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
contents = <>
|
||||||
|
<div className={style.taskIcon} onClick={toggleStatus} tabIndex={0}>
|
||||||
|
<TaskIconEl size={"lg"} icon={task.icon} status={task.status}/>
|
||||||
|
</div>
|
||||||
|
<div className={cn({
|
||||||
|
[style.taskDescription]: true,
|
||||||
|
[style.taskDescriptionComplete]: task.status === "Complete",
|
||||||
|
})} tabIndex={0}>
|
||||||
|
{task.text}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div onClick={toggleStatus} tabIndex={0} className={cn({
|
<div className={cn({
|
||||||
"panel": true,
|
"panel": true,
|
||||||
[style.taskDiv]: true,
|
[style.taskDiv]: true,
|
||||||
|
[style.taskDivFront]: !isDisplayingActions,
|
||||||
|
[style.taskDivBack]: isDisplayingActions,
|
||||||
[style.taskPriorityHighest]: task.priority === "Highest",
|
[style.taskPriorityHighest]: task.priority === "Highest",
|
||||||
[style.taskPriorityHigh]: task.priority === "High",
|
[style.taskPriorityHigh]: task.priority === "High",
|
||||||
[style.taskPriorityNormal]: task.priority === "Normal",
|
[style.taskPriorityNormal]: task.priority === "Normal",
|
||||||
|
@ -34,16 +65,8 @@ export function TaskDiv({task}: {task: TaskWithId}) {
|
||||||
[style.taskStatusUnfinished]: task.status === "Unfinished",
|
[style.taskStatusUnfinished]: task.status === "Unfinished",
|
||||||
[style.taskStatusInProgress]: task.status === "InProgress",
|
[style.taskStatusInProgress]: task.status === "InProgress",
|
||||||
[style.taskStatusComplete]: task.status === "Complete",
|
[style.taskStatusComplete]: task.status === "Complete",
|
||||||
})}>
|
})} onClick={() => setDisplayingActions(!isDisplayingActions)}>
|
||||||
<div className={style.taskIcon}>
|
{contents}
|
||||||
<TaskIconEl size={"lg"} icon={task.icon} style={task.status === "Complete" ? "solid" : "regular"}/>
|
|
||||||
</div>
|
|
||||||
<div className={cn({
|
|
||||||
[style.taskDescription]: true,
|
|
||||||
[style.taskDescriptionComplete]: task.status === "Complete",
|
|
||||||
})}>
|
|
||||||
{task.text}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {TaskIcon} from "@/app/board/[board]/Types"
|
import {TaskIcon, TaskStatus} from "@/app/board/[board]/Types"
|
||||||
import {SizeProp} from "@fortawesome/fontawesome-svg-core"
|
import {SizeProp} from "@fortawesome/fontawesome-svg-core"
|
||||||
import {
|
import {
|
||||||
faUser as faUserSolid,
|
faUser as faUserSolid,
|
||||||
|
@ -99,8 +99,8 @@ export const ICONS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function TaskIconEl({icon, style, size}: {icon: TaskIcon, style: "solid" | "regular", size?: SizeProp}) {
|
export function TaskIconEl({icon, status, size}: {icon: TaskIcon, status: TaskStatus, size?: SizeProp}) {
|
||||||
return (
|
return (
|
||||||
<FontAwesomeIcon icon={ICONS[style][icon]} size={size}/>
|
<FontAwesomeIcon icon={ICONS[status === "Complete" ? "solid" : "regular"][icon]} size={size} beatFade={status === "InProgress"}/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ function sortGroupsByPriority(a: TaskGroup, b: TaskGroup) {
|
||||||
function iconToTitle(a: string) {
|
function iconToTitle(a: string) {
|
||||||
let icon = a as TaskIcon;
|
let icon = a as TaskIcon;
|
||||||
return <>
|
return <>
|
||||||
<TaskIconEl icon={icon} style={"solid"}/>
|
<TaskIconEl icon={icon} status={"Complete"} size={"lg"}/>
|
||||||
|
|
||||||
{a}
|
{a}
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import {BoardAction, Task, TaskBoardAction, TitleBoardAction} from "@/app/board/[board]/types"
|
import {BoardAction, Task, TaskBoardAction, TitleBoardAction} from "@/app/board/[board]/Types"
|
||||||
import {Reducer, useReducer} from "react"
|
import {Reducer, useReducer} from "react"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue