File tree 9 files changed +69
-33
lines changed
9 files changed +69
-33
lines changed Original file line number Diff line number Diff line change @@ -138,10 +138,7 @@ export async function writeFiles(
138
138
)
139
139
} else if ( fName !== CONFIG_FILE ) {
140
140
if ( isBase64 ( contents ) ) {
141
- await environment . writeFile (
142
- resolve ( cwd , file ) ,
143
- getBinaryFile ( contents ) ! ,
144
- )
141
+ await environment . writeFileBase64 ( resolve ( cwd , file ) , contents )
145
142
} else {
146
143
await environment . writeFile ( resolve ( cwd , file ) , contents )
147
144
}
Original file line number Diff line number Diff line change 39
39
"@tanstack/react-store" : " ^0.7.0" ,
40
40
"@tanstack/router-plugin" : " ^1.114.3" ,
41
41
"@tanstack/store" : " ^0.7.0" ,
42
- "@uiw/codemirror-theme-okaidia " : " ^4.23.10" ,
42
+ "@uiw/codemirror-theme-github " : " ^4.23.10" ,
43
43
"@uiw/react-codemirror" : " ^4.23.10" ,
44
44
"class-variance-authority" : " ^0.7.1" ,
45
45
"clsx" : " ^2.1.1" ,
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export function AppSidebar() {
47
47
</ >
48
48
) }
49
49
</ SidebarContent >
50
- < SidebarFooter >
50
+ < SidebarFooter className = "mb-5" >
51
51
< RunAddOns />
52
52
< RunCreateApp />
53
53
</ SidebarFooter >
Original file line number Diff line number Diff line change @@ -10,12 +10,14 @@ import type { FileTreeItem } from '@/types'
10
10
import { Label } from '@/components/ui/label'
11
11
import { Checkbox } from '@/components/ui/checkbox'
12
12
import { Separator } from '@/components/ui/separator'
13
+ import { useSidebar } from '@/components/ui/sidebar'
14
+
13
15
import {
14
16
applicationMode ,
15
17
includeFiles ,
18
+ isInitialized ,
16
19
projectFiles ,
17
20
projectLocalFiles ,
18
- isInitialized ,
19
21
} from '@/store/project'
20
22
21
23
import { getFileClass , twClasses } from '@/file-classes'
@@ -35,8 +37,8 @@ export function Filters() {
35
37
}
36
38
37
39
return (
38
- < >
39
- < div className = "text-center text-sm border-b-1 mb-4 " > File Filters</ div >
40
+ < div className = "p-2 rounded-md bg-gray-900 file-filters" >
41
+ < div className = "text-center text-sm mb-2 " > File Filters</ div >
40
42
< div className = "flex flex-row flex-wrap gap-y-2" >
41
43
< div className = "flex flex-row items-center gap-2 w-1/3" >
42
44
< Checkbox
@@ -94,8 +96,7 @@ export function Filters() {
94
96
</ Label >
95
97
</ div >
96
98
</ div >
97
- < Separator className = "my-4" />
98
- </ >
99
+ </ div >
99
100
)
100
101
}
101
102
@@ -192,7 +193,9 @@ export default function FileNavigator() {
192
193
}
193
194
194
195
return (
195
- < div className = "flex flex-row w-[calc(100vw-450px)]" >
196
+ < div
197
+ className = { `flex flex-row border-1 rounded-md mr-10 p-2 inset-shadow-gray-600 inset-shadow-sm` }
198
+ >
196
199
< div className = "w-1/4 max-w-1/4 pr-2" >
197
200
{ mode === 'add' && < Filters /> }
198
201
< FileTree selectedFile = { selectedFile } tree = { fileTree } />
Original file line number Diff line number Diff line change @@ -6,7 +6,15 @@ import { json } from '@codemirror/lang-json'
6
6
import { css } from '@codemirror/lang-css'
7
7
import { html } from '@codemirror/lang-html'
8
8
9
- import { okaidia } from '@uiw/codemirror-theme-okaidia'
9
+ import { githubDarkInit } from '@uiw/codemirror-theme-github'
10
+
11
+ const theme = githubDarkInit ( {
12
+ settings : {
13
+ background : 'oklch(0.07 0.005 285.823)' ,
14
+ foreground : '#c9d1d9' ,
15
+ gutterBackground : 'oklch(0.22 0.005 285.823)' ,
16
+ } ,
17
+ } )
10
18
11
19
export default function FileViewer ( {
12
20
originalFile,
@@ -41,7 +49,7 @@ export default function FileViewer({
41
49
return (
42
50
< CodeMirror
43
51
value = { modifiedFile }
44
- theme = { okaidia }
52
+ theme = { theme }
45
53
height = "100vh"
46
54
width = "100%"
47
55
readOnly
@@ -51,7 +59,7 @@ export default function FileViewer({
51
59
)
52
60
}
53
61
return (
54
- < CodeMirrorMerge orientation = "a-b" theme = { okaidia } className = "text-lg" >
62
+ < CodeMirrorMerge orientation = "a-b" theme = { theme } className = "text-lg" >
55
63
< CodeMirrorMerge . Original value = { originalFile } extensions = { [ language ] } />
56
64
< CodeMirrorMerge . Modified value = { modifiedFile } extensions = { [ language ] } />
57
65
</ CodeMirrorMerge >
Original file line number Diff line number Diff line change @@ -9,7 +9,11 @@ import appCss from '../styles.css?url'
9
9
10
10
import type { QueryClient } from '@tanstack/react-query'
11
11
12
- import { SidebarProvider , SidebarTrigger } from '@/components/ui/sidebar'
12
+ import {
13
+ SidebarProvider ,
14
+ SidebarTrigger ,
15
+ useSidebar ,
16
+ } from '@/components/ui/sidebar'
13
17
import { Toaster } from '@/components/toaster'
14
18
15
19
import { AppSidebar } from '@/components/cta-sidebar'
@@ -18,6 +22,20 @@ interface MyRouterContext {
18
22
queryClient : QueryClient
19
23
}
20
24
25
+ function Content ( ) {
26
+ const { open } = useSidebar ( )
27
+
28
+ return (
29
+ < main
30
+ className = {
31
+ open ? 'w-full max-w-[calc(100%-370px)]' : 'w-full max-w-[100%]'
32
+ }
33
+ >
34
+ < SidebarTrigger className = "m-2" />
35
+ < Outlet />
36
+ </ main >
37
+ )
38
+ }
21
39
export const Route = createRootRouteWithContext < MyRouterContext > ( ) ( {
22
40
head : ( ) => ( {
23
41
meta : [
@@ -40,18 +58,17 @@ export const Route = createRootRouteWithContext<MyRouterContext>()({
40
58
] ,
41
59
} ) ,
42
60
43
- component : ( ) => (
44
- < RootDocument >
45
- < SidebarProvider >
46
- < AppSidebar />
47
- < main className = "w-[calc(100vw-200px)]" >
48
- < SidebarTrigger />
49
- < Outlet />
61
+ component : ( ) => {
62
+ return (
63
+ < RootDocument >
64
+ < SidebarProvider >
65
+ < AppSidebar />
66
+ < Content />
50
67
< Toaster />
51
- </ main >
52
- </ SidebarProvider >
53
- </ RootDocument >
54
- ) ,
68
+ </ SidebarProvider >
69
+ </ RootDocument >
70
+ )
71
+ } ,
55
72
} )
56
73
57
74
function RootDocument ( { children } : { children : React . ReactNode } ) {
Original file line number Diff line number Diff line change @@ -5,14 +5,15 @@ import { createAPIFileRoute } from '@tanstack/react-start/api'
5
5
6
6
import {
7
7
addToApp ,
8
- cleanUpFiles ,
9
8
createMemoryEnvironment ,
10
9
recursivelyGatherFiles ,
11
10
} from '@tanstack/cta-engine'
12
11
13
12
import { register as registerReactCra } from '@tanstack/cta-framework-react-cra'
14
13
import { register as registerSolid } from '@tanstack/cta-framework-solid'
15
14
15
+ import { cleanUpFileArray , cleanUpFiles } from '@/lib/file-helpers'
16
+
16
17
registerReactCra ( )
17
18
registerSolid ( )
18
19
@@ -37,7 +38,6 @@ export const APIRoute = createAPIFileRoute('/api/dry-run-add-to-app')({
37
38
await recursivelyGatherFiles ( projectPath , false ) ,
38
39
)
39
40
for ( const file of Object . keys ( localFiles ) ) {
40
- console . log ( 'writing local file' , file )
41
41
environment . writeFile ( resolve ( projectPath , file ) , localFiles [ file ] )
42
42
}
43
43
@@ -57,6 +57,9 @@ export const APIRoute = createAPIFileRoute('/api/dry-run-add-to-app')({
57
57
58
58
environment . finishRun ( )
59
59
60
+ output . files = cleanUpFiles ( output . files , projectPath )
61
+ output . deletedFiles = cleanUpFileArray ( output . deletedFiles , projectPath )
62
+
60
63
return json ( output )
61
64
} ,
62
65
} )
Original file line number Diff line number Diff line change @@ -175,3 +175,11 @@ code {
175
175
[data-sidebar = 'header' ] {
176
176
@apply shadow-gray-700 shadow-md z-50;
177
177
}
178
+
179
+ .cm-changedLine {
180
+ background-color : oklch (0.27 0.005 285.823 ) !important ;
181
+ }
182
+
183
+ .file-filters {
184
+ background-color : oklch (0.2 0.005 285.823 );
185
+ }
You can’t perform that action at this time.
0 commit comments