Skip to content

Commit b430c40

Browse files
committed
resolve merge conflicts
2 parents 6e0743c + f4a426b commit b430c40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1519
-982
lines changed

.changeset/warm-wasps-live.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/wild-worms-guess.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.5.1
1+
v23.9.0

build/tsconfig.types.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"declarationMap": true, /* go to js file when using IDE functions like. "Go to Definition" in VSCode */
55
"emitDeclarationOnly": true,
66
"allowJs": true,
7-
"incremental": true,
7+
"incremental": false,
88
"outDir": "./dist/src",
99
"preserveSymlinks": true,
1010
"target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// app.config.ts
2+
import { defineConfig } from "@tanstack/start/config";
3+
4+
// utils/is-chromium.ts
5+
function isChromium(headers) {
6+
const isChromiumFromServer = headers?.["user-agent"]?.includes("Chrome");
7+
if (isChromiumFromServer)
8+
return true;
9+
if (typeof navigator === "undefined")
10+
return false;
11+
return navigator.userAgent.indexOf("Chrome") !== -1;
12+
}
13+
14+
// plugins/vite-worker-plugin.ts
15+
function monacoWorkerPlugin() {
16+
return {
17+
name: "monaco-worker-plugin",
18+
configureServer(server) {
19+
server.middlewares.use((req, res, next) => {
20+
const isChromiumBrowser = isChromium(req.headers);
21+
if (/\.worker(?:-[A-Za-z0-9-]+)?\.js/.test(req.url || "")) {
22+
if (isChromiumBrowser) {
23+
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
24+
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
25+
} else {
26+
res.setHeader("Cache-Control", "no-store");
27+
res.setHeader("Cross-Origin-Embedder-Policy", "unsafe-none");
28+
res.setHeader("Cross-Origin-Opener-Policy", "unsafe-none");
29+
}
30+
}
31+
next();
32+
});
33+
},
34+
configurePreviewServer(server) {
35+
server.middlewares.use((req, res, next) => {
36+
const isChromiumBrowser = isChromium(req.headers);
37+
if (/\.worker(?:-[A-Za-z0-9-]+)?\.js/.test(req.url || "")) {
38+
if (isChromiumBrowser) {
39+
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
40+
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
41+
} else {
42+
res.setHeader("Cache-Control", "no-store");
43+
res.setHeader("Cross-Origin-Embedder-Policy", "unsafe-none");
44+
res.setHeader("Cross-Origin-Opener-Policy", "unsafe-none");
45+
}
46+
}
47+
next();
48+
});
49+
}
50+
};
51+
}
52+
53+
// app.config.ts
54+
var app_config_default = defineConfig({
55+
server: {
56+
preset: "vercel",
57+
plugins: ["./plugins/nitro-worker.plugin.ts"],
58+
routeRules: {
59+
"/assets/**": {
60+
headers: {
61+
"Cross-Origin-Embedder-Policy": "require-corp",
62+
"Cross-Origin-Opener-Policy": "same-origin"
63+
}
64+
},
65+
"/_build/assets/**": {
66+
headers: {
67+
"Cross-Origin-Embedder-Policy": "require-corp",
68+
"Cross-Origin-Opener-Policy": "same-origin"
69+
}
70+
}
71+
}
72+
},
73+
vite: {
74+
plugins: [monacoWorkerPlugin()],
75+
worker: {
76+
format: "es"
77+
}
78+
}
79+
});
80+
export {
81+
app_config_default as default
82+
};

