Skip to content

Commit 8a7b6b8

Browse files
authored
fix: Merge pull request #306 from UniversalDataTool/improve-label-help
Improve Label Help by showing errors when it fails to enable
2 parents 0f1f67b + e3ad112 commit 8a7b6b8

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

src/components/LabelHelpView/api-key-entry.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ const Title = styled("div")({
1818
},
1919
})
2020

21+
const LabelHelpIs = styled("div")({
22+
fontSize: 18,
23+
lineHeight: 1.5,
24+
color: colors.grey[800],
25+
padding: 16,
26+
width: 800,
27+
})
28+
2129
const ErrorText = styled("div")({
2230
color: colors.red[600],
2331
})
@@ -31,6 +39,10 @@ export default () => {
3139

3240
return (
3341
<Box paddingTop={8} textAlign="center">
42+
<LabelHelpIs>
43+
Label Help is a UDT-integrated service that crowd-sources your labeling,
44+
it's about the same speed as having a team of 5-10 full-time labelers.
45+
</LabelHelpIs>
3446
<Title>
3547
To use Label Help, enter your API key. You can{" "}
3648
<a

src/components/LabelHelpView/label-help-dialog-content.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ export default () => {
4646
const {
4747
labelHelpEnabled,
4848
labelHelpError,
49-
loadMyCredits,
49+
loadMyCredits = () => 0,
5050
variables,
51-
totalCost,
52-
formulaFunc,
53-
myCredits,
51+
totalCost = 0,
52+
formulaFunc = () => 0,
53+
myCredits = () => 0,
5454
} = useLabelHelp()
5555
const [error, setError] = useState()
5656
const { dataset, setDataset } = useActiveDataset()
@@ -75,7 +75,6 @@ export default () => {
7575
)}&api_key=${fromConfig("labelhelp.apikey")}`
7676
).then((r) => r.json())
7777
// response contains { progress, status }
78-
console.log({ response })
7978
setLabelHelpInfo({
8079
...dataset.labelHelp,
8180
...response,
@@ -88,9 +87,14 @@ export default () => {
8887
if (!labelHelpEnabled)
8988
return (
9089
<Container>
91-
Label Help is Disabled.
90+
Label Help isn't enabled, check the error below. If you can't resolve
91+
the error, reach out on{" "}
92+
<a href="https://universaldatatool.slack.com">the slack</a> for more
93+
help!
9294
{labelHelpError && (
93-
<div style={{ color: colors.red[500] }}>{labelHelpError}</div>
95+
<div style={{ color: colors.red[500], marginTop: 24 }}>
96+
{labelHelpError}
97+
</div>
9498
)}
9599
</Container>
96100
)

src/components/LabelView/index.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,11 @@ export default ({
3636
sampleTimeToComplete,
3737
}) => {
3838
const [currentTab, setTab] = useState("label")
39-
const [showLabelHelpPricing, setShowLabelHelpPricing] = useState(false)
4039
const posthog = usePosthog()
4140
const { labelHelpEnabled, totalCost } = useLabelHelp()
4241
const labelOnlyMode = useIsLabelOnlyMode()
4342
const [annotationStartTime, setAnnotationStartTime] = useState(null)
4443

45-
useEffect(() => {
46-
if (process.env.REACT_APP_SHOW_LABELHELP_PRICING === "true")
47-
setShowLabelHelpPricing(true)
48-
}, [])
49-
5044
const isInOverview = sampleIndex === null
5145

5246
let percentComplete = 0
@@ -140,14 +134,10 @@ export default ({
140134
value="activelearning"
141135
/>
142136
)}
143-
{labelHelpEnabled && (
137+
{!labelOnlyMode && (
144138
<Tab
145139
icon={<SupervisedUserCircleIcon />}
146-
label={
147-
showLabelHelpPricing && totalCost
148-
? `${totalCost}$`
149-
: "Label Help"
150-
}
140+
label={totalCost ? `$${totalCost}` : "Label Help"}
151141
value="labelhelp"
152142
/>
153143
)}

0 commit comments

Comments
 (0)