@@ -5,14 +5,13 @@ import {
5
5
WorkspaceResource ,
6
6
} from "api/typesGenerated"
7
7
import { Loader } from "components/Loader/Loader"
8
- import { MemoizedMarkdown } from "components/Markdown/Markdown"
9
8
import { Stack } from "components/Stack/Stack"
10
9
import { TemplateResourcesTable } from "components/TemplateResourcesTable/TemplateResourcesTable"
11
10
import { TemplateStats } from "components/TemplateStats/TemplateStats"
12
- import frontMatter from "front-matter"
13
- import { FC } from "react"
11
+ import { FC , useEffect } from "react"
14
12
import { DAUChart } from "../../../components/DAUChart/DAUChart"
15
13
import { TemplateSummaryData } from "./data"
14
+ import { useLocation , useNavigate } from "react-router-dom"
16
15
17
16
export interface TemplateSummaryPageViewProps {
18
17
data ?: TemplateSummaryData
@@ -25,14 +24,22 @@ export const TemplateSummaryPageView: FC<TemplateSummaryPageViewProps> = ({
25
24
template,
26
25
activeVersion,
27
26
} ) => {
28
- const styles = useStyles ( )
27
+ const navigate = useNavigate ( )
28
+ const location = useLocation ( )
29
+
30
+ useEffect ( ( ) => {
31
+ if ( location . hash === "#readme" ) {
32
+ // We moved the readme to the docs page, but we known that some users
33
+ // have bookmarked the readme or linked it elsewhere. Redirect them to the docs page.
34
+ navigate ( `/templates/${ template . name } /docs` , { replace : true } )
35
+ }
36
+ } , [ template , navigate , location ] )
29
37
30
38
if ( ! data ) {
31
39
return < Loader />
32
40
}
33
41
34
42
const { daus, resources } = data
35
- const readme = frontMatter ( activeVersion . readme )
36
43
37
44
const getStartedResources = ( resources : WorkspaceResource [ ] ) => {
38
45
return resources . filter (
@@ -45,13 +52,6 @@ export const TemplateSummaryPageView: FC<TemplateSummaryPageViewProps> = ({
45
52
< TemplateStats template = { template } activeVersion = { activeVersion } />
46
53
{ daus && < DAUChart daus = { daus } /> }
47
54
< TemplateResourcesTable resources = { getStartedResources ( resources ) } />
48
-
49
- < div className = { styles . markdownSection } id = "readme" >
50
- < div className = { styles . readmeLabel } > README.md</ div >
51
- < div className = { styles . markdownWrapper } >
52
- < MemoizedMarkdown > { readme . body } </ MemoizedMarkdown >
53
- </ div >
54
- </ div >
55
55
</ Stack >
56
56
)
57
57
}
0 commit comments