0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(console): improve org settings page

This commit is contained in:
Gao Sun 2023-10-26 18:38:17 +08:00
parent c4826556d9
commit 929f2d6c37
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
4 changed files with 44 additions and 33 deletions

View file

@ -20,7 +20,7 @@
justify-content: flex-start;
flex-wrap: wrap;
gap: _.unit(2);
padding: _.unit(2) _.unit(3);
padding: _.unit(1.5) _.unit(3);
cursor: text;
.tag {

View file

@ -110,7 +110,7 @@ function RoleModal({ isOpen, editData, onClose }: Props) {
</FormField>
<FormField title="general.description">
<TextInput
placeholder="organizations.create_role_placeholder"
placeholder={t('organizations.create_role_placeholder')}
error={Boolean(errors.description)}
{...register('description')}
/>

View file

@ -7,3 +7,7 @@
.table {
margin-top: _.unit(3);
}
.spinner {
margin: _.unit(2) 0;
}

View file

@ -4,6 +4,7 @@ import CirclePlus from '@/assets/icons/circle-plus.svg';
import Plus from '@/assets/icons/plus.svg';
import EmptyDataPlaceholder from '@/components/EmptyDataPlaceholder';
import Button from '@/ds-components/Button';
import { Ring as Spinner } from '@/ds-components/Spinner';
import Table from '@/ds-components/Table';
import { type Column } from '@/ds-components/Table/types';
@ -39,40 +40,46 @@ function TemplateTable<
isLoading,
onPageChange,
}: Props<TFieldValues, TName>) {
const hasData = data.length > 0;
const hasData = !isLoading && data.length > 0;
if (isLoading) {
<Spinner className={styles.spinner} />;
}
return (
<>
<Table
hasBorder
placeholder={<EmptyDataPlaceholder />}
isLoading={isLoading}
className={styles.table}
rowGroups={[
{
key: 'data',
data,
},
]}
columns={columns}
rowIndexKey={rowIndexKey}
pagination={{
page,
totalCount,
pageSize,
onChange: onPageChange,
}}
footer={
<Button
size="small"
type="text"
className={styles.addButton}
icon={<CirclePlus />}
title="general.create_another"
onClick={onAdd}
/>
}
/>
{hasData && (
<Table
hasBorder
placeholder={<EmptyDataPlaceholder />}
isLoading={isLoading}
className={styles.table}
rowGroups={[
{
key: 'data',
data,
},
]}
columns={columns}
rowIndexKey={rowIndexKey}
pagination={{
page,
totalCount,
pageSize,
onChange: onPageChange,
}}
footer={
<Button
size="small"
type="text"
className={styles.addButton}
icon={<CirclePlus />}
title="general.create_another"
onClick={onAdd}
/>
}
/>
)}
{onAdd && !hasData && (
<Button
className={styles.addButton}