The single 1700-line app.slint becomes a design system and screens that later waves can compose: - theme.slint: colour, radius, spacing and type tokens (dark and light, a runtime font scale); icons.slint: Lucide icons as tintable images. - components/: Button, IconButton, TextField, SearchBox, Select, Toggle, Slider, SegmentedTabs, Avatar, badges, Card, Meter, NavItem, ListItem, PopupMenu, Tooltip, Modal, Toast, ResizeHandle, Spinner, RichText and the EmojiPicker. - shells/: the desktop frame (server rail, top bar, sidebar with the user card) and the phone frame with a bottom navigation, switched at a breakpoint from the settings. - screens/: today's screens re-skinned (channels, chat, streams panel and viewer, settings page, home, dialogs, phone pages); all callbacks and properties keep their behaviour. Navigation state is the Nav global. On the Rust side app.rs keeps setup and event glue; servers.rs, chat.rs, settings_page.rs and appearance.rs hold the logic, vm/ the pure view models, bind/ the callbacks, dev.rs the development switches. Models are created once and updated row by row (vm::list::sync); each chat tab owns its lines model, so a message appends one row. Emoji come from the bundled Twemoji archive through a size-bounded image cache, split into runs that wrap with the text. New settings ui.theme, ui.font_scale, ui.narrow_breakpoint and ui.image_cache_mb apply live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
23 lines
586 B
Rust
23 lines
586 B
Rust
//! The chat view.
|
|
|
|
use slint::ComponentHandle;
|
|
use voelin_model::{ChannelId, ChatTarget};
|
|
|
|
use crate::app::{Bridge, MainWindow, with_app};
|
|
|
|
pub(super) fn wire(ui: &MainWindow) {
|
|
let bridge = ui.global::<Bridge>();
|
|
bridge.on_open_channel_chat(|cid| {
|
|
with_app(|app| app.open_chat(ChatTarget::Channel(cid as ChannelId), true));
|
|
});
|
|
bridge.on_select_tab(|i| {
|
|
with_app(|app| app.select_tab(i as usize));
|
|
});
|
|
bridge.on_close_tab(|i| {
|
|
with_app(|app| app.close_tab(i as usize));
|
|
});
|
|
bridge.on_send_message(|text| {
|
|
with_app(|app| app.send_message(text.to_string()));
|
|
});
|
|
}
|