channel.rs
1 use gpui::{prelude::*, *}; 2 use std::sync::Arc; 3 4 #[derive(IntoElement)] 5 pub struct Channel { 6 app_state: Arc<AppState>, 7 } 8 9 impl Channel { 10 pub fn new(app_state: Arc<AppState>) -> Self { 11 Self { app_state } 12 } 13 } 14 15 impl RenderOnce for Channel { 16 fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement { 17 let auth = self.app_state.auth_store.read(cx); 18 19 div() 20 .id("main_channel") 21 .h_full() 22 .flex_1() 23 .bg(rgb(0x313338)) 24 .flex() 25 .flex_col() 26 .child( 27 div() 28 .h(px(48.)) 29 .flex_shrink_0() 30 .bg(rgb(0x2b2d31)) 31 .border_b_1() 32 .border_color(rgb(0x1e1f22)) 33 .flex() 34 .items_center() 35 .px_4() 36 .child( 37 div() 38 .text_color(rgb(0xfbfbfb)) 39 .text_lg() 40 .font_weight(gpui::FontWeight::SEMIBOLD), // .when_some(auth.token.clone(), |this, token| { 41 // this.child(format!("you're authenticated with {token}")) 42 // }), 43 ), 44 ) 45 .child( 46 div() 47 .flex_1() 48 .p_4() 49 .child("Channel content goes here...") 50 .text_color(rgb(0xdbdee1)), 51 ) 52 } 53 }