Skip to content

Commit 2ac2bef

Browse files
feat: mock newm-admin dashboard view
1 parent c38e392 commit 2ac2bef

19 files changed

Lines changed: 902 additions & 276 deletions

File tree

.agent/system/architecture.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,31 @@ This document provides the definitive overview of the NEWM Server system archite
1111
NEWM Server is the backend for the NEWM music platform on Cardano. It enables artists to distribute, tokenize, and earn from their music through NFTs and streaming royalties.
1212

1313
```
14-
┌─────────────────────────────────────────────────────────────────────────────┐
14+
┌─────────────────────────────────────────────────────────────────────────────
1515
│ NEWM PLATFORM │
16-
├─────────────────────────────────────────────────────────────────────────────┤
16+
├─────────────────────────────────────────────────────────────────────────────
1717
│ │
18-
│ ┌─────────────┐ REST API ┌─────────────────────────────────────┐ │
18+
│ ┌─────────────┐ REST API ┌─────────────────────────────────────┐ │
1919
│ │ Mobile Apps │◄──────────────────►│ newm-server │ │
2020
│ │ Portal │ │ (Ktor) │ │
2121
│ └─────────────┘ └───────────┬───────────────────────┬─┘ │
2222
│ │ │ │
23-
│ ┌──────────────────────┼───────────────────────┤ │
24-
│ │ │ │ │
25-
│ ▼ ▼ ▼ │
26-
│ ┌──────────────────┐ ┌─────────────────┐ ┌───────────────┐│
27-
│ │ PostgreSQL │ │ newm-chain │ │ AWS SDK ││
28-
│ │ (Exposed ORM) │ │ (gRPC) │ │ (S3,SQS,KMS) ││
29-
│ └──────────────────┘ └────────┬────────┘ └───────────────┘│
23+
│ ┌─────────────┐ REST API │ │ │
24+
│ │ newm-admin │◄───────────────────────────────┤ │ │
25+
│ │ (Rust/GPUI) │ │ │ │
26+
│ └─────────────┘ ┌───────────┼───────────────────────┤ │
27+
│ │ │ │ │
28+
│ ▼ ▼ ▼ │
29+
│ ┌──────────────────┐ ┌─────────────────┐ ┌───────────────┐ │
30+
│ │ PostgreSQL │ │ newm-chain │ │ AWS SDK │ │
31+
│ │ (Exposed ORM) │ │ (gRPC) │ │ (S3,SQS,KMS) │ │
32+
│ └──────────────────┘ └────────┬────────┘ └───────────────┘ │
3033
│ │ │
3134
│ ▼ │
32-
│ ┌─────────────────┐ │
33-
│ │ Cardano (Ogmios)│ │
34-
│ └─────────────────┘ │
35-
└─────────────────────────────────────────────────────────────────────────────┘
35+
│ ┌─────────────────┐
36+
│ │ Cardano (Ogmios)│
37+
│ └─────────────────┘
38+
└─────────────────────────────────────────────────────────────────────────────
3639
```
3740

3841
---
@@ -52,6 +55,21 @@ NEWM Server is the backend for the NEWM music platform on Cardano. It enables ar
5255
| `newm-chain-util` | `io.newm.chain.util` | Chain utilities |
5356
| `newm-objectpool` | `io.newm.objectpool` | Object pooling utilities |
5457

58+
### Desktop Applications
59+
60+
| Module | Language | Framework | Responsibility |
61+
|--------|----------|-----------|----------------|
62+
| `newm-admin` | Rust | GPUI + gpui-component | Admin desktop app for earnings/refunds management |
63+
64+
**newm-admin Details:**
65+
- **UI Framework**: GPUI (GPU-accelerated, from Zed editor)
66+
- **HTTP Client**: reqwest with async-compat bridge for GPUI async compatibility
67+
- **Auth**: JWT-based, validates `admin: true` claim
68+
- **Environments**: Garage (dev) / Studio (prod)
69+
- **Platforms**: Linux, macOS, Windows
70+
71+
See [/admin workflow](../workflows/admin.md) for development commands.
72+
5573
### Feature Domains (in newm-server)
5674

5775
| Feature | Path | Responsibility |

