Compare commits
1 Commits
24299bfa17
..
work
| Author | SHA1 | Date | |
|---|---|---|---|
| e7a50cbdbc |
Generated
+655
-568
File diff suppressed because it is too large
Load Diff
+1
-1
Submodule iris updated: c118bb446b...a648c62aa2
@@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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),
|
||||||
)
|
)
|
||||||
|
|||||||
+13
-13
@@ -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>(
|
||||||
ids: impl IntoIterator<Item = &'a UserId>,
|
&self,
|
||||||
session: &Session,
|
ids: impl IntoIterator<Item = &'a UserId>,
|
||||||
) -> 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user