codex/pagination-loading-indicator #20

Merged
ksv741 merged 6 commits from codex/pagination-loading-indicator into main 2026-06-18 07:29:36 +03:00
Showing only changes of commit cb90f3c1c0 - Show all commits

View File

@ -95,6 +95,7 @@ const pagButtonDisabledStyle = {
export function BrokerOperationsTable({
isLoading,
isFetching,
page,
pageNumber,
canGoBack,
@ -103,6 +104,7 @@ export function BrokerOperationsTable({
onNext,
}: {
isLoading: boolean;
isFetching: boolean;
page: BrokerOperationsPage | undefined;
pageNumber: number;
canGoBack: boolean;
@ -128,10 +130,17 @@ export function BrokerOperationsTable({
<button
type="button"
onClick={onPrevious}
disabled={!canGoBack}
style={canGoBack ? pagButtonStyle : pagButtonDisabledStyle}
disabled={!canGoBack || isFetching}
style={canGoBack && !isFetching ? pagButtonStyle : pagButtonDisabledStyle}
>
{isFetching ? (
<span
className="loading-spinner"
style={{ width: 14, height: 14, display: 'block' }}
/>
) : (
'←'
)}
</button>
<span
style={{
@ -147,10 +156,17 @@ export function BrokerOperationsTable({
<button
type="button"
onClick={onNext}
disabled={!canGoForward}
style={canGoForward ? pagButtonStyle : pagButtonDisabledStyle}
disabled={!canGoForward || isFetching}
style={canGoForward && !isFetching ? pagButtonStyle : pagButtonDisabledStyle}
>
{isFetching ? (
<span
className="loading-spinner"
style={{ width: 14, height: 14, display: 'block' }}
/>
) : (
'→'
)}
</button>
</div>
</div>
@ -180,9 +196,10 @@ export function BrokerOperationsTable({
/>
</table>
</div>
) : operations.length === 0 ? (
) : operations.length === 0 && !isFetching ? (
<p style={{ color: 'var(--color-text-secondary)' }}>Операций за выбранный период нет</p>
) : (
<div className="table-container">
<div style={{ overflowX: 'auto', background: 'var(--color-surface)' }}>
<table style={tableStyle}>
<thead>
@ -204,7 +221,6 @@ export function BrokerOperationsTable({
<tbody>
{operations.map((operation) => {
const impact = getBrokerOperationImpact(operation);
return (
<tr key={operation.cursor || operation.id}>
<td style={tdStyle}>{formatDate(operation.date)}</td>
@ -226,6 +242,15 @@ export function BrokerOperationsTable({
</tbody>
</table>
</div>
{isFetching && (
<div className="table-loading-overlay">
<div className="loading-spinner" />
<span style={{ fontSize: 13, color: 'var(--color-text-secondary)' }}>
Загрузка страницы {pageNumber}
</span>
</div>
)}
</div>
)}
</section>
);