-
Notifications
You must be signed in to change notification settings - Fork 212
W-18672586 - Update Error Component with Chakra v3 #2776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
d9bfb66
80d87e1
cf7c442
9475ebe
23f6e5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,11 +23,10 @@ import {withChakraUI} from '../with-chakra-ui' | |
|
|
||
| const Error = (props) => { | ||
| const {message, stack} = props | ||
| const history = useHistory() | ||
|
|
||
| const title = "This page isn't working" | ||
| return ( | ||
| <Flex id="sf-app" flex={1} direction="column" minWidth={'375px'}> | ||
| <Flex id="sf-app" flex="1" direction="column" minWidth="375px"> | ||
| <Helmet> | ||
| <title>{title}</title> | ||
| </Helmet> | ||
|
|
@@ -36,60 +35,64 @@ const Error = (props) => { | |
| maxWidth="container.xxxl" | ||
| marginLeft="auto" | ||
| marginRight="auto" | ||
| px={[4, 4, 6, 8]} | ||
| paddingTop={[1, 1, 2, 4]} | ||
| paddingBottom={[3, 3, 2, 4]} | ||
| px={['4', '4', '6', '8']} | ||
| paddingTop={['1', '1', '2', '4']} | ||
| paddingBottom={['3', '3', '2', '4']} | ||
| > | ||
| <IconButton | ||
| aria-label="logo" | ||
| icon={<BrandLogo width={[8, 8, 8, 12]} height={[6, 6, 6, 8]} />} | ||
| marginBottom={[1, 1, 2, 0]} | ||
| marginBottom={['1', '1', '2', '0']} | ||
| variant="unstyled" | ||
| onClick={() => history.push('/')} | ||
| /> | ||
| // We need to use window.location.href here rather than history | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sense to me. Just curious, was it working before?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you meant if history was working before? I suppose it was not, so we changed to use window.location. |
||
| // as the application is in an error state. We need to force a | ||
| // hard navigation to get back to the normal state. | ||
| onClick={() => (window.location.href = '/')} | ||
| > | ||
| <BrandLogo width={{base: '8', lg: '12'}} height={{base: '6', lg: '8'}} /> | ||
| </IconButton> | ||
| </Box> | ||
| </Box> | ||
| <Box | ||
| as="main" | ||
| id="app-main" | ||
| role="main" | ||
| layerStyle="page" | ||
| padding={{lg: 8, md: 6, sm: 0, base: 0}} | ||
| flex={1} | ||
| padding={{lg: '8', md: '6', sm: '0', base: '0'}} | ||
| flex="1" | ||
| > | ||
| <Flex | ||
| direction={'column'} | ||
| justify="center" | ||
| px={{base: 4, md: 6, lg: 50}} | ||
| py={{base: 20, md: 24}} | ||
| px={{base: '4', md: '6', lg: '50'}} | ||
| py={{base: '20', md: '24'}} | ||
| > | ||
| <Flex align="center" direction="column"> | ||
| <FileIcon boxSize={['30px', '32px']} mb={8} /> | ||
| <Heading as="h2" fontSize={['xl', '2xl', '2xl', '3xl']} mb={2}> | ||
| <FileIcon boxSize={['30px', '32px']} mb="8" /> | ||
| <Heading as="h2" fontSize={['xl', '2xl', '2xl', '3xl']} mb="2"> | ||
| {title} | ||
| </Heading> | ||
| <Box maxWidth="440px" marginBottom={8}> | ||
| <Box maxWidth="440px" marginBottom="8"> | ||
| <Text align="center"> | ||
| An error has occurred. Try refreshing the page or if you need | ||
| immediate help please contact support. | ||
| </Text> | ||
| {message && ( | ||
| <Box | ||
| as="pre" | ||
| mt={4} | ||
| mt="4" | ||
| padding="4" | ||
| fontSize="sm" | ||
| background="gray.50" | ||
| borderColor="gray.200" | ||
| borderStyle="solid" | ||
| borderWidth="1px" | ||
| overflow="auto" | ||
| padding={4} | ||
| > | ||
| {message} | ||
| </Box> | ||
| )} | ||
| </Box> | ||
| <Stack direction={['column', 'row']} spacing={4} width={['100%', 'auto']}> | ||
| <Stack direction={['column', 'row']} gap="4" width={['100%', 'auto']}> | ||
| <Button | ||
| variant="outline" | ||
| bg="white" | ||
|
|
@@ -106,20 +109,20 @@ const Error = (props) => { | |
| </Stack> | ||
| </Flex> | ||
| {stack && ( | ||
| <Box marginTop={20}> | ||
| <Box marginTop="20"> | ||
| <Text fontWeight="bold" fontSize="md"> | ||
| Stack Trace | ||
| </Text> | ||
| <Box | ||
| as="pre" | ||
| mt={4} | ||
| mt="4" | ||
| fontSize="sm" | ||
| background="gray.50" | ||
| borderColor="gray.200" | ||
| borderStyle="solid" | ||
| borderWidth="1px" | ||
| overflow="auto" | ||
| padding={4} | ||
| padding="4" | ||
| > | ||
| {stack} | ||
| </Box> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,10 +22,9 @@ import {useCategory, useShopperBasketsMutation} from '@salesforce/commerce-sdk-r | |
| import { | ||
| Box, | ||
| Center, | ||
| Button, | ||
| Flex, | ||
| Heading, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused components |
||
| Spinner, | ||
|
|
||
| // hooks | ||
| useDisclosure, | ||
| useSlotRecipe, | ||
| useToken | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,8 +109,7 @@ const ProductList = (props) => { | |
| const { | ||
| pages: {ProductList: productListConfig}, | ||
| maxCacheAge: MAX_CACHE_AGE, | ||
| staleWhileRevalidate: STALE_WHILE_REVALIDATE, | ||
| search: searchConfig | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I take it we weren't using this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, we don't need this data in this page anymore |
||
| staleWhileRevalidate: STALE_WHILE_REVALIDATE | ||
| } = useExtensionConfig() | ||
| /**************** Page State ****************/ | ||
| const [filtersLoading, setFiltersLoading] = useState(false) | ||
|
|
@@ -221,7 +220,6 @@ const ProductList = (props) => { | |
| // Get urls to be used for pagination, page size changes, and sorting. | ||
| const pageUrls = usePageUrls({total}) | ||
| const sortUrls = useSortUrls({options: sortingOptions}) | ||
| const limitUrls = useLimitUrls() | ||
|
|
||
| /**************** Action Handlers ****************/ | ||
| const {data: wishlist} = useWishList() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ import {useIntl} from 'react-intl' | |
| import {RadioGroup, Stack} from '@chakra-ui/react' | ||
| import {ADD_FILTER, REMOVE_FILTER} from '../../../pages/product-list/partials/refinements-utils' | ||
|
|
||
| const RadioRefinement = ({filter, value, toggleFilter, isSelected}) => { | ||
| const RadioRefinement = ({value, isSelected}) => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are not using |
||
| const {formatMessage} = useIntl() | ||
| // Because choosing a refinement is equivalent to a form submission, the best semantic choice | ||
| // for the refinement is a button or a link, rather than a radio input. The radio element here | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| */ | ||
|
|
||
| import React from 'react' | ||
| import {Heading, Stack, Separator, Accordion} from '@chakra-ui/react' | ||
| import {Heading, Stack, Accordion} from '@chakra-ui/react' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed unused Component |
||
| import PropTypes from 'prop-types' | ||
| import ColorRefinements from '../../../pages/product-list/partials/color-refinements' | ||
| import SizeRefinements from '../../../pages/product-list/partials/size-refinements' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,14 +74,14 @@ class ChakraStorefront extends ApplicationExtension<Config> { | |
| component: Pages.Registration, | ||
| exact: true | ||
| }, | ||
| // { | ||
| // path: [ | ||
| // config.pages.ResetPassword && config.pages.ResetPassword.path, | ||
| // config.login.resetPassword && config.login.resetPassword.landingPath | ||
| // ].filter(Boolean), | ||
| // component: Pages.ResetPassword, | ||
| // exact: true | ||
| // }, | ||
| { | ||
| path: [ | ||
| config.pages.ResetPassword && config.pages.ResetPassword.path, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've fixed this page, I re-enabled it |
||
| config.login.resetPassword && config.login.resetPassword.landingPath | ||
| ].filter(Boolean), | ||
| component: Pages.ResetPassword, | ||
| exact: true | ||
| }, | ||
| // { | ||
| // path: config.pages.Account && config.pages.Account.path, | ||
| // component: Pages.Account | ||
|
|
||
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.
unused