Skip to content

Commit

Permalink
fix(platform): correct docs links
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyi.levi committed Sep 26, 2022
1 parent 4ad1a03 commit 9271f19
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/platform/src/modules/access-token/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import dayjs from 'dayjs'
import { useCallback, useEffect, useRef } from 'react'

import { ForeignLink, useToggleState } from '@perfsee/components'
import { staticPath } from '@perfsee/shared/routes'

import { AccessTokenModule } from './access-token.module'
import { GenerateToken } from './generate-token'
Expand Down Expand Up @@ -82,7 +83,7 @@ export const AccessToken = () => {
/>
</div>
<Text variant="small">
Check out <ForeignLink href="https://perfsee.com/docs/api">Perfsee API</ForeignLink> docs.
Check out <ForeignLink href={staticPath.docs.api}>Perfsee API</ForeignLink> docs.
</Text>
</Stack>
<ListWrap>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const HomeBanner = () => {
<Link to={staticPath.projects}>
<PrimaryButton>Try now</PrimaryButton>
</Link>
<ForeignLink href="/docs">
<ForeignLink href={staticPath.docs.home}>
<DefaultButton>Docs</DefaultButton>
</ForeignLink>
</ButtonsWrap>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const Header = () => {
<Link to={staticPath.projects}>
<MediumPrimaryButton>Try now</MediumPrimaryButton>
</Link>
<ForeignLink href="/docs">
<ForeignLink href={staticPath.docs.home}>
<MediumDefaultButton>Docs</MediumDefaultButton>
</ForeignLink>
</ButtonsWrap>
Expand Down
4 changes: 2 additions & 2 deletions packages/platform/src/modules/layout/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export const Footer: FC<Props> = memo(({ isAdmin }) => {
<Container>
<Line />
<Links>
<FooterForeignLink href="/docs">Documents</FooterForeignLink>
<FooterForeignLink href={staticPath.docs.home}>Documents</FooterForeignLink>
<wbr />
<FooterForeignLink href="/docs/api">API</FooterForeignLink>
<FooterForeignLink href={staticPath.docs.api}>API</FooterForeignLink>
<wbr />
<FooterLink to={staticPath.status}>Status</FooterLink>
<wbr />
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/modules/layout/operations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Operations = () => {
() => (
<>
<Link to={staticPath.accessToken}>API</Link>
<ForeignLink href={`${staticPath.home}/docs`}>Docs</ForeignLink>
<ForeignLink href={staticPath.docs.home}>Docs</ForeignLink>
{loggedIn && <a href={SERVER + `/auth/logout`}>Logout</a>}
</>
),
Expand Down
6 changes: 6 additions & 0 deletions packages/shared/src/routes/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function makePathsFrom<Params = void>(path: string) {

export interface RouteTypes {
home: void
docs: { home: void; api: void }
features: { home: void; bundle: void; lab: void; source: void }
projects: void
notFound: void
Expand Down Expand Up @@ -45,6 +46,7 @@ export interface RouteTypes {

export const staticPath = {
home: '/',
docs: { home: '/docs', api: '/docs/api' },
features: { home: '/features', bundle: '/features/bundle', lab: '/features/lab', source: '/features/source' },
projects: '/projects',
notFound: '/404',
Expand Down Expand Up @@ -80,6 +82,10 @@ export const staticPath = {

export const pathFactory = {
home: makePathsFrom<FactoryParams<RouteTypes['home']>>('/'),
docs: {
home: makePathsFrom<FactoryParams<RouteTypes['docs']['home']>>('/docs'),
api: makePathsFrom<FactoryParams<RouteTypes['docs']['api']>>('/docs/api'),
},
features: {
home: makePathsFrom<FactoryParams<RouteTypes['features']['home']>>('/features'),
bundle: makePathsFrom<FactoryParams<RouteTypes['features']['bundle']>>('/features/bundle'),
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/src/routes/router.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
base: /
paths:
docs:
base: /docs
paths:
api: /api
features:
base: /features
paths:
Expand Down

0 comments on commit 9271f19

Please sign in to comment.