Compare commits

...

1 Commits

Author SHA1 Message Date
iris e7a50cbdbc update 2026-04-15 20:32:09 -04:00
5 changed files with 681 additions and 586 deletions
Generated
+655 -568
View File
File diff suppressed because it is too large Load Diff
+1 -1
Submodule iris updated: c118bb446b...a648c62aa2
+7 -1
View File
@@ -1,8 +1,9 @@
use std::sync::{Arc, Mutex, MutexGuard}; use std::sync::{Arc, Mutex, MutexGuard};
use iris::prelude::*;
use openworm::net::UserId; use openworm::net::UserId;
use crate::{net::NetHandle, ui::UserCache}; use crate::{Rsc, net::NetHandle, ui::UserCache};
// TODO: this really should not be async... // TODO: this really should not be async...
// I mean it could be used async but all widgets // I mean it could be used async but all widgets
@@ -32,4 +33,9 @@ impl Session {
pub fn get(&self) -> MutexGuard<'_, SessionInner> { pub fn get(&self) -> MutexGuard<'_, SessionInner> {
self.0.try_lock().unwrap() self.0.try_lock().unwrap()
} }
pub fn reactive_span(&self, rsc: &mut Rsc) -> WeakWidget {
let span = Span::empty(Dir::DOWN).add(rsc);
span
}
} }
+5 -3
View File
@@ -108,7 +108,7 @@ fn friends_list(rsc: &mut Rsc, session: &Session) -> WeakWidget {
resp.incoming resp.incoming
.rsc_map(|id, rsc| { .rsc_map(|id, rsc| {
( (
user_rect(id, &session, rsc), session.user_rect(id, rsc),
accept_req(id, &con, rsc), accept_req(id, &con, rsc),
deny_req(id, &con, rsc), deny_req(id, &con, rsc),
) )
@@ -121,14 +121,16 @@ fn friends_list(rsc: &mut Rsc, session: &Session) -> WeakWidget {
} }
all.push(section_label("friends").add_strong(rsc)); all.push(section_label("friends").add_strong(rsc));
all.push( all.push(
user_list(&resp.current, &session) session
.user_list(&resp.current)
.span(Dir::DOWN) .span(Dir::DOWN)
.add_strong(rsc), .add_strong(rsc),
); );
if !resp.outgoing.is_empty() { if !resp.outgoing.is_empty() {
all.push(section_label("outgoing").add_strong(rsc)); all.push(section_label("outgoing").add_strong(rsc));
all.push( all.push(
user_list(&resp.outgoing, &session) session
.user_list(&resp.outgoing)
.span(Dir::DOWN) .span(Dir::DOWN)
.add_strong(rsc), .add_strong(rsc),
) )
+5 -5
View File
@@ -46,19 +46,19 @@ impl Session {
s.widgets.entry(id).or_default().push(wid); s.widgets.entry(id).or_default().push(wid);
wid wid
} }
}
pub fn user_list<'a>( pub fn user_list<'a>(
&self,
ids: impl IntoIterator<Item = &'a UserId>, ids: impl IntoIterator<Item = &'a UserId>,
session: &Session,
) -> impl IntoIterator<Item = impl FnOnce(&mut Rsc) -> WeakWidget> { ) -> impl IntoIterator<Item = impl FnOnce(&mut Rsc) -> WeakWidget> {
ids.rsc_map(|id, rsc: &mut Rsc| user_rect(*id, session, rsc)) ids.rsc_map(|id, rsc: &mut Rsc| self.user_rect(*id, rsc))
} }
pub fn user_rect(id: UserId, session: &Session, rsc: &mut Rsc) -> WeakWidget { pub fn user_rect(&self, id: UserId, rsc: &mut Rsc) -> WeakWidget {
(session.username(id, rsc),) (self.username(id, rsc),)
.span(Dir::RIGHT) .span(Dir::RIGHT)
.gap(30) .gap(30)
.pad(15) .pad(15)
.add(rsc) as WeakWidget .add(rsc) as WeakWidget
} }
}