-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aeff35e
commit 8a3207a
Showing
29 changed files
with
86 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ describe('pagination', () => { | |
pages: 7, | ||
prev_num: 3, | ||
total: 7, | ||
page: 4, | ||
}; | ||
|
||
test('first', () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 14 additions & 20 deletions
34
components/report-view/claimInfo.tsx → components/report-view/ClaimInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,42 @@ | ||
import { type ReactElement } from 'react'; | ||
import { type FC } from 'react'; | ||
import { useQuery } from 'react-query'; | ||
import { LoadingOverlay } from 'components/loadingOverlay'; | ||
import ResultInfo from './ResultInfo'; | ||
import { truthyOrNoneTag } from 'components/utility'; | ||
import { Badge } from 'react-bootstrap'; | ||
import useApi from 'lib/useApi'; | ||
import { type Claim } from '@eosc-perf/eosc-perf-client'; | ||
import useUser from 'lib/useUser'; | ||
|
||
type ClaimInfoProps = { id: string; claim: undefined } | { id: undefined; claim: Claim }; | ||
|
||
export const ClaimInfo: React.FC<ClaimInfoProps> = (props): ReactElement => { | ||
const ClaimInfo: FC<ClaimInfoProps> = ({ id, claim: claimCache }) => { | ||
const auth = useUser(); | ||
const api = useApi(auth.token); | ||
|
||
const claim = useQuery( | ||
['claim', props.id], | ||
() => api.reports.getClaim(props.id ?? props.claim.id), | ||
{ | ||
enabled: props.claim === undefined, | ||
} | ||
); | ||
const claim = useQuery(['claim', id], () => api.reports.getClaim(id ?? claimCache.id), { | ||
enabled: claimCache === undefined, | ||
}); | ||
|
||
// use local copy if available | ||
let claimData: Claim | undefined = props.claim; | ||
if (props.claim === undefined && props.id !== undefined && claim.isSuccess && claim.data) { | ||
claimData = claim.data.data; | ||
} | ||
const claimData = | ||
claimCache !== undefined ? claimCache : claim.isSuccess ? claim.data.data : undefined; | ||
|
||
return ( | ||
<> | ||
{props.id === undefined && props.claim === undefined && ( | ||
<Badge bg="danger">No claim data available</Badge> | ||
)} | ||
{claim.isLoading && <LoadingOverlay />} | ||
{claim.isSuccess && claimData && ( | ||
{claimData && ( | ||
<> | ||
Message: {truthyOrNoneTag(claimData.message)} <br /> | ||
Claimant: {claimData.uploader.email} <br /> | ||
{claimData.resource_type === 'result' && ( | ||
{ | ||
//claimData.resource_type === 'result' && ( | ||
<ResultInfo id={claimData.resource_id} /> | ||
)} | ||
//) | ||
} | ||
</> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default ClaimInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.