.agent/task/admin/newm-admin.md

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# NEWM Admin Desktop Application
2+
3+
## Overview
4+
5+
NEWM Admin is a desktop application for internal administrators to manage the NEWM platform. Built with Rust and GPUI (GPU-accelerated UI framework from Zed), it provides a performant, native interface for admin operations.
6+
7+
**Tech Stack:**
8+
- **Language:** Rust (2024 edition)
9+
- **UI Framework:** GPUI + gpui-component
10+
- **HTTP Client:** reqwest with async-compat bridge
11+
- **Target Platform:** Desktop (Linux, macOS, Windows)
12+
13+
---
14+
15+
## Current Features
16+
17+
### ✅ Authentication
18+
19+
**Status:** Completed (2026-01-07)
20+
21+
| Feature | Description |
22+
|---------|-------------|
23+
| Admin Login | Email/password authentication against Garage/Studio APIs |
24+
| Environment Selection | Toggle between Garage (dev) and Studio (prod) environments |
25+
| JWT Validation | Verifies `admin: true` claim in JWT before allowing access |
26+
| Password Visibility Toggle | Eye icon to show/hide password input |
27+
28+
**Files:**
29+
- [auth.rs](file:///home/westbam/Development/newm-server/newm-admin/src/auth.rs) — HTTP authentication client
30+
- [jwt.rs](file:///home/westbam/Development/newm-server/newm-admin/src/jwt.rs) — JWT claims parsing
31+
- [login.rs](file:///home/westbam/Development/newm-server/newm-admin/src/views/login.rs) — Login view UI
32+
33+
---
34+
35+
### ✅ Admin Dashboard
36+
37+
**Status:** Completed (2026-01-07)
38+
39+
| Feature | Description |
40+
|---------|-------------|
41+
| Sidebar Navigation | 200px fixed sidebar with menu items |
42+
| View State Management | Event-driven switching from Login → Dashboard via `LoginSuccessEvent` |
43+
| Menu Items | Earnings (`IconName::ChartPie`), Refunds (`IconName::Undo`) |
44+
| Dynamic Work Area | Content changes based on selected menu |
45+
| Mock Statistics Cards | Placeholder cards showing sample data |
46+
47+
**Architecture:**
48+
49+
```mermaid
50+
graph LR
51+
A[LoginView] -->|LoginSuccessEvent| B[AdminApp]
52+
B -->|Switch View| C[DashboardView]
53+
C --> D[Sidebar - 200px]
54+
C --> E[Work Area]
55+
D --> F[Earnings Menu]
56+
D --> G[Refunds Menu]
57+
E --> H[Earnings Panel]
58+
E --> I[Refunds Panel]
59+
```
60+
61+
**Event-Driven View Switching:**
62+
- `LoginView` emits `LoginSuccessEvent` on successful authentication
63+
- `AdminApp` subscribes to this event and switches `AppView` enum from `Login` to `Dashboard`
64+
- This pattern allows decoupled views and clean state management
65+
66+
**Files:**
67+
- [app.rs](file:///home/westbam/Development/newm-server/newm-admin/src/app.rs) — App state, view switching, event subscription
68+
- [dashboard.rs](file:///home/westbam/Development/newm-server/newm-admin/src/views/dashboard.rs) — Dashboard view with sidebar and work area
69+
- [colors.rs](file:///home/westbam/Development/newm-server/newm-admin/src/colors.rs) — Shared color palette
70+
71+
---
72+
73+
## Planned Features
74+
75+
### 🔲 Earnings Management
76+
77+
**Priority:** High
78+
79+
| Requirement | Status |
80+
|-------------|--------|
81+
| List all earnings with pagination | ⬜ Not started |
82+
| Filter by artist, song, date range | ⬜ Not started |
83+
| View earnings details | ⬜ Not started |
84+
| Export earnings data | ⬜ Not started |
85+
86+
### 🔲 Refunds Processing
87+
88+
**Priority:** High
89+
90+
| Requirement | Status |
91+
|-------------|--------|
92+
| List refund requests | ⬜ Not started |
93+
| Approve/reject refunds | ⬜ Not started |
94+
| View refund history | ⬜ Not started |
95+
| Audit trail for refund actions | ⬜ Not started |
96+
97+
### 🔲 Token Refresh
98+
99+
**Priority:** Medium
100+
101+
| Requirement | Status |
102+
|-------------|--------|
103+
| Automatic token refresh before expiry | ⬜ Not started |
104+
| Token storage (secure) | ⬜ Not started |
105+
| Session timeout handling | ⬜ Not started |
106+
107+
---
108+
109+
## Project Structure
110+
111+
```
112+
newm-admin/
113+
├── src/
114+
│ ├── main.rs # Entry point, window setup
115+
│ ├── app.rs # App state, view coordinator
116+
│ ├── auth.rs # Authentication client
117+
│ ├── jwt.rs # JWT parsing utilities
118+
│ ├── colors.rs # Shared color palette
119+
│ └── views/
120+
│ ├── mod.rs # View module exports
121+
│ ├── login.rs # Login view
122+
│ └── dashboard.rs # Dashboard view
123+
├── Cargo.toml # Dependencies
124+
├── DESIGN_GUIDE.md # UI styling reference
125+
└── README.md # Setup instructions
126+
```
127+
128+
---
129+
130+
## Design System
131+
132+
The application follows NEWM Studio's visual language:
133+
134+
| Element | Specification |
135+
|---------|---------------|
136+
| Background | `#000000` (primary), `#1a1a1a` (surface) |
137+
| Sidebar | 200px fixed width |
138+
| Primary Button | Purple-to-pink gradient (`#C341F0``#F53C69`) |
139+
| Text | White (`#ffffff`), secondary gray (`#a1a1aa`) |
140+
| Icons | From gpui-component-assets |
141+
142+
See [DESIGN_GUIDE.md](file:///home/westbam/Development/newm-server/newm-admin/DESIGN_GUIDE.md) for full specifications.
143+
144+
---
145+
146+
## Development Commands
147+
148+
```bash
149+
# Build
150+
cd newm-admin && cargo build
151+
152+
# Run (development)
153+
cd newm-admin && cargo run
154+
155+
# Format code
156+
cd newm-admin && cargo fmt
157+
158+
# Lint
159+
cd newm-admin && cargo clippy
160+
```
161+
162+
---
163+
164+
## Backend API Dependencies
165+
166+
The admin app communicates with the NEWM backend:
167+
168+
| Endpoint | Purpose |
169+
|----------|---------|
170+
| `POST /v1/auth/login` | Admin authentication |
171+
| `GET /v1/auth/refresh` | Token refresh |
172+
| `GET /v1/earnings/*` | Earnings data (planned) |
173+
| `POST /v1/refunds/*` | Refund operations (planned) |
174+
175+
---
176+
177+
## Change Log
178+
179+
| Date | Feature | Description |
180+
|------|---------|-------------|
181+
| 2026-01-07 | Dashboard | Added sidebar nav with Earnings/Refunds, work area panels |
182+
| 2026-01-07 | Auth | JWT admin validation, login view with environment selector |
183+
| 2026-01-06 | Init | Project setup with GPUI, basic login UI |
184+
185+
---
186+
187+
**Status:** 🚧 In Progress
188+
**Last Updated:** 2026-01-08

.agent/task/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Any unresolved decisions.
106106
107107
| Domain | Plan | Status | Date |
108108
|--------|------|--------|------|
109-
| *No plans yet* ||| |
109+
| admin | [newm-admin.md](admin/newm-admin.md) — NEWM Admin Desktop App | 🚧 In Progress | 2026-01-07 |
110110

111111
---
112112

.agent/workflows/admin.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,19 @@ gpui_component::init(cx);
191191
```bash
192192
sudo apt install libxkbcommon-dev libwayland-dev
193193
```
194+
195+
---
196+
197+
## Visual Verification
198+
199+
This is a **desktop application**, not a web app. You cannot use browser tools to verify UI changes.
200+
201+
When visual verification of UI changes is needed:
202+
203+
1. **Run the application** using `cargo run`
204+
2. **Ask the user to take a screenshot** of the relevant window/view
205+
3. **Request the user provide the screenshot** so you can verify the UI appears correctly
206+
4. Document what specific UI elements should be visible in the screenshot
207+
208+
Example prompt to user:
209+
> "Please run the application and take a screenshot of [specific view]. I need to verify that [specific UI element] appears correctly. Attach the screenshot to your reply."

.github/workflows/heroku-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
build:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: akhileshns/heroku-deploy@v3.12.12
10+
- uses: actions/checkout@v4
11+
- uses: akhileshns/heroku-deploy@v3.14.15
1212
with:
1313
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
1414
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}

.github/workflows/ktlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: |
4949
ktlint --reporter=checkstyle,output=build/ktlint-report.xml '**/*.kt*' '!**/generated/**'
5050
continue-on-error: true
51-
- uses: yutailang0119/action-ktlint@v2
51+
- uses: yutailang0119/action-ktlint@v5
5252
with:
5353
report-path: build/*.xml
5454
continue-on-error: false

0 commit comments

Comments
 (0)