docs/app/router.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { routeTree } from './routeTree.gen';
44
export function createRouter() {
55
const router = createTanStackRouter({
66
routeTree,
7-
defaultPreload: 'intent'
7+
defaultPreload: 'intent',
8+
scrollRestoration: true
89
});
910

1011
return router;

docs/app/routes/__root.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Outlet, ScrollRestoration, createRootRoute } from '@tanstack/react-router';
2-
import { createServerFn, Meta, Scripts } from '@tanstack/start';
1+
import { HeadContent, Outlet, createRootRoute } from '@tanstack/react-router';
2+
import { createServerFn, Scripts } from '@tanstack/start';
33
import type { ReactNode } from 'react';
44
import appCss from '../styles/app.css?url';
55
import { isChromium } from '../../utils/is-chromium';
@@ -67,11 +67,10 @@ function RootDocument({ children }: Readonly<{ children: ReactNode }>) {
6767
return (
6868
<html>
6969
<head>
70-
<Meta />
70+
<HeadContent />
7171
</head>
7272
<body>
7373
{children}
74-
<ScrollRestoration />
7574
<Scripts />
7675
</body>
7776
</html>

docs/app/routes/index.tsx

Lines changed: 97 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,33 @@ export const Route = createFileRoute('/')({
1515
});
1616

1717
function Home() {
18-
const [selectedCode, setSelectedCode] = useState<string>('src/core/database.ts');
18+
const [selectedCodeForMainPage, setSelectedCodeForMainPage] = useState<string>('databases.ts');
19+
const [selectedCodeForFavorites, setSelectedCodeForFavorites] = useState<string>('drizzle.ts');
1920
const {
2021
data: { data, isChromium }
2122
} = Route.useLoaderData();
2223

2324
const codeFiles = (data as Awaited<ReturnType<GetLibraryCodesFn>>)['mainpage'];
24-
const sidebarFiles = Object.keys(codeFiles?.raw || {})
25+
const sidebarFilesForMainPage = Object.keys(codeFiles?.raw || {})
2526
.filter(
2627
(code) =>
27-
code.endsWith('database.ts') ||
28+
code.endsWith('databases.ts') ||
2829
code.endsWith('schemas.ts') ||
2930
code.endsWith('tests.ts') ||
3031
code.endsWith('server.ts')
3132
)
3233
.sort();
3334

35+
const sidebarFilesForFavorites = Object.keys(codeFiles?.raw || {})
36+
.filter(
37+
(code) =>
38+
code.endsWith('drizzle.ts') ||
39+
code.endsWith('express.ts') ||
40+
code.endsWith('zod.ts') ||
41+
code.endsWith('jest.ts')
42+
)
43+
.sort();
44+
3445
return (
3546
<div className="flex flex-col bg-[#ffffff]">
3647
<nav className="flex flex-row justify-center items-center w-full mt-24 mb-24">
@@ -104,48 +115,50 @@ function Home() {
104115
height={860}
105116
width={680}
106117
isChromium={isChromium}
107-
text={codeFiles?.raw[selectedCode]}
118+
text={codeFiles?.raw[selectedCodeForMainPage] || ''}
108119
extraDts={codeFiles?.raw}
109120
libraries={data as Awaited<ReturnType<GetLibraryCodesFn>>}
110121
sidebarWidth={'9rem'}
111-
commands={[
112-
{
113-
command: 'npm install',
114-
tag: 'Dev Server',
115-
shouldExit: true
116-
},
117-
{
118-
command: 'npm run makemigrations -w mainpage',
119-
tag: 'Dev Server',
120-
shouldExit: true
121-
},
122-
{
123-
command: 'npm run migrate -w mainpage',
124-
tag: 'Dev Server',
125-
shouldExit: true
126-
},
127-
{
128-
command: 'npm run seed -w mainpage',
129-
tag: 'Dev Server',
130-
shouldExit: true
131-
},
132-
{
133-
command: 'npm run test -w mainpage',
134-
tag: 'Dev Server',
135-
shouldExit: true
136-
}
137-
]}
122+
commands={
123+
[
124+
// {
125+
// command: 'npm install',
126+
// tag: 'Dev Server',
127+
// shouldExit: true
128+
// },
129+
// {
130+
// command: 'npm run makemigrations -w mainpage',
131+
// tag: 'Dev Server',
132+
// shouldExit: true
133+
// },
134+
// {
135+
// command: 'npm run migrate -w mainpage',
136+
// tag: 'Dev Server',
137+
// shouldExit: true
138+
// },
139+
// {
140+
// command: 'npm run seed -w mainpage',
141+
// tag: 'Dev Server',
142+
// shouldExit: true
143+
// },
144+
// {
145+
// command: 'npm run test -w mainpage',
146+
// tag: 'Dev Server',
147+
// shouldExit: true
148+
// }
149+
]
150+
}
138151
customSidebar={
139152
<div className="flex flex-col w-36 h-[860px] from-tertiary-500 to-white bg-gradient-to-b p-2">
140-
{sidebarFiles.map((code, index) => (
153+
{sidebarFilesForMainPage.map((code, index) => (
141154
<Fragment key={code}>
142155
<button
143156
type={'button'}
144-
onClick={() => setSelectedCode(code)}
145-
className={`flex flex-row items-center justify-between p-2 w-full text-left ${selectedCode === code ? 'bg-tertiary-200' : 'bg-transparent'} font-light text-sm rounded-md`}
157+
onClick={() => setSelectedCodeForMainPage(code)}
158+
className={`flex flex-row items-center justify-between p-2 w-full text-left ${selectedCodeForMainPage === code ? 'bg-tertiary-200' : 'bg-transparent'} font-light text-sm rounded-md`}
146159
>
147160
{code.replace('src/core/', '')}
148-
{selectedCode === code ? (
161+
{selectedCodeForMainPage === code ? (
149162
<div className="flex flex-col w-[24px] max-h-[24px]">
150163
<svg className="w-full h-full" viewBox="0 0 50 50">
151164
<line className="stroke-primary-600" x1={35} y1={10} x2={40} y2={25} strokeWidth={2} />
@@ -154,14 +167,62 @@ function Home() {
154167
</div>
155168
) : null}
156169
</button>
157-
{index === sidebarFiles.length - 1 ? null : (
170+
{index === sidebarFilesForMainPage.length - 1 ? null : (
158171
<div className="h-[2px] w- bg-tertiary-300 mt-2 mb-2"></div>
159172
)}
160173
</Fragment>
161174
))}
162175
</div>
163176
}
164177
/>
178+
<div className="flex flex-col w-full items-center justify-center mt-12 mb-12">
179+
<h1 className="text-5xl font-bold text-primary-600 text-center">
180+
<span
181+
className="to-tertiary-500 from-tertiary-800 bg-gradient-to-r bg-clip-text inline-block mr-2 pt-2 pb-2"
182+
style={{
183+
color: 'transparent'
184+
}}
185+
>
186+
Powered by
187+
</span>
188+
your favorite tools
189+
</h1>
190+
</div>
191+
<Code
192+
height={860}
193+
width={680}
194+
isChromium={isChromium}
195+
text={codeFiles?.raw[selectedCodeForFavorites] || ''}
196+
extraDts={codeFiles?.raw}
197+
libraries={data as Awaited<ReturnType<GetLibraryCodesFn>>}
198+
sidebarWidth={'9rem'}
199+
customSidebar={
200+
<div className="flex flex-col w-36 h-[860px] from-tertiary-500 to-white bg-gradient-to-b p-2">
201+
{sidebarFilesForFavorites.map((code, index) => (
202+
<Fragment key={code}>
203+
<button
204+
type={'button'}
205+
onClick={() => setSelectedCodeForFavorites(code)}
206+
className={`flex flex-row items-center justify-between p-2 w-full text-left ${selectedCodeForFavorites === code ? 'bg-tertiary-200' : 'bg-transparent'} font-light text-sm rounded-md`}
207+
>
208+
{code.replace('src/core/', '')}
209+
{selectedCodeForFavorites === code ? (
210+
<div className="flex flex-col w-[24px] max-h-[24px]">
211+
<svg className="w-full h-full" viewBox="0 0 50 50">
212+
<line className="stroke-primary-600" x1={35} y1={10} x2={40} y2={25} strokeWidth={2} />
213+
<line className="stroke-primary-600" x1={40} y1={25} x2={35} y2={40} strokeWidth={2} />
214+
</svg>
215+
</div>
216+
) : null}
217+
</button>
218+
{index === sidebarFilesForFavorites.length - 1 ? null : (
219+
<div className="h-[2px] w- bg-tertiary-300 mt-2 mb-2" />
220+
)}
221+
</Fragment>
222+
))}
223+
</div>
224+
}
225+
/>
165226
</div>
166227
);
167228
}

0 commit comments

Comments
 (0)