Skip to content

Commit

Permalink
Newswires UI: Update pagination logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-dev committed Jan 24, 2025
1 parent 6b19f70 commit b16349f
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 259 deletions.
61 changes: 30 additions & 31 deletions newswires/client/src/Feed.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
import { EuiEmptyPrompt, EuiLoadingLogo, EuiPageTemplate } from '@elastic/eui';
import { useSearch } from './context/SearchContext.tsx';
import { WireItemTable } from './WireItemTable';
import {EuiEmptyPrompt, EuiLoadingLogo, EuiPageTemplate} from '@elastic/eui';

Check warning on line 1 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `EuiEmptyPrompt,·EuiLoadingLogo,·EuiPageTemplate` with `·EuiEmptyPrompt,·EuiLoadingLogo,·EuiPageTemplate·`
import {useSearch} from './context/SearchContext.tsx';

Check warning on line 2 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `useSearch` with `·useSearch·`
import {WireItemTable} from './WireItemTable';

Check warning on line 3 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `WireItemTable` with `·WireItemTable·`

export const Feed = () => {
const { state } = useSearch();
const {state} = useSearch();

Check warning on line 6 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `····const·{state` with `↹const·{·state·`

const { status, queryData } = state;
const {status, queryData} = state;

Check warning on line 8 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `····const·{status,·queryData` with `↹const·{·status,·queryData·`

return (
<EuiPageTemplate.Section>
{status == 'loading' && (
<EuiEmptyPrompt
icon={<EuiLoadingLogo logo="clock" size="l" />}
title={<h2>Loading Wires</h2>}
/>
)}
{(status == 'success' || status == 'offline') &&
queryData.results.length === 0 && (
<EuiEmptyPrompt
body={<p>Try a different search term</p>}
color="subdued"
layout="horizontal"
title={<h2>No results match your search criteria</h2>}
titleSize="s"
/>
)}
{(status == 'success' ||
status == 'offline' ||
status == 'loading-more') &&
queryData.results.length > 0 && (
<WireItemTable wires={queryData.results} />
)}
</EuiPageTemplate.Section>
);
return (

Check warning on line 10 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `····` with `↹`
<EuiPageTemplate.Section>

Check warning on line 11 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `········` with `↹↹`
{status == 'loading' && (

Check warning on line 12 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `············` with `↹↹↹`
<EuiEmptyPrompt

Check warning on line 13 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `················` with `↹↹↹↹`
icon={<EuiLoadingLogo logo="clock" size="l"/>}

Check warning on line 14 in newswires/client/src/Feed.tsx

View workflow job for this annotation

GitHub Actions / Build and upload to riffraff

Replace `····················icon={<EuiLoadingLogo·logo="clock"·size="l"` with `↹↹↹↹↹icon={<EuiLoadingLogo·logo="clock"·size="l"·`
title={<h2>Loading Wires</h2>}
/>
)}
{(status == 'success' || status == 'offline') &&
queryData.results.length === 0 && (
<EuiEmptyPrompt
body={<p>Try a different search term</p>}
color="subdued"
layout="horizontal"
title={<h2>No results match your search criteria</h2>}
titleSize="s"
/>
)}
{(status == 'success' ||
status == 'offline') &&
queryData.results.length > 0 && (
<WireItemTable wires={queryData.results}/>
)}
</EuiPageTemplate.Section>
);
};
Loading

0 comments on commit b16349f

Please sign in to comment.