-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: BROS-596: Remove the top bar on the labeling stream #8822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 6 commits
7b6f709
0682dcd
76696f7
ec5c559
5448309
da4732d
5242898
67f9246
05577e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| import { IconInfoOutline, IconSettings } from "@humansignal/icons"; | ||
| import { Button, Space } from "@humansignal/ui"; | ||
| import { Button } from "@humansignal/ui"; | ||
| import { cn } from "../../utils/bem"; | ||
| import { isSelfServe } from "../../utils/billing"; | ||
| import { FF_BULK_ANNOTATION, isFF } from "../../utils/feature-flags"; | ||
| import { AutoAcceptToggle } from "../AnnotationTab/AutoAcceptToggle"; | ||
| import { DynamicPreannotationsToggle } from "../AnnotationTab/DynamicPreannotationsToggle"; | ||
| import { GroundTruth } from "../CurrentEntity/GroundTruth"; | ||
| import { EditingHistory } from "./HistoryActions"; | ||
| import "./Actions.scss"; | ||
|
|
||
| export const Actions = ({ store }) => { | ||
| const annotationStore = store.annotationStore; | ||
|
|
@@ -16,43 +17,46 @@ export const Actions = ({ store }) => { | |
| const isBulkMode = isFF(FF_BULK_ANNOTATION) && !isSelfServe() && store.hasInterface("annotation:bulk"); | ||
|
|
||
| return ( | ||
| <Space size="small"> | ||
| <div className={cn("bottombar").elem("section").toClassName()}> | ||
| {!isPrediction && !isViewAll && store.hasInterface("edit-history") && <EditingHistory entity={entity} />} | ||
|
|
||
| {store.description && store.hasInterface("instruction") && ( | ||
| <div className={cn("action-buttons").toClassName()}> | ||
| {store.description && store.hasInterface("instruction") && ( | ||
| <Button | ||
| type="text" | ||
| aria-label="Instructions" | ||
| size="small" | ||
| variant="neutral" | ||
| look="string" | ||
| tooltip="Show instructions" | ||
| onClick={() => store.toggleDescription()} | ||
| className="!p-0 aspect-square" | ||
| leading={<IconInfoOutline />} | ||
| data-testid="bottombar-instructions-button" | ||
| /> | ||
| )} | ||
| <Button | ||
| type="text" | ||
| aria-label="Instructions" | ||
| aria-label="Settings" | ||
| size="small" | ||
| variant="neutral" | ||
| look="string" | ||
| tooltip="Show instructions" | ||
| onClick={() => store.toggleDescription()} | ||
| > | ||
| <IconInfoOutline /> | ||
| </Button> | ||
| )} | ||
| <Button | ||
| type="text" | ||
| aria-label="Settings" | ||
| size="small" | ||
| look="string" | ||
| variant="neutral" | ||
| onClick={() => store.toggleSettings()} | ||
| tooltip="Settings" | ||
| className="!p-0" | ||
| > | ||
| <IconSettings /> | ||
| </Button> | ||
| variant="neutral" | ||
| onClick={() => store.toggleSettings()} | ||
| tooltip="Settings" | ||
| className="!p-0aspect-square" | ||
| leading={<IconSettings />} | ||
| data-testid="bottombar-settings-button" | ||
| /> | ||
| </div> | ||
|
|
||
| {store.hasInterface("ground-truth") && !isBulkMode && <GroundTruth entity={entity} />} | ||
|
|
||
| {!isViewAll && ( | ||
| <div className={cn("bottombar").elem("section").toClassName()}> | ||
| <div className={cn("model-actions").toClassName()}> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this classname going to fail on testing selectors?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probable. But I think the best approach would be to add data-testids to the buttons. I'll add those. |
||
| <DynamicPreannotationsToggle /> | ||
| <AutoAcceptToggle /> | ||
| </div> | ||
| )} | ||
| </Space> | ||
| </div> | ||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| .action-buttons { | ||
| display: flex; | ||
| gap: var(--spacing-tight); | ||
| margin-left: var(--spacing-tight); | ||
|
|
||
| &__action { | ||
| width: 36px; | ||
| max-width: 36px; | ||
| height: 36px; | ||
|
|
||
| &:disabled { | ||
| opacity: 0.6; | ||
| } | ||
|
|
||
| svg { | ||
| display: block; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .model-actions { | ||
| padding: 0 var(--spacing-tight); | ||
| display: flex; | ||
| flex-wrap: nowrap; | ||
| gap: var(--spacing-tight); | ||
| position: relative; | ||
| margin-left: var(--spacing-tight); | ||
|
|
||
| &::before { | ||
| content: ""; | ||
| display: block; | ||
| width: 1px; | ||
| height: calc(100% - var(--spacing-tight) * 2); | ||
| background-color: var(--color-neutral-border); | ||
| position: absolute; | ||
| left: 0; | ||
| top: var(--spacing-tight); | ||
| bottom: var(--spacing-tight); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,68 @@ | ||
| import { useMemo } from "react"; | ||
| import { observer } from "mobx-react"; | ||
| import { Button, IconChevronLeft, IconChevronRight } from "@humansignal/ui"; | ||
| import { useEffect, useState } from "react"; | ||
| import { Button, IconChevronLeft, IconChevronRight, Tooltip } from "@humansignal/ui"; | ||
| import { cn } from "../../utils/bem"; | ||
| import { FF_DEV_3873, FF_DEV_4174, FF_LEAP_1173, FF_TASK_COUNT_FIX, isFF } from "../../utils/feature-flags"; | ||
| import { guidGenerator } from "../../utils/unique"; | ||
| import { isDefined } from "../../utils/utilities"; | ||
| import { FF_LEAP_1173, FF_TASK_COUNT_FIX, isFF } from "../../utils/feature-flags"; | ||
| import "./CurrentTask.scss"; | ||
| import { reaction } from "mobx"; | ||
|
|
||
| export const CurrentTask = observer(({ store }) => { | ||
| const currentIndex = useMemo(() => { | ||
| return store.taskHistory.findIndex((x) => x.taskId === store.task.id) + 1; | ||
| }, [store.taskHistory]); | ||
|
|
||
| const [initialCommentLength, setInitialCommentLength] = useState(0); | ||
| const [visibleComments, setVisibleComments] = useState(0); | ||
|
|
||
| useEffect(() => { | ||
| store.commentStore.setAddedCommentThisSession(false); | ||
|
|
||
| const reactionDisposer = reaction( | ||
| () => store.commentStore.comments.map((item) => item.isDeleted), | ||
| (result) => { | ||
| setVisibleComments(result.filter((item) => !item).length); | ||
| }, | ||
| ); | ||
|
|
||
| return () => { | ||
| reactionDisposer?.(); | ||
| }; | ||
| }, []); | ||
|
|
||
| useEffect(() => { | ||
| if (store.commentStore.addedCommentThisSession) { | ||
| setInitialCommentLength(visibleComments); | ||
| } | ||
| }, [store.commentStore.addedCommentThisSession]); | ||
|
Comment on lines
+17
to
+39
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically that's just a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part of the code serves two purposes:
This component needs to distinguish between comments that existed when the task was opened versus comments added during the current annotation session. This is used to help determine whether a task can be postponed. See lines 52-54. When |
||
|
|
||
| const historyEnabled = store.hasInterface("topbar:prevnext"); | ||
| const showCounter = store.hasInterface("topbar:task-counter"); | ||
|
|
||
| // @todo some interface? | ||
| const canPostpone = | ||
| let canPostpone = | ||
| !isDefined(store.annotationStore.selected.pk) && | ||
| !store.canGoNextTask && | ||
| (!isFF(FF_LEAP_1173) || store.hasInterface("skip")) && | ||
| !store.hasInterface("review") && | ||
| store.hasInterface("postpone"); | ||
|
|
||
| if (store.hasInterface("annotations:comments") && isFF(FF_DEV_4174)) { | ||
| canPostpone = canPostpone && store.commentStore.addedCommentThisSession && visibleComments >= initialCommentLength; | ||
| } | ||
|
Comment on lines
+52
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% sure of this change, or why its necessary to move the topbar CurrentTask down to the bottombar.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the context @bmartel https://humansignal.slack.com/archives/C016L55AYJX/p1762284677894759
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we changed the logic of canPostpone here. Maybe I am not seeing the ask in the messages.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, just about the moving the CurrentTask to the bottom. The canPostpone shouldn't have changed. I'll check that out.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here — it's just how it was in original
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| return ( | ||
| <div className={cn("bottombar").elem("section").toClassName()}> | ||
| <div className={cn("current-task").mod({ "with-history": historyEnabled }).toClassName()}> | ||
| <div className={cn("current-task").elem("task-id").toClassName()}> | ||
| <div | ||
| className={cn("current-task").elem("task-id").toClassName()} | ||
| style={{ fontSize: isFF(FF_DEV_3873) ? 12 : 14 }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar question here about the need for a FF based inline style |
||
| > | ||
| {store.task.id ?? guidGenerator()} | ||
| {historyEnabled && | ||
| showCounter && | ||
| (isFF(FF_TASK_COUNT_FIX) ? ( | ||
| <div className={cn("current-task").elem("task-count").toClassName()}> | ||
| {store.queuePosition} of {store.queueTotal} | ||
|
|
@@ -39,23 +74,38 @@ export const CurrentTask = observer(({ store }) => { | |
| ))} | ||
| </div> | ||
| {historyEnabled && ( | ||
| <div className={cn("current-task").elem("history-controls").toClassName()}> | ||
| <Button | ||
| variant="neutral" | ||
| data-testid="prev-task" | ||
| disabled={!historyEnabled || !store.canGoPrevTask} | ||
| onClick={store.prevTask} | ||
| > | ||
| <IconChevronLeft /> | ||
| </Button> | ||
| <Button | ||
| data-testid="next-task" | ||
| disabled={!store.canGoNextTask && !canPostpone} | ||
| onClick={store.canGoNextTask ? store.nextTask : store.postponeTask} | ||
| variant={!store.canGoNextTask && canPostpone ? "primary" : "neutral"} | ||
| > | ||
| <IconChevronRight /> | ||
| </Button> | ||
| <div | ||
| className={cn("current-task") | ||
| .elem("history-controls") | ||
| .mod({ newui: isFF(FF_DEV_3873) }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yyassi-heartex Do you recall what this
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bmartel we are basically on UI v3 right now. We had v1 which was finally removed some time ago (FF_1170). And we still have v2 hidden behind feature flag. It's enabled for everyone and is ready to be removed, but it's everywhere, including some tests, so we have to fix them first. One day, one day... |
||
| .toClassName()} | ||
| > | ||
| <Tooltip title="Previous Task"> | ||
| <Button | ||
| data-testid="prev-task" | ||
| aria-label="Previous task" | ||
| look="string" | ||
| disabled={!historyEnabled || !store.canGoPrevTask} | ||
| onClick={store.prevTask} | ||
| style={{ background: !isFF(FF_DEV_3873) && "none", backgroundColor: isFF(FF_DEV_3873) && "none" }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this |
||
| variant="neutral" | ||
| leading={<IconChevronLeft />} | ||
| size="small" | ||
| /> | ||
| </Tooltip> | ||
| <Tooltip title={!store.canGoNextTask && canPostpone ? "Postpone Task" : "Next Task"}> | ||
| <Button | ||
| data-testid="next-task" | ||
| aria-label="Next task" | ||
| look="string" | ||
| disabled={!store.canGoNextTask && !canPostpone} | ||
| onClick={store.canGoNextTask ? store.nextTask : store.postponeTask} | ||
| style={{ background: !isFF(FF_DEV_3873) && "none", backgroundColor: isFF(FF_DEV_3873) && "none" }} | ||
| variant={!store.canGoNextTask && canPostpone ? "primary" : "neutral"} | ||
| leading={<IconChevronRight />} | ||
| size="small" | ||
| /> | ||
| </Tooltip> | ||
| </div> | ||
| )} | ||
| </div> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.