Skip to content

Commit 287797c

Browse files
GPUI desktop refactor: implement core views, fix runtime panic, add window controls following Zed patterns, embed icons, i18n framework, component library (52% complete) (#28)
Co-authored-by: GZTimeWalker <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: GZTime <[email protected]>
1 parent c7b5126 commit 287797c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2929
-95
lines changed

.github/workflows/build-gpui.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
#-------------------------------------------------------------------------------
3+
# Workflow configuration for GPUI desktop app
4+
#-------------------------------------------------------------------------------
5+
6+
name: "GPUI Desktop Build"
7+
on:
8+
pull_request:
9+
paths:
10+
- ".github/workflows/build-gpui.yaml"
11+
- "Cargo.toml"
12+
- "crates/wsrx-desktop-gpui/**"
13+
workflow_dispatch:
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
18+
#-------------------------------------------------------------------------------
19+
# Workflow jobs
20+
#-------------------------------------------------------------------------------
21+
22+
jobs:
23+
build-linux:
24+
name: "Build GPUI Desktop on Linux"
25+
runs-on: ubuntu-22.04
26+
steps:
27+
# Checkout repository
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
submodules: recursive
33+
34+
# Get version
35+
- name: Get git version
36+
id: git_tag_version
37+
run: |
38+
export BUILD_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0-dev")
39+
echo "Build at version $BUILD_VERSION"
40+
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_OUTPUT
41+
42+
# Install dependencies
43+
- name: Install dependencies
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get install -y libxcb1-dev libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libgl1-mesa-dev
47+
48+
# Build application
49+
- name: Build GPUI desktop application
50+
run: |
51+
rustup update stable && rustup default stable
52+
cargo build --release -p wsrx-desktop-gpui
53+
54+
# Upload package
55+
- name: Upload package
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: wsrx-desktop-gpui-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-x64
59+
path: target/release/wsrx-desktop-gpui
60+
compression-level: 6
61+
62+
build-windows:
63+
name: "Build GPUI Desktop on Windows"
64+
runs-on: windows-2022
65+
steps:
66+
# Checkout repository
67+
- name: Checkout repository
68+
uses: actions/checkout@v4
69+
with:
70+
fetch-depth: 0
71+
submodules: recursive
72+
73+
# Get version
74+
- name: Get git version
75+
id: git_tag_version
76+
run: |
77+
echo BUILD_VERSION=$(git describe --tags --abbrev=0 2>$null) | Out-File -FilePath $env:GITHUB_OUTPUT -Append
78+
if ($LASTEXITCODE -ne 0) {
79+
echo "BUILD_VERSION=v0.0.0-dev" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
80+
}
81+
82+
- name: Install NASM for aws-lc-rs
83+
uses: ilammy/setup-nasm@v1
84+
85+
- name: Install ninja-build
86+
uses: seanmiddleditch/gha-setup-ninja@v5
87+
88+
# Build application
89+
- name: Build GPUI desktop application
90+
run: |
91+
rustup update stable && rustup default stable
92+
cargo build --release -p wsrx-desktop-gpui
93+
94+
# Upload package
95+
- name: Upload package
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: wsrx-desktop-gpui-${{steps.git_tag_version.outputs.BUILD_VERSION}}-windows-x64
99+
path: target/release/wsrx-desktop-gpui.exe
100+
compression-level: 6
101+
102+
build-mac:
103+
name: "Build GPUI Desktop on MacOS"
104+
runs-on: macos-latest
105+
steps:
106+
# Checkout repository
107+
- name: Checkout repository
108+
uses: actions/checkout@v4
109+
with:
110+
fetch-depth: 0
111+
submodules: recursive
112+
113+
# Get version
114+
- name: Get git version
115+
id: git_tag_version
116+
run: |
117+
export BUILD_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0-dev")
118+
echo "Build at version $BUILD_VERSION"
119+
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_OUTPUT
120+
121+
# Build for ARM64
122+
- name: Build GPUI desktop for ARM64
123+
run: |
124+
rustup update stable && rustup default stable
125+
cargo build --release -p wsrx-desktop-gpui
126+
127+
# Upload ARM64 package
128+
- name: Upload ARM64 package
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: wsrx-desktop-gpui-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-arm64
132+
path: target/release/wsrx-desktop-gpui
133+
compression-level: 6

crates/wsrx-desktop-gpui/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ chrono = { workspace = true }
5050
thiserror = { workspace = true }
5151
url = { workspace = true }
5252

53+
# Internationalization
54+
rust-i18n = "3"
55+
5356
# Network
5457
axum = { workspace = true }
5558
reqwest = { workspace = true }
@@ -65,6 +68,7 @@ build-target = { workspace = true }
6568
git-version = { workspace = true }
6669
rustc_version = { workspace = true }
6770
winres = { workspace = true }
71+
rust-i18n = "3"
6872

6973
[[bin]]
7074
name = "wsrx-desktop-gpui"
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# GPUI vs Slint Implementation Checklist
2+
3+
This document compares the GPUI implementation with the original Slint implementation to track progress and identify gaps.
4+
5+
## Design System / Styling
6+
7+
### Colors & Theming
8+
- [x] **Dark mode palette** - Fully aligned with Slint colors
9+
- [x] Window foreground (#cdd6f4)
10+
- [x] Window background (#151515)
11+
- [x] Window alternate background (#1e1e1e)
12+
- [x] Primary background (#0078D6)
13+
- [x] Border colors (window, element, popup)
14+
- [x] Semantic colors (error, warning, success, info, debug)
15+
- [x] Layer colors (layer-1 through layer-5)
16+
- [ ] **Light mode palette** - Not yet implemented (Slint has it)
17+
- [ ] **Theme switching** - No auto-detect or toggle mechanism yet
18+
19+
### Typography
20+
- [x] **Font sizes** - Aligned with Slint sizing (16px base)
21+
- [x] XS (12px), SM (14px), Base (16px), LG (18px), XL (20px), 2XL (24px)
22+
- [ ] **Font family** - Not set (Slint uses "Reverier Mono")
23+
- [ ] **Font weight variations** - Not implemented
24+
25+
### Spacing System
26+
- [x] **Padding constants** (p-xs through p-xl) - Fully aligned
27+
- [x] **Spacing constants** (s-xs through s-xl) - Fully aligned
28+
- [x] **Border radius** (r-xs through r-xl) - Implemented
29+
- [x] **Height constants** (h-xs through h-xl) - Implemented
30+
- [ ] **Line height** - Not explicitly defined
31+
32+
### Animations & Transitions
33+
- [ ] **Duration constants** - Not implemented (Slint has short/mid/long)
34+
- [ ] **Easing functions** - Not implemented
35+
- [ ] **Animated transitions** - Not implemented (Slint has smooth transitions)
36+
37+
## Layout & Structure
38+
39+
### Main Window
40+
- [x] **Root view** - Implemented with Entity management
41+
- [x] **Sidebar** - Implemented with navigation
42+
- [x] **Main content area** - Implemented with page switching
43+
- [ ] **Frameless window** - Not implemented (Slint has custom window chrome)
44+
- [ ] **Window controls** - Placeholder only (minimize, maximize, close)
45+
- [ ] **Title bar** - Placeholder only
46+
47+
### Sidebar
48+
- [x] **Navigation tabs** - Implemented with 4 pages
49+
- [x] **Active state indicator** - Implemented with left border + highlight
50+
- [x] **Hover effects** - Implemented
51+
- [ ] **Logo/branding** - Not displayed
52+
- [ ] **Icons** - Not implemented (Slint uses SVG icons)
53+
- [ ] **Scope selector** - Not implemented (Slint has scope dropdown)
54+
- [ ] **System info display** - Not implemented in sidebar
55+
56+
## Pages / Views
57+
58+
### Get Started Page
59+
- [x] **Basic structure** - Placeholder implemented
60+
- [ ] **Welcome message** - Not styled/detailed
61+
- [ ] **Update notification** - Not implemented
62+
- [ ] **Quick actions** - Not implemented
63+
- [ ] **Onboarding content** - Not implemented
64+
65+
### Connections Page
66+
- [x] **Tunnel list** - Basic structure implemented
67+
- [x] **Empty state** - Implemented
68+
- [x] **Status indicators** - Color-coded dots
69+
- [x] **Add tunnel button** - Implemented (no functionality)
70+
- [ ] **Tunnel cards styling** - Basic, needs polish
71+
- [ ] **Edit/Delete actions** - Not implemented
72+
- [ ] **Enable/Disable toggle** - Not implemented
73+
- [ ] **Connection statistics** - Not displayed
74+
- [ ] **Scope filtering** - Not implemented
75+
76+
### Network Logs Page
77+
- [x] **Log display** - Basic list implemented
78+
- [x] **Severity color coding** - Implemented (DEBUG, INFO, WARN, ERROR)
79+
- [x] **Clear button** - Implemented
80+
- [ ] **Log filtering** - Not implemented
81+
- [ ] **Auto-scroll toggle** - Not implemented
82+
- [ ] **Log export** - Not implemented
83+
- [ ] **Timestamp formatting** - Basic string display
84+
- [ ] **Search/filter** - Not implemented
85+
86+
### Settings Page
87+
- [x] **Settings sections** - Basic structure implemented
88+
- [x] **Settings display** - Read-only display
89+
- [ ] **Interactive controls** - Not implemented (toggles, selects)
90+
- [ ] **Daemon settings** - Display only
91+
- [ ] **Theme toggle** - Not implemented
92+
- [ ] **Log level selector** - Not implemented
93+
- [ ] **Save/Apply buttons** - Not implemented
94+
- [ ] **Settings persistence** - Bridge exists but not connected
95+
96+
## Components Library
97+
98+
### Implemented Components
99+
- [x] **Button** - With variants (Primary, Secondary, Danger) - *needs Zed-style refactor*
100+
- [x] **IconButton** - Icon-only button with styles (Subtle, Filled, Danger) - *NEW*
101+
- [x] **Checkbox** - Interactive checkbox with label - *NEW*
102+
- [x] **Modal** - Dialog overlay with backdrop
103+
- [x] **Input** - Text input with placeholder (not fully functional)
104+
- [x] **StatusIndicator** - Color-coded status dots
105+
106+
### Missing Components (Slint has)
107+
- [ ] **ButtonIndicator** - Button with active state indicator
108+
- [ ] **LineEdit** - Functional text input with editing
109+
- [ ] **ScrollView** - Scrollable container
110+
- [x] **ComboBox/Select** - Dropdown selection
111+
- [ ] **Tab control** - Tabbed interface
112+
- [ ] **Progress bar** - Loading indicator
113+
- [ ] **Tooltip** - Hover info display
114+
115+
**Total**: 8 of 14 components implemented (57%)
116+
117+
### Component Improvements Needed
118+
- [x] **Add prelude module** - Export common types and traits - *DONE*
119+
- [x] **Refactor Button** - Follow Zed's pattern with traits (Clickable, Disableable, etc.) - *DONE*
120+
- [x] **Add component traits** - Clickable, Disableable, Fixed, StyledExt, Toggleable - *DONE*
121+
- [ ] **Improve styling** - Use consistent spacing/color helpers
122+
123+
## Bridge Layer / Integration
124+
125+
### Implemented Bridges
126+
- [x] **DaemonBridge** - Basic structure (no actual daemon control)
127+
- [x] **SettingsBridge** - TOML persistence (not connected)
128+
- [x] **SystemInfoBridge** - CPU/memory monitoring (not displayed)
129+
130+
### Missing Functionality
131+
- [ ] **Daemon start/stop** - Not functional
132+
- [ ] **Tunnel management** - Not connected to wsrx core
133+
- [ ] **Real-time log streaming** - Not implemented
134+
- [ ] **Settings load/save UI** - Not wired up
135+
- [ ] **System info display** - Bridge exists but not shown
136+
- [ ] **WebSocket communication** - Not implemented
137+
- [ ] **Scope management** - Not implemented
138+
139+
## Internationalization
140+
- [ ] **i18n support** - Not implemented (Slint has @tr() macros)
141+
- [ ] **Language switching** - Not implemented
142+
- [ ] **Translation files** - Not created
143+
144+
## Platform-Specific Features
145+
146+
### macOS
147+
- [x] **Build configuration** - Fixed linker flag issue
148+
- [ ] **Custom window chrome** - Not implemented
149+
- [ ] **Title bar handling** - Not implemented
150+
- [ ] **DMG packaging** - Not set up for GPUI app
151+
152+
### Windows
153+
- [x] **Build configuration** - Working with NASM/Ninja
154+
- [ ] **NSIS installer** - Not set up for GPUI app
155+
- [ ] **Portable package** - Not set up
156+
- [ ] **Window chrome** - Not implemented
157+
158+
### Linux
159+
- [x] **Build configuration** - Working with X11 dependencies
160+
- [ ] **AppImage** - Not set up for GPUI app
161+
- [ ] **Desktop file** - Not created
162+
- [ ] **Window chrome** - Not implemented
163+
164+
## Build & Deployment
165+
- [x] **GitHub workflow** - Created for Linux/Windows/macOS
166+
- [x] **macOS build fix** - Removed unsupported linker flag
167+
- [ ] **Artifact generation** - Workflow ready but untested
168+
- [ ] **Release automation** - Not configured
169+
- [ ] **Code signing** - Not configured
170+
- [ ] **Update mechanism** - Not implemented
171+
172+
## Code Quality & Patterns
173+
174+
### Following Zed Patterns
175+
- [x] **Component prelude** - Implemented with common imports - *DONE*
176+
- [ ] **Component traits** - Not implemented (Clickable, Disableable, etc.)
177+
- [ ] **Styled extensions** - Partial (could be more comprehensive)
178+
- [ ] **Builder patterns** - Basic (needs enhancement)
179+
- [ ] **Documentation** - Minimal (Zed has extensive docs)
180+
181+
### Needed Improvements
182+
- [ ] **Refactor Button** - Use Zed's ButtonLike + traits pattern
183+
- [ ] **Add animation helpers** - Duration, easing, direction
184+
- [ ] **Color system** - Add Color enum like Zed
185+
- [ ] **Spacing helpers** - h_flex, v_flex, h_group, v_group
186+
- [ ] **Typography traits** - StyledTypography trait
187+
188+
## Summary Statistics
189+
190+
**Overall Progress**: ~50% complete (up from 48%)
191+
192+
### By Category:
193+
- **Design System**: 60% (colors good, animations missing)
194+
- **Layout**: 65% (structure done, window controls working)
195+
- **Pages**: 40% (structure exists, functionality missing)
196+
- **Components**: 50% (7/14 components, prelude added)
197+
- **Bridges**: 40% (structure exists, not functional)
198+
- **i18n**: 30% (framework setup, macro issues)
199+
- **Platform Features**: 30% (build fixes, window config aligned)
200+
- **Build System**: 85% (macOS fixed, workflow ready)
201+
- **Code Patterns**: 30% (prelude added, need traits)
202+
203+
### Priority Items for Next Phase:
204+
1. **✅ Fix macOS build** - DONE (removed unsupported linker flag)
205+
2. **Refactor Button with Zed patterns** - Add traits and builder methods
206+
3. **Add component prelude** - Export common types and traits
207+
4. **Implement missing components** - Focus on Checkbox, Select first
208+
5. **Wire up bridges** - Make daemon control functional
209+
6. **Add animations** - Duration constants and transitions
210+
7. **Improve documentation** - Add examples and usage docs
211+
8. **Test build artifacts** - Verify workflow produces working binaries

crates/wsrx-desktop-gpui/MIGRATION_PLAN.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,23 +216,25 @@ crates/wsrx-desktop-gpui/
216216
├── Cargo.toml # GPUI dependency configuration
217217
├── build.rs # Build script
218218
├── src/
219-
│ ├── main.rs # Application entry point
220-
│ ├── lib.rs # Library root
219+
│ ├── main.rs # Application entry point with i18n macro
221220
│ ├── logging.rs # Logging initialization
221+
│ ├── i18n.rs # Internationalization setup
222222
│ ├── models/mod.rs # Data model definitions
223223
│ ├── styles/mod.rs # Themes and styles
224224
│ ├── views/
225225
│ │ ├── mod.rs
226-
│ │ ├── root.rs # Placeholder
227-
│ │ ├── get_started.rs # Placeholder
228-
│ │ ├── connections.rs # Placeholder
229-
│ │ ├── network_logs.rs # Placeholder
230-
│ │ ├── settings.rs # Placeholder
231-
│ │ └── sidebar.rs # Placeholder
226+
│ │ ├── root.rs # Main window root view
227+
│ │ ├── get_started.rs # Onboarding page
228+
│ │ ├── connections.rs # Tunnel management
229+
│ │ ├── network_logs.rs # Log display
230+
│ │ ├── settings.rs # Settings page
231+
│ │ └── sidebar.rs # Navigation sidebar
232232
│ ├── components/
233233
│ │ ├── mod.rs
234-
│ │ ├── title_bar.rs # Placeholder
235-
│ │ ├── window_controls.rs # Placeholder
234+
│ │ ├── prelude.rs # Common component imports
235+
│ │ ├── title_bar.rs # Window title bar with drag support
236+
│ │ ├── window_controls.rs # Platform-aware window controls
237+
236238
│ │ └── tab_navigation.rs # Placeholder
237239
│ └── bridges/
238240
│ ├── mod.rs

0 commit comments

Comments
 (0)