Skip to content

Commit

Permalink
improve ux
Browse files Browse the repository at this point in the history
  • Loading branch information
baudelotphilippe committed Dec 10, 2024
1 parent d6af228 commit d78e013
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions otoroshi/javascript/src/components/inputs/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,21 @@ function ColumnsSelector({ fields, onChange, fetchTemplate, addField, removeFiel
onClick={(e) => e.stopPropagation()}
>
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', padding: '2.5rem' }}>
<div className="d-flex items-center">
<i
className="fa fa-chevron-left me-3"
style={{ cursor: 'pointer' }}
onClick={() => {
if (isCustomFieldView) showCustomField(false);
else closeTab();
}}
/>
<h3 style={{ fontSize: '1.5rem' }} className="text-center">
{isCustomFieldView ? 'New custom field' : 'Columns'}
</h3>
<div className="d-flex justify-content-between">
<div className='d-flex items-center'>
<i
className="fa fa-chevron-left me-3"
style={{ cursor: 'pointer' }}
onClick={() => {
if (isCustomFieldView) showCustomField(false);
else closeTab();
}}
/>
<h3 style={{ fontSize: '1.5rem' }} className="text-center">
{isCustomFieldView ? 'New column' : 'Columns'}
</h3>
</div>
<Button type="quiet" text="X" onClick={closeTab} className="btn-sm" />
</div>

<div className="wizard-content">
Expand All @@ -110,7 +113,7 @@ function ColumnsSelector({ fields, onChange, fetchTemplate, addField, removeFiel
<NgStringRenderer label="Field path" onChange={setFieldPath} value={fieldPath} />
<Button
type="save"
text="Add custom field"
text="Add this column"
onClick={() => addField(fieldPath)}
className="my-2"
disabled={stringifiedExampleValue.length <= 0}
Expand Down Expand Up @@ -185,9 +188,12 @@ function ColumnsSelector({ fields, onChange, fetchTemplate, addField, removeFiel
key={column}
>
<div className="d-flex items-center">
<label className={`col-xs-12 col-form-label`}>
{firstLetterUppercase(columnParts.slice(-1)[0]).replace(/_/g, ' ')}{' '}
</label>
{coreFields && !coreFields.includes(column) && (
<Button
className="btn-sm me-2"
className="btn-sm ms-2"
type="danger"
onClick={(e) => {
e.stopPropagation();
Expand All @@ -197,9 +203,6 @@ function ColumnsSelector({ fields, onChange, fetchTemplate, addField, removeFiel
<i className="fa fa-trash" />
</Button>
)}
<label className={`col-xs-12 col-form-label`}>
{firstLetterUppercase(columnParts.slice(-1)[0]).replace(/_/g, ' ')}{' '}
</label>
</div>
<div className="">
{enabled && <OnSwitch onChange={() => onChange(column, false)} />}
Expand All @@ -216,14 +219,13 @@ function ColumnsSelector({ fields, onChange, fetchTemplate, addField, removeFiel
}}
onClick={() => showCustomField(true)}
>
Add custom field
Add a column
<i className="fa fa-chevron-right ms-1" />
</Button>
</>
)}
</div>

<Button text="Close" onClick={closeTab} className="mt-2" />
</div>
</div>
</div>
Expand All @@ -232,8 +234,8 @@ function ColumnsSelector({ fields, onChange, fetchTemplate, addField, removeFiel
className="ms-auto btn-sm d-flex align-items-center mb-1"
onClick={() => setOpen(true)}
>
<i className="fas fa-filter me-1" />
Filter columns
<i className="fas fa-table-columns me-1" />
Columns
</Button>
</>
);
Expand Down

0 comments on commit d78e013

Please sign in to comment.