mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Merge pull request #2028 from NguyenTranHoangSym/SDA-4369
SDA-4369: PoC Revamp About App Edit
This commit is contained in:
commit
bc4d85c646
@ -11,6 +11,7 @@
|
|||||||
"Copyright": "Copyright",
|
"Copyright": "Copyright",
|
||||||
"Desktop Application": "Desktop Application",
|
"Desktop Application": "Desktop Application",
|
||||||
"Save and Restart": "Save and Restart",
|
"Save and Restart": "Save and Restart",
|
||||||
|
"Save": "Save",
|
||||||
"Cancel": "Cancel"
|
"Cancel": "Cancel"
|
||||||
},
|
},
|
||||||
"Actual Size": "Actual Size",
|
"Actual Size": "Actual Size",
|
||||||
|
@ -41,6 +41,7 @@ interface IState {
|
|||||||
isPodEditing: boolean;
|
isPodEditing: boolean;
|
||||||
isValidHostname: boolean;
|
isValidHostname: boolean;
|
||||||
didUpdateHostname: boolean;
|
didUpdateHostname: boolean;
|
||||||
|
isEditMode?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ABOUT_SYMPHONY_NAMESPACE = 'AboutSymphony';
|
const ABOUT_SYMPHONY_NAMESPACE = 'AboutSymphony';
|
||||||
@ -97,6 +98,7 @@ export default class AboutApp extends React.Component<{}, IState> {
|
|||||||
isPodEditing: false,
|
isPodEditing: false,
|
||||||
isValidHostname: true,
|
isValidHostname: true,
|
||||||
didUpdateHostname: false,
|
didUpdateHostname: false,
|
||||||
|
isEditMode: false,
|
||||||
};
|
};
|
||||||
this.updateState = this.updateState.bind(this);
|
this.updateState = this.updateState.bind(this);
|
||||||
}
|
}
|
||||||
@ -198,15 +200,26 @@ export default class AboutApp extends React.Component<{}, IState> {
|
|||||||
{cancelText}
|
{cancelText}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
<button
|
{this.state.isEditMode ? (
|
||||||
className='AboutApp-close-button'
|
<button
|
||||||
onClick={this.eventHandlers.onClose}
|
className='AboutApp-save-button'
|
||||||
title={closeButtonText}
|
onClick={this.eventHandlers.onPodInputBlur}
|
||||||
data-testid={'CLOSE_BUTTON'}
|
title={i18n.t('Save', ABOUT_SYMPHONY_NAMESPACE)()}
|
||||||
ref={this.closeButtonRef}
|
data-testid={'SAVE_BUTTON'}
|
||||||
>
|
>
|
||||||
{closeButtonText}
|
{i18n.t('Save', ABOUT_SYMPHONY_NAMESPACE)()}
|
||||||
</button>
|
</button>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
className='AboutApp-close-button'
|
||||||
|
onClick={this.eventHandlers.onClose}
|
||||||
|
title={closeButtonText}
|
||||||
|
data-testid={'CLOSE_BUTTON'}
|
||||||
|
ref={this.closeButtonRef}
|
||||||
|
>
|
||||||
|
{closeButtonText}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='AboutApp-version-container'>
|
<div className='AboutApp-version-container'>
|
||||||
@ -244,6 +257,7 @@ export default class AboutApp extends React.Component<{}, IState> {
|
|||||||
};
|
};
|
||||||
if (data) {
|
if (data) {
|
||||||
delete data.updatedHostname;
|
delete data.updatedHostname;
|
||||||
|
delete data.isEditMode;
|
||||||
ipcRenderer.send(apiName.symphonyApi, {
|
ipcRenderer.send(apiName.symphonyApi, {
|
||||||
cmd: apiCmds.aboutAppClipBoardData,
|
cmd: apiCmds.aboutAppClipBoardData,
|
||||||
clipboard: data,
|
clipboard: data,
|
||||||
@ -272,6 +286,7 @@ export default class AboutApp extends React.Component<{}, IState> {
|
|||||||
isPodEditing: false,
|
isPodEditing: false,
|
||||||
isValidHostname: true,
|
isValidHostname: true,
|
||||||
hostname: this.previousUrl,
|
hostname: this.previousUrl,
|
||||||
|
isEditMode: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +299,7 @@ export default class AboutApp extends React.Component<{}, IState> {
|
|||||||
isPodEditing: !!(this.state.globalConfig as IConfig)?.isPodUrlEditable,
|
isPodEditing: !!(this.state.globalConfig as IConfig)?.isPodUrlEditable,
|
||||||
didUpdateHostname: !!(this.state.globalConfig as IConfig)
|
didUpdateHostname: !!(this.state.globalConfig as IConfig)
|
||||||
?.isPodUrlEditable,
|
?.isPodUrlEditable,
|
||||||
|
isEditMode: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -314,6 +330,7 @@ export default class AboutApp extends React.Component<{}, IState> {
|
|||||||
isPodEditing: false,
|
isPodEditing: false,
|
||||||
isValidHostname: true,
|
isValidHostname: true,
|
||||||
hostname: this.previousUrl,
|
hostname: this.previousUrl,
|
||||||
|
isEditMode: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -327,11 +344,13 @@ export default class AboutApp extends React.Component<{}, IState> {
|
|||||||
this.setState({
|
this.setState({
|
||||||
isPodEditing: false,
|
isPodEditing: false,
|
||||||
isValidHostname: false,
|
isValidHostname: false,
|
||||||
|
isEditMode: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
isPodEditing: false,
|
isPodEditing: false,
|
||||||
isValidHostname: true,
|
isValidHostname: true,
|
||||||
|
isEditMode: false,
|
||||||
hostname: updatedHostname || hostname,
|
hostname: updatedHostname || hostname,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -385,7 +404,6 @@ export default class AboutApp extends React.Component<{}, IState> {
|
|||||||
value={updatedHostname}
|
value={updatedHostname}
|
||||||
onKeyDown={this.onKeyDown}
|
onKeyDown={this.onKeyDown}
|
||||||
onChange={this.handlePodChange}
|
onChange={this.handlePodChange}
|
||||||
onBlur={this.handlePodInputBlur}
|
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
@ -188,6 +188,30 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-save-button {
|
||||||
|
box-shadow: none;
|
||||||
|
border: none;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
text-decoration: none;
|
||||||
|
line-height: 12px;
|
||||||
|
background-color: @electricity-ui-50;
|
||||||
|
color: @electricity-ui-05;
|
||||||
|
cursor: pointer;
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: 600;
|
||||||
|
width: 120px;
|
||||||
|
height: 36px;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
box-shadow: 0 0 10px rgba(61, 162, 253, 1);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-cancel-button {
|
&-cancel-button {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
Loading…
Reference in New Issue
Block a user