diff options
| author | cashmere <cashmere@autistici.org> | 2026-07-28 20:14:51 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-07-28 20:14:51 +0200 |
| commit | 32438ce25f69de99d2523b98237f62cfa90890d7 (patch) | |
| tree | 3a712c347dec0889bdea3328b4c817c2d9392b27 /apps/desktop/src/app.rs | |
| parent | f5a82152394fde4d8f740f664ab7737b82861618 (diff) | |
| download | opencut-32438ce25f69de99d2523b98237f62cfa90890d7.tar.gz | |
feat: port domain crates to Rust (session 1 complete)
All green: cargo test --workspace (~300 tests, 0 failures).
- timeline (45): placement, resize/ripple, split, snap, retime,
audio separation, scene helpers
- animation (73): bezier solver, channel sampling, keyframe ops,
split/clamp/clone, param definitions
- commands (9): Command trait, BatchCommand, history, 19 concrete
commands, freeze-frame port 1:1
- audio (22): audible collection, range mixing, mastering limiter,
rms/peak buckets
- text (19): cosmic-text layout/measure/raster, backgrounds,
decorations
- graphics (52): full CSS gradient parser, tiny-skia raster,
4 shape definitions
- effect-defs (16): blur definition, registry, pass resolution
- mask-defs (19): all 9 mask renderers via tiny-skia
- renderer (6): node model + scene builder port
- desktop: GPUI projects screen wired to ProjectStore
- scene: factory (web defaults: v32, Main Track, 1920x1080, 30fps)
Diffstat (limited to 'apps/desktop/src/app.rs')
| -rw-r--r-- | apps/desktop/src/app.rs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/apps/desktop/src/app.rs b/apps/desktop/src/app.rs new file mode 100644 index 00000000..8eab4f87 --- /dev/null +++ b/apps/desktop/src/app.rs @@ -0,0 +1,62 @@ +use gpui::{Context, Window, div, prelude::*, rgb}; + +use crate::projects_view::ProjectsView; +use crate::theme; + +pub enum Screen { + Projects, + Editor { project_id: String, project_name: String }, +} + +pub struct OpenCutApp { + pub screen: Screen, + pub projects_view: gpui::Entity<ProjectsView>, +} + +impl OpenCutApp { + pub fn new(cx: &mut Context<Self>) -> Self { + let app = cx.weak_entity(); + let projects_view = cx.new(|_| ProjectsView::new(app)); + Self { + screen: Screen::Projects, + projects_view, + } + } + + pub fn open_project(&mut self, project_id: String, project_name: String, cx: &mut Context<Self>) { + self.screen = Screen::Editor { + project_id, + project_name, + }; + cx.notify(); + } +} + +impl Render for OpenCutApp { + fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement { + let content: gpui::AnyElement = match &self.screen { + Screen::Projects => self.projects_view.clone().into_any_element(), + Screen::Editor { project_name, project_id } => div() + .size_full() + .flex() + .flex_col() + .items_center() + .justify_center() + .gap_2() + .child(format!("Editing: {project_name}")) + .child( + div() + .text_sm() + .text_color(rgb(theme::TEXT_SECONDARY)) + .child(format!("Editor UI lands here — preview, timeline, panels ({project_id})")), + ) + .into_any_element(), + }; + + div() + .size_full() + .bg(rgb(theme::BACKGROUND)) + .text_color(rgb(theme::TEXT_PRIMARY)) + .child(content) + } +} |
