From 4d584314973da51e0f31c4f05b4092b58bb1e9dc Mon Sep 17 00:00:00 2001 From: yash sharma Date: Tue, 5 Sep 2023 21:45:54 +0530 Subject: [PATCH 1/4] Updated PromptComponent Signed-off-by: yash sharma --- ui/components/PromptComponent.js | 36 +++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/ui/components/PromptComponent.js b/ui/components/PromptComponent.js index c0d0cc472ec..023e3291e7a 100644 --- a/ui/components/PromptComponent.js +++ b/ui/components/PromptComponent.js @@ -7,7 +7,9 @@ import { DialogActions, DialogContentText, DialogContent, - DialogTitle + DialogTitle, + FormControlLabel, + Checkbox } from "@material-ui/core"; import classNames from 'classnames'; @@ -67,7 +69,9 @@ class PromptComponent extends React.Component { show : false, title : "", subtitle : "", - options : [] + options : [], + isChecked : false, + showCheckbox : false } this.promiseInfo = {}; } @@ -80,6 +84,7 @@ class PromptComponent extends React.Component { title : passed.title, subtitle : passed.subtitle, options : passed.options, + showCheckbox : passed.showCheckbox === true, show : true }); }); @@ -89,9 +94,20 @@ class PromptComponent extends React.Component { this.setState({ show : false }); }; + handleCheckboxChange = () => { + this.setState((prevState) => ({ + isChecked : !prevState.isChecked, + })); + }; + + getCheckboxState = () => { + return this.state.isChecked; + }; + + render() { const { - show, options, title, subtitle + show, options, title, subtitle, isChecked, showCheckbox } = this.state; const { classes } = this.props; const { resolve } = this.promiseInfo; @@ -116,6 +132,20 @@ class PromptComponent extends React.Component { {subtitle} + {showCheckbox && ( + { + this.handleCheckboxChange(); + }} + color="primary" + /> + } + label="Do not show again" + /> + )} } From 66c09fbc5f6fdc4e5cd5574067cb71a7c6c75e24 Mon Sep 17 00:00:00 2001 From: Yash sharma <71271069+Yashsharma1911@users.noreply.github.com> Date: Wed, 6 Sep 2023 23:49:41 +0530 Subject: [PATCH 2/4] use double negation Co-authored-by: Chetan Kumar Signed-off-by: Yash sharma <71271069+Yashsharma1911@users.noreply.github.com> --- ui/components/PromptComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/components/PromptComponent.js b/ui/components/PromptComponent.js index 023e3291e7a..c2f33e09d44 100644 --- a/ui/components/PromptComponent.js +++ b/ui/components/PromptComponent.js @@ -84,7 +84,7 @@ class PromptComponent extends React.Component { title : passed.title, subtitle : passed.subtitle, options : passed.options, - showCheckbox : passed.showCheckbox === true, + showCheckbox : !!passed.showCheckbox, show : true }); }); From c1ed7b29a8d98e2089d5507f69aa62a4ab0d813a Mon Sep 17 00:00:00 2001 From: yash sharma Date: Mon, 11 Sep 2023 16:18:32 +0530 Subject: [PATCH 3/4] Decrease font size and changed label color Signed-off-by: yash sharma --- ui/components/PromptComponent.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ui/components/PromptComponent.js b/ui/components/PromptComponent.js index 023e3291e7a..dbc0c708174 100644 --- a/ui/components/PromptComponent.js +++ b/ui/components/PromptComponent.js @@ -59,6 +59,16 @@ const styles = (theme) => ({ "&:hover" : { backgroundColor : "#B32700", } + }, + checkboxLabelStyle : { + fontSize : "1rem", + color : theme.palette.secondary.lightText + }, + checkbox : { + color : theme.palette.secondary.focused, + "&$checked" : { + color : theme.palette.secondary.focused, + } } }); @@ -137,13 +147,15 @@ class PromptComponent extends React.Component { control={ { - this.handleCheckboxChange(); - }} - color="primary" + onChange={this.handleCheckboxChange} + className={classes.checkbox} /> } - label="Do not show again" + label={ + + Do not show again + + } /> )} From ff7a4e52e210cb11cfdf1c46afde4415abf8120f Mon Sep 17 00:00:00 2001 From: yash sharma Date: Mon, 11 Sep 2023 16:35:26 +0530 Subject: [PATCH 4/4] Colorized modal text Signed-off-by: yash sharma --- ui/components/PromptComponent.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/components/PromptComponent.js b/ui/components/PromptComponent.js index d2945286208..fc107b1f558 100644 --- a/ui/components/PromptComponent.js +++ b/ui/components/PromptComponent.js @@ -25,7 +25,8 @@ const styles = (theme) => ({ minWidth : 400, overflowWrap : 'anywhere', textAlign : 'center', - padding : '5px' + padding : '5px', + color : theme.palette.secondary.text }, actions : { display : 'flex', @@ -62,7 +63,6 @@ const styles = (theme) => ({ }, checkboxLabelStyle : { fontSize : "1rem", - color : theme.palette.secondary.lightText }, checkbox : { color : theme.palette.secondary.focused, @@ -149,6 +149,7 @@ class PromptComponent extends React.Component { checked={isChecked} onChange={this.handleCheckboxChange} className={classes.checkbox} + color="primary" /> } label={