-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
482 additions
and
2 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
24 changes: 24 additions & 0 deletions
24
front/src/app/(base)/annotation_projects/detail/clips/page.css
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,24 @@ | ||
.resizer { | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
height: 100%; | ||
width: 5px; | ||
cursor: col-resize; | ||
user-select: none; | ||
touch-action: none; | ||
} | ||
|
||
.resizer.isResizing { | ||
opacity: 1; | ||
} | ||
|
||
@media (hover: hover) { | ||
.resizer { | ||
opacity: 0; | ||
} | ||
|
||
*:hover > .resizer { | ||
opacity: 1; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
front/src/app/(base)/annotation_projects/detail/clips/page.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,31 @@ | ||
"use client"; | ||
import { notFound } from "next/navigation"; | ||
import { useContext } from "react"; | ||
|
||
import AnnotationProjectTaskClips from "@/components/annotation_projects/AnnotationProjectTaskClips"; | ||
import AnnotationProject from "../context"; | ||
|
||
import type { AnnotationTask } from "@/types"; | ||
|
||
import "./page.css"; | ||
|
||
function getAnnotationTaskLink(annotationTask: AnnotationTask): string { | ||
return `detail/annotation/?annotation_task_uuid=${annotationTask.uuid}`; | ||
} | ||
|
||
export default function Page() { | ||
const annotationProject = useContext(AnnotationProject); | ||
|
||
if (annotationProject == null) { | ||
return notFound(); | ||
} | ||
|
||
return ( | ||
<div className="w-full"> | ||
<AnnotationProjectTaskClips | ||
annotationProject={annotationProject} | ||
getAnnotationTaskLink={getAnnotationTaskLink} | ||
/> | ||
</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
33 changes: 33 additions & 0 deletions
33
front/src/components/annotation_projects/AnnotationProjectTaskClips.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,33 @@ | ||
import { useMemo } from "react"; | ||
|
||
import AnnotationTaskTable from "@/components/annotation_tasks/AnnotationTaskTable"; | ||
|
||
import type {AnnotationProject, AnnotationTask} from "@/types"; | ||
|
||
export default function AnnotationProjectTaskClips({ | ||
annotationProject, | ||
getAnnotationTaskLink: getAnnotationTaskLinkFn, | ||
}: { | ||
annotationProject: AnnotationProject; | ||
getAnnotationTaskLink?: (annotationTask: AnnotationTask) => string; | ||
}) { | ||
|
||
const getAnnotationTaskLink = useMemo(() => { | ||
if (getAnnotationTaskLinkFn == null) return undefined; | ||
|
||
return (annotationTask: AnnotationTask) => { | ||
const url = getAnnotationTaskLinkFn(annotationTask); | ||
return `${url}&annotation_project_uuid=${annotationProject.uuid}`; | ||
}; | ||
}, [getAnnotationTaskLinkFn, annotationProject.uuid]); | ||
const filter = useMemo(() => ({ annotation_project: annotationProject }), [annotationProject]); | ||
|
||
return ( | ||
<AnnotationTaskTable | ||
filter={filter} | ||
fixed={["annotation_project"]} | ||
getAnnotationTaskLink={getAnnotationTaskLink} | ||
// pathFormatter={pathFormatter} TODO: if there was a dataset column, the path could be formatted as in the recordings table | ||
/> | ||
); | ||
} |
69 changes: 69 additions & 0 deletions
69
front/src/components/annotation_tasks/AnnotationTaskTable.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,69 @@ | ||
import type { AnnotationTaskFilter } from "@/api/annotation_tasks"; | ||
import type { AnnotationTask } from "@/types"; | ||
import useAnnotationTasks from "@/hooks/api/useAnnotationTasks"; | ||
import useAnnotationTaskTable from "@/hooks/useAnnotationTaskTable"; | ||
import Loading from "@/app/loading"; | ||
import Search from "@/components/inputs/Search"; | ||
import FilterPopover from "@/components/filters/FilterMenu"; | ||
import annotationTaskFilterDefs from "@/components/filters/annotation_tasks"; | ||
import FilterBar from "@/components/filters/FilterBar"; | ||
import Table from "@/components/tables/Table"; | ||
import Pagination from "@/components/lists/Pagination"; | ||
|
||
export default function AnnotationTaskTable({ | ||
filter, | ||
fixed, | ||
getAnnotationTaskLink, | ||
pathFormatter, | ||
}: { | ||
filter: AnnotationTaskFilter; | ||
fixed?: (keyof AnnotationTaskFilter)[]; | ||
getAnnotationTaskLink?: (annotationTask: AnnotationTask) => string; | ||
pathFormatter?: (path: string) => string; | ||
}) { | ||
const annotationTasks = useAnnotationTasks({ filter, fixed }); | ||
|
||
const table = useAnnotationTaskTable({ | ||
data: annotationTasks.items, | ||
getAnnotationTaskLink: getAnnotationTaskLink, | ||
pathFormatter | ||
}); | ||
|
||
if (annotationTasks.isLoading || annotationTasks.data == null) { | ||
return <Loading />; | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col gap-y-4"> | ||
<div className="flex flex-row justify-between space-x-4"> | ||
<div className="flex flex-row space-x-3 basis-1/2"> | ||
<div className="grow"> | ||
<Search | ||
label="Search" | ||
placeholder="Search recordings..." | ||
value={annotationTasks.filter.get("search_recordings") ?? ""} | ||
onChange={(value) => | ||
annotationTasks.filter.set("search_recordings", value as string) | ||
} | ||
/> | ||
</div> | ||
<FilterPopover | ||
filter={annotationTasks.filter} | ||
filterDef={annotationTaskFilterDefs} | ||
/> | ||
</div> | ||
</div> | ||
<FilterBar | ||
filter={annotationTasks.filter} | ||
total={annotationTasks.total} | ||
filterDef={annotationTaskFilterDefs} | ||
/> | ||
<div className="w-full"> | ||
<div className="overflow-x-auto overflow-y-auto w-full max-h-screen rounded-md outline outline-1 outline-stone-200 dark:outline-stone-800"> | ||
<Table table={table}/> | ||
</div> | ||
</div> | ||
<Pagination {...annotationTasks.pagination} /> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.