-
Notifications
You must be signed in to change notification settings - Fork 377
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
feat: Text Generation record card (Align buttons & interaction) #2374
feat: Text Generation record card (Align buttons & interaction) #2374
Conversation
|
||
<div> | ||
<div class="--editable" v-if="!sentences.length"> | ||
<text-2-text-content-editable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component name in camelcase
{{ sentence.score | percent }}</base-button | ||
> | ||
</div> | ||
<text-2-text-content-editable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component name in camel case
@@ -208,9 +187,13 @@ export default { | |||
}, | |||
selectedSentence() { | |||
return ( | |||
this.sentences[this.itemNumber] && this.sentences[this.itemNumber].text | |||
this.sentences[this.predictionNumber] && | |||
this.sentences[this.predictionNumber].text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace this.sentences[this.predictionNumber] &&
this.sentences[this.predictionNumber].text by this.sentences[this.predictionNumber]?.text
); | ||
}, | ||
isPreannotated() { | ||
return (this.predictionsLength && !this.annotations.length) || false; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the left part is always a boolean, the test 'right expression || left expression' can be replace by 'right expression'
@@ -224,54 +207,53 @@ export default { | |||
if (this.sentencesOrigin === "Prediction") { | |||
return this.predictions; | |||
} | |||
if (this.sentencesOrigin === "Preannotation") { | |||
return this.predictions; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/replace the 3 if by a swith case
2/ to not have case problem in case this.sentencesOrigin change, compare the same case text
name: "Reset", | ||
allow: this.sentencesOrigin !== "Prediction", | ||
active: this.record.status === "Edited", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/duplicate code : add a variable for the 2 test this.sentencesOrigin !== "Prediction" and a function for the test "this.record.status !== "Discarded" or "Edited"
2/ delete comments
3/ create a functionfactory for construc the object { id: "discard", name: "Discard", allow: this.sentencesOrigin !== "Prediction", active: this.record.status !== "Discarded", }
const focusInInput = event.target.tagName?.toLowerCase() === "input"; | ||
const focusInInput = | ||
event.target.tagName?.toLowerCase() === "input" || | ||
event.target.contentEditable === "true"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a computed or a method for this equality test
if (this.focus && event.target.isContentEditable) { | ||
event.preventDefault(); | ||
var text = event.clipboardData.getData("text/plain"); | ||
document.execCommand("insertText", false, text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never use var keyword : const or let. In this case const
set: async function (newValue) { | ||
this.idState.selectedPredictionIndex = newValue; | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntactic sugar => in an object, you can replace a function like
get : function() {...}
by get() {...}
. Same with set
Description
Text Generation record card (Align actions buttons & interaction)
Closes #2335
Type of change
How Has This Been Tested
Checklist