Skip to content

Commit

Permalink
Merge pull request #703 from vtexdocs/feat/troubleshooting-section-su…
Browse files Browse the repository at this point in the history
…pport

feat(index.tsx): adding new support component to the troubleshooting page
  • Loading branch information
mariana-caetano authored Jun 20, 2024
2 parents 0f4b093 + 78f691b commit dddbbc0
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -14879,7 +14879,7 @@
"name": "VTEX Troubleshooting overview",
"slug": "overview",
"origin": "",
"type": "markdown",
"type": "category",
"children": [
{
"name": "Development",
Expand Down
1 change: 1 addition & 0 deletions src/messages/language.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"troubleshooting.description": "Find practical solutions to development issues.",
"troubleshooting.title": "Troubleshooting",
"troubleshooting.subtitle": "Find practical solutions to development issues in our troubleshooting guides.",
"troubleshooting_page_other_resources.title": "Still having trouble?",
"relese-note-days-elapsed": "days ago",
"error_loading_image": "An error occurred while trying to load the image.",
"multiselect_apply_button": "Apply",
Expand Down
27 changes: 26 additions & 1 deletion src/pages/docs/troubleshooting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment, useState, useContext, useMemo } from 'react'
import { Box, Flex } from '@vtex/brand-ui'
import { Box, Flex, Link, Text } from '@vtex/brand-ui'
import { GetStaticProps, NextPage } from 'next'
import getNavigation from 'utils/getNavigation'
import { DocumentationTitle, UpdatesTitle } from 'utils/typings/unionTypes'
Expand All @@ -13,6 +13,7 @@ import { PreviewContext } from 'utils/contexts/preview'
import getTroubleshootingData from 'utils/getTroubleshootingData'
import TroubleshootingCard from 'components/troubleshooting-card'
import Pagination from 'components/pagination'
import { resourceTroubleshooting } from 'utils/constants'

interface Props {
sidebarfallback: any //eslint-disable-line
Expand Down Expand Up @@ -81,6 +82,30 @@ const TroubleshootingPage: NextPage<Props> = ({
pageCount={page.total}
onPageChange={handleClick}
/>
<Box sx={styles.resourcesSectionContainer}>
<Text sx={styles.contentTitle}>
{messages['troubleshooting_page_other_resources.title']}
</Text>
<Box>
{resourceTroubleshooting.map((resourceTroubleshooting) => (
<Box
key={resourceTroubleshooting.title}
sx={styles.resourceContainer}
>
<Link
target="_blank"
href={resourceTroubleshooting.link}
sx={styles.resourceTitle}
>
{resourceTroubleshooting.title}
</Link>
<Text sx={styles.resourceDescription}>
{resourceTroubleshooting.description}
</Text>
</Box>
))}
</Box>
</Box>
</Box>
</Fragment>
</>
Expand Down
23 changes: 23 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
getLearningCenterURL,
getGithubURL,
getHelpCenterURL,
getHelpCenterTroubleshootingURL,
getSupportURL,
} from 'utils/get-url'

Expand All @@ -22,6 +23,7 @@ import {
CodeSamplesElement,
ResourceDataElement,
AdminDataElement,
ResourceDataTroubleshooting,
} from './typings/types'
import EditIcon from 'components/icons/edit-icon'
import MenuIcon from 'components/icons/menu-icon'
Expand Down Expand Up @@ -184,6 +186,27 @@ export const resources: ResourceDataElement[] = [
},
]

export const resourceTroubleshooting: ResourceDataTroubleshooting[] = [
{
title: 'Community',
description:
messages['app_development_page_other_resources_community.description'],
link: getCommunityURL(),
},
{
title: 'Help Center',
description:
messages['app_development_page_other_resources_help_center.description'],
link: getHelpCenterTroubleshootingURL(),
},
{
title: 'Support',
description:
messages['app_development_page_other_resources_support.description'],
link: getSupportURL(),
},
]

export const codeSamples: CodeSamplesElement[] = [
{
title: 'React app',
Expand Down
4 changes: 4 additions & 0 deletions src/utils/get-url.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const getHelpCenterURL = () => {
return `https://help.vtex.com/`
}

export const getHelpCenterTroubleshootingURL = () => {
return `https://help.vtex.com/category/troubleshooting--39pDkp8qxSll6mGj0tWViz`
}

export const getCommunityURL = () => {
return `https://community.vtex.com/?_ga=2.198523433.743584735.1647618303-1974737580.1645714642`
}
Expand Down
7 changes: 7 additions & 0 deletions src/utils/typings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
UpdatesTitle,
ResourceTitle,
AdminTitle,
ResourceTitleTroubleshooting,
} from './unionTypes'

// eslint-disable-next-line @typescript-eslint/ban-types
Expand Down Expand Up @@ -77,6 +78,12 @@ export type ResourceDataElement = {
link: string
}

export type ResourceDataTroubleshooting = {
title: ResourceTitleTroubleshooting
description: string
link: string
}

export type SelectOption = {
id: string
label: string
Expand Down
5 changes: 5 additions & 0 deletions src/utils/typings/unionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export type ResourceTitle =
| 'Help Center'
| 'Support'

export type ResourceTitleTroubleshooting =
| 'Community'
| 'Help Center'
| 'Support'

export type MethodType = 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH'

export function isMethodType(value: string): value is MethodType {
Expand Down

0 comments on commit dddbbc0

Please sign in to comment.