-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: LEAP-872: LEAP-935: Auto-Annotation fixes (#5715)
LEAP-872: Move the Auto-Accept checkbox to the bottom bar LEAP-935: Fix Reject All button not working Mirroring #5714 --------- Co-authored-by: Michael Malyuk <[email protected]> Co-authored-by: robot-ci-heartex <[email protected]> Co-authored-by: hlomzik <[email protected]>
- Loading branch information
1 parent
224b72e
commit 91e2618
Showing
11 changed files
with
127 additions
and
59 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
web/libs/editor/src/components/AnnotationTab/AutoAcceptToggle.js
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,64 @@ | ||
import { inject, observer } from 'mobx-react'; | ||
|
||
import { Block, Elem } from '../../utils/bem'; | ||
import { Button } from '../../common/Button/Button'; | ||
import { IconCheck, IconCross } from '../../assets/icons'; | ||
import { Space } from '../../common/Space/Space'; | ||
import Toggle from '../../common/Toggle/Toggle'; | ||
|
||
import './AutoAcceptToggle.styl'; | ||
|
||
const injector = inject(({ store }) => { | ||
const annotation = store.annotationStore?.selected; | ||
const suggestions = annotation?.suggestions; | ||
|
||
return { | ||
store, | ||
annotation, | ||
suggestions, | ||
interfaces: Array.from(store?.interfaces), | ||
}; | ||
}); | ||
|
||
export const AutoAcceptToggle = injector(observer(({ | ||
store, | ||
annotation, | ||
suggestions, | ||
}) => { | ||
if (!store.autoAnnotation) return null; | ||
|
||
const withSuggestions = annotation.hasSuggestionsSupport && !store.forceAutoAcceptSuggestions; | ||
const loading = store.awaitingSuggestions; | ||
|
||
return ( | ||
<Block name="auto-accept"> | ||
{withSuggestions && ( | ||
<Elem name="wrapper" mod={{ loading }}> | ||
<Space spread> | ||
{suggestions.size > 0 ? ( | ||
<Space size="small"> | ||
<Elem name="info"> | ||
{suggestions.size} suggestion{suggestions.size > 0 && 's'} | ||
</Elem> | ||
<Elem name="action" tag={Button} mod={{ type: 'reject' }} onClick={() => annotation.rejectAllSuggestions()}> | ||
<IconCross/> | ||
</Elem> | ||
<Elem name="action" tag={Button} mod={{ type: 'accept' }} onClick={() => annotation.acceptAllSuggestions()}> | ||
<IconCheck/> | ||
</Elem> | ||
</Space> | ||
) : ( | ||
<Toggle | ||
checked={store.autoAcceptSuggestions} | ||
onChange={(e) => store.setAutoAcceptSuggestions(e.target.checked)} | ||
label="Auto-Accept Suggestions" | ||
style={{ color: '#7F64FF' }} | ||
/> | ||
)} | ||
</Space> | ||
</Elem> | ||
)} | ||
{loading && <Elem name="spinner" />} | ||
</Block> | ||
); | ||
})); |
55 changes: 55 additions & 0 deletions
55
web/libs/editor/src/components/AnnotationTab/AutoAcceptToggle.styl
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,55 @@ | ||
.auto-accept | ||
height 44px | ||
display flex | ||
align-items center | ||
box-sizing border-box | ||
background-color #fff | ||
margin-left: 16px; | ||
|
||
&__wrapper | ||
width 100% | ||
|
||
&_loading | ||
// toggle will not be disabled, because it's usable even when loading | ||
opacity: 0.5; | ||
|
||
&__info | ||
font-size: 16px; | ||
|
||
&__action | ||
padding 0 | ||
margin 0 | ||
margin 2px | ||
width 28px | ||
height 28px | ||
display flex | ||
align-items center | ||
justify-content center | ||
border-radius 100% | ||
color rgba(#000, 0.6) | ||
background-color rgba(#000, 0.1) | ||
|
||
&_type | ||
&_accept svg | ||
width 15px | ||
height 10px | ||
|
||
&_reject svg | ||
width 12.5px | ||
height 12.5px | ||
|
||
&__spinner | ||
width 16px | ||
height 16px | ||
border-radius 100%; | ||
box-sizing border-box | ||
border 2px solid #FFD666 | ||
border-right-color transparent | ||
animation waiting-spin 1s linear infinite | ||
|
||
@keyframes waiting-spin | ||
0% | ||
transform rotate(0deg) | ||
|
||
100% | ||
transform rotate(360deg) |
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
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