-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): create TaskLogsTable
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/frontend/src/components/Dashboard/TaskLogs/TaskLogsTable.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,58 @@ | ||
import { format } from 'date-fns'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
interface ITaskLogsTableProps { | ||
data: any[]; | ||
} | ||
|
||
const TaskLogsTable = ({ data: taskList }: ITaskLogsTableProps) => { | ||
const navigate = useNavigate(); | ||
return ( | ||
<div className="flex"> | ||
<table className="naxatw-w-full naxatw-overflow-hidden naxatw-rounded-lg"> | ||
<thead> | ||
<tr className="naxatw-bg-red naxatw-text-left naxatw-font-normal naxatw-text-white"> | ||
<td className="naxatw-w-80 naxatw-border-r-2 naxatw-px-2 naxatw-py-1"> | ||
ID | ||
</td> | ||
<td className="naxatw-border-r-2 naxatw-px-2 naxatw-py-1"> | ||
Total task area | ||
</td> | ||
<td className="naxatw-border-r-2 naxatw-px-2 naxatw-py-1"> | ||
Est.flight time | ||
</td> | ||
<td className="naxatw-border-r-2 naxatw-px-2 naxatw-py-1"> | ||
Created Date | ||
</td> | ||
<td className="naxatw-border-r-2 naxatw-px-2 naxatw-py-1"> | ||
Status | ||
</td> | ||
<td className="naxatw-w-12" /> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{taskList?.map(task => ( | ||
<tr key={task.task_id}> | ||
<td>{task.task_id}</td> | ||
<td>{task.task_area}</td> | ||
<td>-</td> | ||
<td>{format(new Date(task.created_at), 'yyyy-MM-dd')}</td> | ||
<td>{task.state}</td> | ||
<td className="naxatw-flex naxatw-items-center"> | ||
<div | ||
className="naxatw-flex naxatw-h-8 naxatw-w-8 naxatw-cursor-pointer naxatw-items-center naxatw-justify-center naxatw-rounded-lg hover:naxatw-bg-gray-200" | ||
role="presentation" | ||
onClick={() => navigate(`/tasks/${task.task_id}`)} | ||
> | ||
<i className="material-icons-outlined">zoom_in</i> | ||
</div> | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TaskLogsTable; |