-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mywork): show overdue tasks, but including tasks that has been co…
…mpleted (#163)
- Loading branch information
Showing
8 changed files
with
146 additions
and
42 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
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
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,37 @@ | ||
import { Task } from "@prisma/client" | ||
import { format, formatDistanceToNowStrict } from "date-fns" | ||
|
||
|
||
|
||
export default function MyworkTaskList({ loading, tasks }: { loading: boolean, tasks: Task[] }) { | ||
const total = tasks.length | ||
|
||
return <> | ||
{!loading && | ||
tasks.map(task => { | ||
const dueDate = task.dueDate ? new Date(task.dueDate) : null | ||
return ( | ||
<div className="mw-task" key={task.id}> | ||
<div className=""> | ||
{/* <TaskStatus taskId={task.id} value={task.taskStatusId || ''} /> */} | ||
{task.title} | ||
<div className="text-xs text-gray-400 mt-1.5"> | ||
{dueDate ? formatDistanceToNowStrict(dueDate, { addSuffix: true }) : null} | ||
</div> | ||
|
||
{/* <TaskPriorityCell taskId={task.id} value={task.priority} /> */} | ||
</div> | ||
</div> | ||
) | ||
})} | ||
{!loading && tasks.length < total && ( | ||
<div className="mw-card-more">And {total} more</div> | ||
)} | ||
|
||
{!loading && !tasks.length && ( | ||
<div className="task-empty text-sm bg-red-200 dark:bg-red-300 rounded-md border border-red-200 dark:border-red-400 shadow-sm shadow-red-300 dark:shadow-red-700 p-3 text-red-800"> | ||
{`🎃😎🥶 No tasks found! You're so lucky buddy !!`} | ||
</div> | ||
)} | ||
</> | ||
} |
27 changes: 27 additions & 0 deletions
27
packages/ui-app/app/_features/MyWorks/MyworkTaskPaginate.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,27 @@ | ||
import { Button } from "@shared/ui"; | ||
|
||
interface IMyworkPaginate { | ||
enable: boolean | ||
page: number, | ||
maxPage: number, | ||
onNext: () => void, | ||
onPrev: () => void | ||
} | ||
|
||
export default function MyworkTaskPaginate({ enable, page, onNext, onPrev, maxPage }: IMyworkPaginate) { | ||
if (!enable) return null | ||
|
||
return <div className="flex items-center justify-between"> | ||
<div className='space-x-2'> | ||
<Button disabled={page === 1} title="Prev" size="sm" onClick={() => { | ||
onPrev() | ||
}} /> | ||
<Button disabled={page === maxPage} title="Next" size="sm" onClick={() => { | ||
onNext() | ||
}} /> | ||
</div> | ||
<div className='text-xs text-gray-400'> | ||
{page}/{maxPage} pages | ||
</div> | ||
</div> | ||
} |