-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix ErrBlockNotFound page * Improve invalid election page * Implement tx not found page * Fix translation
- Loading branch information
Showing
8 changed files
with
137 additions
and
24 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,39 @@ | ||
import { Text } from '@chakra-ui/react' | ||
import { useRouteError } from 'react-router-dom' | ||
import { Flex, Heading, Text } from '@chakra-ui/react' | ||
import { useParams, useRouteError } from 'react-router-dom' | ||
import ShowRawButton from '~components/Layout/ShowRawButton' | ||
import RouteError from '~src/router/errors/RouteError' | ||
import { PublishedElection } from '@vocdoni/sdk' | ||
import { ReducedTextAndCopy } from '~components/Layout/CopyButton' | ||
|
||
export const ElectionError = () => { | ||
const error = useRouteError() as Error & { raw?: unknown; electionId: string } | ||
const { pid }: { pid?: string } = useParams() | ||
|
||
const electionId = pid || error.electionId || '' | ||
|
||
let raw: any | ||
let title = '' | ||
if (error.raw) { | ||
raw = error.raw | ||
title = raw['metadata']['title']['default'] | ||
} | ||
|
||
return ( | ||
<> | ||
<Flex direction={'column'} mt={{ base: '20px', lg: '40px' }} gap={6} wordBreak='break-all'> | ||
{!!title && ( | ||
<Heading fontSize={'2xl'} fontWeight='bold'> | ||
{title} | ||
</Heading> | ||
)} | ||
{!!electionId && ( | ||
<Flex> | ||
<ReducedTextAndCopy fontSize={'lg'} color={'textAccent1'} toCopy={electionId}> | ||
{electionId} | ||
</ReducedTextAndCopy> | ||
</Flex> | ||
)} | ||
<RouteError /> | ||
{!!error.electionId && <Text fontWeight='bold'>{error.electionId}</Text>} | ||
{!!error.raw && <ShowRawButton obj={error.raw} />} | ||
</> | ||
{!!raw && <ShowRawButton obj={raw} />} | ||
</Flex> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Alert, AlertIcon, Code, Flex, Heading, Stack, Text, VStack } from '@chakra-ui/react' | ||
import { ErrTransactionNotFound } from '@vocdoni/sdk' | ||
import { Trans } from 'react-i18next' | ||
import { useParams, useRouteError } from 'react-router-dom' | ||
import RouteError from '~src/router/errors/RouteError' | ||
|
||
export const TransactionNotFound = () => { | ||
const error = useRouteError() as Error | ||
const { block, index, hashOrHeight }: { block?: string; index?: string; hashOrHeight?: string } = useParams() | ||
|
||
if (error instanceof ErrTransactionNotFound) { | ||
return ( | ||
<Flex direction={'column'} mt={{ base: '20px', lg: '40px' }} gap={6} wordBreak='break-all'> | ||
<VStack align='start'> | ||
<Heading isTruncated wordBreak='break-word' mb={0}> | ||
<Trans i18nKey={'transactions.not_found'}>Transaction not found</Trans> | ||
</Heading> | ||
</VStack> | ||
<Flex gap={2}> | ||
{!!block && ( | ||
<Text> | ||
<Trans i18nKey={'transactions.on_block'} block={block}> | ||
On block {{ block }} | ||
</Trans> | ||
</Text> | ||
)} | ||
{!!index && ( | ||
<Text> | ||
<Trans i18nKey={'transactions.with_index'} index={index}> | ||
With index {{ index }} | ||
</Trans> | ||
</Text> | ||
)} | ||
{!!hashOrHeight && ( | ||
<Text> | ||
<Trans i18nKey={'transactions.with_hash_or_height'} hashOrHeight={hashOrHeight}> | ||
With hash or height {{ hashOrHeight }} | ||
</Trans> | ||
</Text> | ||
)} | ||
</Flex> | ||
<Stack spacing={4}> | ||
<Alert status='warning'> | ||
<AlertIcon /> | ||
<Trans i18nKey={'transactions.not_found_message'}> | ||
The transaction you are trying to access is not found | ||
</Trans> | ||
</Alert> | ||
<Code>{error.message}</Code> | ||
</Stack> | ||
</Flex> | ||
) | ||
} | ||
|
||
return <RouteError /> | ||
} |
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
6a1b53f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Published on https://vocdoni-explorer-stg.netlify.app as production
π Deployed on https://66c8483c85fd0744427bff44--vocdoni-explorer-stg.netlify.app
6a1b53f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Published on https://vocdoni-explorer-dev.netlify.app as production
π Deployed on https://66c8483e0c815f45a087999d--vocdoni-explorer-dev.netlify.app