Skip to content

Commit 0450c4f

Browse files
committed
chore: convert dashboard to react and typescript
1 parent d7a5fd4 commit 0450c4f

26 files changed

+3581
-17746
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ docker/compose.yml
1111
**/.pytest_cache
1212
.venv
1313
venv
14+
src/dashboard/node_modules
15+
src/dashboard/dist

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ test:
2626
test_with_running_controller:
2727
pytest -s --controller-already-runs
2828

29-
.PHONY: check style_check style code_check test test_with_running_controller
29+
build_dashboard:
30+
@echo [DASHBOARD BUILD]
31+
@cd src/dashboard && npm install && npm run build
32+
33+
.PHONY: check style_check style code_check test test_with_running_controller build_dashboard

docker/Dockerfile-debian

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ ENV TERM=xterm \
1010
NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
1111

1212
# Install required packages
13-
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
14-
RUN apt-get update && apt-get install -y --no-install-recommends \
13+
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash - && \
14+
apt-get update && apt-get install -y --no-install-recommends \
1515
openssl \
1616
bash \
1717
git \
1818
nodejs \
19+
npm \
1920
python3 \
2021
python3-dev \
2122
python3-pip \
@@ -49,6 +50,12 @@ RUN uv sync
4950
# Copy the rest of the files
5051
COPY ./ /trezor-user-env
5152

53+
# Build the React dashboard
54+
WORKDIR /trezor-user-env/src/dashboard
55+
RUN npm install && npm run build
56+
57+
# Download and setup binaries
58+
WORKDIR /trezor-user-env
5259
RUN ./src/binaries/firmware/bin/download.sh
5360
RUN ./src/binaries/trezord-go/bin/download.sh
5461
RUN ./src/binaries/node-bridge/download.sh

src/dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
IP = "0.0.0.0"
1515
PORT = 9002
16-
HTML_DIR = Path(__file__).parent.parent / "src" / "dashboard"
16+
HTML_DIR = Path(__file__).parent.parent / "src" / "dashboard" / "dist"
1717
LOG_COLOR = "yellow"
1818

1919

src/dashboard/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# React build
2+
node_modules
3+
dist
4+
*.local
5+
6+
# Editor
7+
.vscode/*
8+
!.vscode/extensions.json
9+
.idea
10+
.DS_Store
11+
*.suo
12+
*.ntvs*
13+
*.njsproj
14+
*.sln
15+
*.sw?

0 commit comments

Comments
 (0)