Skip to content

Commit

Permalink
SDA-4369: PoC Revamp About App Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
NguyenTranHoangSym committed Dec 11, 2023
1 parent f3380b0 commit 2fac9d5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Copyright": "Copyright",
"Desktop Application": "Desktop Application",
"Save and Restart": "Save and Restart",
"Save": "Save",
"Cancel": "Cancel"
},
"Actual Size": "Actual Size",
Expand Down
37 changes: 27 additions & 10 deletions src/renderer/components/about-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface IState {
isPodEditing: boolean;
isValidHostname: boolean;
didUpdateHostname: boolean;
isEditMode: boolean;
}

const ABOUT_SYMPHONY_NAMESPACE = 'AboutSymphony';
Expand Down Expand Up @@ -97,6 +98,7 @@ export default class AboutApp extends React.Component<{}, IState> {
isPodEditing: false,
isValidHostname: true,
didUpdateHostname: false,
isEditMode: false,
};
this.updateState = this.updateState.bind(this);
}
Expand Down Expand Up @@ -198,15 +200,26 @@ export default class AboutApp extends React.Component<{}, IState> {
{cancelText}
</button>
)}
<button
className='AboutApp-close-button'
onClick={this.eventHandlers.onClose}
title={closeButtonText}
data-testid={'CLOSE_BUTTON'}
ref={this.closeButtonRef}
>
{closeButtonText}
</button>
{this.state.isEditMode ? (
<button
className='AboutApp-save-button'
onClick={this.eventHandlers.onPodInputBlur}
title={i18n.t('Save', ABOUT_SYMPHONY_NAMESPACE)()}
data-testid={'SAVE_BUTTON'}
>
{i18n.t('Save', ABOUT_SYMPHONY_NAMESPACE)()}
</button>
) : (
<button
className='AboutApp-close-button'
onClick={this.eventHandlers.onClose}
title={closeButtonText}
data-testid={'CLOSE_BUTTON'}
ref={this.closeButtonRef}
>
{closeButtonText}
</button>
)}
</div>
</div>
<div className='AboutApp-version-container'>
Expand Down Expand Up @@ -272,6 +285,7 @@ export default class AboutApp extends React.Component<{}, IState> {
isPodEditing: false,
isValidHostname: true,
hostname: this.previousUrl,
isEditMode: false,
});
}

Expand All @@ -284,6 +298,7 @@ export default class AboutApp extends React.Component<{}, IState> {
isPodEditing: !!(this.state.globalConfig as IConfig)?.isPodUrlEditable,
didUpdateHostname: !!(this.state.globalConfig as IConfig)
?.isPodUrlEditable,
isEditMode: true,
});
}
}
Expand Down Expand Up @@ -314,6 +329,7 @@ export default class AboutApp extends React.Component<{}, IState> {
isPodEditing: false,
isValidHostname: true,
hostname: this.previousUrl,
isEditMode: false,
});
}
};
Expand All @@ -327,11 +343,13 @@ export default class AboutApp extends React.Component<{}, IState> {
this.setState({
isPodEditing: false,
isValidHostname: false,
isEditMode: false,
});
} else {
this.setState({
isPodEditing: false,
isValidHostname: true,
isEditMode: false,
hostname: updatedHostname || hostname,
});
}
Expand Down Expand Up @@ -385,7 +403,6 @@ export default class AboutApp extends React.Component<{}, IState> {
value={updatedHostname}
onKeyDown={this.onKeyDown}
onChange={this.handlePodChange}
onBlur={this.handlePodInputBlur}
autoFocus
/>
) : (
Expand Down
24 changes: 24 additions & 0 deletions src/renderer/styles/about-app.less
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
box-shadow: none;
border: none;
Expand Down

0 comments on commit 2fac9d5

Please sign in to comment.