forked from josedvq/covfee
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented a functional dropdown. State in sync with buttons. (#3)
- Implemented a AnnotationTypeDropdown based on the antd dropdown. Notes: there is a good likelihood that this can be trimmed and used as a direct instance given the experience with it. Also, this needs to be reusable, so we may simply fallback into using "Dropdown" directly. - Tried to set the styling for the dropdown, making a layout with a sidebar on the left and the video on the right. However, it is currently not working as it seems the video is being forced to render ocupying all available space. This may be forced somewhere in a higher level. - Added another task instance in the journey, for simple testing.
- Loading branch information
1 parent
3b8bab4
commit 9cf3f08
Showing
4 changed files
with
127 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from "react"; | ||
import { DownOutlined } from "@ant-design/icons"; | ||
import type { MenuProps } from "antd"; | ||
import { Dropdown, Menu, Space, MenuInfo } from "antd"; | ||
|
||
interface AnnotationTypeDropdownProps { | ||
annotation_types: string[]; | ||
itemClick: (item: string) => void; | ||
selected_annotation: string; | ||
} | ||
|
||
export const AnnotationTypeDropdown: React.FC<AnnotationTypeDropdownProps> = ({ | ||
annotation_types, | ||
itemClick, | ||
selected_annotation, | ||
}) => { | ||
console.log("Selected annotation:" + selected_annotation); | ||
const items: MenuProps["items"] = [ | ||
{ | ||
key: "1", | ||
type: "group", | ||
label: "Action Annotations", | ||
children: annotation_types.map((annotation_type) => ({ | ||
key: annotation_type, | ||
label: annotation_type, | ||
onClick: (item: MenuInfo) => { | ||
itemClick(item.key); | ||
}, | ||
})), | ||
}, | ||
]; | ||
|
||
return ( | ||
<Dropdown menu={{ items }}> | ||
<a | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
}} | ||
> | ||
<Space> | ||
{selected_annotation} | ||
<DownOutlined /> | ||
</Space> | ||
</a> | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
export default AnnotationTypeDropdown; |
31 changes: 31 additions & 0 deletions
31
covfee/client/tasks/action_annotation/action_annotation.module.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,31 @@ | ||
.action-annotation-task { | ||
text-align: center; | ||
font-size: calc(10px + 2vmin); | ||
display: flex; | ||
} | ||
|
||
.sidebar { | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
width: 20%; /* Adjust as needed */ | ||
min-width: 200px; /* Set a minimum width */ | ||
background-color: #f0f0f0; /* Example background color */ | ||
} | ||
|
||
.main-content { | ||
background-color: #ffffff; /* Example background color */ | ||
width: 80%; | ||
flex-direction: column; | ||
} | ||
|
||
.videoPlayer{ | ||
width: 50%; | ||
} | ||
|
||
.dropdown{ | ||
background-color: red; | ||
} |
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 |
---|---|---|
|
@@ -5,9 +5,10 @@ | |
config.load_environment("local") | ||
|
||
my_task_1 = tasks.ActionAnnotationTaskSpec(name="My Task 1", input=None, media=None) | ||
my_task_2 = tasks.ActionAnnotationTaskSpec(name="My Task 1", input=None, media=None) | ||
|
||
hit = HIT("Joint counter") | ||
j1 = hit.add_journey(nodes=[my_task_1]) | ||
j1 = hit.add_journey(nodes=[my_task_1, my_task_2]) | ||
|
||
projects = [Project("My Project", email="[email protected]", hits=[hit])] | ||
app = CovfeeApp(projects) |