@@ -15,22 +15,33 @@ export const Route = createFileRoute('/')({
1515} ) ;
1616
1717function 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