@@ -7,26 +7,10 @@ import {
7
7
import type { LinksFunction , LoaderFunction , V2_MetaFunction } from '@remix-run/node' ;
8
8
import { json , redirect } from '@remix-run/node' ;
9
9
import { getConfig , getPage } from '~/utils/loaders.server' ;
10
- import type { SiteManifest } from 'myst-config' ;
10
+ import Page from './$' ;
11
+ import { SiteManifest } from 'myst-config' ;
11
12
import { getProject } from '@myst-theme/common' ;
12
13
13
- import { } from '@remix-run/node' ;
14
- import { type PageLoader } from '@myst-theme/common' ;
15
- import { useOutlineHeight , useSidebarHeight , PrimaryNavigation , TopNav } from '@myst-theme/site' ;
16
- import { useLoaderData } from '@remix-run/react' ;
17
- import {
18
- TabStateProvider ,
19
- UiStateProvider ,
20
- useBaseurl ,
21
- useSiteManifest ,
22
- useThemeTop ,
23
- ProjectProvider ,
24
- } from '@myst-theme/providers' ;
25
- import { MadeWithMyst } from '@myst-theme/icons' ;
26
- import DefaultPageRoute from './$' ;
27
- import { ArticlePage } from '../components/ArticlePage.js' ;
28
- import { ComputeOptionsProvider , ThebeLoaderAndServer } from '@myst-theme/jupyter' ;
29
- import type { TemplateOptions } from '../types.js' ;
30
14
type ManifestProject = Required < SiteManifest > [ 'projects' ] [ 0 ] ;
31
15
32
16
export const meta : V2_MetaFunction < typeof loader > = ( { data, location } ) => {
@@ -58,96 +42,4 @@ export const loader: LoaderFunction = async ({ params, request }) => {
58
42
return json ( { config, page, project } ) ;
59
43
} ;
60
44
61
- function ArticlePageAndNavigationInternal ( {
62
- children,
63
- hide_toc,
64
- hideSearch,
65
- projectSlug,
66
- inset = 20 , // begin text 20px from the top (aligned with menu)
67
- } : {
68
- hide_toc ?: boolean ;
69
- hideSearch ?: boolean ;
70
- projectSlug ?: string ;
71
- children : React . ReactNode ;
72
- inset ?: number ;
73
- } ) {
74
- const top = useThemeTop ( ) ;
75
- const { container, toc } = useSidebarHeight ( top , inset ) ;
76
- return (
77
- < >
78
- < TopNav hideToc = { hide_toc } hideSearch = { hideSearch } />
79
- < PrimaryNavigation
80
- sidebarRef = { toc }
81
- hide_toc = { hide_toc }
82
- footer = { < MadeWithMyst /> }
83
- projectSlug = { projectSlug }
84
- />
85
- < TabStateProvider >
86
- < article
87
- ref = { container }
88
- className = "article content article-grid grid-gap"
89
- // article does not neet to get top as it is in the page flow (z-0)
90
- // style={{ marginTop: top }}
91
- >
92
- { children }
93
- </ article >
94
- </ TabStateProvider >
95
- </ >
96
- ) ;
97
- }
98
-
99
- function ArticlePageAndNavigation ( {
100
- children,
101
- hide_toc,
102
- hideSearch,
103
- projectSlug,
104
- inset = 20 , // begin text 20px from the top (aligned with menu)
105
- } : {
106
- hide_toc ?: boolean ;
107
- hideSearch ?: boolean ;
108
- projectSlug ?: string ;
109
- children : React . ReactNode ;
110
- inset ?: number ;
111
- } ) {
112
- return (
113
- < UiStateProvider >
114
- < ArticlePageAndNavigationInternal
115
- children = { children }
116
- hide_toc = { hide_toc }
117
- hideSearch = { hideSearch }
118
- projectSlug = { projectSlug }
119
- inset = { inset }
120
- />
121
- </ UiStateProvider >
122
- ) ;
123
- }
124
-
125
- export default function Page ( ) {
126
- const siteDesign : TemplateOptions =
127
- ( useSiteManifest ( ) as SiteManifest & TemplateOptions ) ?. options ?? { } ;
128
-
129
- const { container } = useOutlineHeight ( ) ;
130
- const data = useLoaderData ( ) as { page : PageLoader ; project : ManifestProject } ;
131
- const baseurl = useBaseurl ( ) ;
132
- const pageDesign : TemplateOptions = ( data . page . frontmatter as any ) ?. site ?? { } ;
133
- const { hide_search, hide_footer_links } = {
134
- ...siteDesign ,
135
- ...pageDesign ,
136
- } ;
137
- return (
138
- < ArticlePageAndNavigation hide_toc hideSearch = { hide_search } projectSlug = { data . page . project } >
139
- { /* <ProjectProvider project={project}> */ }
140
- < ProjectProvider >
141
- < ComputeOptionsProvider
142
- features = { { notebookCompute : true , figureCompute : true , launchBinder : false } }
143
- >
144
- < ThebeLoaderAndServer baseurl = { baseurl } >
145
- < main ref = { container } className = "landing-page article-grid subgrid-gap col-screen" >
146
- < ArticlePage article = { data . page } hide_all_footer_links = { hide_footer_links } />
147
- </ main >
148
- </ ThebeLoaderAndServer >
149
- </ ComputeOptionsProvider >
150
- </ ProjectProvider >
151
- </ ArticlePageAndNavigation >
152
- ) ;
153
- }
45
+ export default Page ;
0 commit comments