mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-26 04:24:44 +03:00
feat(clients): tint rows and cards of depleting and ended clients (#7084)
An operator scanning a long client list for renewals had only a small tag in one column to go by. Tint the table row and the mobile card amber when the client is about to run out of time or traffic and red once it has, using the theme's warning and error tokens so all three themes follow. A selected row keeps its selection colour.
This commit is contained in:
@@ -338,3 +338,45 @@
|
||||
text-align: center;
|
||||
color: var(--ant-color-text-secondary);
|
||||
}
|
||||
|
||||
.clients-page
|
||||
.ant-table-wrapper
|
||||
.ant-table-tbody
|
||||
> tr.client-row-expiring:not(.ant-table-row-selected)
|
||||
> td {
|
||||
background: var(--ant-color-warning-bg);
|
||||
}
|
||||
|
||||
.clients-page
|
||||
.ant-table-wrapper
|
||||
.ant-table-tbody
|
||||
> tr.client-row-expiring:not(.ant-table-row-selected):hover
|
||||
> td {
|
||||
background: var(--ant-color-warning-bg-hover);
|
||||
}
|
||||
|
||||
.clients-page
|
||||
.ant-table-wrapper
|
||||
.ant-table-tbody
|
||||
> tr.client-row-depleted:not(.ant-table-row-selected)
|
||||
> td {
|
||||
background: var(--ant-color-error-bg);
|
||||
}
|
||||
|
||||
.clients-page
|
||||
.ant-table-wrapper
|
||||
.ant-table-tbody
|
||||
> tr.client-row-depleted:not(.ant-table-row-selected):hover
|
||||
> td {
|
||||
background: var(--ant-color-error-bg-hover);
|
||||
}
|
||||
|
||||
.client-card.is-expiring:not(.is-selected) {
|
||||
border-color: var(--ant-color-warning-border);
|
||||
background: var(--ant-color-warning-bg);
|
||||
}
|
||||
|
||||
.client-card.is-depleted:not(.is-selected) {
|
||||
border-color: var(--ant-color-error-border);
|
||||
background: var(--ant-color-error-bg);
|
||||
}
|
||||
|
||||
@@ -1241,6 +1241,16 @@ export default function ClientsPage() {
|
||||
],
|
||||
);
|
||||
|
||||
const rowClassName = useCallback(
|
||||
(record: ClientRecord) => {
|
||||
const bucket = clientBucket(record);
|
||||
if (bucket === 'depleted') return 'client-row-depleted';
|
||||
if (bucket === 'expiring') return 'client-row-expiring';
|
||||
return '';
|
||||
},
|
||||
[clientBucket],
|
||||
);
|
||||
|
||||
const tablePagination = {
|
||||
current: currentPage,
|
||||
pageSize: tablePageSize,
|
||||
@@ -1708,6 +1718,7 @@ export default function ClientsPage() {
|
||||
loading={transitioning}
|
||||
rowKey="email"
|
||||
rowSelection={rowSelection}
|
||||
rowClassName={rowClassName}
|
||||
pagination={tablePagination}
|
||||
size="small"
|
||||
scroll={{ x: 1200 }}
|
||||
@@ -1767,11 +1778,13 @@ export default function ClientsPage() {
|
||||
)}
|
||||
{filteredClients.map((row) => {
|
||||
const bucket = clientBucket(row);
|
||||
const cardClass = ['client-card'];
|
||||
if (selectedRowKeys.includes(row.email))
|
||||
cardClass.push('is-selected');
|
||||
if (bucket === 'depleted' || bucket === 'expiring')
|
||||
cardClass.push(`is-${bucket}`);
|
||||
return (
|
||||
<div
|
||||
key={row.email}
|
||||
className={`client-card${selectedRowKeys.includes(row.email) ? ' is-selected' : ''}`}
|
||||
>
|
||||
<div key={row.email} className={cardClass.join(' ')}>
|
||||
<div className="card-head">
|
||||
<Checkbox
|
||||
checked={selectedRowKeys.includes(row.email)}
|
||||
|
||||
Reference in New Issue
Block a user