Skip to content

Commit 48e99cf

Browse files
feat: FIT-658: Refactor Data Manager and Labeling/Review Stream Empty states to use new Empty State component (#9519)
1 parent 5c7d198 commit 48e99cf

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

web/libs/editor/src/components/App/App.jsx

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import "../../tags/Custom";
2525
* Utils and common components
2626
*/
2727
import { Space } from "../../common/Space/Space";
28-
import { Button } from "@humansignal/ui";
28+
import { Button, EmptyState, IconCheck } from "@humansignal/ui";
2929
import { isStarterCloudPlan } from "@humansignal/core";
3030
import { cn } from "../../utils/bem";
3131
import { FF_BULK_ANNOTATION, FF_LSDV_4620_3_ML, FF_SIMPLE_INIT, isFF } from "../../utils/feature-flags";
@@ -81,22 +81,35 @@ class App extends Component {
8181
}
8282

8383
renderSuccess() {
84+
const messages = getEnv(this.props.store).messages;
8485
return (
8586
<div className={cn("editor").toClassName()}>
86-
<Result status="success" title={getEnv(this.props.store).messages.DONE} />
87+
<EmptyState
88+
variant="positive"
89+
icon={<IconCheck />}
90+
title={messages.DONE}
91+
description="Your annotation has been submitted."
92+
/>
8793
</div>
8894
);
8995
}
9096

9197
renderNoAnnotation() {
98+
const messages = getEnv(this.props.store).messages;
9299
return (
93100
<div className={cn("editor").toClassName()}>
94-
<Result status="success" title={getEnv(this.props.store).messages.NO_COMP_LEFT} />
101+
<EmptyState
102+
variant="positive"
103+
icon={<IconCheck />}
104+
title={messages.NO_COMP_LEFT}
105+
description="You've viewed all annotations for this task."
106+
/>
95107
</div>
96108
);
97109
}
98110

99111
renderNothingToLabel(store) {
112+
const messages = getEnv(this.props.store).messages;
100113
return (
101114
<div
102115
className={cn("editor").toClassName()}
@@ -108,18 +121,25 @@ class App extends Component {
108121
paddingBottom: "30vh",
109122
}}
110123
>
111-
<Result status="success" title={getEnv(this.props.store).messages.NO_NEXT_TASK} />
112-
<div className={cn("sub__result").toClassName()}>All tasks in the queue have been completed</div>
113-
{store.taskHistory.length > 0 && (
114-
<Button
115-
onClick={(e) => store.prevTask(e, true)}
116-
variant="neutral"
117-
className="mx-0 my-4"
118-
aria-label="Previous task"
119-
>
120-
Go to Previous Task
121-
</Button>
122-
)}
124+
<EmptyState
125+
variant="positive"
126+
icon={<IconCheck />}
127+
title={messages.NO_NEXT_TASK}
128+
description="All tasks in the queue have been completed"
129+
actions={
130+
store.taskHistory.length > 0 ? (
131+
<Button
132+
onClick={(e) => store.prevTask(e, true)}
133+
variant="primary"
134+
aria-label="Previous task"
135+
data-testid="editor-empty-queue-previous-task"
136+
>
137+
Go to Previous Task
138+
</Button>
139+
) : undefined
140+
}
141+
data-testid="editor-empty-queue"
142+
/>
123143
</div>
124144
);
125145
}
@@ -132,7 +152,7 @@ class App extends Component {
132152
);
133153
}
134154

135-
renderConfigValidationException(store) {
155+
renderConfigValidationException(_store) {
136156
return (
137157
<div className={cn("main-view").toClassName()}>
138158
<div className={cn("main-view").elem("annotation").toClassName()}>

web/libs/editor/src/utils/messages.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const URL_TAGS_DOCS = "https://labelstud.io/tags";
66
export default {
77
DONE: "Done!",
88
NO_COMP_LEFT: "No more annotations",
9-
NO_NEXT_TASK: "No More Tasks Left in Queue",
9+
NO_NEXT_TASK: "You're all caught up!",
1010
NO_ACCESS: "You don't have access to this task",
1111

1212
CONFIRM_TO_DELETE_ALL_REGIONS: "Please confirm you want to delete all labeled regions",

0 commit comments

Comments
 (0)