Skip to content

Commit 06b02c9

Browse files
committed
Version display on dashboard
Development docker compose file .dockerignore for windows (because windows stinks)
1 parent a577dd4 commit 06b02c9

File tree

5 files changed

+64
-12
lines changed

5 files changed

+64
-12
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.3
1+
1.4.0

docker-compose-dev.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: invio-dev
2+
3+
services:
4+
backend:
5+
build: ./backend # Build from local backend/ directory
6+
env_file:
7+
- .env
8+
environment:
9+
ADMIN_USER: ${ADMIN_USER:-admin}
10+
ADMIN_PASS: ${ADMIN_PASS:-supersecret}
11+
JWT_SECRET: ${JWT_SECRET:-change-me-in-prod}
12+
DATABASE_PATH: ${DATABASE_PATH:-/app/data/invio.db}
13+
volumes:
14+
- invio_data:/app/data
15+
- ./backend:/app # Mount source for live changes (if supported by your backend setup)
16+
ports:
17+
- "${BACKEND_PORT:-3000}:3000"
18+
restart: unless-stopped
19+
20+
frontend:
21+
build: ./frontend # Build from local frontend/ directory
22+
env_file:
23+
- .env
24+
environment:
25+
PORT: ${FRONTEND_PORT_INTERNAL:-8000}
26+
BACKEND_URL: ${BACKEND_URL:-http://backend:3000}
27+
depends_on:
28+
- backend
29+
volumes:
30+
- ./frontend:/app # Mount source for live changes
31+
- ./VERSION:/app/VERSION # Mount VERSION file into the container at /app/VERSION
32+
ports:
33+
- "${FRONTEND_PORT:-8000}:${FRONTEND_PORT_INTERNAL:-8000}"
34+
restart: unless-stopped
35+
36+
volumes:
37+
invio_data:
38+
driver: local

frontend/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.deno
3+
_fresh
4+
*.log

frontend/VERSION

Whitespace-only changes.

frontend/routes/dashboard.tsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Invoice = {
1616
type Data = {
1717
authed: boolean;
1818
error?: string;
19-
counts?: { invoices: number; customers: number; templates: number };
19+
counts?: { invoices: number; customers: number };
2020
money?: {
2121
billed: number;
2222
paid: number;
@@ -25,6 +25,7 @@ type Data = {
2525
};
2626
status?: { draft: number; sent: number; paid: number; overdue: number };
2727
recent?: Invoice[];
28+
version?: string;
2829
};
2930

3031
export const handler: Handlers<Data> = {
@@ -39,10 +40,9 @@ export const handler: Handlers<Data> = {
3940
});
4041
}
4142
try {
42-
const [invoices, customers, templates] = await Promise.all([
43+
const [invoices, customers] = await Promise.all([
4344
backendGet("/api/v1/invoices", auth) as Promise<Invoice[]>,
4445
backendGet("/api/v1/customers", auth) as Promise<unknown[]>,
45-
backendGet("/api/v1/templates", auth) as Promise<unknown[]>,
4646
]);
4747

4848
const currency = (invoices[0]?.currency as string) || "USD";
@@ -69,16 +69,28 @@ export const handler: Handlers<Data> = {
6969
)
7070
.slice(0, 5);
7171

72+
// Read version from VERSION file at project root
73+
let version = 'unknown';
74+
const possiblePaths = ['/app/VERSION', Deno.cwd() + '/../VERSION', Deno.cwd() + '/VERSION'];
75+
for (const path of possiblePaths) {
76+
try {
77+
version = await Deno.readTextFile(path).then(v => v.trim());
78+
break;
79+
} catch {
80+
// Ignore and try next path
81+
}
82+
}
83+
7284
return ctx.render({
7385
authed: true,
7486
counts: {
7587
invoices: invoices.length,
7688
customers: customers.length,
77-
templates: templates.length,
7889
},
7990
money: { billed, paid, outstanding, currency },
8091
status,
8192
recent,
93+
version,
8294
});
8395
} catch (e) {
8496
return ctx.render({ authed: true, error: String(e) });
@@ -131,19 +143,17 @@ export default function Dashboard(props: PageProps<Data>) {
131143
</div>
132144
<div class="card bg-base-100 border border-base-300 rounded-box">
133145
<div class="card-body">
134-
<div class="text-sm opacity-70">Templates</div>
146+
<div class="text-sm opacity-70">Open Invoices</div>
135147
<div class="text-3xl font-extrabold">
136-
{props.data.counts.templates}
148+
{(props.data.status?.sent || 0) +
149+
(props.data.status?.overdue || 0)}
137150
</div>
138151
</div>
139152
</div>
140153
<div class="card bg-base-100 border border-base-300 rounded-box">
141154
<div class="card-body">
142-
<div class="text-sm opacity-70">Open Invoices</div>
143-
<div class="text-3xl font-extrabold">
144-
{(props.data.status?.sent || 0) +
145-
(props.data.status?.overdue || 0)}
146-
</div>
155+
<div class="text-sm opacity-70">Version</div>
156+
<div class="text-3xl font-extrabold">{props.data.version}</div>
147157
</div>
148158
</div>
149159
</div>

0 commit comments

Comments
 (0)