Skip to content

Commit

Permalink
Slightly better UI
Browse files Browse the repository at this point in the history
  • Loading branch information
xurei committed Apr 27, 2020
1 parent 512090b commit a0b8fff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions src/webapp/react-macros-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ class MacrosListItem extends React.Component {
macro: PropTypes.object.isRequired,
metadata: PropTypes.object.isRequired,
onRemoveMacro: PropTypes.func.isRequired,
onMacroConfig: PropTypes.func.isRequired,
};

constructor(props) {
super(props);
this.state = {
detailsVisible: true,
detailsVisible: false,
};
}

Expand All @@ -30,8 +29,19 @@ class MacrosListItem extends React.Component {

return (
<ListGroupItem>
<div onClick={this.handleToggleDetails} style={{cursor: 'pointer'}}>
<span style={{lineHeight: '45px', display: 'inline-block', width: 200}}>{hasConfig ? (this.state.detailsVisible ? '−':'+') : ' '} {macro.title}</span>
<div>
<span onClick={this.handleToggleDetails} style={{cursor: 'pointer'}}>
<span style={{lineHeight: '45px', display: 'inline-block', width: 32, paddingLeft: 3}}>
{hasConfig ? (this.state.detailsVisible ? (
<i className="fa fa-cog"/>
): (
<i className="fa fa-cog"/>
)) : ' '}
</span>
<span style={{lineHeight: '45px', display: 'inline-block', width: 300}}>
{macro.title}
</span>
</span>
<ShortcutsList id_macro={macro.id} shortcuts={macro.shortcuts} metadatas={metadata.actions}/>
<span className="pull-right">
<span className="btn btn-danger" data-id={macro.id} onClick={this.handleRemoveclick}>&times;</span>
Expand Down Expand Up @@ -88,7 +98,6 @@ class MacrosList extends React.Component {
macros: PropTypes.array.isRequired,
metadatas: PropTypes.object.isRequired,
onRemoveMacro: PropTypes.func.isRequired,
onMacroConfig: PropTypes.func.isRequired,
};

render() {
Expand All @@ -102,7 +111,7 @@ class MacrosList extends React.Component {
const shortcuts = macros.map((macro) => {
return (
<MacrosListItem key={`macro_${macro.id}`} macro={macro} metadata={this.props.metadatas[macro.name]}
onRemoveMacro={this.props.onRemoveMacro} onMacroConfig={this.props.onMacroConfig}/>
onRemoveMacro={this.props.onRemoveMacro} />
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/webapp/react-view-macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MacrosView extends React.Component {
<Button color="success" onClick={this.handleAddMacroClick}>Add Macro</Button>
</div>
<h2>Configured Macros</h2>
<MacrosList macros={props.macros} metadatas={props.metadatas} onRemoveMacro={this.handleRemoveMacro} onMacroConfig={this.handleShowMacroConfig} />
<MacrosList macros={props.macros} metadatas={props.metadatas} onRemoveMacro={this.handleRemoveMacro} />

{this.state.showPopupAddMacro && (
<PopupAddMacro onClose={this.handleCloseAddMacroPopup} onSubmit={this.handleSubmitAddMacroPopup} metadatas={props.metadatas}/>
Expand Down

0 comments on commit a0b8fff

Please sign in to comment.