diff --git a/.gitignore b/.gitignore index 02abb20..cd778fb 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,9 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json # Finder (MacOS) folder config .DS_Store +# Dashboard-MD +Dashboard-MD + # Playwright artifacts test-results/ playwright-report/ diff --git a/package.json b/package.json index fbe9b89..b835530 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "scripts": { - "dev": "bun run gen:api && REACT_EDITOR=antigravity bun --hot src/index.ts", + "dev": "lsof -ti:3000 | xargs kill -9 2>/dev/null || true; bun run gen:api && REACT_EDITOR=antigravity bun --hot src/index.ts", "lint": "biome check .", "check": "biome check --write .", "format": "biome format --write .", @@ -12,7 +12,7 @@ "test": "bun test __tests__/api", "test:ui": "bun test --ui __tests__/api", "test:e2e": "bun run build && playwright test", - "build": "bun build ./src/index.html --outdir=dist --sourcemap --target=browser --minify --define:process.env.NODE_ENV='\"production\"' --env='VITE_*'", + "build": "bun build ./src/index.html --outdir=dist --sourcemap --target=browser --minify --define:process.env.NODE_ENV='\"production\"' --env='VITE_*' && cp -r public/* dist/ 2>/dev/null || true", "start": "NODE_ENV=production bun src/index.ts", "seed": "bun prisma/seed.ts" }, diff --git a/public/logo-desa-plus.png b/public/logo-desa-plus.png new file mode 100644 index 0000000..78f4e84 Binary files /dev/null and b/public/logo-desa-plus.png differ diff --git a/src/components/sidebar.tsx b/src/components/sidebar.tsx index f734db2..c25a897 100644 --- a/src/components/sidebar.tsx +++ b/src/components/sidebar.tsx @@ -1,13 +1,11 @@ import { - Badge, Box, Collapse, - Group, + Image, Input, NavLink as MantineNavLink, Stack, - Text, - useMantineColorScheme, + useMantineColorScheme } from "@mantine/core"; import { useLocation, useNavigate } from "@tanstack/react-router"; import { ChevronDown, ChevronUp, Search } from "lucide-react"; @@ -66,30 +64,7 @@ export function Sidebar({ className }: SidebarProps) { return ( {/* Logo */} - - - - DESA - - - + - - - - Digitalisasi Desa Transparansi Kerja - - + {/* Search */} diff --git a/src/components/ui/logo-desa-plus.png b/src/components/ui/logo-desa-plus.png new file mode 100644 index 0000000..78f4e84 Binary files /dev/null and b/src/components/ui/logo-desa-plus.png differ diff --git a/src/index.ts b/src/index.ts index a8ab986..4fc91ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -95,10 +95,27 @@ if (!isProduction) { getHeader(name: string) { return this.headers[name.toLowerCase()]; }, + writeHead(code: number, headers: Record) { + this.statusCode = code; + Object.assign(this.headers, headers); + }, + write(chunk: any, callback?: () => void) { + // Collect chunks for streaming responses + if (!this._chunks) this._chunks = []; + this._chunks.push(chunk); + if (callback) callback(); + return true; // Indicate we can accept more data + }, headers: {} as Record, end(data: any) { // Handle potential Buffer or string data from Vite let body = data; + + // If we have collected chunks from write() calls, combine them + if (this._chunks && this._chunks.length > 0) { + body = Buffer.concat(this._chunks); + } + if (data instanceof Uint8Array) { body = data; } else if (typeof data === "string") { @@ -158,6 +175,11 @@ if (!isProduction) { if (fs.existsSync(srcPath)) { filePath = srcPath; } + // Check public folder for static assets + const publicPath = path.join("public", pathname); + if (fs.existsSync(publicPath)) { + filePath = publicPath; + } } // 2. If not found and looks like an asset (has extension), try root of dist or src @@ -173,8 +195,18 @@ if (!isProduction) { ) { filePath = fallbackDistPath; } + // Try public folder + else { + const fallbackPublicPath = path.join("public", filename); + if ( + fs.existsSync(fallbackPublicPath) && + fs.statSync(fallbackPublicPath).isFile() + ) { + filePath = fallbackPublicPath; + } + } // Special handling for PWA files in src - else if (pathname.includes("assetlinks.json")) { + if (pathname.includes("assetlinks.json")) { const srcFilename = pathname.includes("assetlinks.json") ? ".well-known/assetlinks.json" : filename; diff --git a/src/vite.ts b/src/vite.ts index e8ccfab..5af027a 100644 --- a/src/vite.ts +++ b/src/vite.ts @@ -8,6 +8,7 @@ import { createServer as createViteServer } from "vite"; export async function createVite() { return createViteServer({ root: process.cwd(), + publicDir: "public", resolve: { alias: { "@": path.resolve(process.cwd(), "./src"),