Merge branch 'claude/gifted-lovelace-1crlx2' into worktree-agent-a5ecbed1e5dd55ddc
# Conflicts: # crates/voelin-ui/src/settings.rs
No files matched your search
@@ -9489,6 +9489,7 @@ dependencies = [
|
||||
"toml",
|
||||
"tracing",
|
||||
"tsclientlib",
|
||||
"tsproto",
|
||||
"tsproto-packets",
|
||||
"tsproto-types",
|
||||
"voelin-audio",
|
||||
|
||||
@@ -49,6 +49,8 @@ voelin-query = { path = "../voelin-query" }
|
||||
voelin-store = { path = "../voelin-store" }
|
||||
voelin-stream = { path = "../voelin-stream" }
|
||||
tsclientlib = { path = "../proto/tsclientlib" }
|
||||
# The hash cash level, for raising an identity's security level.
|
||||
tsproto = { path = "../proto/tsproto" }
|
||||
tsproto-packets = { path = "../proto/tsproto-packets" }
|
||||
tsproto-types = { path = "../proto/tsproto-types" }
|
||||
|
||||
|
||||
@@ -365,6 +365,17 @@ impl History {
|
||||
Ok(rows.into_iter().map(HistoryMessage::from).collect())
|
||||
}
|
||||
|
||||
/// The newest stored message of every chat with the server's unique id,
|
||||
/// the most recently active chat first, at most `limit` chats (a list
|
||||
/// of recent chats across servers).
|
||||
pub async fn recent_chats(
|
||||
&self,
|
||||
limit: usize,
|
||||
) -> Result<Vec<(String, HistoryMessage)>, String> {
|
||||
let rows = self.run(false, move |s| s.recent_chats(Some(limit))).await?;
|
||||
Ok(rows.into_iter().map(|m| (m.server_uid.clone(), HistoryMessage::from(m))).collect())
|
||||
}
|
||||
|
||||
/// Delete messages older than `before_ms` (pinned ones stay).
|
||||
pub(crate) fn prune(&self, before_ms: i64) {
|
||||
self.send(Job::Run {
|
||||
@@ -812,6 +823,9 @@ mod tests {
|
||||
["m49", "n49"]
|
||||
);
|
||||
assert!(page[0].id > 0);
|
||||
let recent = history.recent_chats(5).await.unwrap();
|
||||
assert_eq!(recent.len(), 1, "one chat");
|
||||
assert_eq!((recent[0].0.as_str(), recent[0].1.message.ts_ms), ("srv", 49));
|
||||
// Kept in memory only: negative ids, not in the file.
|
||||
let kept = history.write_async(true, vec![live("secret", 99)], 5000).await.unwrap();
|
||||
assert!(kept[0].message.id < 0);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::io::{Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::{AtomicBool, AtomicU8, AtomicU64, Ordering};
|
||||
use std::{fs, str};
|
||||
|
||||
use rusqlite::{Connection, OpenFlags, OptionalExtension};
|
||||
@@ -253,6 +254,51 @@ pub fn write_export(path: &Path, nickname: &str, identity: &Identity) -> Result<
|
||||
file.write_all(export(nickname, identity).as_bytes()).map_err(|e| IdentityError::read(path, e))
|
||||
}
|
||||
|
||||
/// Raise `identity`'s hash cash security level to at least `target` on
|
||||
/// every core: the counters after its current one are searched in parallel
|
||||
/// chunks, and the identity with the first counter found that reaches
|
||||
/// `target` is returned (the same key, so the same unique id). `progress`
|
||||
/// hears each better level reached, from the worker threads; setting
|
||||
/// `cancel` stops the search with `None`. Each level takes about twice as
|
||||
/// long as the one before; there is no upper limit.
|
||||
pub fn improve_level(
|
||||
identity: &Identity,
|
||||
target: u8,
|
||||
cancel: &AtomicBool,
|
||||
progress: impl Fn(u8) + Sync,
|
||||
) -> Option<Identity> {
|
||||
const CHUNK: u64 = 1 << 14;
|
||||
if identity.level() >= target {
|
||||
return Some(identity.clone());
|
||||
}
|
||||
let omega = identity.key().to_pub().to_ts();
|
||||
let threads = std::thread::available_parallelism().map_or(1, |n| n.get());
|
||||
let next = AtomicU64::new(identity.max_counter().max(identity.counter()));
|
||||
let found = AtomicU64::new(u64::MAX);
|
||||
let best = AtomicU8::new(identity.level());
|
||||
std::thread::scope(|scope| {
|
||||
for _ in 0..threads {
|
||||
scope.spawn(|| {
|
||||
while !cancel.load(Ordering::Relaxed) && found.load(Ordering::Relaxed) == u64::MAX {
|
||||
let start = next.fetch_add(CHUNK, Ordering::Relaxed);
|
||||
for counter in start..start.saturating_add(CHUNK) {
|
||||
let level = tsproto::algorithms::get_hash_cash_level(&omega, counter);
|
||||
if level > best.fetch_max(level, Ordering::Relaxed) {
|
||||
progress(level);
|
||||
}
|
||||
if level >= target {
|
||||
found.fetch_min(counter, Ordering::Relaxed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
let counter = found.into_inner();
|
||||
(counter != u64::MAX).then(|| Identity::new(identity.key().clone(), counter))
|
||||
}
|
||||
|
||||
/// Does `path` start with the SQLite file header?
|
||||
fn is_sqlite(path: &Path) -> Result<bool, IdentityError> {
|
||||
let mut head = [0u8; 16];
|
||||
@@ -502,6 +548,25 @@ mod tests {
|
||||
Identity::create()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn improve_level_keeps_the_key() {
|
||||
let identity = synthetic();
|
||||
let levels = std::sync::Mutex::new(Vec::new());
|
||||
let better = improve_level(&identity, 13, &AtomicBool::new(false), |l| {
|
||||
levels.lock().unwrap().push(l);
|
||||
})
|
||||
.unwrap();
|
||||
assert!(better.level() >= 13);
|
||||
assert_eq!(better.key().to_pub().get_uid(), identity.key().to_pub().get_uid());
|
||||
assert!(better.counter() > identity.counter());
|
||||
assert!(levels.into_inner().unwrap().iter().any(|l| *l >= 13));
|
||||
// Cancelled: nothing.
|
||||
assert!(improve_level(&identity, 60, &AtomicBool::new(true), |_| {}).is_none());
|
||||
// Already there: the same identity.
|
||||
let same = improve_level(&better, 8, &AtomicBool::new(false), |_| {}).unwrap();
|
||||
assert_eq!(same.counter(), better.counter());
|
||||
}
|
||||
|
||||
fn temp_dir(name: &str) -> PathBuf {
|
||||
let dir =
|
||||
std::env::temp_dir().join(format!("voelin-identity-{name}-{}", std::process::id()));
|
||||
|
||||
@@ -30,7 +30,8 @@ use crate::history::{self, ChatCtx, HistoryMessage, MessageSource, SharedHistory
|
||||
use crate::query::{self, QueryCmd, QueryEvent};
|
||||
use crate::route::{ChatRoute, Dedup, route_chat};
|
||||
use crate::settings::{
|
||||
BlockMode, CACHE_FETCH_IMAGES, CACHE_MAX_MB, PRIVACY_BLOCK_MODE, SharedSettings,
|
||||
Allowed, BlockMode, CACHE_FETCH_IMAGES, CACHE_MAX_MB, Key, PRIVACY_BLOCK_MODE, PRIVACY_POKES,
|
||||
PRIVACY_PRIVATE_MESSAGES, SharedSettings,
|
||||
};
|
||||
use crate::stream::{
|
||||
LayerSpec, OwnStreamEvent, PeerConfig, SrtpProfile, StreamFrame, StreamHandle, StreamInfo,
|
||||
@@ -49,6 +50,26 @@ fn max_cache_bytes(settings: &SharedSettings) -> u64 {
|
||||
settings.current().get(&CACHE_MAX_MB).saturating_mul(1024 * 1024)
|
||||
}
|
||||
|
||||
/// Whether a privacy setting lets someone with this relation (`None`: no
|
||||
/// unique id known) reach us.
|
||||
fn allows(setting: Allowed, relation: Option<Relation>) -> bool {
|
||||
match setting {
|
||||
Allowed::Everyone => true,
|
||||
Allowed::Friends => relation == Some(Relation::Friend),
|
||||
Allowed::Nobody => false,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[test]
|
||||
fn privacy_settings() {
|
||||
assert!(allows(Allowed::Everyone, None));
|
||||
assert!(allows(Allowed::Friends, Some(Relation::Friend)));
|
||||
assert!(!allows(Allowed::Friends, Some(Relation::Neutral)));
|
||||
assert!(!allows(Allowed::Friends, None));
|
||||
assert!(!allows(Allowed::Nobody, Some(Relation::Friend)));
|
||||
}
|
||||
|
||||
pub(crate) struct SessionHandle {
|
||||
tx: mpsc::UnboundedSender<Command>,
|
||||
}
|
||||
@@ -875,6 +896,12 @@ impl Session {
|
||||
self.settings.current().get(&PRIVACY_BLOCK_MODE)
|
||||
}
|
||||
|
||||
/// Whether `privacy.private_messages` or `privacy.pokes` (`key`) lets
|
||||
/// the person with this unique id reach us.
|
||||
fn allowed(&self, key: &'static Key<Allowed>, uid: Option<&str>) -> bool {
|
||||
allows(self.settings.current().get(key), uid.map(|u| self.contacts.relation(u)))
|
||||
}
|
||||
|
||||
fn stream_input(&self, input: StreamInput) {
|
||||
match &self.streams {
|
||||
Some(s) => s.send(input),
|
||||
@@ -1347,6 +1374,10 @@ impl Session {
|
||||
debug!(?from_uid, "poke of a blocked contact hidden");
|
||||
return;
|
||||
}
|
||||
if !self.allowed(&PRIVACY_POKES, from_uid.as_deref()) {
|
||||
debug!(?from_uid, "poke dropped (privacy.pokes)");
|
||||
return;
|
||||
}
|
||||
let session = self.id;
|
||||
self.emit(Event::Poke { session, from, from_uid, from_name, message, blocked });
|
||||
}
|
||||
@@ -1548,6 +1579,13 @@ impl Session {
|
||||
debug!(author = ?msg.author_uid, "private message of a blocked contact hidden");
|
||||
return;
|
||||
}
|
||||
if matches!(msg.target, ChatTarget::Private(_))
|
||||
&& msg.author_id != self.state.own_client
|
||||
&& !self.allowed(&PRIVACY_PRIVATE_MESSAGES, msg.author_uid.as_deref())
|
||||
{
|
||||
debug!(author = ?msg.author_uid, "private message dropped (privacy.private_messages)");
|
||||
return;
|
||||
}
|
||||
if let Some(ctx) = self.chat_ctx() {
|
||||
let stored = match &entry {
|
||||
Some(entry) => history::gateway_message(&ctx.server_uid, entry),
|
||||
|
||||
@@ -1170,6 +1170,33 @@ pub static PRIVACY_BLOCK_MODE: Key<BlockMode> = Key::new(
|
||||
BlockMode::default,
|
||||
);
|
||||
|
||||
/// Who may reach us with private messages or pokes; the others' are
|
||||
/// dropped (neither reported nor stored).
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum Allowed {
|
||||
/// Anyone (blocked contacts still follow `privacy.block_mode`).
|
||||
#[default]
|
||||
Everyone,
|
||||
/// Contacts marked friend.
|
||||
Friends,
|
||||
Nobody,
|
||||
}
|
||||
|
||||
pub static PRIVACY_PRIVATE_MESSAGES: Key<Allowed> = Key::new(
|
||||
"privacy.private_messages",
|
||||
Kind::Choice(&["everyone", "friends", "nobody"]),
|
||||
"Who may send us private messages: everyone, friends or nobody.",
|
||||
Allowed::default,
|
||||
);
|
||||
|
||||
pub static PRIVACY_POKES: Key<Allowed> = Key::new(
|
||||
"privacy.pokes",
|
||||
Kind::Choice(&["everyone", "friends", "nobody"]),
|
||||
"Who may poke us: everyone, friends or nobody.",
|
||||
Allowed::default,
|
||||
);
|
||||
|
||||
/// What an audio source of our stream captures, as stored; see
|
||||
/// [`AudioSourceSetting`].
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
@@ -1322,6 +1349,8 @@ pub fn builtin_keys() -> Vec<&'static dyn Setting> {
|
||||
&IDENTITY_IMPORT,
|
||||
&FILES_PROGRESS_MS,
|
||||
&PRIVACY_BLOCK_MODE,
|
||||
&PRIVACY_PRIVATE_MESSAGES,
|
||||
&PRIVACY_POKES,
|
||||
#[cfg(feature = "media")]
|
||||
&STUDIO_SCENES,
|
||||
#[cfg(feature = "media")]
|
||||
|
||||
@@ -529,6 +529,24 @@ impl Store {
|
||||
Ok(rows)
|
||||
}
|
||||
|
||||
/// The newest message of every chat (of every server), the most
|
||||
/// recently active chat first, at most `limit` chats (`None`: all).
|
||||
pub fn recent_chats(&self, limit: Option<usize>) -> Result<Vec<StoredMessage>> {
|
||||
// SQLite takes the bare columns from the row with the MAX.
|
||||
// ponytail: one pass over the time index; keep a table of each
|
||||
// chat's last message if histories grow into the millions.
|
||||
let sql = format!(
|
||||
"SELECT {COLUMNS}, MAX(ts_ms) FROM messages WHERE server_uid <> ''
|
||||
GROUP BY server_uid, target ORDER BY ts_ms DESC, id DESC LIMIT ?1"
|
||||
);
|
||||
let limit = limit.map_or(-1, |l| l as i64);
|
||||
Ok(self
|
||||
.db
|
||||
.prepare_cached(&sql)?
|
||||
.query_map([limit], message_from_row)?
|
||||
.collect::<rusqlite::Result<Vec<_>>>()?)
|
||||
}
|
||||
|
||||
/// One message by its local id.
|
||||
pub fn message(&self, id: i64) -> Result<Option<StoredMessage>> {
|
||||
Ok(self
|
||||
@@ -767,6 +785,30 @@ mod tests {
|
||||
rows.iter().map(|m| m.text.as_str()).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recent_chats_newest_first() {
|
||||
let mut store = Store::open_in_memory().unwrap();
|
||||
let mut dm = msg(MessageSource::Voice, "b", "hi", 3000);
|
||||
dm.target = ChatTarget::Private("uid-b".into());
|
||||
let mut other = msg(MessageSource::Voice, "c", "elsewhere", 2500);
|
||||
other.server_uid = "srv2".into();
|
||||
store
|
||||
.write_messages(
|
||||
&[
|
||||
msg(MessageSource::Voice, "a", "old", 1000),
|
||||
msg(MessageSource::Voice, "a", "newer", 2000),
|
||||
dm,
|
||||
other,
|
||||
],
|
||||
0,
|
||||
)
|
||||
.unwrap();
|
||||
let recent = store.recent_chats(None).unwrap();
|
||||
assert_eq!(texts(&recent), ["hi", "elsewhere", "newer"]);
|
||||
assert_eq!(recent[0].target, ChatTarget::Private("uid-b".into()));
|
||||
assert_eq!(texts(&store.recent_chats(Some(1)).unwrap()), ["hi"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn batch_insert_and_pages() {
|
||||
let mut store = Store::open_in_memory().unwrap();
|
||||
|
||||
@@ -24,6 +24,8 @@ dirs = "6"
|
||||
miniz_oxide = "0.8"
|
||||
png = "0.18"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
# Settings and gateway values as JSON (the advanced and integrations pages).
|
||||
serde_json = "1"
|
||||
tokio = { version = "1.53.1", features = ["rt-multi-thread", "macros", "time", "sync"] }
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
@@ -57,9 +59,6 @@ voelin-store = { path = "../voelin-store", features = ["keyring"] }
|
||||
slint = { version = "1.18", default-features = false, features = ["std", "compat-1-2", "renderer-software", "backend-android-activity-06"] }
|
||||
voelin-core = { path = "../voelin-core", default-features = false, features = ["media"] }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1"
|
||||
|
||||
[build-dependencies]
|
||||
slint-build = "1.18"
|
||||
|
||||
|
||||
@@ -54,6 +54,9 @@ fn open_settings(dir: &Path, overrides: &[String]) -> Settings {
|
||||
for key in appearance_keys() {
|
||||
prefs.register(key);
|
||||
}
|
||||
for key in crate::settings::page_keys() {
|
||||
prefs.register(key);
|
||||
}
|
||||
prefs.register(&crate::studio::STUDIO_UI);
|
||||
let config = std::env::var_os("VOELIN_CONFIG")
|
||||
.map(PathBuf::from)
|
||||
@@ -219,6 +222,8 @@ pub(crate) struct SessionView {
|
||||
pub downloads: HashMap<u64, crate::chat::Download>,
|
||||
/// The next transfer id.
|
||||
pub next_transfer: u64,
|
||||
/// What the home, messages and events screens keep of the session.
|
||||
pub extra: crate::social::SessionExtra,
|
||||
}
|
||||
|
||||
impl Default for SessionView {
|
||||
@@ -242,6 +247,7 @@ impl Default for SessionView {
|
||||
stream_viewers: HashMap::new(),
|
||||
downloads: HashMap::new(),
|
||||
next_transfer: 1,
|
||||
extra: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,6 +320,15 @@ pub(crate) struct Models {
|
||||
pub qualities: Rc<VecModel<slint::SharedString>>,
|
||||
/// Shown when there is no chat.
|
||||
pub no_chat: Rc<VecModel<ChatLine>>,
|
||||
/// Home, friends, messages, the bell, the search, events.
|
||||
pub social: crate::social::SocialModels,
|
||||
/// Settings pages.
|
||||
pub layers: Rc<VecModel<LayerItem>>,
|
||||
pub audio_sources: Rc<VecModel<AudioSourceItem>>,
|
||||
pub identities: Rc<VecModel<IdentityItem>>,
|
||||
pub gateway_config: Rc<VecModel<ConfigItem>>,
|
||||
pub gateway_perms: Rc<VecModel<PermItem>>,
|
||||
pub all_settings: Rc<VecModel<SettingItem>>,
|
||||
}
|
||||
|
||||
impl Models {
|
||||
@@ -331,6 +346,13 @@ impl Models {
|
||||
topic_messages: Rc::default(),
|
||||
qualities: Rc::default(),
|
||||
no_chat: Rc::default(),
|
||||
social: crate::social::SocialModels::new(bridge),
|
||||
layers: Rc::default(),
|
||||
audio_sources: Rc::default(),
|
||||
identities: Rc::default(),
|
||||
gateway_config: Rc::default(),
|
||||
gateway_perms: Rc::default(),
|
||||
all_settings: Rc::default(),
|
||||
};
|
||||
bridge.set_servers(ModelRc::from(models.servers.clone()));
|
||||
bridge.set_tree(ModelRc::from(models.tree.clone()));
|
||||
@@ -344,6 +366,12 @@ impl Models {
|
||||
bridge.set_topic_messages(ModelRc::from(models.topic_messages.clone()));
|
||||
bridge.set_viewer_qualities(ModelRc::from(models.qualities.clone()));
|
||||
bridge.set_messages(ModelRc::from(models.no_chat.clone()));
|
||||
bridge.set_layers(ModelRc::from(models.layers.clone()));
|
||||
bridge.set_audio_sources(ModelRc::from(models.audio_sources.clone()));
|
||||
bridge.set_identities(ModelRc::from(models.identities.clone()));
|
||||
bridge.set_gateway_config(ModelRc::from(models.gateway_config.clone()));
|
||||
bridge.set_gateway_perms(ModelRc::from(models.gateway_perms.clone()));
|
||||
bridge.set_all_settings(ModelRc::from(models.all_settings.clone()));
|
||||
models
|
||||
}
|
||||
}
|
||||
@@ -359,8 +387,6 @@ pub(crate) struct App {
|
||||
pub sessions: HashMap<i64, SessionView>,
|
||||
pub models: Models,
|
||||
pub status: String,
|
||||
/// The top bar's search: filters the channel tree.
|
||||
pub tree_filter: String,
|
||||
/// The members panel's search.
|
||||
pub member_filter: String,
|
||||
/// The topics drawer's search.
|
||||
@@ -410,6 +436,10 @@ pub(crate) struct App {
|
||||
/// Files being uploaded to a channel from the composer: session,
|
||||
/// channel and name, so the link can be posted when they are up.
|
||||
pub uploads: HashMap<u64, (i64, u64, String)>,
|
||||
/// Home, friends, messages, the bell and the search.
|
||||
pub social: crate::social::Social,
|
||||
/// The settings pages of the new design.
|
||||
pub pages: crate::settings_pages::Pages,
|
||||
/// The Stream Studio (studio.rs).
|
||||
pub studio: crate::studio::StudioState,
|
||||
}
|
||||
@@ -596,7 +626,6 @@ pub fn run(options: RunOptions) -> Result<()> {
|
||||
sessions: HashMap::new(),
|
||||
models,
|
||||
status: String::new(),
|
||||
tree_filter: String::new(),
|
||||
member_filter: String::new(),
|
||||
topic_filter: String::new(),
|
||||
voice_view: false,
|
||||
@@ -624,15 +653,24 @@ pub fn run(options: RunOptions) -> Result<()> {
|
||||
open_client_pending: switches.open_client,
|
||||
notices_loaded: false,
|
||||
uploads: HashMap::new(),
|
||||
social: Default::default(),
|
||||
pages: Default::default(),
|
||||
studio: Default::default(),
|
||||
};
|
||||
APP.with(|a| *a.borrow_mut() = Some(app));
|
||||
crate::bind::wire(&ui);
|
||||
with_app(|app| {
|
||||
app.apply_appearance();
|
||||
app.load_own_uids();
|
||||
app.apply_srtp();
|
||||
app.refresh_all();
|
||||
app.refresh_settings_flags();
|
||||
app.refresh_crash_notice();
|
||||
app.load_recent_chats();
|
||||
app.refresh_people();
|
||||
app.refresh_home();
|
||||
app.refresh_notices();
|
||||
app.refresh_pages();
|
||||
if app.demo {
|
||||
app.start_demo();
|
||||
}
|
||||
@@ -766,9 +804,16 @@ impl App {
|
||||
} else if key == STREAM_HARDWARE_DECODING.name() || key == STREAM_DECODER_BACKEND.name() {
|
||||
self.video.set_decoder_preference(decoder_preference(&self.prefs));
|
||||
}
|
||||
self.page_setting_changed(key);
|
||||
}
|
||||
|
||||
pub(crate) fn handle_event(&mut self, event: Event) {
|
||||
let touched = self.social_event(&event);
|
||||
self.dispatch(event);
|
||||
self.social_refresh(touched);
|
||||
}
|
||||
|
||||
fn dispatch(&mut self, event: Event) {
|
||||
match event {
|
||||
Event::State { session, state } => {
|
||||
let id = session as i64;
|
||||
@@ -866,7 +911,10 @@ impl App {
|
||||
Event::ChatHistory { session, target, messages, source, complete } => {
|
||||
self.history_batch(session as i64, &target, messages, source, complete);
|
||||
}
|
||||
Event::Gateway { session, update } => self.gateway_update(session as i64, update),
|
||||
Event::Gateway { session, update } => {
|
||||
self.gateway_extra(session as i64, &update);
|
||||
self.gateway_update(session as i64, update);
|
||||
}
|
||||
Event::Groups { session, server_groups, .. } => {
|
||||
let view = self.sessions.entry(session as i64).or_default();
|
||||
view.server_groups = (*server_groups).clone();
|
||||
@@ -894,6 +942,8 @@ impl App {
|
||||
Event::Transfer { session, transfer, state } => {
|
||||
self.transfer_progress(session as i64, transfer, state);
|
||||
}
|
||||
// The engine's contacts would replace the sample ones.
|
||||
Event::ContactsChanged { .. } if self.demo_ui && !self.contacts.is_empty() => {}
|
||||
Event::ContactsChanged { contacts } => {
|
||||
self.contacts = contacts.iter().map(|c| (c.uid.clone(), c.clone())).collect();
|
||||
self.refresh_member_card();
|
||||
@@ -919,6 +969,7 @@ impl App {
|
||||
/// Once a second.
|
||||
fn tick(&mut self) {
|
||||
self.tick_streams();
|
||||
self.tick_pages();
|
||||
if self.audio_dirty {
|
||||
self.save_audio();
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
|
||||
mod chat;
|
||||
mod emoji;
|
||||
mod pages;
|
||||
mod servers;
|
||||
mod settings;
|
||||
mod social;
|
||||
mod streams;
|
||||
pub(crate) mod studio;
|
||||
|
||||
@@ -19,5 +21,7 @@ pub(crate) fn wire(ui: &MainWindow) {
|
||||
streams::wire(ui);
|
||||
settings::wire(ui);
|
||||
emoji::wire(ui);
|
||||
social::wire(ui);
|
||||
pages::wire(ui);
|
||||
studio::wire(&ui.global::<StudioBridge>());
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
//! The settings pages of the new design (settings_pages.rs).
|
||||
|
||||
use slint::ComponentHandle;
|
||||
|
||||
use crate::app::{Bridge, MainWindow, with_app};
|
||||
|
||||
pub(super) fn wire(ui: &MainWindow) {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.on_settings_section(|section| {
|
||||
with_app(|app| app.settings_section(section));
|
||||
});
|
||||
// Profiles.
|
||||
bridge.on_identity_action(|id, action| {
|
||||
with_app(|app| app.identity_action(id, &action));
|
||||
});
|
||||
bridge.on_rename_identity(|id, name| {
|
||||
with_app(|app| app.rename_identity(id, &name));
|
||||
});
|
||||
bridge.on_improve_target(|id, target| {
|
||||
with_app(|app| app.improve_identity(id, target));
|
||||
});
|
||||
bridge.on_find_identities(|| {
|
||||
with_app(|app| app.find_identities());
|
||||
});
|
||||
bridge.on_pick_found(|index, on| {
|
||||
with_app(|app| app.pick_found(index, on));
|
||||
});
|
||||
bridge.on_import_identities(|| {
|
||||
with_app(|app| app.import_identities());
|
||||
});
|
||||
bridge.on_bookmark_identity(|bookmark, index| {
|
||||
with_app(|app| app.bookmark_identity(bookmark, index));
|
||||
});
|
||||
// Voice & Video.
|
||||
bridge.on_video_changed(|form| {
|
||||
with_app(|app| app.video_changed(&form));
|
||||
});
|
||||
bridge.on_toggle_camera_preview(|| {
|
||||
with_app(|app| app.toggle_camera_preview());
|
||||
});
|
||||
bridge.on_test_sound(|| {
|
||||
with_app(|app| app.test_sound());
|
||||
});
|
||||
// Streaming.
|
||||
bridge.on_streaming_changed(|form| {
|
||||
with_app(|app| app.streaming_changed(&form));
|
||||
});
|
||||
bridge.on_layer_changed(|index, item| {
|
||||
with_app(|app| app.layer_changed(index, &item));
|
||||
});
|
||||
bridge.on_add_layer(|| {
|
||||
with_app(|app| app.add_layer());
|
||||
});
|
||||
bridge.on_remove_layer(|index| {
|
||||
with_app(|app| app.remove_layer(index));
|
||||
});
|
||||
bridge.on_audio_source_changed(|index, item| {
|
||||
with_app(|app| app.audio_source_changed(index, &item));
|
||||
});
|
||||
bridge.on_add_audio_source(|kind, name| {
|
||||
with_app(|app| app.add_audio_source(&kind, &name));
|
||||
});
|
||||
bridge.on_remove_audio_source(|index| {
|
||||
with_app(|app| app.remove_audio_source(index));
|
||||
});
|
||||
// Notifications, privacy.
|
||||
bridge.on_notify_changed(|form| {
|
||||
with_app(|app| app.notify_changed(&form));
|
||||
});
|
||||
bridge.on_test_notification(|| {
|
||||
with_app(|app| app.test_notification());
|
||||
});
|
||||
bridge.on_privacy_changed(|form| {
|
||||
with_app(|app| app.privacy_changed(&form));
|
||||
});
|
||||
// Integrations.
|
||||
bridge.on_gateway_admin(|session| {
|
||||
with_app(|app| app.gateway_admin(session));
|
||||
});
|
||||
bridge.on_config_set(|key, value| {
|
||||
with_app(|app| app.config_set(&key, &value));
|
||||
});
|
||||
bridge.on_config_reset(|key| {
|
||||
with_app(|app| app.config_reset(&key));
|
||||
});
|
||||
bridge.on_config_reload(|| {
|
||||
with_app(|app| app.config_reload());
|
||||
});
|
||||
bridge.on_perm_set(|action, everyone, server, channel| {
|
||||
with_app(|app| app.perm_set(&action, everyone, &server, &channel));
|
||||
});
|
||||
bridge.on_perm_reset(|action| {
|
||||
with_app(|app| app.perm_reset(&action));
|
||||
});
|
||||
bridge.on_refresh_encoders(|| {
|
||||
with_app(|app| app.refresh_encoders());
|
||||
});
|
||||
// Advanced.
|
||||
bridge.on_advanced_changed(|form| {
|
||||
with_app(|app| app.advanced_changed(&form));
|
||||
});
|
||||
bridge.on_srtp_move(|index, by| {
|
||||
with_app(|app| app.srtp_move(index, by));
|
||||
});
|
||||
bridge.on_srtp_toggle(|name| {
|
||||
with_app(|app| app.srtp_toggle(&name));
|
||||
});
|
||||
bridge.on_setting_set(|key, value| {
|
||||
with_app(|app| app.setting_set(&key, &value)).unwrap_or_default().into()
|
||||
});
|
||||
bridge.on_setting_reset(|key| {
|
||||
with_app(|app| app.setting_reset(&key));
|
||||
});
|
||||
bridge.on_search_settings(|text| {
|
||||
with_app(|app| app.search_settings(text.to_string()));
|
||||
});
|
||||
bridge.on_open_logs(|| {
|
||||
with_app(|app| app.open_logs());
|
||||
});
|
||||
}
|
||||
@@ -11,9 +11,6 @@ pub(super) fn wire(ui: &MainWindow) {
|
||||
bridge.on_select_server(|id| {
|
||||
with_app(|app| app.select_server(id as i64));
|
||||
});
|
||||
bridge.on_search(|text| {
|
||||
with_app(|app| app.search(text.to_string()));
|
||||
});
|
||||
bridge.on_search_members(|text| {
|
||||
with_app(|app| app.search_members(text.to_string()));
|
||||
});
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
//! Home, friends, direct messages, the bell, the search, a server's events
|
||||
//! and pictures in chat.
|
||||
|
||||
use slint::ComponentHandle;
|
||||
|
||||
use crate::app::{Bridge, MainWindow, with_app};
|
||||
|
||||
pub(super) fn wire(ui: &MainWindow) {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
// Home.
|
||||
bridge.on_open_conversation(|key| {
|
||||
with_app(|app| app.open_conversation(key));
|
||||
});
|
||||
bridge.on_watch_live(|session, id| {
|
||||
with_app(|app| app.watch_live(i64::from(session), &id));
|
||||
});
|
||||
bridge.on_open_happening(|index| {
|
||||
with_app(|app| app.open_happening(index));
|
||||
});
|
||||
bridge.on_open_recording(|path| {
|
||||
with_app(|app| app.open_recording(&path));
|
||||
});
|
||||
bridge.on_open_recordings_folder(|| {
|
||||
with_app(|app| app.open_recordings_folder());
|
||||
});
|
||||
bridge.on_connect_server(|id| {
|
||||
with_app(|app| app.connect_server(i64::from(id)));
|
||||
});
|
||||
|
||||
// Friends.
|
||||
bridge.on_friends_tab(|tab| {
|
||||
with_app(|app| app.friends_tab(tab));
|
||||
});
|
||||
bridge.on_search_contacts(|text| {
|
||||
with_app(|app| app.search_contacts(text.to_string()));
|
||||
});
|
||||
bridge.on_select_contact(|uid| {
|
||||
with_app(|app| app.select_contact(uid.to_string()));
|
||||
});
|
||||
bridge.on_contact_action(|uid, action| {
|
||||
with_app(|app| app.contact_action(&uid, &action));
|
||||
});
|
||||
bridge.on_contact_note(|uid, note| {
|
||||
with_app(|app| app.contact_note(&uid, note.to_string()));
|
||||
});
|
||||
bridge.on_contact_volume(|uid, percent| {
|
||||
with_app(|app| app.contact_volume(&uid, percent));
|
||||
});
|
||||
|
||||
// Direct messages.
|
||||
bridge.on_dm_tab(|tab| {
|
||||
with_app(|app| app.dm_tab(tab));
|
||||
});
|
||||
bridge.on_search_conversations(|text| {
|
||||
with_app(|app| app.search_conversations(text.to_string()));
|
||||
});
|
||||
bridge.on_dm_action(|action| {
|
||||
with_app(|app| app.dm_action(&action));
|
||||
});
|
||||
bridge.on_dm_volume(|percent| {
|
||||
with_app(|app| app.dm_volume(percent));
|
||||
});
|
||||
bridge.on_send_offline(|form| {
|
||||
with_app(|app| app.send_offline(form));
|
||||
});
|
||||
|
||||
// The bell.
|
||||
bridge.on_open_notice(|key| {
|
||||
with_app(|app| app.open_notice(key));
|
||||
});
|
||||
bridge.on_mark_notices_read(|| {
|
||||
with_app(|app| app.mark_notices_read());
|
||||
});
|
||||
bridge.on_clear_notices(|| {
|
||||
with_app(|app| app.clear_notices());
|
||||
});
|
||||
|
||||
// The search: the top bar's field used to filter the channel tree;
|
||||
// it now opens the search (Ctrl+K), whose results are everywhere.
|
||||
bridge.on_search(|text| {
|
||||
with_app(|app| app.search(text.to_string()));
|
||||
});
|
||||
bridge.on_search_activate(|index| {
|
||||
with_app(|app| app.search_activate(index));
|
||||
});
|
||||
|
||||
// Events.
|
||||
bridge.on_open_events(|| {
|
||||
with_app(|app| app.open_events());
|
||||
});
|
||||
bridge.on_rsvp(|id, status| {
|
||||
with_app(|app| app.rsvp(id, &status));
|
||||
});
|
||||
bridge.on_toggle_event(|id| {
|
||||
with_app(|app| app.toggle_event(id));
|
||||
});
|
||||
bridge.on_edit_event(|id| with_app(|app| app.edit_event(id)).unwrap_or_default());
|
||||
bridge.on_save_event(|form| with_app(|app| app.save_event(&form)).unwrap_or_default().into());
|
||||
bridge.on_delete_event(|id| {
|
||||
with_app(|app| app.delete_event(id));
|
||||
});
|
||||
bridge.on_watch_event(|id| {
|
||||
with_app(|app| app.watch_event(id));
|
||||
});
|
||||
|
||||
// Pictures in chat.
|
||||
bridge.on_open_preview(|key, index| {
|
||||
with_app(|app| app.open_preview(key, index)).unwrap_or_default()
|
||||
});
|
||||
|
||||
// Opening the messages or the Library loads what they list.
|
||||
bridge.on_open_messages(|| {
|
||||
with_app(|app| app.load_recent_chats());
|
||||
});
|
||||
bridge.on_open_library(|| {
|
||||
with_app(|app| app.load_library());
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
//! The camera preview of the Voice & Video settings (the Stream Studio's
|
||||
//! camera capture, with its background blur), and the speakers' test tone.
|
||||
|
||||
use std::sync::{Arc, Mutex, PoisonError};
|
||||
use std::time::Duration;
|
||||
|
||||
use slint::{Image, Rgba8Pixel, SharedPixelBuffer};
|
||||
use tokio::sync::oneshot;
|
||||
use voelin_core::media::voelin_media::convert;
|
||||
use voelin_core::studio::camera::{self, Capture};
|
||||
use voelin_core::studio::compose::Feed;
|
||||
use voelin_core::studio::scene::Background;
|
||||
|
||||
use crate::app::with_app;
|
||||
|
||||
/// The cameras as (id, name): the devices, then the test pattern.
|
||||
pub(crate) fn list() -> Vec<(String, String)> {
|
||||
camera::list().into_iter().map(|c| (c.id, c.name)).collect()
|
||||
}
|
||||
|
||||
/// A running preview; the camera stops when it is dropped.
|
||||
pub(crate) struct Preview {
|
||||
feed: Arc<Feed>,
|
||||
status: Arc<Mutex<String>>,
|
||||
mirror: bool,
|
||||
_stop: oneshot::Sender<()>,
|
||||
_timer: slint::Timer,
|
||||
}
|
||||
|
||||
impl Preview {
|
||||
/// Open `device` (empty: the first camera) at `size` if it has it.
|
||||
pub fn start(
|
||||
runtime: &tokio::runtime::Handle,
|
||||
device: &str,
|
||||
size: Option<(u32, u32)>,
|
||||
blur: bool,
|
||||
mirror: bool,
|
||||
) -> Self {
|
||||
let feed = Arc::new(Feed::new());
|
||||
let status = Arc::new(Mutex::new(String::new()));
|
||||
let (stop, stopped) = oneshot::channel::<()>();
|
||||
let background = if blur { Background::Blur { strength: 0.04 } } else { Background::Keep };
|
||||
let (device, task_feed, task_status) = (device.to_owned(), feed.clone(), status.clone());
|
||||
runtime.spawn(async move {
|
||||
match Capture::start(&device, size, 30, task_feed, background).await {
|
||||
Ok(capture) => {
|
||||
// Runs until the preview is dropped.
|
||||
let _ = stopped.await;
|
||||
drop(capture);
|
||||
}
|
||||
Err(e) => {
|
||||
*task_status.lock().unwrap_or_else(PoisonError::into_inner) =
|
||||
format!("The camera does not start: {e}");
|
||||
}
|
||||
}
|
||||
});
|
||||
let timer = slint::Timer::default();
|
||||
timer.start(slint::TimerMode::Repeated, Duration::from_millis(66), || {
|
||||
with_app(|app| app.camera_frame());
|
||||
});
|
||||
Self { feed, status, mirror, _stop: stop, _timer: timer }
|
||||
}
|
||||
|
||||
/// The newest picture since the last call.
|
||||
pub fn take_picture(&self) -> Option<Image> {
|
||||
let frame = self.feed.take()?;
|
||||
let mut buffer = SharedPixelBuffer::<Rgba8Pixel>::new(frame.width, frame.height);
|
||||
let stride = frame.width as usize * 4;
|
||||
convert::to_rgba(&frame, buffer.make_mut_bytes(), stride).ok()?;
|
||||
if self.mirror {
|
||||
for row in buffer.make_mut_slice().chunks_mut(frame.width as usize) {
|
||||
row.reverse();
|
||||
}
|
||||
}
|
||||
Some(Image::from_rgba8(buffer))
|
||||
}
|
||||
|
||||
/// What to show while there is no picture.
|
||||
pub fn status(&self) -> String {
|
||||
let status = self.status.lock().unwrap_or_else(PoisonError::into_inner).clone();
|
||||
if !status.is_empty() {
|
||||
return status;
|
||||
}
|
||||
match self.feed.error() {
|
||||
Some(e) => e,
|
||||
None if self.feed.delivered() == 0 => "Starting the camera…".into(),
|
||||
None => String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Play a short two-tone chime on `device` (the system default for
|
||||
/// `None`) at `volume` (linear). Blocks while it plays.
|
||||
pub(crate) fn play_tone(device: Option<&str>, volume: f32) -> Result<(), String> {
|
||||
let mut out = voelin_audio::device::Playback::open(device, 300).map_err(|e| e.to_string())?;
|
||||
let rate = out.rate as f32;
|
||||
let channels = out.channels.max(1);
|
||||
let samples: Vec<f32> = (0..(rate * 0.7) as usize)
|
||||
.flat_map(|i| {
|
||||
let t = i as f32 / rate;
|
||||
let freq = if t < 0.35 { 660.0 } else { 880.0 };
|
||||
// Fade in and out of each note.
|
||||
let local = t % 0.35;
|
||||
let envelope = (local / 0.02).min(1.0) * ((0.35 - local) / 0.05).min(1.0);
|
||||
let v = (t * freq * std::f32::consts::TAU).sin() * 0.3 * envelope * volume.min(2.0);
|
||||
std::iter::repeat_n(v, channels)
|
||||
})
|
||||
.collect();
|
||||
let mut written = 0;
|
||||
while written < samples.len() {
|
||||
written += out.write(&samples[written..]);
|
||||
std::thread::sleep(Duration::from_millis(20));
|
||||
}
|
||||
while out.queued() > 0 {
|
||||
std::thread::sleep(Duration::from_millis(20));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -67,7 +67,7 @@ impl App {
|
||||
format!("#{}", name.unwrap_or_else(|| cid.to_string()))
|
||||
}
|
||||
ChatTarget::Server => "Server".into(),
|
||||
ChatTarget::Private(uid) => format!("@{uid}"),
|
||||
ChatTarget::Private(uid) => format!("@{}", self.peer_name(uid, None)),
|
||||
};
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
let index = match view.tabs.iter().position(|t| t.target == target) {
|
||||
@@ -96,6 +96,9 @@ impl App {
|
||||
view.tabs[index].unread = 0;
|
||||
view.tabs[index].topic = None;
|
||||
}
|
||||
if let Some(id) = self.current {
|
||||
self.fetch_previews(id);
|
||||
}
|
||||
self.refresh_chat();
|
||||
self.refresh_servers();
|
||||
}
|
||||
@@ -183,9 +186,20 @@ impl App {
|
||||
complete: bool,
|
||||
) {
|
||||
let current = self.current == Some(id);
|
||||
// A private chat is named after the peer, whoever wrote first.
|
||||
let peer = match target {
|
||||
ChatTarget::Private(uid) => Some(format!(
|
||||
"@{}",
|
||||
self.peer_name(
|
||||
uid,
|
||||
messages.iter().find(|m| m.message.author_uid.as_deref() == Some(uid.as_str()))
|
||||
)
|
||||
)),
|
||||
_ => None,
|
||||
};
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
let author = messages.first().map_or("", |m| m.message.author_name.as_str());
|
||||
let title = Self::tab_title(view, target, author);
|
||||
let title = peer.unwrap_or_else(|| Self::tab_title(view, target, author));
|
||||
let index = Self::tab_for(view, target, || title);
|
||||
let shown = current && view.current_tab == index;
|
||||
let tab = &mut view.tabs[index];
|
||||
@@ -214,6 +228,7 @@ impl App {
|
||||
tab.unread += fresh;
|
||||
}
|
||||
if current {
|
||||
self.fetch_previews(id);
|
||||
self.refresh_chat();
|
||||
}
|
||||
if fresh > 0 && !shown {
|
||||
@@ -249,7 +264,7 @@ impl App {
|
||||
|| view.gateway_has(feature::REACTIONS)
|
||||
|| view.gateway_has(feature::TOPICS);
|
||||
let mut previous: Option<Previous> = None;
|
||||
let mut lines = Vec::with_capacity(messages.len());
|
||||
let mut lines: Vec<(i64, ChatLine)> = Vec::with_capacity(messages.len());
|
||||
for m in messages {
|
||||
let avatar =
|
||||
m.message.message.author_uid.as_ref().and_then(|uid| view.avatars.get(uid));
|
||||
@@ -260,6 +275,14 @@ impl App {
|
||||
.and_then(|t| tab.topics.iter().find(|i| i.id == t))
|
||||
.map(|t| t.title.clone())
|
||||
.unwrap_or_default();
|
||||
let previews = m
|
||||
.message
|
||||
.message
|
||||
.file_refs()
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(i, f)| crate::previews::image_of(view, f).map(|image| (i, image)))
|
||||
.collect();
|
||||
let ctx = LineCtx {
|
||||
key: m.key,
|
||||
avatar: vm::avatar::image(avatar),
|
||||
@@ -267,11 +290,20 @@ impl App {
|
||||
marked: tab.marked == Some(m.message.id),
|
||||
topic,
|
||||
downloads: self.downloads_of(view, m.key),
|
||||
previews,
|
||||
};
|
||||
lines.push(vm::chat::history_line(&m.message, previous.as_ref(), &ctx));
|
||||
lines.push((
|
||||
m.message.message.ts_ms,
|
||||
vm::chat::history_line(&m.message, previous.as_ref(), &ctx),
|
||||
));
|
||||
previous = Some(Previous::of(&m.message.message));
|
||||
}
|
||||
lines
|
||||
// Pokes of a private chat's peer show among its messages.
|
||||
if let (ChatTarget::Private(uid), Some(session)) = (&tab.target, self.current) {
|
||||
lines.extend(self.poke_lines(session, uid));
|
||||
lines.sort_by_key(|(ts, _)| *ts);
|
||||
}
|
||||
lines.into_iter().map(|(_, line)| line).collect()
|
||||
}
|
||||
|
||||
/// The file cards of a message that has downloads running.
|
||||
@@ -712,6 +744,9 @@ impl App {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if self.preview_progress(id, transfer, &state) {
|
||||
return;
|
||||
}
|
||||
let done = matches!(state, TransferState::Done { .. });
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
let Some(entry) = view.downloads.get_mut(&transfer) else { return };
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
//! - `VOELIN_DEMO_STREAM=1`: a local test stream in the viewer.
|
||||
//! - `VOELIN_OPEN=<what>[,<what>...]`: open screens on start: `home`,
|
||||
//! `server`, `settings[:<section>]` (voice, keybinds, streaming, privacy,
|
||||
//! appearance, identities, or 0-5), `about`, `share`, `bookmark` (add a server;
|
||||
//! appearance, or 0-4), `about`, `share`, `bookmark` (add a server;
|
||||
//! `bookmark:edit` the current one, Advanced open),
|
||||
//! `emoji` (the picker), `client` (the volume dialog of the first other
|
||||
//! client once connected), `panel` / `no-panel` (the members panel),
|
||||
@@ -23,7 +23,14 @@
|
||||
//! `topic:<id>` (a topic's messages), `member` (the member card of the
|
||||
//! first other client), `watch` (the first stream; with sample data the
|
||||
//! local test pattern in its place), `popout` (the same, popped out),
|
||||
//! `tab:<home|servers|chat|activity|you>` (phone layout),
|
||||
//! `tab:<home|servers|chat|activity|you>` (phone layout); `friends[:<uid>]`,
|
||||
//! `messages[:<uid>]` (a private chat), `inbox` (offline messages),
|
||||
//! `library`, `events`, `event-form`, `search[:<text>]`,
|
||||
//! `notifications` (the bell), `join` (join by address), `offline` (an
|
||||
//! offline message), `picture` (a chat picture opened large), `camera`
|
||||
//! (the settings' camera preview); settings sections also `account`,
|
||||
//! `profiles` (also `identities`), `devices`, `notifications`,
|
||||
//! `integrations`, `advanced` (5-10);
|
||||
//! `studio[:<what>]`: the Stream Studio (with `VOELIN_DEMO_UI` a demo
|
||||
//! studio from synthetic sources), `studio:window` in a window of its own,
|
||||
//! `studio:live` going live, `studio:record`, or a dialog: `studio:source`,
|
||||
@@ -42,16 +49,22 @@ use slint::{ComponentHandle, Rgba8Pixel, SharedPixelBuffer};
|
||||
use voelin_core::gateway::Pin;
|
||||
use voelin_core::stream::{StreamInfo, StreamKind};
|
||||
use voelin_core::{
|
||||
Event, GatewayUpdate, HistoryMessage, HistorySource, ObserveState, SessionState, Source,
|
||||
VoiceState,
|
||||
Contact, Event, GatewayUpdate, HistoryMessage, HistorySource, ObserveState, OfflineMessageInfo,
|
||||
Relation, SessionState, Source, VoiceState,
|
||||
};
|
||||
use voelin_gateway_proto::{
|
||||
Action, Attendee, ConfigEntry, ConfigSource, EventInfo, EventKind, EventSpec, PermRule,
|
||||
PermRuleInfo, ReactionCount, RsvpStatus, StreamEntry, StreamSource, TopicInfo, UserRef,
|
||||
feature,
|
||||
};
|
||||
use voelin_gateway_proto::{ReactionCount, StreamEntry, StreamSource, TopicInfo, UserRef, feature};
|
||||
use voelin_model::{
|
||||
ChannelInfo, ChatMessage, ChatTarget, ClientInfo, GroupInfo, Presence, ServerFlavor,
|
||||
};
|
||||
use voelin_store::{Bookmark, MessageSource};
|
||||
|
||||
use crate::app::{App, Bridge, MainWindow, MobileTab, Nav, Page, SettingsSection, with_app};
|
||||
use crate::app::{
|
||||
App, Bridge, MainWindow, MobileTab, Nav, Page, RecordingItem, SettingsSection, with_app,
|
||||
};
|
||||
|
||||
/// The switches read at start.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
@@ -108,7 +121,12 @@ fn section(name: &str) -> SettingsSection {
|
||||
"2" | "streaming" => SettingsSection::Streaming,
|
||||
"3" | "privacy" => SettingsSection::Privacy,
|
||||
"4" | "appearance" => SettingsSection::Appearance,
|
||||
"5" | "identities" => SettingsSection::Identities,
|
||||
"5" | "account" => SettingsSection::Account,
|
||||
"6" | "profiles" | "identities" => SettingsSection::Profiles,
|
||||
"7" | "devices" => SettingsSection::Devices,
|
||||
"8" | "notifications" => SettingsSection::Notifications,
|
||||
"9" | "integrations" => SettingsSection::Integrations,
|
||||
"10" | "advanced" => SettingsSection::Advanced,
|
||||
_ => SettingsSection::Voice,
|
||||
}
|
||||
}
|
||||
@@ -202,6 +220,41 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running {
|
||||
});
|
||||
ui.global::<Bridge>().set_viewer_popped(what == "popout");
|
||||
}
|
||||
// Home, friends, messages, events, the bell, the search.
|
||||
"friends" => {
|
||||
with_app(|app| app.select_contact(arg.to_owned()));
|
||||
nav.invoke_show(Page::Friends);
|
||||
}
|
||||
"messages" | "dm" => {
|
||||
let uid = if arg.is_empty() { "demo-3" } else { arg };
|
||||
with_app(|app| app.open_dm_with(Some(DEMO), uid));
|
||||
nav.invoke_show(Page::Messages);
|
||||
}
|
||||
"inbox" => {
|
||||
nav.set_dm_tab(2);
|
||||
with_app(|app| app.dm_tab(2));
|
||||
nav.invoke_show(Page::Messages);
|
||||
}
|
||||
"library" => nav.invoke_show(Page::Library),
|
||||
"events" => nav.invoke_show(Page::Events),
|
||||
"event-form" => nav.invoke_create_event(),
|
||||
"search" => nav.invoke_open_search(arg.into()),
|
||||
"notifications" => nav.set_notifications_open(true),
|
||||
"join" => nav.invoke_join_server(),
|
||||
"offline" => nav.invoke_write_offline("demo-ari".into(), "Ari".into()),
|
||||
"picture" => {
|
||||
let picture = demo_picture(1280, 720, 16);
|
||||
let image = crate::images::picture("demo:lightbox", &picture);
|
||||
nav.set_lightbox(image);
|
||||
nav.set_lightbox_open(true);
|
||||
}
|
||||
// The camera preview of the settings (the test pattern).
|
||||
"camera" => {
|
||||
with_app(|app| {
|
||||
app.start_camera();
|
||||
app.refresh_pages();
|
||||
});
|
||||
}
|
||||
"studio" => {
|
||||
if arg != "window" {
|
||||
nav.invoke_open_studio();
|
||||
@@ -318,7 +371,10 @@ fn demo_ui(app: &mut App) {
|
||||
client_version: None,
|
||||
};
|
||||
app.bookmarks = vec![
|
||||
bookmark(DEMO, "Nightfall Guild", "ts.nightfall.example:9987"),
|
||||
Bookmark {
|
||||
gateway_url: Some("wss://gw.nightfall.example/v1".into()),
|
||||
..bookmark(DEMO, "Nightfall Guild", "ts.nightfall.example:9987")
|
||||
},
|
||||
bookmark(DEMO + 1, "Pixel Lounge", "pixel.example"),
|
||||
bookmark(DEMO + 2, "Dev TS3", "127.0.0.1:9987"),
|
||||
];
|
||||
@@ -326,6 +382,9 @@ fn demo_ui(app: &mut App) {
|
||||
let session = DEMO as u64;
|
||||
|
||||
let mut p = Presence { server_name: "Nightfall Guild".into(), ..Default::default() };
|
||||
p.server.welcome_message =
|
||||
"Welcome to [b]Nightfall Guild[/b]! Raids on Tuesdays and Fridays, all levels welcome."
|
||||
.into();
|
||||
let mut chill = channel(2, 0, 1, "Chill Zone");
|
||||
chill.max_clients = Some(50);
|
||||
chill.topic = Some("Hang out, chat, and explore the worlds beyond.".into());
|
||||
@@ -354,6 +413,9 @@ fn demo_ui(app: &mut App) {
|
||||
client(9, 1, "Rin"),
|
||||
];
|
||||
clients[1].streaming = Some(true);
|
||||
// Live in other channels (the gateway's directory has their streams).
|
||||
clients[5].streaming = Some(true);
|
||||
clients[6].streaming = Some(true);
|
||||
clients[4].input_muted = true;
|
||||
clients[7].away = Some("brb".into());
|
||||
clients[8].output_muted = true;
|
||||
@@ -426,6 +488,10 @@ fn demo_ui(app: &mut App) {
|
||||
feature::PINS.into(),
|
||||
feature::REACTIONS.into(),
|
||||
feature::TOPICS.into(),
|
||||
feature::EVENTS.into(),
|
||||
feature::STREAMS.into(),
|
||||
feature::ACTIVITY.into(),
|
||||
feature::ADMIN.into(),
|
||||
],
|
||||
},
|
||||
},
|
||||
@@ -452,11 +518,529 @@ fn demo_ui(app: &mut App) {
|
||||
app.handle_event(event);
|
||||
}
|
||||
demo_chat(app, session);
|
||||
demo_social(app);
|
||||
// No toast over the screenshots.
|
||||
app.set_status("");
|
||||
app.refresh_all();
|
||||
}
|
||||
|
||||
/// Sample people, private chats, pokes, notifications, events, a picture
|
||||
/// and recordings for the home, friends, messages, events and settings
|
||||
/// screens (`VOELIN_DEMO_UI`).
|
||||
fn demo_social(app: &mut App) {
|
||||
let session = DEMO as u64;
|
||||
let now = chrono::Utc::now().timestamp_millis();
|
||||
let min = 60_000;
|
||||
// The second sample server is observed: a few people there.
|
||||
let mut lounge = Presence { server_name: "Pixel Lounge".into(), ..Default::default() };
|
||||
for c in [channel(1, 0, 0, "Lobby"), channel(2, 0, 1, "Art Corner"), channel(3, 0, 2, "Music")]
|
||||
{
|
||||
lounge.channels.insert(c.id, c);
|
||||
}
|
||||
let mut ivy = client(21, 2, "Ivy");
|
||||
ivy.uid = Some("demo-ivy".into());
|
||||
let mut sora = client(22, 3, "Sora");
|
||||
sora.uid = Some("demo-sora".into());
|
||||
sora.away = Some("painting".into());
|
||||
let mut pixel = client(23, 1, "Pixel");
|
||||
pixel.uid = Some("demo-pixel".into());
|
||||
for c in [ivy, sora, pixel] {
|
||||
lounge.clients.insert(c.id, c);
|
||||
}
|
||||
app.handle_event(Event::Presence { session: session + 1, presence: Arc::new(lounge) });
|
||||
app.handle_event(Event::State {
|
||||
session: session + 1,
|
||||
state: SessionState {
|
||||
observe: ObserveState::Observing,
|
||||
presence_source: Some(Source::Gateway),
|
||||
server_uid: Some("demo-lounge".into()),
|
||||
..Default::default()
|
||||
},
|
||||
});
|
||||
app.handle_event(Event::ServerInfo {
|
||||
session: session + 1,
|
||||
name: "Pixel Lounge".into(),
|
||||
flavor: ServerFlavor::from_version_string("3.13.8 [Build: 1]"),
|
||||
capabilities: Default::default(),
|
||||
});
|
||||
|
||||
// Contacts: friends here and there, some offline, one blocked.
|
||||
let contact =
|
||||
|uid: &str, nick: &str, relation: Relation, seen_min: i64, server: &str| Contact {
|
||||
uid: uid.into(),
|
||||
nickname: nick.into(),
|
||||
relation,
|
||||
note: String::new(),
|
||||
muted: false,
|
||||
volume: 1.0,
|
||||
added_ms: now - 400 * 86_400_000,
|
||||
last_seen_ms: if seen_min > 0 { now - seen_min * min } else { 0 },
|
||||
last_server: (!server.is_empty()).then(|| server.to_owned()),
|
||||
};
|
||||
let mut kairo = contact("demo-3", "Kairo", Relation::Friend, 1, "Nightfall Guild");
|
||||
kairo.note = "Tank on Tuesday raids. Always down for co-op.".into();
|
||||
let contacts = vec![
|
||||
contact("demo-2", "Lumen", Relation::Friend, 1, "Nightfall Guild"),
|
||||
kairo,
|
||||
contact("demo-4", "Mira", Relation::Friend, 1, "Nightfall Guild"),
|
||||
contact("demo-5", "dex", Relation::Friend, 1, "Nightfall Guild"),
|
||||
contact("demo-6", "Talon", Relation::Friend, 1, "Nightfall Guild"),
|
||||
contact("demo-7", "Zeph", Relation::Friend, 1, "Nightfall Guild"),
|
||||
contact("demo-ivy", "Ivy", Relation::Friend, 1, "Pixel Lounge"),
|
||||
contact("demo-sora", "Sora", Relation::Friend, 1, "Pixel Lounge"),
|
||||
contact("demo-ari", "Ari", Relation::Friend, 130, "Nightfall Guild"),
|
||||
contact("demo-neon", "Neon", Relation::Friend, 26 * 60, "Dev TS3"),
|
||||
contact("demo-9", "Rin", Relation::Neutral, 1, "Nightfall Guild"),
|
||||
contact("demo-spam", "FreeSkinsBot", Relation::Blocked, 3 * 24 * 60, "Pixel Lounge"),
|
||||
];
|
||||
app.handle_event(Event::ContactsChanged { contacts: Arc::new(contacts) });
|
||||
for (uid, ago) in [
|
||||
("demo-2", 12),
|
||||
("demo-3", 28),
|
||||
("demo-4", 42),
|
||||
("demo-5", 64),
|
||||
("demo-6", 95),
|
||||
("demo-7", 130),
|
||||
("demo-ivy", 8),
|
||||
("demo-sora", 50),
|
||||
] {
|
||||
app.social.online_since.insert(uid.into(), now - ago * min);
|
||||
}
|
||||
|
||||
// Private chats: with Kairo (a picture, a file), Mira, Lumen, dex,
|
||||
// and Ivy on the other server; Neon's is only stored.
|
||||
let picture = file_link(2, "night-castle.png", 412_331);
|
||||
let private =
|
||||
|id: i64, peer: &str, from_me: bool, author: (&str, u16), text: String, ago: i64| {
|
||||
HistoryMessage {
|
||||
id,
|
||||
message: ChatMessage {
|
||||
target: ChatTarget::Private(peer.into()),
|
||||
author_name: author.0.into(),
|
||||
author_uid: Some(if from_me { "demo-1".into() } else { peer.into() }),
|
||||
author_id: (author.1 > 0).then_some(author.1),
|
||||
text,
|
||||
ts_ms: now - ago * min,
|
||||
via_relay: false,
|
||||
blocked: false,
|
||||
},
|
||||
source: MessageSource::Voice,
|
||||
remote_id: None,
|
||||
topic_id: None,
|
||||
reactions: Vec::new(),
|
||||
pinned: false,
|
||||
rev: 0,
|
||||
}
|
||||
};
|
||||
let nova = ("Nova", 1);
|
||||
let kairo = ("Kairo", 3);
|
||||
let lines = vec![
|
||||
private(
|
||||
300,
|
||||
"demo-3",
|
||||
true,
|
||||
nova,
|
||||
format!("Hey! Check out this shot I got last night while exploring 👀 {picture}"),
|
||||
95,
|
||||
),
|
||||
private(301, "demo-3", false, kairo, "That looks incredible! Where was this?".into(), 93),
|
||||
private(
|
||||
302,
|
||||
"demo-3",
|
||||
true,
|
||||
nova,
|
||||
"In the northern region. The lighting was perfect.".into(),
|
||||
91,
|
||||
),
|
||||
private(
|
||||
303,
|
||||
"demo-3",
|
||||
false,
|
||||
kairo,
|
||||
"We should explore together this weekend! I found some cool locations too.".into(),
|
||||
89,
|
||||
),
|
||||
private(
|
||||
304,
|
||||
"demo-3",
|
||||
false,
|
||||
kairo,
|
||||
format!(
|
||||
"Here are the spots I marked. {}",
|
||||
file_link(2, "exploration-routes.pdf", 2_516_582)
|
||||
),
|
||||
88,
|
||||
),
|
||||
private(305, "demo-3", true, nova, "That sunset looks unreal. Let's do it! 🙌".into(), 6),
|
||||
private(
|
||||
310,
|
||||
"demo-4",
|
||||
false,
|
||||
("Mira", 4),
|
||||
"Working on a new video today, want to see a sneak peek?".into(),
|
||||
70,
|
||||
),
|
||||
private(311, "demo-2", false, ("Lumen", 2), "Let's run it tonight!".into(), 120),
|
||||
private(312, "demo-5", false, ("dex", 5), file_link(2, "map-notes.png", 96_120), 26 * 60),
|
||||
];
|
||||
for m in lines {
|
||||
let target = m.message.target.clone();
|
||||
app.handle_event(Event::ChatHistory {
|
||||
session,
|
||||
target,
|
||||
messages: vec![m],
|
||||
source: HistorySource::Gateway,
|
||||
complete: true,
|
||||
});
|
||||
}
|
||||
app.handle_event(Event::ChatHistory {
|
||||
session: session + 1,
|
||||
target: ChatTarget::Private("demo-ivy".into()),
|
||||
messages: vec![HistoryMessage {
|
||||
message: ChatMessage {
|
||||
target: ChatTarget::Private("demo-ivy".into()),
|
||||
author_name: "Ivy".into(),
|
||||
author_uid: Some("demo-ivy".into()),
|
||||
author_id: Some(21),
|
||||
text: "Same here! The new channel is great.".into(),
|
||||
ts_ms: now - 30 * min,
|
||||
via_relay: true,
|
||||
blocked: false,
|
||||
},
|
||||
..private(320, "demo-ivy", false, ("Ivy", 21), String::new(), 30)
|
||||
}],
|
||||
source: HistorySource::Gateway,
|
||||
complete: true,
|
||||
});
|
||||
let mut neon = private(
|
||||
330,
|
||||
"demo-neon",
|
||||
false,
|
||||
("Neon", 0),
|
||||
"Sent you the config, check the server folder.".into(),
|
||||
3 * 24 * 60,
|
||||
);
|
||||
neon.message.author_id = None;
|
||||
app.social.dm.stored.push(("demo-dev".into(), neon));
|
||||
app.social.dm.bookmark_of.insert("demo-dev".into(), DEMO + 2);
|
||||
// Unread: Mira's and Lumen's messages came while away.
|
||||
if let Some(view) = app.sessions.get_mut(&DEMO) {
|
||||
for tab in &mut view.tabs {
|
||||
match &tab.target {
|
||||
ChatTarget::Private(uid) if uid == "demo-4" => tab.unread = 1,
|
||||
ChatTarget::Private(uid) if uid == "demo-2" => tab.unread = 2,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
// A poke from Kairo, shown among the messages and in the bell.
|
||||
app.handle_event(Event::Poke {
|
||||
session,
|
||||
from: 3,
|
||||
from_uid: Some("demo-3".into()),
|
||||
from_name: "Kairo".into(),
|
||||
message: "raid in 5?".into(),
|
||||
blocked: false,
|
||||
});
|
||||
if let Some(p) = app.social.pokes.last_mut() {
|
||||
p.ts_ms = now - 7 * min;
|
||||
}
|
||||
// Offline messages the server keeps (the Inbox tab).
|
||||
let mail = |id: u32, from: &str, subject: &str, ago_min: i64, read: bool| OfflineMessageInfo {
|
||||
id,
|
||||
from_uid: from.into(),
|
||||
subject: subject.into(),
|
||||
ts_s: (now - ago_min * min) / 1000,
|
||||
read,
|
||||
};
|
||||
app.handle_event(Event::OfflineMessages {
|
||||
session,
|
||||
request: 0,
|
||||
result: Ok(vec![
|
||||
mail(1, "demo-ari", "Raid roster for Friday", 3 * 60, false),
|
||||
mail(2, "demo-neon", "The config for the dev server", 26 * 60, true),
|
||||
mail(3, "demo-4", "Thumbnails for the stream", 3 * 24 * 60, true),
|
||||
]),
|
||||
});
|
||||
|
||||
// The pictures of the links, as if downloaded.
|
||||
if let Some(view) = app.sessions.get_mut(&DEMO) {
|
||||
for (channel, name) in
|
||||
[(2, "night-castle.png"), (2, "guild-banner.png"), (2, "map-notes.png")]
|
||||
{
|
||||
let file = voelin_model::FileRef {
|
||||
channel,
|
||||
path: "/".into(),
|
||||
name: name.into(),
|
||||
..Default::default()
|
||||
};
|
||||
view.extra.previews.insert(
|
||||
crate::previews::link_key(&file),
|
||||
crate::previews::Preview::Ready(voelin_core::Bytes(
|
||||
demo_picture(640, 360, name.len() as u32).into(),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// The gateway's events (one is live), its configuration and rules.
|
||||
let by = |name: &str, uid: &str| UserRef { uid: uid.into(), name: name.into() };
|
||||
let event =
|
||||
|id: i64, title: &str, start: i64, hours: i64, channel: Option<u64>, stream: bool| {
|
||||
EventInfo {
|
||||
id,
|
||||
spec: EventSpec {
|
||||
title: title.into(),
|
||||
description: String::new(),
|
||||
start_ms: start,
|
||||
end_ms: Some(start + hours * 3_600_000),
|
||||
channel,
|
||||
kind: if stream { EventKind::Stream } else { EventKind::General },
|
||||
stream_title: None,
|
||||
stream_game: None,
|
||||
host_uid: None,
|
||||
},
|
||||
creator: by("Nova", "demo-1"),
|
||||
created_ms: now - 86_400_000,
|
||||
updated_ms: now - 86_400_000,
|
||||
going: 0,
|
||||
maybe: 0,
|
||||
not_going: 0,
|
||||
my_rsvp: None,
|
||||
attendees: Vec::new(),
|
||||
live_stream: None,
|
||||
}
|
||||
};
|
||||
let hour = 3_600_000;
|
||||
let tomorrow = (now / 86_400_000 + 1) * 86_400_000 + 18 * hour;
|
||||
let mut raid = event(1, "Raid Night: The Frozen Citadel", tomorrow, 3, Some(4), false);
|
||||
raid.spec.description = "Bring elixirs and fire resistance. Voice in Raid Night.".into();
|
||||
raid.going = 12;
|
||||
raid.maybe = 4;
|
||||
raid.not_going = 1;
|
||||
raid.my_rsvp = Some(RsvpStatus::Going);
|
||||
raid.attendees = vec![
|
||||
Attendee { user: by("Nova", "demo-1"), status: RsvpStatus::Going, ts_ms: now },
|
||||
Attendee { user: by("Kairo", "demo-3"), status: RsvpStatus::Going, ts_ms: now },
|
||||
Attendee { user: by("Mira", "demo-4"), status: RsvpStatus::Maybe, ts_ms: now },
|
||||
Attendee { user: by("dex", "demo-5"), status: RsvpStatus::NotGoing, ts_ms: now },
|
||||
];
|
||||
let mut live = event(2, "Exploring the Lands Between", now - 12 * min, 2, Some(2), true);
|
||||
live.spec.stream_title = Some("Exploring the Lands Between".into());
|
||||
live.spec.stream_game = Some("Elden Ring".into());
|
||||
live.creator = by("Lumen", "demo-2");
|
||||
live.going = 8;
|
||||
live.live_stream = Some("demo-stream".into());
|
||||
let mut night = event(3, "Community Game Night", tomorrow + 2 * 86_400_000, 3, None, false);
|
||||
night.spec.description = "Party games for everyone: drop in any time.".into();
|
||||
night.creator = by("Talon", "demo-6");
|
||||
night.going = 23;
|
||||
night.maybe = 9;
|
||||
let mut lofi = event(4, "Late Night Lofi & Chat", now + 50 * min, 2, Some(5), true);
|
||||
lofi.spec.stream_title = Some("Lofi beats to raid to".into());
|
||||
lofi.creator = by("Mira", "demo-4");
|
||||
lofi.going = 5;
|
||||
lofi.maybe = 2;
|
||||
app.handle_event(Event::Gateway {
|
||||
session,
|
||||
update: GatewayUpdate::Events { events: vec![raid, live, night, lofi] },
|
||||
});
|
||||
app.handle_event(Event::Gateway {
|
||||
session,
|
||||
update: GatewayUpdate::Permissions {
|
||||
channel: None,
|
||||
actions: vec![
|
||||
Action::React,
|
||||
Action::Pin,
|
||||
Action::CreateEvent,
|
||||
Action::Rsvp,
|
||||
Action::Moderate,
|
||||
Action::Admin,
|
||||
],
|
||||
},
|
||||
});
|
||||
let config = |key: &str, value: serde_json::Value, source: ConfigSource, description: &str| {
|
||||
ConfigEntry {
|
||||
key: key.into(),
|
||||
default: value.clone(),
|
||||
value,
|
||||
source,
|
||||
value_type: "int".into(),
|
||||
description: description.into(),
|
||||
bootstrap: false,
|
||||
}
|
||||
};
|
||||
app.handle_event(Event::Gateway {
|
||||
session,
|
||||
update: GatewayUpdate::Config {
|
||||
entries: vec![
|
||||
config(
|
||||
"history.retention_days",
|
||||
serde_json::json!(90),
|
||||
ConfigSource::Db,
|
||||
"Days of chat history the gateway keeps.",
|
||||
),
|
||||
config(
|
||||
"events.reminders_min",
|
||||
serde_json::json!([60, 15, 0]),
|
||||
ConfigSource::File,
|
||||
"Minutes before an event when reminders go out.",
|
||||
),
|
||||
config(
|
||||
"streams.directory",
|
||||
serde_json::json!(true),
|
||||
ConfigSource::Default,
|
||||
"Keep a directory of the server's streams.",
|
||||
),
|
||||
],
|
||||
},
|
||||
});
|
||||
app.handle_event(Event::Gateway {
|
||||
session,
|
||||
update: GatewayUpdate::PermRules {
|
||||
rules: vec![
|
||||
PermRuleInfo {
|
||||
action: Action::CreateEvent,
|
||||
rule: Some(PermRule {
|
||||
everyone: false,
|
||||
server_groups: vec![GROUP_ADMIN, GROUP_MOD],
|
||||
channel_groups: vec![],
|
||||
}),
|
||||
source: ConfigSource::Db,
|
||||
default: "server admins".into(),
|
||||
},
|
||||
PermRuleInfo {
|
||||
action: Action::Pin,
|
||||
rule: None,
|
||||
source: ConfigSource::Default,
|
||||
default: "moderators".into(),
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
// Notifications: a mention, a message, an event, a friend online (and
|
||||
// the poke above).
|
||||
use crate::social::{NoticeKind, NoticeTarget};
|
||||
app.notify(
|
||||
NoticeKind::Mention,
|
||||
"Talon mentioned you".into(),
|
||||
"Nova, can you open the raid at 20:00? — #Chill Zone · Nightfall Guild".into(),
|
||||
NoticeTarget::Chat(DEMO, ChatTarget::Channel(2)),
|
||||
"Talon".into(),
|
||||
Some("demo-6".into()),
|
||||
);
|
||||
app.notify(
|
||||
NoticeKind::Event,
|
||||
"Late Night Lofi & Chat starts in 50 min".into(),
|
||||
"on Nightfall Guild".into(),
|
||||
NoticeTarget::Event(DEMO, 4),
|
||||
"Mira".into(),
|
||||
Some("demo-4".into()),
|
||||
);
|
||||
app.notify(
|
||||
NoticeKind::Friend,
|
||||
"Ivy is online".into(),
|
||||
"on Pixel Lounge · #Art Corner".into(),
|
||||
NoticeTarget::Contact("demo-ivy".into()),
|
||||
"Ivy".into(),
|
||||
Some("demo-ivy".into()),
|
||||
);
|
||||
app.notify(
|
||||
NoticeKind::Message,
|
||||
"Mira".into(),
|
||||
"Working on a new video today, want to see a sneak peek?".into(),
|
||||
NoticeTarget::Dm(DEMO, "demo-4".into()),
|
||||
"Mira".into(),
|
||||
Some("demo-4".into()),
|
||||
);
|
||||
for (i, n) in app.social.notices.iter_mut().enumerate() {
|
||||
n.ts_ms = now - (i as i64 * 9 + 2) * min;
|
||||
n.unread = i < 3;
|
||||
}
|
||||
app.refresh_notices();
|
||||
|
||||
// Recordings and clips of the Studio.
|
||||
let recording = |name: &str, detail: &str| RecordingItem {
|
||||
name: name.into(),
|
||||
detail: detail.into(),
|
||||
clip: name.contains("clip"),
|
||||
path: format!("/tmp/{name}").into(),
|
||||
};
|
||||
crate::vm::list::sync(
|
||||
&app.models.social.recordings,
|
||||
&[
|
||||
recording("raid-night-2026-10-02.webm", "1.2 GB · 2 Oct 22:41"),
|
||||
recording("clip-boss-down.mkv", "38.4 MB · 2 Oct 21:57"),
|
||||
recording("lands-between-stream.mkv", "2.8 GB · 28 Sep 20:12"),
|
||||
recording("clip-lucky-parry.mkv", "12.1 MB · 28 Sep 19:40"),
|
||||
],
|
||||
);
|
||||
app.refresh_chats();
|
||||
app.refresh_people();
|
||||
app.refresh_home();
|
||||
}
|
||||
|
||||
/// A painted night: sky, moon, stars, hills and a castle; PNG bytes.
|
||||
fn demo_picture(width: u32, height: u32, seed: u32) -> Vec<u8> {
|
||||
let mut rgba = Vec::with_capacity((width * height * 4) as usize);
|
||||
let (w, h) = (width as f32, height as f32);
|
||||
let (mx, my, mr) = (w * 0.68, h * 0.3, h * 0.17);
|
||||
let hash = |x: u32, y: u32| {
|
||||
let mut v = x.wrapping_mul(374_761_393)
|
||||
^ y.wrapping_mul(668_265_263)
|
||||
^ seed.wrapping_mul(2_654_435_761);
|
||||
v = (v ^ (v >> 13)).wrapping_mul(1_274_126_177);
|
||||
v ^ (v >> 16)
|
||||
};
|
||||
for y in 0..height {
|
||||
for x in 0..width {
|
||||
let (fx, fy) = (x as f32, y as f32);
|
||||
let t = fy / h;
|
||||
// Sky: deep blue to violet at the horizon.
|
||||
let mut c = [12.0 + 50.0 * t, 18.0 + 30.0 * t, 60.0 + 90.0 * t];
|
||||
// Moon and its glow.
|
||||
let d = ((fx - mx).powi(2) + (fy - my).powi(2)).sqrt();
|
||||
if d < mr {
|
||||
let shade = 1.0 - 0.25 * ((fx - mx + mr * 0.3) / mr).max(0.0);
|
||||
c = [200.0 * shade, 210.0 * shade, 245.0 * shade];
|
||||
} else {
|
||||
let glow = (1.0 - (d - mr) / (mr * 2.5)).max(0.0) * 60.0;
|
||||
c = [c[0] + glow, c[1] + glow, c[2] + glow * 1.2];
|
||||
}
|
||||
if hash(x, y) % 900 == 0 && t < 0.6 {
|
||||
c = [235.0, 235.0, 255.0];
|
||||
}
|
||||
// Hills, then a castle on the middle one.
|
||||
let far = h * 0.62 + (fx / w * 9.0 + seed as f32).sin() * h * 0.05;
|
||||
let near = h * 0.78 + (fx / w * 5.0 + 1.3).sin() * h * 0.06;
|
||||
let castle = (fx > w * 0.36
|
||||
&& fx < w * 0.52
|
||||
&& fy > h * 0.38
|
||||
&& ((((fx - w * 0.36) / (w * 0.02)) as u32).is_multiple_of(2) || fy > h * 0.45))
|
||||
|| (fx > w * 0.42 && fx < w * 0.46 && fy > h * 0.24);
|
||||
if fy > near {
|
||||
c = [6.0, 10.0, 26.0];
|
||||
} else if fy > far || castle {
|
||||
c = [16.0, 20.0, 52.0];
|
||||
// Lit windows.
|
||||
if castle && hash(x / 6, y / 8) % 7 == 0 && (x % 6) < 3 && (y % 8) < 4 {
|
||||
c = [255.0, 190.0, 90.0];
|
||||
}
|
||||
}
|
||||
rgba.extend([c[0].min(255.0) as u8, c[1].min(255.0) as u8, c[2].min(255.0) as u8, 255]);
|
||||
}
|
||||
}
|
||||
let mut out = Vec::new();
|
||||
let mut encoder = png::Encoder::new(&mut out, width, height);
|
||||
encoder.set_color(png::ColorType::Rgba);
|
||||
encoder.set_depth(png::BitDepth::Eight);
|
||||
if let Ok(mut writer) = encoder.write_header() {
|
||||
let _ = writer.write_image_data(&rgba);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Server group ids of the sample server.
|
||||
const GROUP_ADMIN: u64 = 6;
|
||||
const GROUP_MOD: u64 = 7;
|
||||
@@ -680,19 +1264,47 @@ fn demo_chat(app: &mut App, session: u64) {
|
||||
app.handle_event(Event::Gateway {
|
||||
session,
|
||||
update: GatewayUpdate::Streams {
|
||||
streams: vec![StreamEntry {
|
||||
id: "demo-stream".into(),
|
||||
stream_id: Some("demo-stream".into()),
|
||||
streamer: UserRef { uid: "demo-2".into(), name: "Lumen".into() },
|
||||
client_id: Some(2),
|
||||
channel: Some(2),
|
||||
title: "Exploring the Lands Between".into(),
|
||||
kind: "screen".into(),
|
||||
started_ms: now - 12 * 60_000,
|
||||
viewers: Some(12),
|
||||
source: StreamSource::Registered,
|
||||
event_id: None,
|
||||
}],
|
||||
streams: vec![
|
||||
StreamEntry {
|
||||
id: "demo-stream".into(),
|
||||
stream_id: Some("demo-stream".into()),
|
||||
streamer: UserRef { uid: "demo-2".into(), name: "Lumen".into() },
|
||||
client_id: Some(2),
|
||||
channel: Some(2),
|
||||
title: "Exploring the Lands Between".into(),
|
||||
kind: "screen".into(),
|
||||
started_ms: now - 12 * 60_000,
|
||||
viewers: Some(12),
|
||||
source: StreamSource::Registered,
|
||||
event_id: None,
|
||||
},
|
||||
StreamEntry {
|
||||
id: "demo-stream-2".into(),
|
||||
stream_id: Some("demo-stream-2".into()),
|
||||
streamer: UserRef { uid: "demo-6".into(), name: "Talon".into() },
|
||||
client_id: Some(6),
|
||||
channel: Some(3),
|
||||
title: "Ranked Grind & Vibes".into(),
|
||||
kind: "screen".into(),
|
||||
started_ms: now - 41 * 60_000,
|
||||
viewers: Some(38),
|
||||
source: StreamSource::Registered,
|
||||
event_id: None,
|
||||
},
|
||||
StreamEntry {
|
||||
id: "demo-stream-3".into(),
|
||||
stream_id: Some("demo-stream-3".into()),
|
||||
streamer: UserRef { uid: "demo-7".into(), name: "Zeph".into() },
|
||||
client_id: Some(7),
|
||||
channel: Some(4),
|
||||
title: "Raid prep: gear check".into(),
|
||||
kind: "camera".into(),
|
||||
started_ms: now - 8 * 60_000,
|
||||
viewers: Some(9),
|
||||
source: StreamSource::Registered,
|
||||
event_id: None,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
let by = |name: &str| UserRef { uid: format!("demo-{name}"), name: name.into() };
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
//! What a server's gateway tells besides chat: its events (the events
|
||||
//! page, RSVP, reminders), the stream directory and the activity feed (the
|
||||
//! home page), our permissions there, its configuration (gateway
|
||||
//! administration). The pins, reactions and topics are in `chat.rs`.
|
||||
|
||||
use slint::{ComponentHandle, SharedString};
|
||||
use voelin_core::{Command, GatewayRequest, GatewayUpdate};
|
||||
use voelin_gateway_proto::{Action, EventKind, EventQuery, EventSpec, RsvpStatus, feature};
|
||||
|
||||
use crate::app::{App, Bridge, EventForm, EventItem};
|
||||
use crate::social::{NoticeKind, NoticeTarget, now_ms};
|
||||
use crate::vm;
|
||||
use crate::vm::social::{date_block, event_when, format_local, parse_local, soon};
|
||||
|
||||
impl App {
|
||||
/// A request to a session's gateway (not for the sample sessions).
|
||||
pub(crate) fn gateway_to(&self, session: i64, request: GatewayRequest) {
|
||||
if !self.demo_ui {
|
||||
self.engine.send(Command::Gateway { session: session as u64, request });
|
||||
}
|
||||
}
|
||||
|
||||
/// Keep what a gateway update tells these screens (before the chat
|
||||
/// handles its part).
|
||||
pub(crate) fn gateway_extra(&mut self, id: i64, update: &GatewayUpdate) {
|
||||
use GatewayUpdate as U;
|
||||
let mut ask: Vec<GatewayRequest> = Vec::new();
|
||||
let mut remind = None;
|
||||
let extra = &mut self.sessions.entry(id).or_default().extra;
|
||||
match update {
|
||||
U::Connected { uid, capabilities, .. } => {
|
||||
extra.gateway_uid = Some(uid.clone());
|
||||
let has = |f: &str| capabilities.iter().any(|c| c == f);
|
||||
ask.push(GatewayRequest::Permissions { channel: None });
|
||||
if has(feature::EVENTS) {
|
||||
ask.push(GatewayRequest::Events { query: EventQuery::default() });
|
||||
}
|
||||
if has(feature::STREAMS) {
|
||||
ask.push(GatewayRequest::Streams);
|
||||
}
|
||||
if has(feature::ACTIVITY) {
|
||||
ask.push(GatewayRequest::Activity { before: None, limit: Some(30) });
|
||||
}
|
||||
}
|
||||
U::Disconnected { .. } => {
|
||||
extra.directory.clear();
|
||||
extra.events.clear();
|
||||
extra.events_loaded = false;
|
||||
extra.activity.clear();
|
||||
extra.actions.clear();
|
||||
extra.config.clear();
|
||||
extra.perms.clear();
|
||||
}
|
||||
U::Permissions { channel: None, actions } => extra.actions = actions.clone(),
|
||||
U::Events { events } => {
|
||||
extra.events = events.clone();
|
||||
extra.events.sort_by_key(|e| e.spec.start_ms);
|
||||
extra.events_loaded = true;
|
||||
}
|
||||
U::Event { event } => {
|
||||
match extra.events.iter().position(|e| e.id == event.id) {
|
||||
Some(i) => extra.events[i] = event.clone(),
|
||||
None => extra.events.push(event.clone()),
|
||||
}
|
||||
extra.events.sort_by_key(|e| e.spec.start_ms);
|
||||
}
|
||||
U::EventDeleted { id: event } => extra.events.retain(|e| e.id != *event),
|
||||
U::EventReminder { event, starts_in_ms } => {
|
||||
remind = Some((event.clone(), *starts_in_ms))
|
||||
}
|
||||
U::Streams { streams } => extra.directory = streams.clone(),
|
||||
U::StreamStarted { stream }
|
||||
| U::StreamUpdated { stream }
|
||||
| U::StreamRegistered { stream } => {
|
||||
extra.directory.retain(|e| e.id != stream.id);
|
||||
extra.directory.push(stream.clone());
|
||||
}
|
||||
U::StreamEnded { id: stream, .. } => extra.directory.retain(|e| e.id != *stream),
|
||||
U::Activity { entries, .. } => extra.activity = entries.clone(),
|
||||
U::ActivityAdded { entry } => {
|
||||
extra.activity.insert(0, entry.clone());
|
||||
extra.activity.truncate(100);
|
||||
}
|
||||
U::Config { entries } => extra.config = entries.clone(),
|
||||
U::ConfigValue { entry } => {
|
||||
match extra.config.iter().position(|e| e.key == entry.key) {
|
||||
Some(i) => extra.config[i] = entry.clone(),
|
||||
None => extra.config.push(entry.clone()),
|
||||
}
|
||||
}
|
||||
U::PermRules { rules } => extra.perms = rules.clone(),
|
||||
_ => return,
|
||||
}
|
||||
for request in ask {
|
||||
self.gateway_to(id, request);
|
||||
}
|
||||
if let Some((event, starts_in_ms)) = remind {
|
||||
let minutes = starts_in_ms / 60_000;
|
||||
let title = if minutes <= 0 {
|
||||
format!("{} starts now", event.spec.title)
|
||||
} else {
|
||||
format!("{} starts in {minutes} min", event.spec.title)
|
||||
};
|
||||
let body = format!("on {}", self.server_name(id));
|
||||
self.notify(
|
||||
NoticeKind::Event,
|
||||
title,
|
||||
body,
|
||||
NoticeTarget::Event(id, event.id),
|
||||
event.creator.name.clone(),
|
||||
Some(event.creator.uid.clone()),
|
||||
);
|
||||
}
|
||||
self.refresh_home();
|
||||
self.refresh_events();
|
||||
self.refresh_gateways();
|
||||
}
|
||||
|
||||
/// The events page of the current server was opened.
|
||||
pub(crate) fn open_events(&mut self) {
|
||||
let Some(id) = self.current else { return };
|
||||
let loaded = self.sessions.get(&id).is_some_and(|v| v.extra.events_loaded);
|
||||
if !loaded {
|
||||
self.gateway_to(id, GatewayRequest::Events { query: EventQuery::default() });
|
||||
}
|
||||
self.refresh_events();
|
||||
}
|
||||
|
||||
/// Channels an event can be in: server-wide first.
|
||||
fn event_channels(&self) -> Vec<(Option<u64>, String)> {
|
||||
let mut out = vec![(None, "Server-wide".to_owned())];
|
||||
if let Some(view) = self.view() {
|
||||
out.extend(
|
||||
view.presence.channels.values().map(|c| (Some(c.id), format!("#{}", c.name))),
|
||||
);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
pub(crate) fn refresh_events(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let view = self.view();
|
||||
let has = view.is_some_and(|v| v.gateway_has(feature::EVENTS));
|
||||
bridge.set_has_events(has);
|
||||
let extra = view.map(|v| &v.extra);
|
||||
let moderate = extra.is_some_and(|e| e.actions.contains(&Action::Moderate));
|
||||
bridge.set_can_create_events(
|
||||
has && extra
|
||||
.is_some_and(|e| e.actions.is_empty() || e.actions.contains(&Action::CreateEvent)),
|
||||
);
|
||||
bridge.set_events_loading(has && !extra.is_some_and(|e| e.events_loaded));
|
||||
let channels = self.event_channels();
|
||||
bridge.set_event_channels(crate::app::model(
|
||||
channels.iter().map(|(_, n)| SharedString::from(n.as_str())).collect(),
|
||||
));
|
||||
let now = now_ms();
|
||||
let items: Vec<EventItem> = extra
|
||||
.map(|extra| {
|
||||
extra
|
||||
.events
|
||||
.iter()
|
||||
.filter(|e| e.spec.end_ms.unwrap_or(e.spec.start_ms + 3 * 3_600_000) >= now)
|
||||
.map(|e| {
|
||||
let (weekday, day, month) = date_block(e.spec.start_ms);
|
||||
let place = channels
|
||||
.iter()
|
||||
.find(|(c, _)| *c == e.spec.channel)
|
||||
.map_or_else(|| "A channel".to_owned(), |(_, n)| n.clone());
|
||||
let stream = if e.spec.kind == EventKind::Stream {
|
||||
[e.spec.stream_title.clone(), e.spec.stream_game.clone()]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect::<Vec<_>>()
|
||||
.join(" · ")
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
let stream = if e.spec.kind == EventKind::Stream && stream.is_empty() {
|
||||
"Scheduled stream".to_owned()
|
||||
} else {
|
||||
stream
|
||||
};
|
||||
EventItem {
|
||||
id: e.id as i32,
|
||||
title: e.spec.title.clone().into(),
|
||||
description: e.spec.description.clone().into(),
|
||||
weekday: weekday.into(),
|
||||
day: day.into(),
|
||||
month: month.into(),
|
||||
when: event_when(e.spec.start_ms, e.spec.end_ms).into(),
|
||||
place: place.into(),
|
||||
stream: stream.into(),
|
||||
live: e.live_stream.is_some(),
|
||||
going: e.going as i32,
|
||||
maybe: e.maybe as i32,
|
||||
not_going: e.not_going as i32,
|
||||
rsvp: e.my_rsvp.map(RsvpStatus::as_str).unwrap_or_default().into(),
|
||||
creator: e.creator.name.clone().into(),
|
||||
editable: moderate
|
||||
|| extra.gateway_uid.as_deref() == Some(e.creator.uid.as_str()),
|
||||
soon: soon(e.spec.start_ms, e.spec.end_ms, now).into(),
|
||||
attendees: crate::app::model(
|
||||
e.attendees
|
||||
.iter()
|
||||
.map(|a| {
|
||||
let status = match a.status {
|
||||
RsvpStatus::Going => "going",
|
||||
RsvpStatus::Maybe => "maybe",
|
||||
RsvpStatus::NotGoing => "not going",
|
||||
RsvpStatus::Unknown => "?",
|
||||
};
|
||||
SharedString::from(format!("{} ({status})", a.user.name))
|
||||
})
|
||||
.collect(),
|
||||
),
|
||||
expanded: extra.expanded.contains(&e.id),
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
vm::list::sync(&self.models.social.events, &items);
|
||||
}
|
||||
|
||||
/// Answer an event ("" withdraws the answer).
|
||||
pub(crate) fn rsvp(&mut self, event_id: i32, status: &str) {
|
||||
let Some(id) = self.current else { return };
|
||||
let status = (!status.is_empty()).then(|| RsvpStatus::parse(status));
|
||||
self.gateway_to(id, GatewayRequest::Rsvp { event_id: i64::from(event_id), status });
|
||||
}
|
||||
|
||||
/// Show or hide who answered (fetching the event with its attendees).
|
||||
pub(crate) fn toggle_event(&mut self, event_id: i32) {
|
||||
let Some(id) = self.current else { return };
|
||||
let event_id = i64::from(event_id);
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
if !view.extra.expanded.remove(&event_id) {
|
||||
view.extra.expanded.insert(event_id);
|
||||
self.gateway_to(id, GatewayRequest::GetEvent { id: event_id });
|
||||
}
|
||||
self.refresh_events();
|
||||
}
|
||||
|
||||
/// The form for a new event (`-1`) or an existing one.
|
||||
pub(crate) fn edit_event(&self, event_id: i32) -> EventForm {
|
||||
let channels = self.event_channels();
|
||||
let event =
|
||||
self.view().and_then(|v| v.extra.events.iter().find(|e| e.id == i64::from(event_id)));
|
||||
match event {
|
||||
Some(e) => EventForm {
|
||||
id: event_id,
|
||||
title: e.spec.title.clone().into(),
|
||||
description: e.spec.description.clone().into(),
|
||||
start: format_local(e.spec.start_ms).into(),
|
||||
end: e.spec.end_ms.map(format_local).unwrap_or_default().into(),
|
||||
channel: channels.iter().position(|(c, _)| *c == e.spec.channel).unwrap_or(0)
|
||||
as i32,
|
||||
stream: e.spec.kind == EventKind::Stream,
|
||||
stream_title: e.spec.stream_title.clone().unwrap_or_default().into(),
|
||||
game: e.spec.stream_game.clone().unwrap_or_default().into(),
|
||||
},
|
||||
None => {
|
||||
// The next full hour.
|
||||
let start = (now_ms() / 3_600_000 + 1) * 3_600_000;
|
||||
EventForm { id: -1, start: format_local(start).into(), ..Default::default() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Create or change an event; the reason when the form is not right.
|
||||
pub(crate) fn save_event(&mut self, form: &EventForm) -> String {
|
||||
let Some(id) = self.current else { return "No server selected.".into() };
|
||||
let Some(start_ms) = parse_local(&form.start) else {
|
||||
return "Write the start as YYYY-MM-DD HH:MM.".into();
|
||||
};
|
||||
let end_ms = if form.end.trim().is_empty() {
|
||||
None
|
||||
} else {
|
||||
match parse_local(&form.end) {
|
||||
Some(end) if end > start_ms => Some(end),
|
||||
Some(_) => return "The end must be after the start.".into(),
|
||||
None => return "Write the end as YYYY-MM-DD HH:MM, or leave it empty.".into(),
|
||||
}
|
||||
};
|
||||
let channels = self.event_channels();
|
||||
let text = |s: &slint::SharedString| Some(s.to_string()).filter(|s| !s.trim().is_empty());
|
||||
let spec = EventSpec {
|
||||
title: form.title.trim().to_owned(),
|
||||
description: form.description.to_string(),
|
||||
start_ms,
|
||||
end_ms,
|
||||
channel: channels.get(form.channel.max(0) as usize).and_then(|(c, _)| *c),
|
||||
kind: if form.stream { EventKind::Stream } else { EventKind::General },
|
||||
stream_title: text(&form.stream_title).filter(|_| form.stream),
|
||||
stream_game: text(&form.game).filter(|_| form.stream),
|
||||
host_uid: None,
|
||||
};
|
||||
self.gateway_to(
|
||||
id,
|
||||
if form.id < 0 {
|
||||
GatewayRequest::CreateEvent { event: spec }
|
||||
} else {
|
||||
GatewayRequest::UpdateEvent { id: i64::from(form.id), event: spec }
|
||||
},
|
||||
);
|
||||
String::new()
|
||||
}
|
||||
|
||||
pub(crate) fn delete_event(&mut self, event_id: i32) {
|
||||
if let Some(id) = self.current {
|
||||
self.gateway_to(id, GatewayRequest::DeleteEvent { id: i64::from(event_id) });
|
||||
}
|
||||
}
|
||||
|
||||
/// Watch the stream of a live scheduled stream.
|
||||
pub(crate) fn watch_event(&mut self, event_id: i32) {
|
||||
let Some(id) = self.current else { return };
|
||||
let stream = self
|
||||
.view()
|
||||
.and_then(|v| v.extra.events.iter().find(|e| e.id == i64::from(event_id)))
|
||||
.and_then(|e| e.live_stream.clone());
|
||||
if let Some(stream) = stream {
|
||||
self.watch_live(id, &stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
//! The home page (design mockup 01): live streams on our servers, what is
|
||||
//! happening there (events, scheduled streams, server news), and the
|
||||
//! Library of recordings and clips. Friends are in `social.rs`, the recent
|
||||
//! chats in `messages.rs`.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use slint::ComponentHandle;
|
||||
use voelin_core::VoiceState;
|
||||
|
||||
use crate::app::{App, Bridge, HappeningItem, LiveItem, Page, RecordingItem};
|
||||
use crate::vm;
|
||||
use crate::vm::social::{event_when, plain};
|
||||
|
||||
/// What a "What's Happening" entry opens.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub(crate) enum Happening {
|
||||
Event(i64, i64),
|
||||
News(i64),
|
||||
}
|
||||
|
||||
/// "screen" → "Screen".
|
||||
fn kind_label(kind: &str) -> String {
|
||||
let mut chars = kind.chars();
|
||||
chars.next().map(|c| c.to_uppercase().chain(chars).collect()).unwrap_or_default()
|
||||
}
|
||||
|
||||
impl App {
|
||||
/// Streams on our servers: those the server lists (any channel; we can
|
||||
/// watch them at once), the gateways' directories, and clients flagged
|
||||
/// streaming.
|
||||
fn live_rooms(&self) -> Vec<LiveItem> {
|
||||
let mut rooms = Vec::new();
|
||||
for b in &self.bookmarks {
|
||||
let Some(view) = self.sessions.get(&b.id) else { continue };
|
||||
let channel_of = |cid: Option<u64>| {
|
||||
cid.and_then(|c| view.presence.channels.get(&c))
|
||||
.map(|c| c.name.clone())
|
||||
.unwrap_or_default()
|
||||
};
|
||||
let backdrop = vm::avatar::tint(&b.name);
|
||||
let item = |id: String,
|
||||
title: String,
|
||||
client: Option<u16>,
|
||||
uid: Option<&str>,
|
||||
name: String| {
|
||||
let avatar = match (client, uid) {
|
||||
(Some(c), _) if view.avatar(c).is_some() => vm::avatar::image(view.avatar(c)),
|
||||
(_, Some(uid)) => self.avatar_of(uid),
|
||||
_ => slint::Image::default(),
|
||||
};
|
||||
LiveItem {
|
||||
session: b.id as i32,
|
||||
id: id.into(),
|
||||
title: title.into(),
|
||||
initials: vm::avatar::initials(&name).into(),
|
||||
tint: vm::avatar::tint(&name),
|
||||
avatar,
|
||||
streamer: name.into(),
|
||||
server: b.name.clone().into(),
|
||||
backdrop,
|
||||
..Default::default()
|
||||
}
|
||||
};
|
||||
let mut covered: Vec<u16> = Vec::new();
|
||||
if view.streams_available() {
|
||||
for s in &view.streams {
|
||||
let name = view.nickname(s.streamer.0);
|
||||
let title =
|
||||
if s.name.is_empty() { format!("{name}'s stream") } else { s.name.clone() };
|
||||
let mut room = item(s.id.clone(), title, Some(s.streamer.0), None, name);
|
||||
room.channel = channel_of(view.channel_of(s.streamer.0)).into();
|
||||
room.viewers = view.stream_viewers.get(&s.id).map_or(0, |v| *v as i32);
|
||||
room.kind = match s.kind {
|
||||
voelin_core::stream::StreamKind::Screen => "Screen",
|
||||
voelin_core::stream::StreamKind::Window => "Window",
|
||||
voelin_core::stream::StreamKind::Camera => "Camera",
|
||||
voelin_core::stream::StreamKind::Other(_) => "",
|
||||
}
|
||||
.into();
|
||||
room.watchable = view.state.own_client != Some(s.streamer.0);
|
||||
covered.push(s.streamer.0);
|
||||
rooms.push(room);
|
||||
}
|
||||
}
|
||||
for e in &view.extra.directory {
|
||||
if e.client_id.is_some_and(|c| covered.contains(&c)) {
|
||||
continue;
|
||||
}
|
||||
let title = if e.title.is_empty() {
|
||||
format!("{}'s stream", e.streamer.name)
|
||||
} else {
|
||||
e.title.clone()
|
||||
};
|
||||
let mut room = item(
|
||||
e.id.clone(),
|
||||
title,
|
||||
e.client_id,
|
||||
Some(&e.streamer.uid),
|
||||
e.streamer.name.clone(),
|
||||
);
|
||||
room.channel = channel_of(e.channel).into();
|
||||
room.viewers = e.viewers.map_or(0, |v| v as i32);
|
||||
room.kind = kind_label(&e.kind).into();
|
||||
covered.extend(e.client_id);
|
||||
rooms.push(room);
|
||||
}
|
||||
for c in view.presence.clients.values() {
|
||||
if c.streaming != Some(true)
|
||||
|| covered.contains(&c.id)
|
||||
|| Some(c.id) == view.state.own_client
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let mut room = item(
|
||||
format!("client/{}", c.id),
|
||||
format!("{} is live", c.nickname),
|
||||
Some(c.id),
|
||||
c.uid.as_deref(),
|
||||
c.nickname.clone(),
|
||||
);
|
||||
room.channel = channel_of(Some(c.channel)).into();
|
||||
rooms.push(room);
|
||||
}
|
||||
}
|
||||
rooms
|
||||
}
|
||||
|
||||
/// Events, scheduled streams and server news of our servers, what is
|
||||
/// soonest first.
|
||||
pub(crate) fn happenings(&self) -> Vec<(HappeningItem, Happening)> {
|
||||
let now = crate::social::now_ms();
|
||||
let mut events: Vec<(i64, HappeningItem, Happening)> = Vec::new();
|
||||
let mut news = Vec::new();
|
||||
for b in &self.bookmarks {
|
||||
let Some(view) = self.sessions.get(&b.id) else { continue };
|
||||
for e in &view.extra.events {
|
||||
let ends = e.spec.end_ms.unwrap_or(e.spec.start_ms + 3 * 3_600_000);
|
||||
if ends < now {
|
||||
continue;
|
||||
}
|
||||
let stream = e.spec.kind == voelin_gateway_proto::EventKind::Stream;
|
||||
events.push((
|
||||
e.spec.start_ms,
|
||||
HappeningItem {
|
||||
kind: if stream { "stream" } else { "event" }.into(),
|
||||
title: e.spec.title.clone().into(),
|
||||
subtitle: if stream {
|
||||
format!("Scheduled stream · {}", b.name)
|
||||
} else {
|
||||
format!("Event · {}", b.name)
|
||||
}
|
||||
.into(),
|
||||
when: event_when(e.spec.start_ms, e.spec.end_ms).into(),
|
||||
session: b.id as i32,
|
||||
id: e.id as i32,
|
||||
live: e.live_stream.is_some(),
|
||||
},
|
||||
Happening::Event(b.id, e.id),
|
||||
));
|
||||
}
|
||||
let details = &view.presence.server;
|
||||
for (title, text) in [
|
||||
(format!("Welcome to {}", b.name), &details.welcome_message),
|
||||
(format!("News of {}", b.name), &details.host_message),
|
||||
] {
|
||||
let text = plain(text);
|
||||
if !text.is_empty() {
|
||||
news.push((
|
||||
HappeningItem {
|
||||
kind: "news".into(),
|
||||
title: title.into(),
|
||||
subtitle: text.into(),
|
||||
session: b.id as i32,
|
||||
..Default::default()
|
||||
},
|
||||
Happening::News(b.id),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
events.sort_by_key(|(start, ..)| *start);
|
||||
events
|
||||
.into_iter()
|
||||
.map(|(_, item, h)| (item, h))
|
||||
.take(6)
|
||||
.chain(news.into_iter().take(3))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Live rooms and what is happening (friends: `refresh_people`, chats:
|
||||
/// `refresh_chats`).
|
||||
pub(crate) fn refresh_home(&self) {
|
||||
let m = &self.models.social;
|
||||
vm::list::sync(&m.live, &self.live_rooms());
|
||||
let items: Vec<HappeningItem> = self.happenings().into_iter().map(|(i, _)| i).collect();
|
||||
vm::list::sync(&m.happenings, &items);
|
||||
}
|
||||
|
||||
/// A live room's card: watch it at once in our channel, else go to its
|
||||
/// server (and the streamer's channel, watching once there).
|
||||
pub(crate) fn watch_live(&mut self, session: i64, id: &str) {
|
||||
self.show_server(session);
|
||||
let Some(view) = self.sessions.get(&session) else { return };
|
||||
if view.streams_available() && view.streams.iter().any(|s| s.id == id) {
|
||||
self.watch_stream(id.to_owned());
|
||||
return;
|
||||
}
|
||||
let client = view
|
||||
.extra
|
||||
.directory
|
||||
.iter()
|
||||
.find(|e| e.id == id)
|
||||
.and_then(|e| e.client_id)
|
||||
.or_else(|| id.strip_prefix("client/").and_then(|c| c.parse().ok()));
|
||||
match client {
|
||||
Some(client) if view.state.voice == VoiceState::Connected => self.watch_client(client),
|
||||
_ => self.set_status("Connect with voice to watch."),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn open_happening(&mut self, index: i32) {
|
||||
let Some((_, target)) =
|
||||
usize::try_from(index).ok().and_then(|i| self.happenings().into_iter().nth(i))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
match target {
|
||||
Happening::Event(session, _) => {
|
||||
self.select_server(session);
|
||||
self.navigate(|nav| nav.invoke_show(Page::Events));
|
||||
}
|
||||
Happening::News(session) => self.show_server(session),
|
||||
}
|
||||
}
|
||||
|
||||
/// Connect a bookmark with voice (the Join buttons).
|
||||
pub(crate) fn connect_server(&mut self, id: i64) {
|
||||
self.select_server(id);
|
||||
self.connect_voice();
|
||||
}
|
||||
|
||||
/// The folder of recordings and clips.
|
||||
fn recordings_dir(&self) -> PathBuf {
|
||||
voelin_core::studio::recording_dir(&self.prefs)
|
||||
}
|
||||
|
||||
/// List the recordings and clips (when the Library opens).
|
||||
pub(crate) fn load_library(&mut self) {
|
||||
// Sample data shows sample recordings, not the user's.
|
||||
if self.demo_ui {
|
||||
if let Some(ui) = self.ui.upgrade() {
|
||||
ui.global::<Bridge>().set_recordings_dir("~/Videos/Voelin".into());
|
||||
}
|
||||
return;
|
||||
}
|
||||
let dir = self.recordings_dir();
|
||||
let items = recordings_in(&dir);
|
||||
vm::list::sync(&self.models.social.recordings, &items);
|
||||
if let Some(ui) = self.ui.upgrade() {
|
||||
ui.global::<Bridge>().set_recordings_dir(dir.display().to_string().into());
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn open_recording(&mut self, path: &str) {
|
||||
if let Err(e) = crate::app::open_path(Path::new(path)) {
|
||||
self.set_status(format!("Cannot open {path}: {e}"));
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn open_recordings_folder(&mut self) {
|
||||
let dir = self.recordings_dir();
|
||||
if let Err(e) = std::fs::create_dir_all(&dir).and_then(|()| crate::app::open_path(&dir)) {
|
||||
self.set_status(format!("Cannot open {}: {e}", dir.display()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The videos in `dir`, newest first.
|
||||
pub(crate) fn recordings_in(dir: &Path) -> Vec<RecordingItem> {
|
||||
let Ok(entries) = std::fs::read_dir(dir) else { return Vec::new() };
|
||||
let mut files: Vec<(std::time::SystemTime, RecordingItem)> = entries
|
||||
.flatten()
|
||||
.filter_map(|e| {
|
||||
let path = e.path();
|
||||
let ext = path.extension()?.to_str()?.to_ascii_lowercase();
|
||||
if !["webm", "mkv", "mp4", "mov"].contains(&ext.as_str()) {
|
||||
return None;
|
||||
}
|
||||
let meta = e.metadata().ok()?;
|
||||
let modified = meta.modified().ok()?;
|
||||
let name = path.file_name()?.to_string_lossy().to_string();
|
||||
let when = chrono::DateTime::<chrono::Local>::from(modified).format("%-d %b %H:%M");
|
||||
Some((
|
||||
modified,
|
||||
RecordingItem {
|
||||
clip: name.to_lowercase().contains("clip"),
|
||||
detail: format!("{} · {when}", vm::chat::size_text(meta.len())).into(),
|
||||
name: name.into(),
|
||||
path: path.display().to_string().into(),
|
||||
},
|
||||
))
|
||||
})
|
||||
.collect();
|
||||
files.sort_by_key(|(t, _)| std::cmp::Reverse(*t));
|
||||
files.into_iter().map(|(_, item)| item).collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn library_lists_videos() {
|
||||
let dir = std::env::temp_dir().join(format!("voelin-library-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
std::fs::write(dir.join("raid.webm"), b"1234").unwrap();
|
||||
std::fs::write(dir.join("clip-boss.mkv"), b"12").unwrap();
|
||||
std::fs::write(dir.join("notes.txt"), b"x").unwrap();
|
||||
let items = recordings_in(&dir);
|
||||
let mut names: Vec<String> = items.iter().map(|i| i.name.to_string()).collect();
|
||||
names.sort();
|
||||
assert_eq!(names, ["clip-boss.mkv", "raid.webm"]);
|
||||
assert!(items.iter().any(|i| i.clip && i.detail.starts_with("2 B")));
|
||||
assert!(recordings_in(&dir.join("missing")).is_empty());
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
assert_eq!(kind_label("screen"), "Screen");
|
||||
assert_eq!(kind_label(""), "");
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,25 @@
|
||||
//! Settings → Identities: the stored identities, which one servers see us
|
||||
//! as (the default), and the import of the official clients' identities on
|
||||
//! start (`voelin_core::identity::import_new`, app.rs).
|
||||
//! The identity servers see us as: the store's default (schema 4,
|
||||
//! `Store::default_identity`), chosen under Settings → Profiles, and the
|
||||
//! import of the official clients' identities on start
|
||||
//! (`voelin_core::identity::import_new`, app.rs). The rest of the Profiles
|
||||
//! page is in `settings_pages.rs`.
|
||||
|
||||
use slint::ComponentHandle;
|
||||
use tracing::warn;
|
||||
use voelin_core::settings::IDENTITY_IMPORT;
|
||||
use voelin_store::{IdentityEntry, IdentityOrigin};
|
||||
use voelin_store::IdentityOrigin;
|
||||
|
||||
use crate::app::{App, Bridge, IdentityItem, model};
|
||||
use crate::vm::avatar;
|
||||
use crate::app::App;
|
||||
|
||||
/// A row of the identities card.
|
||||
fn item(entry: &IdentityEntry) -> IdentityItem {
|
||||
let origin = match entry.origin {
|
||||
IdentityOrigin::Imported => "From TeamSpeak",
|
||||
IdentityOrigin::Created | IdentityOrigin::User => "Made in Voelin",
|
||||
};
|
||||
IdentityItem {
|
||||
id: entry.id as i32,
|
||||
name: entry.name.clone().into(),
|
||||
detail: format!("{origin} · level {}", entry.level).into(),
|
||||
uid: entry.uid.clone().into(),
|
||||
initials: avatar::initials(&entry.name).into(),
|
||||
tint: avatar::tint(&entry.name),
|
||||
is_default: entry.is_default,
|
||||
/// Where an identity came from, as Profiles says it.
|
||||
pub(crate) fn origin_label(origin: IdentityOrigin) -> &'static str {
|
||||
match origin {
|
||||
IdentityOrigin::Created => "Made in Voelin",
|
||||
IdentityOrigin::Imported => "Imported",
|
||||
IdentityOrigin::User => "Chosen by you",
|
||||
}
|
||||
}
|
||||
|
||||
impl App {
|
||||
pub(crate) fn refresh_identities(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let mut entries = self.store.identities().unwrap_or_default();
|
||||
// A store from before defaults were marked: the first one.
|
||||
let default = self.store.default_identity().ok().flatten().map(|e| e.id);
|
||||
for entry in &mut entries {
|
||||
entry.is_default = Some(entry.id) == default;
|
||||
}
|
||||
bridge.set_identities(model(entries.iter().map(item).collect()));
|
||||
bridge.set_identity_import(self.prefs.get(&IDENTITY_IMPORT));
|
||||
}
|
||||
|
||||
/// The user's choice of the identity servers see us as, from the next
|
||||
/// connection on; no import replaces it.
|
||||
pub(crate) fn use_identity(&mut self, id: i64) {
|
||||
@@ -79,23 +58,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn rows_say_where_an_identity_came_from() {
|
||||
let entry = |origin, is_default| IdentityEntry {
|
||||
id: 3,
|
||||
name: "Main Nick".into(),
|
||||
uid: "uid=".into(),
|
||||
level: 8,
|
||||
origin,
|
||||
is_default,
|
||||
};
|
||||
let row = item(&entry(IdentityOrigin::Imported, true));
|
||||
assert_eq!((row.id, row.name.as_str(), row.uid.as_str()), (3, "Main Nick", "uid="));
|
||||
assert_eq!(row.detail, "From TeamSpeak · level 8");
|
||||
assert!(row.is_default);
|
||||
assert_eq!(row.initials, avatar::initials("Main Nick"));
|
||||
for origin in [IdentityOrigin::Created, IdentityOrigin::User] {
|
||||
let row = item(&entry(origin, false));
|
||||
assert_eq!(row.detail, "Made in Voelin · level 8");
|
||||
assert!(!row.is_default);
|
||||
}
|
||||
assert_eq!(origin_label(IdentityOrigin::Created), "Made in Voelin");
|
||||
assert_eq!(origin_label(IdentityOrigin::Imported), "Imported");
|
||||
// Made by the app, then chosen: an import never replaces it.
|
||||
assert_eq!(origin_label(IdentityOrigin::User), "Chosen by you");
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,21 @@ pub fn file(path: &std::path::Path) -> Image {
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// A picture from encoded bytes (PNG, JPEG, GIF, WebP), decoded once and
|
||||
/// kept by `key`; an empty image if it cannot be decoded.
|
||||
pub fn picture(key: &str, bytes: &[u8]) -> Image {
|
||||
let cache_key = format!("picture:{key}");
|
||||
CACHE
|
||||
.with(|c| {
|
||||
c.borrow_mut().get_or_load(&cache_key, || {
|
||||
let image = Image::load_from_data(bytes, None).ok()?;
|
||||
let size = image.size();
|
||||
Some((image, size.width as usize * size.height as usize * 4))
|
||||
})
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// A Twemoji by key; an empty image if there is none.
|
||||
pub fn emoji(key: &str) -> Image {
|
||||
if key.is_empty() {
|
||||
@@ -165,6 +180,17 @@ mod tests {
|
||||
assert_eq!(lru.get_or_load("none", || None), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pictures_decode() {
|
||||
let mut png = Vec::new();
|
||||
let mut encoder = png::Encoder::new(&mut png, 4, 2);
|
||||
encoder.set_color(png::ColorType::Rgba);
|
||||
encoder.set_depth(png::BitDepth::Eight);
|
||||
encoder.write_header().unwrap().write_image_data(&[200; 32]).unwrap();
|
||||
assert_eq!(picture("test:4x2", &png).size().width, 4);
|
||||
assert_eq!(picture("test:junk", b"not a picture").size().width, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn emoji_images_decode() {
|
||||
let image = emoji("1f600");
|
||||
|
||||
@@ -3,17 +3,24 @@
|
||||
mod app;
|
||||
mod appearance;
|
||||
mod bind;
|
||||
mod camera;
|
||||
mod chat;
|
||||
mod dev;
|
||||
mod emoji;
|
||||
mod events;
|
||||
mod home;
|
||||
mod hotkey;
|
||||
mod identities;
|
||||
mod images;
|
||||
mod inbox;
|
||||
mod members;
|
||||
mod messages;
|
||||
mod previews;
|
||||
mod servers;
|
||||
mod settings;
|
||||
mod settings_page;
|
||||
mod settings_pages;
|
||||
mod social;
|
||||
mod streams;
|
||||
mod studio;
|
||||
mod video;
|
||||
|
||||
@@ -0,0 +1,799 @@
|
||||
//! Direct messages (design mockup 02) and the recent chats of the home
|
||||
//! page: every chat the sessions hold and the newest ones in the history
|
||||
//! store, across servers; the open private chat with who it is with; TS3
|
||||
//! and TS6 offline messages (mail the server keeps).
|
||||
//!
|
||||
//! A private chat is a chat tab of its session (`ChatTarget::Private`
|
||||
//! stored under the peer's unique id), so opening one selects its server
|
||||
//! and its tab: the chat view's machinery (history pages, the composer)
|
||||
//! serves it. A chat only in the store (its server is not connected, or no
|
||||
//! longer a bookmark) is read from there and shown read-only.
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use slint::{ComponentHandle, Image, SharedString};
|
||||
use voelin_core::{Command, HistoryMessage, OfflineMessage, OfflineMessageInfo, VoiceState};
|
||||
use voelin_model::ChatTarget;
|
||||
use voelin_store::PageQuery;
|
||||
|
||||
use crate::app::{App, Bridge, ConversationItem, DmPeer, FileItem, Nav, OfflineForm, Page, later};
|
||||
use crate::vm;
|
||||
use crate::vm::social::{ago, list_time, matches, plain, preview};
|
||||
|
||||
/// Keys of offline messages in the conversation list start here.
|
||||
const MAIL: i32 = 10_000;
|
||||
|
||||
/// A chat of any server.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub(crate) struct ChatRef {
|
||||
/// The bookmark (session) it belongs to, when known.
|
||||
pub session: Option<i64>,
|
||||
pub server_uid: Option<String>,
|
||||
pub target: ChatTarget,
|
||||
pub last: Option<HistoryMessage>,
|
||||
pub unread: i32,
|
||||
}
|
||||
|
||||
/// The open conversation.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub(crate) struct Open {
|
||||
pub session: Option<i64>,
|
||||
pub server_uid: Option<String>,
|
||||
pub uid: String,
|
||||
/// An offline message (session, id) shown instead of the chat.
|
||||
pub mail: Option<(i64, u32)>,
|
||||
/// Read from the store: no session holds the chat.
|
||||
pub stored: bool,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct Dms {
|
||||
/// The newest stored message of every chat, with its server's unique id.
|
||||
pub stored: Vec<(String, HistoryMessage)>,
|
||||
/// Bookmarks by the server unique id remembered for their address.
|
||||
pub bookmark_of: HashMap<String, i64>,
|
||||
/// Every chat, newest first (the keys of the lists).
|
||||
pub chats: Vec<ChatRef>,
|
||||
/// The Inbox tab's offline messages: session and message.
|
||||
pub inbox: Vec<(i64, OfflineMessageInfo)>,
|
||||
/// 0 all, 1 unread, 2 inbox.
|
||||
pub tab: i32,
|
||||
pub filter: String,
|
||||
pub open: Option<Open>,
|
||||
/// The text of the open offline message.
|
||||
pub mail: Option<OfflineMessage>,
|
||||
/// Offline message requests in flight: session and what for.
|
||||
pub requests: HashMap<u64, (i64, &'static str)>,
|
||||
pub next_request: u64,
|
||||
}
|
||||
|
||||
impl App {
|
||||
/// Read the newest chats of the history store (start, and when the
|
||||
/// lists are shown).
|
||||
pub(crate) fn load_recent_chats(&mut self) {
|
||||
if self.demo_ui {
|
||||
return;
|
||||
}
|
||||
self.social.dm.bookmark_of.clear();
|
||||
for b in &self.bookmarks {
|
||||
for alias in [
|
||||
Some(format!("voice:{}", b.address)),
|
||||
b.gateway_url.as_ref().map(|u| format!("gateway:{u}")),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
{
|
||||
if let Ok(Some(uid)) = self.store.server_alias(&alias) {
|
||||
self.social.dm.bookmark_of.insert(uid, b.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
let history = self.engine.history();
|
||||
self.engine.runtime().spawn(async move {
|
||||
let result = history.recent_chats(60).await;
|
||||
later(move |app| match result {
|
||||
Ok(list) => {
|
||||
app.social.dm.stored = list;
|
||||
app.refresh_chats();
|
||||
app.refresh_home();
|
||||
}
|
||||
Err(e) => tracing::warn!("cannot read recent chats: {e}"),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// The session a server unique id belongs to.
|
||||
fn session_of_server(&self, server_uid: &str) -> Option<i64> {
|
||||
self.sessions
|
||||
.iter()
|
||||
.find(|(_, v)| v.state.server_uid.as_deref() == Some(server_uid))
|
||||
.map(|(id, _)| *id)
|
||||
.or_else(|| self.social.dm.bookmark_of.get(server_uid).copied())
|
||||
}
|
||||
|
||||
/// What we call the peer of a private chat.
|
||||
pub(crate) fn peer_name(&self, uid: &str, last: Option<&HistoryMessage>) -> String {
|
||||
if let Some(c) = self.contacts.get(uid).filter(|c| !c.nickname.is_empty()) {
|
||||
return c.nickname.clone();
|
||||
}
|
||||
if let Some(s) = self.spots_of(uid).first() {
|
||||
return self.sessions[&s.session].nickname(s.client);
|
||||
}
|
||||
let from_peer = |m: &HistoryMessage| {
|
||||
(m.message.author_uid.as_deref() == Some(uid)).then(|| m.message.author_name.clone())
|
||||
};
|
||||
last.and_then(from_peer)
|
||||
.or_else(|| {
|
||||
self.sessions.values().flat_map(|v| &v.tabs).find_map(|t| {
|
||||
(t.target == ChatTarget::Private(uid.to_owned()))
|
||||
.then(|| t.messages.iter().rev().find_map(|m| from_peer(&m.message)))
|
||||
.flatten()
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|| uid.chars().take(8).collect())
|
||||
}
|
||||
|
||||
/// Every chat, newest first; then the lists that show them.
|
||||
pub(crate) fn refresh_chats(&mut self) {
|
||||
let mut chats: Vec<ChatRef> = Vec::new();
|
||||
for b in &self.bookmarks {
|
||||
let Some(view) = self.sessions.get(&b.id) else { continue };
|
||||
for tab in &view.tabs {
|
||||
let last = tab.messages.last().map(|m| m.message.clone());
|
||||
if last.is_none() && !matches!(tab.target, ChatTarget::Private(_)) {
|
||||
continue;
|
||||
}
|
||||
chats.push(ChatRef {
|
||||
session: Some(b.id),
|
||||
server_uid: view.state.server_uid.clone(),
|
||||
target: tab.target.clone(),
|
||||
last,
|
||||
unread: tab.unread,
|
||||
});
|
||||
}
|
||||
}
|
||||
for (server_uid, m) in &self.social.dm.stored {
|
||||
let known = chats.iter().any(|c| {
|
||||
c.target == m.message.target && c.server_uid.as_deref() == Some(server_uid.as_str())
|
||||
});
|
||||
if !known {
|
||||
chats.push(ChatRef {
|
||||
session: self.session_of_server(server_uid),
|
||||
server_uid: Some(server_uid.clone()),
|
||||
target: m.message.target.clone(),
|
||||
last: Some(m.clone()),
|
||||
unread: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
chats.sort_by_key(|c| std::cmp::Reverse(c.last.as_ref().map_or(0, |m| m.message.ts_ms)));
|
||||
self.social.dm.chats = chats;
|
||||
self.social.dm.inbox = self
|
||||
.bookmarks
|
||||
.iter()
|
||||
.filter_map(|b| self.sessions.get(&b.id).map(|v| (b.id, v)))
|
||||
.flat_map(|(id, v)| v.extra.inbox.iter().map(move |m| (id, m.clone())))
|
||||
.collect();
|
||||
self.social.dm.inbox.sort_by_key(|(_, m)| std::cmp::Reverse(m.ts_s));
|
||||
self.refresh_conversations();
|
||||
self.refresh_dm();
|
||||
}
|
||||
|
||||
/// One chat for a list.
|
||||
fn conversation_item(&self, key: usize, chat: &ChatRef) -> ConversationItem {
|
||||
let session = chat.session;
|
||||
let server =
|
||||
session.map(|s| self.server_name(s)).unwrap_or_else(|| "Another server".into());
|
||||
let (title, avatar, online, kind) = match &chat.target {
|
||||
ChatTarget::Private(uid) => (
|
||||
self.peer_name(uid, chat.last.as_ref()),
|
||||
self.avatar_of(uid),
|
||||
!self.spots_of(uid).is_empty(),
|
||||
2,
|
||||
),
|
||||
ChatTarget::Channel(cid) => {
|
||||
let name = session
|
||||
.and_then(|s| self.sessions.get(&s))
|
||||
.and_then(|v| v.presence.channels.get(cid))
|
||||
.map_or_else(|| format!("#channel {cid}"), |c| format!("#{}", c.name));
|
||||
(name, slint::Image::default(), false, 1)
|
||||
}
|
||||
ChatTarget::Server => (server.clone(), slint::Image::default(), false, 0),
|
||||
};
|
||||
let (text, ts) = match &chat.last {
|
||||
Some(m) => {
|
||||
let mine = session.is_some_and(|s| self.is_own(s, &m.message));
|
||||
let files = m.message.file_refs();
|
||||
let mut text = preview(&m.message.text, mine, &files);
|
||||
if kind != 2 && !mine {
|
||||
text = format!("{}: {text}", m.message.author_name);
|
||||
}
|
||||
(text, m.message.ts_ms)
|
||||
}
|
||||
None => (String::new(), 0),
|
||||
};
|
||||
let open = self.social.dm.open.as_ref();
|
||||
ConversationItem {
|
||||
key: key as i32,
|
||||
kind,
|
||||
title: title.clone().into(),
|
||||
server: server.into(),
|
||||
preview: text.into(),
|
||||
time: list_time(ts).into(),
|
||||
ago: ago(ts).into(),
|
||||
unread: chat.unread,
|
||||
initials: vm::avatar::initials(&title).into(),
|
||||
tint: vm::avatar::tint(&title),
|
||||
avatar,
|
||||
online,
|
||||
selected: open.is_some_and(|o| {
|
||||
o.mail.is_none()
|
||||
&& ChatTarget::Private(o.uid.clone()) == chat.target
|
||||
&& (o.session == chat.session || o.server_uid == chat.server_uid)
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
/// The DM list, the recent chats of home and the unread counts.
|
||||
fn refresh_conversations(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let dm = &self.social.dm;
|
||||
let recent: Vec<ConversationItem> = dm
|
||||
.chats
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, c)| c.last.is_some())
|
||||
.take(4)
|
||||
.map(|(i, c)| self.conversation_item(i, c))
|
||||
.collect();
|
||||
vm::list::sync(&self.models.social.recent, &recent);
|
||||
let private = |c: &&ChatRef| matches!(c.target, ChatTarget::Private(_));
|
||||
let items: Vec<ConversationItem> = if dm.tab == 2 {
|
||||
dm.inbox
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, (session, m))| {
|
||||
let name = self.peer_name(&m.from_uid, None);
|
||||
ConversationItem {
|
||||
key: MAIL + i as i32,
|
||||
kind: 3,
|
||||
title: name.clone().into(),
|
||||
server: self.server_name(*session).into(),
|
||||
preview: m.subject.clone().into(),
|
||||
time: list_time(m.ts_s * 1000).into(),
|
||||
ago: ago(m.ts_s * 1000).into(),
|
||||
unread: i32::from(!m.read),
|
||||
// A letter in the sender's colour, no initials or
|
||||
// picture under it.
|
||||
initials: SharedString::new(),
|
||||
tint: vm::avatar::tint(&name),
|
||||
avatar: Image::default(),
|
||||
online: false,
|
||||
selected: dm
|
||||
.open
|
||||
.as_ref()
|
||||
.is_some_and(|o| o.mail == Some((*session, m.id))),
|
||||
}
|
||||
})
|
||||
.filter(|c| matches(&dm.filter, &[&c.title, &c.preview]))
|
||||
.collect()
|
||||
} else {
|
||||
dm.chats
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, c)| private(c) && (dm.tab == 0 || c.unread > 0))
|
||||
.map(|(i, c)| self.conversation_item(i, c))
|
||||
.filter(|c| matches(&dm.filter, &[&c.title, &c.preview]))
|
||||
.collect()
|
||||
};
|
||||
vm::list::sync(&self.models.social.conversations, &items);
|
||||
let unread: i32 = dm.chats.iter().filter(private).map(|c| c.unread).sum();
|
||||
bridge.set_dm_unread(unread);
|
||||
bridge.set_inbox_unread(dm.inbox.iter().filter(|(_, m)| !m.read).count() as i32);
|
||||
}
|
||||
|
||||
pub(crate) fn dm_tab(&mut self, tab: i32) {
|
||||
self.social.dm.tab = tab;
|
||||
if tab == 2 {
|
||||
for view in self.sessions.values_mut() {
|
||||
view.extra.inbox_asked = false;
|
||||
}
|
||||
self.ask_inboxes();
|
||||
}
|
||||
self.refresh_conversations();
|
||||
}
|
||||
|
||||
pub(crate) fn search_conversations(&mut self, text: String) {
|
||||
self.social.dm.filter = text;
|
||||
self.refresh_conversations();
|
||||
}
|
||||
|
||||
/// Open a chat of the lists (`-1` closes the open one).
|
||||
pub(crate) fn open_conversation(&mut self, key: i32) {
|
||||
if key < 0 {
|
||||
self.social.dm.open = None;
|
||||
self.refresh_dm();
|
||||
return;
|
||||
}
|
||||
if key >= MAIL {
|
||||
let Some((session, m)) = self.social.dm.inbox.get((key - MAIL) as usize).cloned()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
self.open_mail(session, &m);
|
||||
return;
|
||||
}
|
||||
let Some(chat) = self.social.dm.chats.get(key as usize).cloned() else { return };
|
||||
match &chat.target {
|
||||
ChatTarget::Private(uid) => self.open_dm(chat.session, chat.server_uid.clone(), uid),
|
||||
target => {
|
||||
let Some(session) = chat.session else {
|
||||
self.set_status("That server is not in your bookmarks.");
|
||||
return;
|
||||
};
|
||||
self.show_server(session);
|
||||
self.open_chat(target.clone(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Message someone: where they are with voice, else the newest
|
||||
/// conversation with them, else where they were seen.
|
||||
pub(crate) fn message_person(&mut self, uid: &str) {
|
||||
let spots = self.spots_of(uid);
|
||||
let session = spots.iter().find(|s| s.voice).or(spots.first()).map(|s| s.session);
|
||||
self.open_dm_with(session, uid);
|
||||
}
|
||||
|
||||
/// Open the private chat with `uid`, in `session` if given.
|
||||
pub(crate) fn open_dm_with(&mut self, session: Option<i64>, uid: &str) {
|
||||
let target = ChatTarget::Private(uid.to_owned());
|
||||
let known = self
|
||||
.social
|
||||
.dm
|
||||
.chats
|
||||
.iter()
|
||||
.find(|c| c.target == target && (session.is_none() || c.session == session));
|
||||
let session = session.or_else(|| known.and_then(|c| c.session));
|
||||
let server_uid = session
|
||||
.and_then(|s| self.sessions.get(&s))
|
||||
.and_then(|v| v.state.server_uid.clone())
|
||||
.or_else(|| known.and_then(|c| c.server_uid.clone()));
|
||||
self.open_dm(session, server_uid, uid);
|
||||
}
|
||||
|
||||
/// Open a private chat: in its session when one holds it, else from
|
||||
/// the store.
|
||||
pub(crate) fn open_dm(&mut self, session: Option<i64>, server_uid: Option<String>, uid: &str) {
|
||||
let live = session
|
||||
.and_then(|s| self.sessions.get(&s))
|
||||
.is_some_and(|v| v.has_history() || v.state.voice == VoiceState::Connected);
|
||||
self.social.dm.open = Some(Open {
|
||||
session,
|
||||
server_uid: server_uid.clone(),
|
||||
uid: uid.to_owned(),
|
||||
mail: None,
|
||||
stored: !live,
|
||||
});
|
||||
self.social.dm.mail = None;
|
||||
vm::list::sync(&self.models.social.dm_lines, &[]);
|
||||
let target = ChatTarget::Private(uid.to_owned());
|
||||
if let (true, Some(id)) = (live, session) {
|
||||
if self.current != Some(id) {
|
||||
self.select_server(id);
|
||||
}
|
||||
self.open_chat(target, true);
|
||||
} else if let Some(server_uid) = server_uid.filter(|_| !self.demo_ui) {
|
||||
let history = self.engine.history();
|
||||
let uid = uid.to_owned();
|
||||
self.engine.runtime().spawn(async move {
|
||||
let query = PageQuery { limit: Some(200), ..PageQuery::default() };
|
||||
let page = history.page(&server_uid, &target, query, false).await;
|
||||
later(move |app| app.stored_dm(&uid, page.unwrap_or_default()));
|
||||
});
|
||||
}
|
||||
self.navigate(|nav| nav.invoke_show(Page::Messages));
|
||||
self.refresh_chats();
|
||||
}
|
||||
|
||||
/// The stored messages of a chat no session holds.
|
||||
pub(crate) fn stored_dm(&mut self, uid: &str, messages: Vec<HistoryMessage>) {
|
||||
if !self.social.dm.open.as_ref().is_some_and(|o| o.stored && o.uid == uid) {
|
||||
return;
|
||||
}
|
||||
let mut previous = None;
|
||||
let lines: Vec<_> = messages
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, m)| {
|
||||
let ctx = vm::chat::LineCtx {
|
||||
key: -1 - i as i32,
|
||||
avatar: m
|
||||
.message
|
||||
.author_uid
|
||||
.as_deref()
|
||||
.map(|u| self.avatar_of(u))
|
||||
.unwrap_or_default(),
|
||||
..Default::default()
|
||||
};
|
||||
let line = vm::chat::history_line(m, previous.as_ref(), &ctx);
|
||||
previous = Some(vm::chat::Previous::of(&m.message));
|
||||
line
|
||||
})
|
||||
.collect();
|
||||
vm::list::sync(&self.models.social.dm_lines, &lines);
|
||||
self.refresh_dm();
|
||||
}
|
||||
|
||||
/// Whether the private chat with `uid` in `session` is on screen.
|
||||
pub(crate) fn dm_shown(&self, session: i64, uid: &str) -> bool {
|
||||
let page = self.ui.upgrade().map(|ui| ui.global::<Nav>().get_page());
|
||||
page == Some(Page::Messages)
|
||||
&& self
|
||||
.social
|
||||
.dm
|
||||
.open
|
||||
.as_ref()
|
||||
.is_some_and(|o| o.mail.is_none() && o.uid == uid && o.session == Some(session))
|
||||
}
|
||||
|
||||
/// Who the open conversation is with, and what can be done.
|
||||
pub(crate) fn refresh_dm(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let Some(open) = &self.social.dm.open else {
|
||||
bridge.set_dm(DmPeer::default());
|
||||
return;
|
||||
};
|
||||
let uid = open.uid.as_str();
|
||||
let contact = self.contacts.get(uid);
|
||||
let spots = self.spots_of(uid);
|
||||
let here = open.session.and_then(|s| spots.iter().find(|sp| sp.session == s));
|
||||
let view = open.session.and_then(|s| self.sessions.get(&s));
|
||||
let client = here.and_then(|s| self.sessions[&s.session].presence.clients.get(&s.client));
|
||||
let tab =
|
||||
view.and_then(|v| v.tabs.iter().find(|t| t.target == ChatTarget::Private(uid.into())));
|
||||
let name = self.peer_name(uid, tab.and_then(|t| t.messages.last().map(|m| &m.message)));
|
||||
let server =
|
||||
open.session.map(|s| self.server_name(s)).unwrap_or_else(|| "another server".into());
|
||||
let voice = view.is_some_and(|v| v.state.voice == VoiceState::Connected);
|
||||
let blocked = contact.is_some_and(|c| c.relation == voelin_core::Relation::Blocked);
|
||||
let status = match here.or(spots.first()) {
|
||||
Some(s) => match &s.away {
|
||||
Some(m) if !m.is_empty() => format!("Away: {m} · {}", s.server),
|
||||
Some(_) => format!("Away · {}", s.server),
|
||||
None if s.channel_name.is_empty() => format!("Online · {}", s.server),
|
||||
None => format!("Online · {} · #{}", s.server, s.channel_name),
|
||||
},
|
||||
None => match contact.filter(|c| c.last_seen_ms > 0) {
|
||||
Some(c) => format!("Offline · last seen {}", ago(c.last_seen_ms)),
|
||||
None => "Offline".into(),
|
||||
},
|
||||
};
|
||||
let groups: Vec<SharedString> = match (client, view) {
|
||||
(Some(c), Some(v)) => c
|
||||
.server_groups
|
||||
.iter()
|
||||
.filter_map(|g| v.server_groups.iter().find(|i| i.id == *g))
|
||||
.map(|g| g.name.clone().into())
|
||||
.collect(),
|
||||
_ => Vec::new(),
|
||||
};
|
||||
let servers: Vec<SharedString> = if spots.is_empty() {
|
||||
contact
|
||||
.and_then(|c| c.last_server.clone())
|
||||
.map(|s| {
|
||||
vec![
|
||||
format!("{s} · last seen {}", ago(contact.map_or(0, |c| c.last_seen_ms)))
|
||||
.into(),
|
||||
]
|
||||
})
|
||||
.unwrap_or_default()
|
||||
} else {
|
||||
spots
|
||||
.iter()
|
||||
.map(|s| {
|
||||
if s.channel_name.is_empty() {
|
||||
s.server.clone().into()
|
||||
} else {
|
||||
format!("{} · #{}", s.server, s.channel_name).into()
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
// The pictures that are here (newest first), and the other files.
|
||||
let mut media = Vec::new();
|
||||
let mut files = Vec::new();
|
||||
for m in tab.iter().flat_map(|t| t.messages.iter().rev()) {
|
||||
let message = &m.message.message;
|
||||
for f in message.file_refs() {
|
||||
if let Some(image) = view.and_then(|v| crate::previews::image_of(v, &f)) {
|
||||
media.push(image);
|
||||
continue;
|
||||
}
|
||||
let when = vm::chat::time_of(message.ts_ms);
|
||||
files.push(FileItem {
|
||||
picture: vm::chat::is_picture(&f.name),
|
||||
detail: match f.size {
|
||||
Some(size) => format!("{} · {when}", vm::chat::size_text(size)),
|
||||
None => when,
|
||||
}
|
||||
.into(),
|
||||
name: f.name.into(),
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
}
|
||||
let media_more = if media.len() > 6 { media.len() - 5 } else { 0 };
|
||||
if media_more > 0 {
|
||||
media.truncate(5);
|
||||
}
|
||||
let can_send = voice && here.is_some() && !blocked;
|
||||
let offline =
|
||||
voice && here.is_none() && view.is_some_and(|v| v.capabilities.offline_messages);
|
||||
let in_bookmarks = open.session.is_some_and(|s| self.bookmark(s).is_some());
|
||||
let notice = if open.session.is_none() {
|
||||
"This server is not in your bookmarks: the messages are the ones stored on this device."
|
||||
.to_owned()
|
||||
} else if !voice {
|
||||
format!("Connect to {server} with voice to send messages.")
|
||||
} else if here.is_none() {
|
||||
format!(
|
||||
"{name} is not on {server} now: TeamSpeak delivers private messages only to people online on the server."
|
||||
)
|
||||
} else if blocked {
|
||||
format!("You blocked {name}.")
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
let mail = open.mail.and_then(|(s, id)| {
|
||||
self.social
|
||||
.dm
|
||||
.inbox
|
||||
.iter()
|
||||
.find(|(ms, m)| *ms == s && m.id == id)
|
||||
.map(|(_, m)| m.clone())
|
||||
});
|
||||
bridge.set_dm(DmPeer {
|
||||
open: true,
|
||||
uid: uid.into(),
|
||||
name: name.clone().into(),
|
||||
initials: vm::avatar::initials(&name).into(),
|
||||
tint: vm::avatar::tint(&name),
|
||||
avatar: self.avatar_of(uid),
|
||||
online: !spots.is_empty(),
|
||||
status: status.into(),
|
||||
description: client.and_then(|c| c.description.clone()).unwrap_or_default().into(),
|
||||
groups: crate::app::model(groups),
|
||||
note: contact.map(|c| c.note.clone()).unwrap_or_default().into(),
|
||||
since: contact
|
||||
.filter(|c| c.added_ms > 0)
|
||||
.and_then(|c| chrono::DateTime::from_timestamp_millis(c.added_ms))
|
||||
.map(|t| {
|
||||
format!("Contact since {}", t.with_timezone(&chrono::Local).format("%-d %b %Y"))
|
||||
})
|
||||
.unwrap_or_default()
|
||||
.into(),
|
||||
servers: crate::app::model(servers),
|
||||
media: crate::app::model(media),
|
||||
media_more: media_more as i32,
|
||||
files: crate::app::model(files),
|
||||
friend: contact.is_some_and(|c| c.relation == voelin_core::Relation::Friend),
|
||||
blocked,
|
||||
volume: contact.map_or(100.0, |c| c.volume * 100.0),
|
||||
muted: contact.is_some_and(|c| c.muted),
|
||||
can_send,
|
||||
notice: notice.into(),
|
||||
offline,
|
||||
can_connect: !voice && in_bookmarks,
|
||||
stored: open.stored,
|
||||
mail: open.mail.is_some(),
|
||||
mail_subject: mail.as_ref().map(|m| m.subject.clone()).unwrap_or_default().into(),
|
||||
mail_text: self
|
||||
.social
|
||||
.dm
|
||||
.mail
|
||||
.as_ref()
|
||||
.map(|m| plain(&m.text))
|
||||
.unwrap_or_default()
|
||||
.into(),
|
||||
mail_time: mail.map(|m| vm::chat::time_of(m.ts_s * 1000)).unwrap_or_default().into(),
|
||||
});
|
||||
}
|
||||
|
||||
/// The buttons of the open conversation.
|
||||
pub(crate) fn dm_action(&mut self, action: &str) {
|
||||
let Some(open) = self.social.dm.open.clone() else { return };
|
||||
let uid = open.uid.clone();
|
||||
match action {
|
||||
"poke" | "join" | "mute" => self.contact_action(&uid, action),
|
||||
"friend" | "block" => {
|
||||
let current = self.contacts.get(&uid).map(|c| c.relation);
|
||||
let wanted = if action == "friend" {
|
||||
voelin_core::Relation::Friend
|
||||
} else {
|
||||
voelin_core::Relation::Blocked
|
||||
};
|
||||
let next = if current == Some(wanted) { "neutral" } else { action };
|
||||
self.contact_action(&uid, next);
|
||||
}
|
||||
"connect" => {
|
||||
if let Some(session) = open.session {
|
||||
self.select_server(session);
|
||||
self.connect_voice();
|
||||
}
|
||||
}
|
||||
"delete-mail" | "unread-mail" => {
|
||||
let Some((session, id)) = open.mail else { return };
|
||||
let request = self.offline_request(
|
||||
session,
|
||||
if action == "delete-mail" { "delete" } else { "unread" },
|
||||
);
|
||||
if !self.demo_ui {
|
||||
self.engine.send(if action == "delete-mail" {
|
||||
Command::DeleteOfflineMessage { session: session as u64, request, id }
|
||||
} else {
|
||||
Command::SetOfflineMessageRead {
|
||||
session: session as u64,
|
||||
request,
|
||||
id,
|
||||
read: false,
|
||||
}
|
||||
});
|
||||
}
|
||||
if action == "delete-mail" {
|
||||
self.social.dm.open = None;
|
||||
}
|
||||
self.refresh_chats();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn dm_volume(&mut self, percent: f32) {
|
||||
if let Some(uid) = self.social.dm.open.as_ref().map(|o| o.uid.clone()) {
|
||||
self.contact_volume(&uid, percent);
|
||||
}
|
||||
}
|
||||
|
||||
fn offline_request(&mut self, session: i64, what: &'static str) -> u64 {
|
||||
self.social.dm.next_request += 1;
|
||||
let request = self.social.dm.next_request;
|
||||
self.social.dm.requests.insert(request, (session, what));
|
||||
request
|
||||
}
|
||||
|
||||
/// Send an offline message through the open conversation's server.
|
||||
pub(crate) fn send_offline(&mut self, form: OfflineForm) {
|
||||
let session =
|
||||
self.social.dm.open.as_ref().and_then(|o| o.session).or(self.current).filter(|s| {
|
||||
self.sessions.get(s).is_some_and(|v| v.state.voice == VoiceState::Connected)
|
||||
});
|
||||
let Some(session) = session else {
|
||||
self.set_status("Connect with voice to send an offline message.");
|
||||
return;
|
||||
};
|
||||
let request = self.offline_request(session, "send");
|
||||
if !self.demo_ui {
|
||||
self.engine.send(Command::SendOfflineMessage {
|
||||
session: session as u64,
|
||||
request,
|
||||
to_uid: form.uid.to_string(),
|
||||
subject: if form.subject.is_empty() {
|
||||
"Message".into()
|
||||
} else {
|
||||
form.subject.to_string()
|
||||
},
|
||||
text: form.text.to_string(),
|
||||
});
|
||||
}
|
||||
self.set_status(format!("Sending an offline message to {}…", form.to));
|
||||
}
|
||||
|
||||
/// Show an offline message (and ask the server for its text).
|
||||
fn open_mail(&mut self, session: i64, m: &OfflineMessageInfo) {
|
||||
self.social.dm.open = Some(Open {
|
||||
session: Some(session),
|
||||
server_uid: None,
|
||||
uid: m.from_uid.clone(),
|
||||
mail: Some((session, m.id)),
|
||||
stored: false,
|
||||
});
|
||||
self.social.dm.mail = None;
|
||||
let request = self.offline_request(session, "get");
|
||||
if !self.demo_ui {
|
||||
self.engine.send(Command::GetOfflineMessage {
|
||||
session: session as u64,
|
||||
request,
|
||||
id: m.id,
|
||||
});
|
||||
}
|
||||
self.refresh_chats();
|
||||
}
|
||||
|
||||
pub(crate) fn mail_arrived(&mut self, session: i64, result: Result<OfflineMessage, String>) {
|
||||
match result {
|
||||
Ok(m) => {
|
||||
if let Some(view) = self.sessions.get_mut(&session)
|
||||
&& let Some(info) = view.extra.inbox.iter_mut().find(|i| i.id == m.id)
|
||||
{
|
||||
info.read = true;
|
||||
}
|
||||
self.social.dm.mail = Some(m);
|
||||
}
|
||||
Err(e) => self.set_status(format!("Could not read the offline message: {e}")),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn request_done(&mut self, session: i64, request: u64, result: Result<(), String>) {
|
||||
let Some((_, what)) = self.social.dm.requests.remove(&request) else { return };
|
||||
match (what, result) {
|
||||
("send", Ok(())) => self.set_status("Offline message sent"),
|
||||
("send", Err(e)) => self.set_status(format!("Could not send the offline message: {e}")),
|
||||
(_, Err(e)) => self.set_status(format!("Offline messages: {e}")),
|
||||
(_, Ok(())) => {
|
||||
if let Some(view) = self.sessions.get_mut(&session) {
|
||||
view.extra.inbox_asked = false;
|
||||
}
|
||||
self.ask_inboxes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// List the offline messages of voice sessions whose server keeps them.
|
||||
pub(crate) fn ask_inboxes(&mut self) {
|
||||
if self.demo_ui {
|
||||
return;
|
||||
}
|
||||
let ids: Vec<i64> = self
|
||||
.sessions
|
||||
.iter()
|
||||
.filter(|(_, v)| {
|
||||
v.state.voice == VoiceState::Connected
|
||||
&& v.capabilities.offline_messages
|
||||
&& !v.extra.inbox_asked
|
||||
})
|
||||
.map(|(id, _)| *id)
|
||||
.collect();
|
||||
for id in ids {
|
||||
let request = self.offline_request(id, "list");
|
||||
if let Some(view) = self.sessions.get_mut(&id) {
|
||||
view.extra.inbox_asked = true;
|
||||
}
|
||||
self.engine.send(Command::ListOfflineMessages { session: id as u64, request });
|
||||
}
|
||||
}
|
||||
|
||||
/// Pokes from `uid` as lines of their private chat, among its messages
|
||||
/// (`lines` and `times` in step, oldest first).
|
||||
pub(crate) fn poke_lines(&self, session: i64, uid: &str) -> Vec<(i64, crate::app::ChatLine)> {
|
||||
self.social
|
||||
.pokes
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, p)| p.session == session && p.uid.as_deref() == Some(uid))
|
||||
.map(|(i, p)| {
|
||||
let text = if p.message.is_empty() {
|
||||
"👋 poked you".to_owned()
|
||||
} else {
|
||||
format!("👋 poked you: {}", p.message)
|
||||
};
|
||||
let message = voelin_model::ChatMessage {
|
||||
target: ChatTarget::Private(uid.to_owned()),
|
||||
author_name: p.name.clone(),
|
||||
author_uid: p.uid.clone(),
|
||||
author_id: None,
|
||||
text,
|
||||
ts_ms: p.ts_ms,
|
||||
via_relay: false,
|
||||
blocked: false,
|
||||
};
|
||||
let mut line = vm::chat::line(&message, None);
|
||||
line.key = -1_000_000 - i as i32;
|
||||
line.avatar = self.avatar_of(uid);
|
||||
(p.ts_ms, line)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
//! Pictures linked in chat, shown inline: a link to a PNG, JPEG, GIF or
|
||||
//! WebP file (by name) up to `ui.image_preview_kb` is downloaded into
|
||||
//! memory once (`Command::DownloadChatFile` with `DownloadTo::Memory`,
|
||||
//! voice connections only) and decoded once into the image cache
|
||||
//! (`images.rs`); the chat shows it as a picture card, and a click opens
|
||||
//! it larger.
|
||||
|
||||
use voelin_core::{Bytes, Command, DownloadTo, TransferState, VoiceState};
|
||||
use voelin_model::{ChatTarget, FileRef};
|
||||
|
||||
use crate::app::{App, SessionView};
|
||||
use crate::settings::UI_IMAGE_PREVIEW_KB;
|
||||
|
||||
/// A linked picture.
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) enum Preview {
|
||||
/// Downloading (transfer id).
|
||||
Loading(u64),
|
||||
Ready(Bytes),
|
||||
/// Too large, not a picture, or the download failed.
|
||||
Failed,
|
||||
}
|
||||
|
||||
/// Whether a file name is a picture the chat shows inline.
|
||||
pub(crate) fn is_previewable(name: &str) -> bool {
|
||||
let lower = name.to_ascii_lowercase();
|
||||
[".png", ".jpg", ".jpeg", ".gif", ".webp"].iter().any(|e| lower.ends_with(e))
|
||||
}
|
||||
|
||||
/// The key of a link: where the file is.
|
||||
pub(crate) fn link_key(file: &FileRef) -> String {
|
||||
format!(
|
||||
"{}/{}{}{}",
|
||||
file.server_uid.as_deref().unwrap_or(""),
|
||||
file.channel,
|
||||
file.path,
|
||||
file.name
|
||||
)
|
||||
}
|
||||
|
||||
/// The decoded picture of a link, if it is there (decoded once, kept by
|
||||
/// the image cache).
|
||||
pub(crate) fn image_of(view: &SessionView, file: &FileRef) -> Option<slint::Image> {
|
||||
let key = link_key(file);
|
||||
match view.extra.previews.get(&key)? {
|
||||
Preview::Ready(bytes) => {
|
||||
let image = crate::images::picture(&key, &bytes.0);
|
||||
(image.size().width > 0).then_some(image)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
impl App {
|
||||
/// Download the pictures linked in the current chat of `session` that
|
||||
/// are not there yet.
|
||||
pub(crate) fn fetch_previews(&mut self, session: i64) {
|
||||
if self.demo_ui {
|
||||
return;
|
||||
}
|
||||
let limit = u64::from(self.prefs.get(&UI_IMAGE_PREVIEW_KB)) * 1024;
|
||||
let Some(view) = self.sessions.get_mut(&session) else { return };
|
||||
if limit == 0
|
||||
|| view.state.voice != VoiceState::Connected
|
||||
|| !view.capabilities.file_transfer
|
||||
{
|
||||
return;
|
||||
}
|
||||
let Some(tab) = view.tabs.get(view.current_tab) else { return };
|
||||
// Channel chats only: a link names its channel's file browser.
|
||||
if matches!(tab.target, ChatTarget::Private(_)) && tab.messages.is_empty() {
|
||||
return;
|
||||
}
|
||||
let wanted: Vec<FileRef> = tab
|
||||
.messages
|
||||
.iter()
|
||||
.rev()
|
||||
.take(200)
|
||||
.flat_map(|m| m.message.message.file_refs())
|
||||
.filter(|f| is_previewable(&f.name) && f.size.is_some_and(|s| s <= limit))
|
||||
.filter(|f| !view.extra.previews.contains_key(&link_key(f)))
|
||||
.collect();
|
||||
for file in wanted {
|
||||
let transfer = view.next_transfer;
|
||||
view.next_transfer += 1;
|
||||
view.extra.previews.insert(link_key(&file), Preview::Loading(transfer));
|
||||
self.engine.send(Command::DownloadChatFile {
|
||||
session: session as u64,
|
||||
transfer,
|
||||
file,
|
||||
password: None,
|
||||
to: DownloadTo::Memory,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// A transfer of a picture: `true` if it was one.
|
||||
pub(crate) fn preview_progress(
|
||||
&mut self,
|
||||
session: i64,
|
||||
transfer: u64,
|
||||
state: &TransferState,
|
||||
) -> bool {
|
||||
let limit = u64::from(self.prefs.get(&UI_IMAGE_PREVIEW_KB)) * 1024;
|
||||
let Some(view) = self.sessions.get_mut(&session) else { return false };
|
||||
let Some(key) = view
|
||||
.extra
|
||||
.previews
|
||||
.iter()
|
||||
.find(|(_, p)| matches!(p, Preview::Loading(t) if *t == transfer))
|
||||
.map(|(k, _)| k.clone())
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
match state {
|
||||
TransferState::Started { size, .. } if *size > limit => {
|
||||
view.extra.previews.insert(key, Preview::Failed);
|
||||
if !self.demo_ui {
|
||||
self.engine.send(Command::CancelTransfer { session: session as u64, transfer });
|
||||
}
|
||||
}
|
||||
TransferState::Done { data: Some(data), .. } => {
|
||||
view.extra.previews.insert(key, Preview::Ready(data.clone()));
|
||||
if self.current == Some(session) {
|
||||
self.refresh_chat();
|
||||
}
|
||||
}
|
||||
TransferState::Done { .. } | TransferState::Failed(_) | TransferState::Cancelled => {
|
||||
view.extra.previews.insert(key, Preview::Failed);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
/// The picture of link `index` of a message of the current chat, for
|
||||
/// the large view.
|
||||
pub(crate) fn open_preview(&self, key: i32, index: i32) -> slint::Image {
|
||||
let Some(view) = self.view() else { return slint::Image::default() };
|
||||
let Some(tab) = view.tabs.get(view.current_tab) else { return slint::Image::default() };
|
||||
tab.message(key)
|
||||
.and_then(|m| m.message.file_refs().into_iter().nth(index.max(0) as usize))
|
||||
.and_then(|f| image_of(view, &f))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn previewable_names() {
|
||||
assert!(is_previewable("Banner.PNG"));
|
||||
assert!(is_previewable("a.webp"));
|
||||
assert!(!is_previewable("notes.svg"));
|
||||
assert!(!is_previewable("route.pdf"));
|
||||
let file =
|
||||
FileRef { channel: 2, path: "/".into(), name: "a.png".into(), ..Default::default() };
|
||||
assert_eq!(link_key(&file), "/2/a.png");
|
||||
}
|
||||
}
|
||||
@@ -86,11 +86,22 @@ fn bookmark_from_form(
|
||||
|
||||
impl App {
|
||||
pub(crate) fn connect_voice(&mut self) {
|
||||
let channel =
|
||||
self.current.and_then(|id| self.bookmark(id)).and_then(|b| b.default_channel.clone());
|
||||
self.connect_voice_to(channel);
|
||||
}
|
||||
|
||||
/// Connect the current server with voice, into `channel` (a name or
|
||||
/// path) if given.
|
||||
pub(crate) fn connect_voice_to(&mut self, channel: Option<String>) {
|
||||
let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return };
|
||||
if self.demo_ui {
|
||||
return;
|
||||
}
|
||||
let mut options = VoiceOptions::new(&b.address, &b.nickname);
|
||||
options.identity = Some(self.identity.clone());
|
||||
options.identity = Some(self.identity_for(Some(b.id)));
|
||||
options.server_password = self.secrets.get(&b.server_password_key()).ok().flatten();
|
||||
options.channel = b.default_channel.clone();
|
||||
options.channel = channel;
|
||||
options.audio = true;
|
||||
options.stream_peer = self.video.peer_config(options.stream_peer);
|
||||
self.engine
|
||||
@@ -182,7 +193,7 @@ impl App {
|
||||
self.engine.send(Command::ObserveGateway {
|
||||
session,
|
||||
url: url.clone(),
|
||||
identity: Box::new(self.identity.clone()),
|
||||
identity: Box::new(self.identity_for(Some(b.id))),
|
||||
});
|
||||
} else if let Some(q) = &b.query {
|
||||
let secret = self.secrets.get(&b.query_password_key()).ok().flatten();
|
||||
@@ -306,7 +317,12 @@ impl App {
|
||||
let state = view.map(|v| v.state.clone()).unwrap_or_default();
|
||||
let unread = view.map_or(0, |v| v.unread());
|
||||
let live = view.is_some_and(|v| v.streams_available() && !v.streams.is_empty());
|
||||
vm::servers::item(b, &state, unread, live)
|
||||
let detail = view
|
||||
.filter(|v| !v.presence.channels.is_empty())
|
||||
.map(|v| vm::tree::stats(&v.presence))
|
||||
.unwrap_or_default();
|
||||
let flavor = view.map(|v| v.extra.flavor.clone()).unwrap_or_default();
|
||||
vm::servers::item(b, &state, unread, live, detail, flavor)
|
||||
})
|
||||
.collect();
|
||||
vm::list::sync(&self.models.servers, &items);
|
||||
@@ -382,7 +398,7 @@ impl App {
|
||||
playback: &self.playback,
|
||||
own_channel: view.state.own_channel,
|
||||
own_client: view.state.own_client,
|
||||
filter: &self.tree_filter,
|
||||
filter: "",
|
||||
avatars: &view.avatars,
|
||||
icons: &view.icons,
|
||||
groups: &view.server_groups,
|
||||
@@ -458,14 +474,6 @@ impl App {
|
||||
}
|
||||
self.refresh_tree();
|
||||
}
|
||||
|
||||
/// The top bar's search.
|
||||
pub(crate) fn search(&mut self, text: String) {
|
||||
if self.tree_filter != text {
|
||||
self.tree_filter = text;
|
||||
self.refresh_tree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -105,6 +105,134 @@ pub fn appearance_keys() -> [&'static dyn voelin_core::settings::Setting; 5] {
|
||||
[&UI_THEME, &UI_FONT_SCALE, &UI_NARROW_BREAKPOINT, &UI_IMAGE_CACHE_MB, &UI_MEMBERS_WIDTH]
|
||||
}
|
||||
|
||||
/// What a kind of notification does: nothing, the bell, or the bell and a
|
||||
/// desktop notification.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum NotifyLevel {
|
||||
Off,
|
||||
App,
|
||||
#[default]
|
||||
Desktop,
|
||||
}
|
||||
|
||||
impl NotifyLevel {
|
||||
pub fn index(self) -> i32 {
|
||||
self as i32
|
||||
}
|
||||
|
||||
pub fn from_index(index: i32) -> Self {
|
||||
match index {
|
||||
0 => Self::Off,
|
||||
1 => Self::App,
|
||||
_ => Self::Desktop,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const NOTIFY_LEVELS: Kind = Kind::Choice(&["off", "app", "desktop"]);
|
||||
|
||||
/// `notify.*`: what the bell and the desktop say about each kind.
|
||||
pub static NOTIFY_MENTIONS: Key<NotifyLevel> = Key::new(
|
||||
"notify.mentions",
|
||||
NOTIFY_LEVELS,
|
||||
"Our name in a channel or server chat: off, app (the bell) or desktop.",
|
||||
NotifyLevel::default,
|
||||
);
|
||||
pub static NOTIFY_MESSAGES: Key<NotifyLevel> = Key::new(
|
||||
"notify.private_messages",
|
||||
NOTIFY_LEVELS,
|
||||
"Private messages: off, app (the bell) or desktop.",
|
||||
NotifyLevel::default,
|
||||
);
|
||||
pub static NOTIFY_POKES: Key<NotifyLevel> =
|
||||
Key::new("notify.pokes", NOTIFY_LEVELS, "Pokes: off, app (the bell) or desktop.", || {
|
||||
NotifyLevel::Desktop
|
||||
});
|
||||
pub static NOTIFY_EVENTS: Key<NotifyLevel> = Key::new(
|
||||
"notify.event_reminders",
|
||||
NOTIFY_LEVELS,
|
||||
"Reminders of scheduled events: off, app (the bell) or desktop.",
|
||||
NotifyLevel::default,
|
||||
);
|
||||
pub static NOTIFY_FRIENDS: Key<NotifyLevel> = Key::new(
|
||||
"notify.friends_online",
|
||||
NOTIFY_LEVELS,
|
||||
"Friends coming online: off, app (the bell) or desktop.",
|
||||
|| NotifyLevel::App,
|
||||
);
|
||||
|
||||
/// `video.camera`: the camera of the preview and the default of camera
|
||||
/// sources (a device id; empty: the first camera).
|
||||
pub static VIDEO_CAMERA: Key<String> = Key::new(
|
||||
"video.camera",
|
||||
Kind::Text { suggestions: &[] },
|
||||
"Camera device (empty: the first one).",
|
||||
String::new,
|
||||
);
|
||||
|
||||
/// `video.background`: the camera's background effect.
|
||||
pub static VIDEO_BACKGROUND: Key<String> = Key::new(
|
||||
"video.background",
|
||||
Kind::Choice(&["none", "blur"]),
|
||||
"Background effect of the camera: none or blur.",
|
||||
|| "none".into(),
|
||||
);
|
||||
|
||||
/// `video.resolution`: the camera's capture size, `auto` or `WIDTHxHEIGHT`.
|
||||
pub static VIDEO_RESOLUTION: Key<String> = Key::new(
|
||||
"video.resolution",
|
||||
Kind::Text { suggestions: &["auto", "1280x720", "1920x1080", "2560x1440"] },
|
||||
"Camera resolution: auto or WIDTHxHEIGHT.",
|
||||
|| "auto".into(),
|
||||
)
|
||||
.validated(valid_resolution);
|
||||
|
||||
/// `video.mirror`: show our camera mirrored, as in a mirror.
|
||||
pub static VIDEO_MIRROR: Key<bool> =
|
||||
Key::new("video.mirror", Kind::Bool, "Show our camera mirrored.", || true);
|
||||
|
||||
/// `ui.image_preview_kb`: linked pictures up to this size are downloaded
|
||||
/// and shown in the chat (0: never). No maximum.
|
||||
pub static UI_IMAGE_PREVIEW_KB: Key<u32> = Key::new(
|
||||
"ui.image_preview_kb",
|
||||
Kind::UInt { min: 0 },
|
||||
"Show pictures linked in chat up to this size in KB (0: never).",
|
||||
|| 8192,
|
||||
);
|
||||
|
||||
#[allow(clippy::ptr_arg)] // a validation of `Key<String>` is `fn(&String)`
|
||||
fn valid_resolution(text: &String) -> Result<(), String> {
|
||||
if text == "auto" || parse_size(text).is_some() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err("auto or WIDTHxHEIGHT, e.g. 1280x720".into())
|
||||
}
|
||||
}
|
||||
|
||||
/// `1280x720` → (1280, 720), both above 0.
|
||||
pub fn parse_size(text: &str) -> Option<(u32, u32)> {
|
||||
let (w, h) = text.trim().split_once(['x', 'X', '×'])?;
|
||||
let (w, h) = (w.trim().parse().ok()?, h.trim().parse().ok()?);
|
||||
(w > 0 && h > 0).then_some((w, h))
|
||||
}
|
||||
|
||||
/// The keys of the home, messages and settings pages, for registering.
|
||||
pub fn page_keys() -> [&'static dyn voelin_core::settings::Setting; 10] {
|
||||
[
|
||||
&NOTIFY_MENTIONS,
|
||||
&NOTIFY_MESSAGES,
|
||||
&NOTIFY_POKES,
|
||||
&NOTIFY_EVENTS,
|
||||
&NOTIFY_FRIENDS,
|
||||
&VIDEO_CAMERA,
|
||||
&VIDEO_BACKGROUND,
|
||||
&VIDEO_RESOLUTION,
|
||||
&VIDEO_MIRROR,
|
||||
&UI_IMAGE_PREVIEW_KB,
|
||||
]
|
||||
}
|
||||
|
||||
/// Frame rates and bitrates (kbit/s; 0: automatic) the share dialog
|
||||
/// offers, in the order of its lists (`dialogs.slint`); any other value can
|
||||
/// be typed in.
|
||||
@@ -374,6 +502,19 @@ mod tests {
|
||||
assert_eq!(parse_positive("fast"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn page_keys() {
|
||||
assert_eq!(parse_size("1280x720"), Some((1280, 720)));
|
||||
assert_eq!(parse_size(" 1920 × 1080 "), Some((1920, 1080)));
|
||||
assert_eq!(parse_size("0x720"), None);
|
||||
assert_eq!(parse_size("big"), None);
|
||||
assert!(VIDEO_RESOLUTION.validate(&"auto".into()).is_ok());
|
||||
assert!(VIDEO_RESOLUTION.validate(&"wide".into()).is_err());
|
||||
assert_eq!(serde_json::to_value(NotifyLevel::App).unwrap(), "app");
|
||||
assert_eq!(NotifyLevel::from_index(NotifyLevel::Off.index()), NotifyLevel::Off);
|
||||
assert_eq!(NotifyLevel::from_index(7), NotifyLevel::Desktop);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ui_settings_defaults() {
|
||||
let parsed: UiSettings = serde_json::from_str(r#"{"openh264":true}"#).unwrap();
|
||||
|
||||
@@ -11,7 +11,7 @@ use slint::{Image, Rgba8Pixel, SharedPixelBuffer};
|
||||
use tokio::runtime::Handle;
|
||||
use tracing::warn;
|
||||
use voelin_core::media::voelin_media::capture::{CaptureSource, SourceId};
|
||||
use voelin_core::media::voelin_media::{Codec, Codecs, EncoderReport, VideoFrame, convert};
|
||||
use voelin_core::media::voelin_media::{Codec, Codecs, VideoFrame, convert};
|
||||
use voelin_core::media::{
|
||||
self, AudioSourceSpec, DecoderPreference, EncoderPreference, Latest, LocalPreview, Streamer,
|
||||
StreamerConfig, StreamerConfigUpdate, Viewer, peer_config, preferred_codec, stream_codec,
|
||||
@@ -103,7 +103,6 @@ impl Video {
|
||||
/// `stream.encoder_backend`) and stream codec (`stream.codec`, `None`:
|
||||
/// automatic). A running share follows through
|
||||
/// `Streamer::reconfigure` with `StreamerConfigUpdate::encoder`.
|
||||
#[allow(dead_code, reason = "for the settings page")]
|
||||
pub fn set_encoder_preference(&mut self, encoder: EncoderPreference, codec: Option<Codec>) {
|
||||
let mut codecs = (*self.codecs).clone();
|
||||
codecs.set_preference(encoder.clone());
|
||||
@@ -123,13 +122,6 @@ impl Video {
|
||||
}
|
||||
}
|
||||
|
||||
/// Every encoder and decoder backend, what works and why the rest does
|
||||
/// not.
|
||||
#[allow(dead_code, reason = "for the integrations page")]
|
||||
pub fn encoder_report(&self) -> EncoderReport {
|
||||
self.codecs.report()
|
||||
}
|
||||
|
||||
/// Whether H.264 works, and a line for the settings page.
|
||||
pub fn h264_status(&self) -> (bool, String) {
|
||||
#[cfg(target_os = "android")]
|
||||
|
||||
@@ -47,6 +47,8 @@ pub struct LineCtx {
|
||||
pub topic: String,
|
||||
/// The state of the downloads started from this message, by link index.
|
||||
pub downloads: Vec<(usize, FileItem)>,
|
||||
/// Pictures of the links shown inline, by link index.
|
||||
pub previews: Vec<(usize, Image)>,
|
||||
}
|
||||
|
||||
/// When a message was sent, for its header (see [`stamp`]).
|
||||
@@ -197,6 +199,9 @@ fn line_of(
|
||||
item.state = running.state.clone();
|
||||
item.progress = running.progress;
|
||||
}
|
||||
if let Some((_, picture)) = ctx.previews.iter().find(|(index, _)| *index == i) {
|
||||
item.preview = picture.clone();
|
||||
}
|
||||
item
|
||||
})
|
||||
.collect();
|
||||
@@ -223,7 +228,7 @@ fn line_of(
|
||||
}
|
||||
}
|
||||
|
||||
fn is_picture(name: &str) -> bool {
|
||||
pub fn is_picture(name: &str) -> bool {
|
||||
let lower = name.to_ascii_lowercase();
|
||||
[".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".svg"].iter().any(|e| lower.ends_with(e))
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@ pub mod avatar;
|
||||
pub mod chat;
|
||||
pub mod list;
|
||||
pub mod servers;
|
||||
pub mod social;
|
||||
pub mod studio;
|
||||
pub mod tree;
|
||||
@@ -16,9 +16,18 @@ pub fn status(state: &SessionState) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
/// A server of the rail. `unread`: messages in its chats; `live`:
|
||||
/// streams on it.
|
||||
pub fn item(bookmark: &Bookmark, state: &SessionState, unread: i32, live: bool) -> ServerItem {
|
||||
/// A server of the rail and the home page. `unread`: messages in its
|
||||
/// chats; `live`: streams on it; `detail`: who is there ("9 online · 7
|
||||
/// channels"), empty for its address; `flavor`: "TeamSpeak 6" once
|
||||
/// reached.
|
||||
pub fn item(
|
||||
bookmark: &Bookmark,
|
||||
state: &SessionState,
|
||||
unread: i32,
|
||||
live: bool,
|
||||
detail: String,
|
||||
flavor: String,
|
||||
) -> ServerItem {
|
||||
ServerItem {
|
||||
id: bookmark.id as i32,
|
||||
name: bookmark.name.clone().into(),
|
||||
@@ -28,6 +37,9 @@ pub fn item(bookmark: &Bookmark, state: &SessionState, unread: i32, live: bool)
|
||||
tint: avatar::tint(&bookmark.name),
|
||||
unread,
|
||||
live,
|
||||
detail: if detail.is_empty() { bookmark.address.clone() } else { detail }.into(),
|
||||
flavor: flavor.into(),
|
||||
gateway: bookmark.gateway_url.is_some() || bookmark.query.is_some(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
//! Texts of the home, friends, messages, bell and events screens: times
|
||||
//! ("12m ago", "Yesterday"), message previews without BBCode, mentions,
|
||||
//! event dates; pure, so they are tested here.
|
||||
|
||||
use chrono::{DateTime, Local, NaiveDateTime, TimeZone};
|
||||
|
||||
fn local(ts_ms: i64) -> Option<NaiveDateTime> {
|
||||
DateTime::from_timestamp_millis(ts_ms).map(|t| t.with_timezone(&Local).naive_local())
|
||||
}
|
||||
|
||||
fn now_local() -> NaiveDateTime {
|
||||
Local::now().naive_local()
|
||||
}
|
||||
|
||||
/// "now", "5m ago", "2h ago", "3d ago", else the date ("12 Mar").
|
||||
pub fn ago(ts_ms: i64) -> String {
|
||||
ago_at(ts_ms, chrono::Utc::now().timestamp_millis())
|
||||
}
|
||||
|
||||
pub fn ago_at(ts_ms: i64, now_ms: i64) -> String {
|
||||
if ts_ms <= 0 {
|
||||
return String::new();
|
||||
}
|
||||
let minutes = (now_ms - ts_ms) / 60_000;
|
||||
match minutes {
|
||||
i64::MIN..=0 => "now".into(),
|
||||
1..=59 => format!("{minutes}m ago"),
|
||||
60..=1439 => format!("{}h ago", minutes / 60),
|
||||
1440..=10079 => format!("{}d ago", minutes / 1440),
|
||||
_ => local(ts_ms).map(|t| t.format("%-d %b").to_string()).unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
|
||||
/// The time of a conversation in a list: "11:42" today, "Yesterday", the
|
||||
/// weekday within a week ("Mon"), else the date ("12 Mar", with the year
|
||||
/// when it is another).
|
||||
pub fn list_time(ts_ms: i64) -> String {
|
||||
local(ts_ms).map(|t| list_time_at(t, now_local())).unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn list_time_at(then: NaiveDateTime, now: NaiveDateTime) -> String {
|
||||
use chrono::Datelike;
|
||||
let days = (now.date() - then.date()).num_days();
|
||||
match days {
|
||||
i64::MIN..=0 => then.format("%H:%M").to_string(),
|
||||
1 => "Yesterday".into(),
|
||||
2..=6 => then.format("%a").to_string(),
|
||||
_ if then.year() == now.year() => then.format("%-d %b").to_string(),
|
||||
_ => then.format("%-d %b %Y").to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Chat text without BBCode tags (`[b]`, `[URL=…]`, `[/URL]`), on one line.
|
||||
pub fn plain(text: &str) -> String {
|
||||
let mut out = String::with_capacity(text.len());
|
||||
let mut rest = text;
|
||||
while let Some(open) = rest.find('[') {
|
||||
out.push_str(&rest[..open]);
|
||||
let after = &rest[open + 1..];
|
||||
match after.find(']') {
|
||||
Some(close) if is_tag(&after[..close]) => rest = &after[close + 1..],
|
||||
_ => {
|
||||
out.push('[');
|
||||
rest = after;
|
||||
}
|
||||
}
|
||||
}
|
||||
out.push_str(rest);
|
||||
// Plain text draws no emoji (they are pictures in the chat): leave
|
||||
// them out of one-line previews.
|
||||
let out: String = out.chars().filter(|c| !is_emoji(*c)).collect();
|
||||
out.split_whitespace().collect::<Vec<_>>().join(" ")
|
||||
}
|
||||
|
||||
/// Pictographs, symbols and their joiners and variation selectors.
|
||||
fn is_emoji(c: char) -> bool {
|
||||
matches!(u32::from(c), 0x1F000..=0x1FAFF | 0x2600..=0x27BF | 0xFE0F | 0x200D)
|
||||
}
|
||||
|
||||
/// `b`, `/url`, `URL=https://…`, `color=#f00`: a BBCode tag.
|
||||
fn is_tag(inside: &str) -> bool {
|
||||
let name = inside.strip_prefix('/').unwrap_or(inside);
|
||||
let name = name.split('=').next().unwrap_or_default();
|
||||
!name.is_empty() && name.len() <= 8 && name.chars().all(|c| c.is_ascii_alphabetic())
|
||||
}
|
||||
|
||||
/// A one-line preview of a message: "You: …" for our own, "Sent a
|
||||
/// picture" / "Sent a file" for links without text.
|
||||
pub fn preview(text: &str, mine: bool, files: &[voelin_model::FileRef]) -> String {
|
||||
let body = if files.is_empty() { plain(text) } else { String::new() };
|
||||
let body = if body.is_empty() && !files.is_empty() {
|
||||
if files.iter().any(|f| crate::vm::chat::is_picture(&f.name)) {
|
||||
"Sent a picture".to_owned()
|
||||
} else {
|
||||
"Sent a file".to_owned()
|
||||
}
|
||||
} else {
|
||||
body
|
||||
};
|
||||
if mine { format!("You: {body}") } else { body }
|
||||
}
|
||||
|
||||
/// Whether `text` names `nick` as a word (case does not matter): a mention.
|
||||
pub fn mentions(text: &str, nick: &str) -> bool {
|
||||
let nick = nick.trim().to_lowercase();
|
||||
if nick.is_empty() {
|
||||
return false;
|
||||
}
|
||||
let text = text.to_lowercase();
|
||||
text.match_indices(&nick).any(|(at, _)| {
|
||||
let before = text[..at].chars().next_back();
|
||||
let after = text[at + nick.len()..].chars().next();
|
||||
!before.is_some_and(char::is_alphanumeric) && !after.is_some_and(char::is_alphanumeric)
|
||||
})
|
||||
}
|
||||
|
||||
/// Case-insensitive search in any of `fields`.
|
||||
pub fn matches(query: &str, fields: &[&str]) -> bool {
|
||||
let q = query.trim().to_lowercase();
|
||||
q.is_empty() || fields.iter().any(|f| f.to_lowercase().contains(&q))
|
||||
}
|
||||
|
||||
/// The date block of an event: "SAT", "26", "APR".
|
||||
pub fn date_block(ts_ms: i64) -> (String, String, String) {
|
||||
local(ts_ms)
|
||||
.map(|t| {
|
||||
(
|
||||
t.format("%a").to_string().to_uppercase(),
|
||||
t.format("%-d").to_string(),
|
||||
t.format("%b").to_string().to_uppercase(),
|
||||
)
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// "Sat 26 Apr, 19:00 – 21:00" (the end's date too when it is another day).
|
||||
pub fn event_when(start_ms: i64, end_ms: Option<i64>) -> String {
|
||||
let Some(start) = local(start_ms) else { return String::new() };
|
||||
let mut out = start.format("%a %-d %b, %H:%M").to_string();
|
||||
if let Some(end) = end_ms.and_then(local) {
|
||||
let end = if end.date() == start.date() {
|
||||
end.format("%H:%M")
|
||||
} else {
|
||||
end.format("%a %-d %b, %H:%M")
|
||||
};
|
||||
out.push_str(&format!(" – {end}"));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// "Starts in 15 min", "Starts in 3 h", "Happening now", or nothing (more
|
||||
/// than a day away, or over).
|
||||
pub fn soon(start_ms: i64, end_ms: Option<i64>, now_ms: i64) -> String {
|
||||
let minutes = (start_ms - now_ms) / 60_000;
|
||||
let over = end_ms.map_or(now_ms - start_ms > 3 * 3_600_000, |end| now_ms > end);
|
||||
match minutes {
|
||||
_ if over => String::new(),
|
||||
i64::MIN..=0 => "Happening now".into(),
|
||||
1..=59 => format!("Starts in {minutes} min"),
|
||||
60..=1439 => format!("Starts in {} h", minutes / 60),
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// `2026-10-04 19:00` in local time → Unix milliseconds.
|
||||
pub fn parse_local(text: &str) -> Option<i64> {
|
||||
let t = NaiveDateTime::parse_from_str(text.trim(), "%Y-%m-%d %H:%M").ok()?;
|
||||
Local.from_local_datetime(&t).earliest().map(|t| t.timestamp_millis())
|
||||
}
|
||||
|
||||
/// Unix milliseconds → `2026-10-04 19:00` in local time.
|
||||
pub fn format_local(ts_ms: i64) -> String {
|
||||
local(ts_ms).map(|t| t.format("%Y-%m-%d %H:%M").to_string()).unwrap_or_default()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn at(text: &str) -> NaiveDateTime {
|
||||
NaiveDateTime::parse_from_str(text, "%Y-%m-%d %H:%M").unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn times() {
|
||||
let now = 1_800_000_000_000;
|
||||
assert_eq!(ago_at(now - 30_000, now), "now");
|
||||
assert_eq!(ago_at(now - 12 * 60_000, now), "12m ago");
|
||||
assert_eq!(ago_at(now - 2 * 3_600_000, now), "2h ago");
|
||||
assert_eq!(ago_at(now - 3 * 86_400_000, now), "3d ago");
|
||||
assert_eq!(ago_at(0, now), "");
|
||||
let now = at("2026-10-03 14:00");
|
||||
assert_eq!(list_time_at(at("2026-10-03 11:42"), now), "11:42");
|
||||
assert_eq!(list_time_at(at("2026-10-02 23:00"), now), "Yesterday");
|
||||
assert_eq!(list_time_at(at("2026-09-28 10:00"), now), "Mon");
|
||||
assert_eq!(list_time_at(at("2026-03-12 10:00"), now), "12 Mar");
|
||||
assert_eq!(list_time_at(at("2025-03-12 10:00"), now), "12 Mar 2025");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn previews() {
|
||||
assert_eq!(plain("[b]Hi[/b] there"), "Hi there");
|
||||
assert_eq!(plain("see [URL=https://x.org]this[/URL]"), "see this");
|
||||
assert_eq!(plain("a [not a tag here] b"), "a [not a tag here] b");
|
||||
assert_eq!(plain("[1] item"), "[1] item");
|
||||
assert_eq!(plain("later? 👀 Posting ❤️"), "later? Posting");
|
||||
assert_eq!(preview("Hello", true, &[]), "You: Hello");
|
||||
let file = |name: &str| voelin_model::FileRef { name: name.into(), ..Default::default() };
|
||||
assert_eq!(
|
||||
preview("[URL=ts3file://x]a.png[/URL]", false, &[file("a.png")]),
|
||||
"Sent a picture"
|
||||
);
|
||||
assert_eq!(preview("x", true, &[file("notes.txt")]), "You: Sent a file");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mention_words() {
|
||||
assert!(mentions("hey Nova, raid?", "nova"));
|
||||
assert!(mentions("@Nova", "Nova"));
|
||||
assert!(!mentions("supernova", "Nova"));
|
||||
assert!(!mentions("anything", ""));
|
||||
assert!(matches("kai", &["Kairo", "x"]));
|
||||
assert!(matches("", &[]));
|
||||
assert!(!matches("zz", &["Kairo"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn event_dates() {
|
||||
let start = parse_local("2026-04-25 19:00").unwrap();
|
||||
assert_eq!(format_local(start), "2026-04-25 19:00");
|
||||
assert_eq!(date_block(start), ("SAT".into(), "25".into(), "APR".into()));
|
||||
let end = parse_local("2026-04-25 21:30").unwrap();
|
||||
assert_eq!(event_when(start, Some(end)), "Sat 25 Apr, 19:00 – 21:30");
|
||||
assert_eq!(event_when(start, None), "Sat 25 Apr, 19:00");
|
||||
assert!(parse_local("tomorrow").is_none());
|
||||
assert_eq!(soon(start, Some(end), start - 15 * 60_000), "Starts in 15 min");
|
||||
assert_eq!(soon(start, Some(end), start - 3 * 3_600_000), "Starts in 3 h");
|
||||
assert_eq!(soon(start, Some(end), start + 60_000), "Happening now");
|
||||
assert_eq!(soon(start, Some(end), end + 60_000), "");
|
||||
assert_eq!(soon(start, None, start - 2 * 86_400_000), "");
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,11 @@ import { MemberCardPopup, MembersPanel } from "screens/members.slint";
|
||||
import { VoiceView } from "screens/voice.slint";
|
||||
import { StreamViewer } from "screens/streams.slint";
|
||||
import { SettingsNav, SettingsPage } from "screens/settings.slint";
|
||||
import { HomeNav, HomePage } from "screens/home.slint";
|
||||
import { HomeNav, HomePage, HomeAside, LibraryPage } from "screens/home.slint";
|
||||
import { FriendsPage, ContactPanel } from "screens/friends.slint";
|
||||
import { MessagesPage, ConversationList, Conversation, DmProfile, OfflineDialog } from "screens/messages.slint";
|
||||
import { ServerLinks, EventsPage, EventDialog } from "screens/events.slint";
|
||||
import { NotificationsPanel, SearchPalette, Lightbox } from "screens/overlays.slint";
|
||||
import { MobileServers, ActivityPage, YouPage, PhoneSheet } from "screens/mobile.slint";
|
||||
import { MobileVoice } from "screens/mobile-voice.slint";
|
||||
import { BookmarkDialog, ShareDialog, ClientAudioDialog, AboutDialog } from "screens/dialogs.slint";
|
||||
@@ -52,10 +56,14 @@ export component MainWindow inherits Window {
|
||||
// Set from change handlers: a binding on `width` would loop through the
|
||||
// layout.
|
||||
property <length> breakpoint: Nav.narrow-breakpoint;
|
||||
changed width => { Nav.narrow = self.width < Nav.narrow-breakpoint; }
|
||||
changed width => {
|
||||
Nav.narrow = self.width < Nav.narrow-breakpoint;
|
||||
Nav.wide = self.width > 1180px;
|
||||
}
|
||||
changed breakpoint => { Nav.narrow = self.width < Nav.narrow-breakpoint; }
|
||||
init => {
|
||||
Nav.narrow = self.width < Nav.narrow-breakpoint;
|
||||
Nav.wide = self.width > 1180px;
|
||||
Theme.system-dark = Palette.color-scheme != ColorScheme.light;
|
||||
}
|
||||
// Android: the space under the on-screen keyboard (the window is not
|
||||
@@ -104,8 +112,8 @@ export component MainWindow inherits Window {
|
||||
keys := FocusScope {
|
||||
// Ctrl+K: search.
|
||||
capture-key-pressed(event) => {
|
||||
if event.modifiers.control && (event.text == "k" || event.text == "K") && !Nav.narrow && root.chrome {
|
||||
Nav.search-requests += 1;
|
||||
if event.modifiers.control && (event.text == "k" || event.text == "K") && root.chrome {
|
||||
Nav.open-search("");
|
||||
return accept;
|
||||
}
|
||||
reject
|
||||
@@ -123,14 +131,46 @@ export component MainWindow inherits Window {
|
||||
context: Nav.page == Page.settings ? @tr("Settings") : Nav.page == Page.studio ? @tr("Stream Studio") : "";
|
||||
if Nav.page == Page.home: Sidebar {
|
||||
HomeNav { }
|
||||
Rectangle { vertical-stretch: 1; }
|
||||
}
|
||||
if Nav.page == Page.home: Panel {
|
||||
horizontal-stretch: 1;
|
||||
HomePage { }
|
||||
}
|
||||
if Nav.page == Page.server: Sidebar {
|
||||
if Nav.page == Page.home && Nav.wide: Panel {
|
||||
width: 300px;
|
||||
horizontal-stretch: 0;
|
||||
HomeAside { }
|
||||
}
|
||||
// Friends, direct messages and the Library share the home
|
||||
// sidebar.
|
||||
if Nav.page == Page.friends || Nav.page == Page.messages || Nav.page == Page.library: Sidebar {
|
||||
HomeNav { }
|
||||
}
|
||||
if Nav.page == Page.friends: Panel {
|
||||
horizontal-stretch: 1;
|
||||
FriendsPage { }
|
||||
}
|
||||
if Nav.page == Page.friends && Bridge.contact.uid != "": Panel {
|
||||
width: 320px;
|
||||
horizontal-stretch: 0;
|
||||
ContactPanel { }
|
||||
}
|
||||
if Nav.page == Page.messages: Panel {
|
||||
horizontal-stretch: 1;
|
||||
MessagesPage { }
|
||||
}
|
||||
if Nav.page == Page.messages && Bridge.dm.open && !Bridge.dm.mail && Nav.wide: Panel {
|
||||
width: 300px;
|
||||
horizontal-stretch: 0;
|
||||
DmProfile { }
|
||||
}
|
||||
if Nav.page == Page.library: Panel {
|
||||
horizontal-stretch: 1;
|
||||
LibraryPage { }
|
||||
}
|
||||
if Nav.page == Page.server || Nav.page == Page.events: Sidebar {
|
||||
ServerHeader { }
|
||||
ServerLinks { }
|
||||
if !Bridge.voice-connected && !Bridge.voice-connecting: ConnectActions { }
|
||||
ChannelTree {
|
||||
vertical-stretch: 1;
|
||||
@@ -157,9 +197,12 @@ export component MainWindow inherits Window {
|
||||
if Nav.topics-open && !Nav.pins-open: TopicsDrawer { }
|
||||
if !Nav.pins-open && !Nav.topics-open: MembersPanel { }
|
||||
}
|
||||
if Nav.page == Page.events: Panel {
|
||||
horizontal-stretch: 1;
|
||||
EventsPage { }
|
||||
}
|
||||
if Nav.page == Page.settings: Sidebar {
|
||||
SettingsNav { }
|
||||
Rectangle { vertical-stretch: 1; }
|
||||
}
|
||||
if Nav.page == Page.settings: Panel {
|
||||
horizontal-stretch: 1;
|
||||
@@ -172,26 +215,54 @@ export component MainWindow inherits Window {
|
||||
|
||||
if Nav.narrow && root.chrome: MobileShell {
|
||||
title: Nav.page == Page.settings ? @tr("Settings")
|
||||
: Nav.page == Page.friends ? @tr("Friends")
|
||||
: Nav.page == Page.messages ? @tr("Messages")
|
||||
: Nav.page == Page.library ? @tr("Library")
|
||||
: Nav.page == Page.events ? @tr("Events")
|
||||
: Nav.phone-voice ? Bridge.app-name
|
||||
: Nav.mobile-tab == MobileTab.home ? Bridge.app-name
|
||||
: Nav.page == Page.home || Nav.mobile-tab == MobileTab.home ? Bridge.app-name
|
||||
: Nav.mobile-tab == MobileTab.you ? @tr("You")
|
||||
: Nav.mobile-tab == MobileTab.activity ? @tr("Activity")
|
||||
: Bridge.server-title;
|
||||
subtitle: Nav.page == Page.settings ? ""
|
||||
: Nav.phone-voice ? Bridge.server-title
|
||||
subtitle: Nav.page == Page.settings || Nav.page == Page.friends || Nav.page == Page.messages || Nav.page == Page.library ? ""
|
||||
: Nav.page == Page.events || Nav.phone-voice ? Bridge.server-title
|
||||
: Nav.page == Page.home || Nav.mobile-tab == MobileTab.home ? @tr("Find your people. Talk beyond.")
|
||||
: Nav.mobile-tab == MobileTab.chat && Bridge.current-tab >= 0 && Bridge.current-tab < Bridge.tabs.length ? Bridge.tabs[Bridge.current-tab].title
|
||||
: Nav.mobile-tab == MobileTab.servers ? Bridge.server-stats
|
||||
: Nav.page == Page.home || Nav.mobile-tab == MobileTab.home ? @tr("Talk. Watch. Share.") : "";
|
||||
back: Nav.page == Page.settings;
|
||||
: Nav.mobile-tab == MobileTab.servers ? Bridge.server-stats : "";
|
||||
back: Nav.page == Page.settings || Nav.page == Page.friends || Nav.page == Page.messages || Nav.page == Page.library || Nav.page == Page.events;
|
||||
unread: Bridge.unread-total;
|
||||
voice: Nav.phone-voice;
|
||||
// The voice channel and the studio bring their own controls.
|
||||
navigation: !Nav.phone-voice && Nav.page != Page.studio;
|
||||
go-back => { Nav.show(Page.server); }
|
||||
go-back => {
|
||||
if Nav.page == Page.messages && Bridge.dm.open {
|
||||
Bridge.open-conversation(-1);
|
||||
} else if Nav.page == Page.events || Nav.page == Page.settings {
|
||||
Nav.show(Page.server);
|
||||
} else {
|
||||
Nav.show(Page.home);
|
||||
Nav.mobile-tab = MobileTab.home;
|
||||
}
|
||||
}
|
||||
if Nav.page == Page.settings: SettingsPage {
|
||||
compact: true;
|
||||
}
|
||||
if Nav.page != Page.settings && Nav.page != Page.studio && !Nav.phone-voice && (Nav.page == Page.home || Nav.mobile-tab == MobileTab.home): HomePage { }
|
||||
if !Nav.phone-voice && (Nav.page == Page.home || (Nav.page == Page.server && Nav.mobile-tab == MobileTab.home)): HomePage {
|
||||
compact: true;
|
||||
}
|
||||
if Nav.page == Page.friends: FriendsPage {
|
||||
compact: true;
|
||||
}
|
||||
if Nav.page == Page.messages && !Bridge.dm.open: ConversationList { }
|
||||
if Nav.page == Page.messages && Bridge.dm.open: Conversation {
|
||||
compact: true;
|
||||
}
|
||||
if Nav.page == Page.library: LibraryPage {
|
||||
compact: true;
|
||||
}
|
||||
if Nav.page == Page.events: EventsPage {
|
||||
compact: true;
|
||||
}
|
||||
if Nav.phone-voice: MobileVoice { }
|
||||
if Nav.page == Page.server && !Nav.phone-voice && Nav.mobile-tab == MobileTab.servers: MobileServers { }
|
||||
// Watching without voice (the local test stream): the player.
|
||||
@@ -251,12 +322,39 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
// The bell's panel, under the bell (the phone: the whole width).
|
||||
if Nav.notifications-open: Rectangle {
|
||||
TouchArea {
|
||||
clicked => { Nav.notifications-open = false; }
|
||||
}
|
||||
NotificationsPanel {
|
||||
x: Nav.narrow ? 8px : parent.width - self.width - 100px;
|
||||
y: Nav.narrow ? 64px : Theme.topbar-height;
|
||||
width: Nav.narrow ? parent.width - 16px : 400px;
|
||||
height: min(parent.height - self.y - 16px, 560px);
|
||||
}
|
||||
}
|
||||
|
||||
if Nav.search-open: SearchPalette { }
|
||||
|
||||
if Nav.lightbox-open: Lightbox { }
|
||||
|
||||
if Nav.event-form-open: EventDialog {
|
||||
form <=> Nav.event-form;
|
||||
done => { Nav.event-form-open = false; }
|
||||
}
|
||||
|
||||
if Nav.offline-form-open: OfflineDialog {
|
||||
done => { Nav.offline-form-open = false; }
|
||||
}
|
||||
|
||||
if Nav.topic-form-open: TopicDialog {
|
||||
done => { Nav.topic-form-open = false; }
|
||||
}
|
||||
|
||||
if Nav.bookmark-open: BookmarkDialog {
|
||||
form <=> Nav.bookmark-form;
|
||||
join: Nav.join-open;
|
||||
done => { Nav.bookmark-open = false; }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 460" preserveAspectRatio="xMidYMid slice"><defs>
|
||||
<linearGradient id="sky" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0" stop-color="#0a1648"/><stop offset="0.45" stop-color="#1b1766"/>
|
||||
<stop offset="0.75" stop-color="#2b1a78"/><stop offset="1" stop-color="#0c1a52"/></linearGradient>
|
||||
<radialGradient id="glow" cx="0.5" cy="0.5" r="0.5">
|
||||
<stop offset="0" stop-color="#9aa8ff" stop-opacity="0.55"/><stop offset="0.6" stop-color="#6f74ff" stop-opacity="0.18"/>
|
||||
<stop offset="1" stop-color="#6f74ff" stop-opacity="0"/></radialGradient>
|
||||
<radialGradient id="moon" cx="0.38" cy="0.35" r="0.75">
|
||||
<stop offset="0" stop-color="#dfe5ff"/><stop offset="0.5" stop-color="#a7b2f2"/>
|
||||
<stop offset="0.85" stop-color="#6a72d0"/><stop offset="1" stop-color="#4b4fae"/></radialGradient>
|
||||
<linearGradient id="night" x1="0" y1="0" x2="1" y2="0.3">
|
||||
<stop offset="0.35" stop-color="#1c1f6e" stop-opacity="0"/><stop offset="1" stop-color="#1c1f6e" stop-opacity="0.55"/></linearGradient>
|
||||
<radialGradient id="dusk" cx="0.5" cy="0.5" r="0.5">
|
||||
<stop offset="0" stop-color="#a24bff" stop-opacity="0.55"/><stop offset="1" stop-color="#a24bff" stop-opacity="0"/></radialGradient>
|
||||
<radialGradient id="warm" cx="0.5" cy="0.5" r="0.5">
|
||||
<stop offset="0" stop-color="#ffb35c" stop-opacity="0.6"/><stop offset="1" stop-color="#ffb35c" stop-opacity="0"/></radialGradient>
|
||||
<linearGradient id="shade" x1="0" y1="0" x2="1" y2="0">
|
||||
<stop offset="0" stop-color="#060c2c" stop-opacity="0.9"/><stop offset="0.38" stop-color="#060c2c" stop-opacity="0.55"/>
|
||||
<stop offset="0.6" stop-color="#060c2c" stop-opacity="0"/></linearGradient>
|
||||
<linearGradient id="far" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#3a3fae"/><stop offset="1" stop-color="#171c5c"/></linearGradient>
|
||||
<linearGradient id="mid" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#262a86"/><stop offset="1" stop-color="#0d1240"/></linearGradient>
|
||||
</defs><rect width="1600" height="460" fill="url(#sky)"/><circle cx="518" cy="50" r="0.6" fill="#fff" opacity="0.35"/><circle cx="1314" cy="31" r="1.8" fill="#fff" opacity="0.35"/><circle cx="1456" cy="71" r="0.6" fill="#fff" opacity="0.9"/><circle cx="669" cy="79" r="1.8" fill="#fff" opacity="0.9"/><circle cx="95" cy="187" r="0.8" fill="#fff" opacity="0.35"/><circle cx="923" cy="131" r="0.8" fill="#fff" opacity="0.35"/><circle cx="891" cy="44" r="1.2" fill="#fff" opacity="0.5"/><circle cx="865" cy="188" r="1.8" fill="#fff" opacity="0.5"/><circle cx="165" cy="188" r="0.8" fill="#fff" opacity="0.7"/><circle cx="156" cy="235" r="1.8" fill="#fff" opacity="0.35"/><circle cx="990" cy="164" r="1.8" fill="#fff" opacity="0.9"/><circle cx="1244" cy="154" r="1.2" fill="#fff" opacity="0.7"/><circle cx="480" cy="262" r="0.8" fill="#fff" opacity="0.35"/><circle cx="919" cy="173" r="1.0" fill="#fff" opacity="0.9"/><circle cx="461" cy="323" r="0.6" fill="#fff" opacity="0.9"/><circle cx="264" cy="113" r="1.2" fill="#fff" opacity="0.9"/><circle cx="63" cy="221" r="1.8" fill="#fff" opacity="0.7"/><circle cx="544" cy="116" r="1.2" fill="#fff" opacity="0.9"/><circle cx="110" cy="31" r="1.0" fill="#fff" opacity="0.9"/><circle cx="1115" cy="21" r="1.0" fill="#fff" opacity="0.9"/><circle cx="455" cy="127" r="1.0" fill="#fff" opacity="0.35"/><circle cx="1505" cy="117" r="1.8" fill="#fff" opacity="0.35"/><circle cx="790" cy="72" r="1.0" fill="#fff" opacity="0.5"/><circle cx="1181" cy="131" r="1.2" fill="#fff" opacity="0.35"/><circle cx="266" cy="133" r="1.0" fill="#fff" opacity="0.5"/><circle cx="1311" cy="285" r="1.0" fill="#fff" opacity="0.9"/><circle cx="1578" cy="225" r="1.2" fill="#fff" opacity="0.5"/><circle cx="241" cy="58" r="0.8" fill="#fff" opacity="0.5"/><circle cx="19" cy="274" r="0.8" fill="#fff" opacity="0.7"/><circle cx="451" cy="48" r="1.8" fill="#fff" opacity="0.7"/><circle cx="976" cy="105" r="0.8" fill="#fff" opacity="0.35"/><circle cx="731" cy="287" r="1.8" fill="#fff" opacity="0.9"/><circle cx="637" cy="130" r="1.2" fill="#fff" opacity="0.9"/><circle cx="100" cy="22" r="0.8" fill="#fff" opacity="0.9"/><circle cx="260" cy="112" r="0.6" fill="#fff" opacity="0.35"/><circle cx="0" cy="50" r="0.6" fill="#fff" opacity="0.7"/><circle cx="982" cy="23" r="0.8" fill="#fff" opacity="0.9"/><circle cx="238" cy="83" r="1.0" fill="#fff" opacity="0.7"/><circle cx="759" cy="38" r="1.2" fill="#fff" opacity="0.9"/><circle cx="769" cy="103" r="0.8" fill="#fff" opacity="0.35"/><circle cx="1199" cy="244" r="1.2" fill="#fff" opacity="0.5"/><circle cx="826" cy="68" r="1.8" fill="#fff" opacity="0.7"/><circle cx="235" cy="179" r="0.6" fill="#fff" opacity="0.7"/><circle cx="1566" cy="285" r="1.0" fill="#fff" opacity="0.7"/><circle cx="1453" cy="117" r="0.8" fill="#fff" opacity="0.7"/><circle cx="1018" cy="202" r="0.8" fill="#fff" opacity="0.5"/><circle cx="1309" cy="244" r="0.8" fill="#fff" opacity="0.5"/><circle cx="828" cy="117" r="0.6" fill="#fff" opacity="0.35"/><circle cx="1264" cy="156" r="0.8" fill="#fff" opacity="0.7"/><circle cx="716" cy="309" r="1.0" fill="#fff" opacity="0.7"/><circle cx="129" cy="34" r="1.2" fill="#fff" opacity="0.5"/><circle cx="540" cy="159" r="1.8" fill="#fff" opacity="0.35"/><circle cx="767" cy="215" r="0.6" fill="#fff" opacity="0.35"/><circle cx="1456" cy="258" r="0.8" fill="#fff" opacity="0.9"/><circle cx="1422" cy="143" r="1.0" fill="#fff" opacity="0.35"/><circle cx="1281" cy="321" r="1.2" fill="#fff" opacity="0.9"/><circle cx="642" cy="312" r="0.8" fill="#fff" opacity="0.5"/><circle cx="1589" cy="9" r="1.8" fill="#fff" opacity="0.9"/><circle cx="1290" cy="48" r="1.8" fill="#fff" opacity="0.9"/><circle cx="1052" cy="116" r="1.8" fill="#fff" opacity="0.5"/><circle cx="34" cy="264" r="0.6" fill="#fff" opacity="0.5"/><circle cx="694" cy="288" r="0.8" fill="#fff" opacity="0.35"/><circle cx="403" cy="97" r="0.8" fill="#fff" opacity="0.7"/><circle cx="415" cy="138" r="0.8" fill="#fff" opacity="0.35"/><circle cx="1456" cy="117" r="1.2" fill="#fff" opacity="0.9"/><circle cx="1323" cy="290" r="0.8" fill="#fff" opacity="0.5"/><circle cx="838" cy="6" r="1.2" fill="#fff" opacity="0.5"/><circle cx="974" cy="256" r="0.8" fill="#fff" opacity="0.5"/><circle cx="226" cy="204" r="0.6" fill="#fff" opacity="0.35"/><circle cx="522" cy="171" r="1.8" fill="#fff" opacity="0.9"/><circle cx="1255" cy="35" r="1.8" fill="#fff" opacity="0.35"/><circle cx="398" cy="91" r="0.6" fill="#fff" opacity="0.9"/><circle cx="899" cy="251" r="0.6" fill="#fff" opacity="0.9"/><circle cx="521" cy="321" r="1.8" fill="#fff" opacity="0.5"/><circle cx="1108" cy="149" r="1.8" fill="#fff" opacity="0.9"/><circle cx="812" cy="82" r="1.8" fill="#fff" opacity="0.7"/><circle cx="1476" cy="295" r="0.8" fill="#fff" opacity="0.9"/><circle cx="219" cy="40" r="1.2" fill="#fff" opacity="0.7"/><circle cx="116" cy="79" r="0.6" fill="#fff" opacity="0.5"/><circle cx="1071" cy="259" r="0.8" fill="#fff" opacity="0.7"/><circle cx="229" cy="291" r="1.2" fill="#fff" opacLine truncated
|
||||
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 300" preserveAspectRatio="xMidYMid slice"><defs>
|
||||
<linearGradient id="sky" x1="0" y1="0" x2="0.4" y2="1">
|
||||
<stop offset="0" stop-color="#13235f"/><stop offset="0.7" stop-color="#3a2a8f"/><stop offset="1" stop-color="#1a1450"/></linearGradient>
|
||||
<radialGradient id="glow" cx="0.5" cy="0.5" r="0.5">
|
||||
<stop offset="0" stop-color="#ffffff" stop-opacity="0.45"/><stop offset="1" stop-color="#ffffff" stop-opacity="0"/></radialGradient>
|
||||
</defs><rect width="600" height="300" fill="url(#sky)"/><circle cx="81" cy="144" r="0.6" fill="#fff" opacity="0.7"/><circle cx="71" cy="129" r="1.2" fill="#fff" opacity="0.9"/><circle cx="473" cy="16" r="0.6" fill="#fff" opacity="0.9"/><circle cx="260" cy="130" r="0.6" fill="#fff" opacity="0.9"/><circle cx="160" cy="136" r="1.8" fill="#fff" opacity="0.35"/><circle cx="541" cy="5" r="0.6" fill="#fff" opacity="0.35"/><circle cx="563" cy="65" r="0.8" fill="#fff" opacity="0.9"/><circle cx="436" cy="90" r="1.2" fill="#fff" opacity="0.9"/><circle cx="332" cy="59" r="0.8" fill="#fff" opacity="0.9"/><circle cx="571" cy="158" r="1.2" fill="#fff" opacity="0.35"/><circle cx="112" cy="169" r="1.0" fill="#fff" opacity="0.35"/><circle cx="446" cy="152" r="1.8" fill="#fff" opacity="0.9"/><circle cx="305" cy="155" r="0.8" fill="#fff" opacity="0.7"/><circle cx="170" cy="165" r="1.2" fill="#fff" opacity="0.9"/><circle cx="353" cy="6" r="0.8" fill="#fff" opacity="0.9"/><circle cx="249" cy="29" r="1.8" fill="#fff" opacity="0.7"/><circle cx="52" cy="113" r="0.6" fill="#fff" opacity="0.5"/><circle cx="313" cy="67" r="1.2" fill="#fff" opacity="0.35"/><circle cx="282" cy="52" r="1.8" fill="#fff" opacity="0.9"/><circle cx="388" cy="29" r="0.8" fill="#fff" opacity="0.35"/><circle cx="462" cy="92" r="1.8" fill="#fff" opacity="0.5"/><circle cx="243" cy="58" r="1.8" fill="#fff" opacity="0.7"/><circle cx="275" cy="46" r="1.8" fill="#fff" opacity="0.35"/><circle cx="230" cy="146" r="1.8" fill="#fff" opacity="0.5"/><circle cx="311" cy="95" r="1.2" fill="#fff" opacity="0.35"/><circle cx="289" cy="62" r="1.8" fill="#fff" opacity="0.5"/><circle cx="565" cy="70" r="1.0" fill="#fff" opacity="0.9"/><circle cx="208" cy="92" r="1.8" fill="#fff" opacity="0.7"/><circle cx="275" cy="5" r="0.8" fill="#fff" opacity="0.5"/><circle cx="330" cy="31" r="0.6" fill="#fff" opacity="0.7"/><circle cx="19" cy="160" r="0.6" fill="#fff" opacity="0.35"/><circle cx="521" cy="77" r="1.0" fill="#fff" opacity="0.5"/><circle cx="161" cy="136" r="0.8" fill="#fff" opacity="0.7"/><circle cx="174" cy="28" r="1.0" fill="#fff" opacity="0.5"/><circle cx="394" cy="110" r="1.0" fill="#fff" opacity="0.9"/><circle cx="422" cy="84" r="0.6" fill="#fff" opacity="0.35"/><circle cx="187" cy="58" r="0.8" fill="#fff" opacity="0.7"/><circle cx="65" cy="153" r="1.8" fill="#fff" opacity="0.5"/><circle cx="579" cy="73" r="0.6" fill="#fff" opacity="0.5"/><circle cx="11" cy="25" r="0.8" fill="#fff" opacity="0.9"/><circle cx="423" cy="115" r="1.8" fill="#fff" opacity="0.5"/><circle cx="586" cy="107" r="1.8" fill="#fff" opacity="0.9"/><circle cx="134" cy="110" r="1.2" fill="#fff" opacity="0.7"/><circle cx="396" cy="72" r="1.0" fill="#fff" opacity="0.5"/><circle cx="581" cy="149" r="1.0" fill="#fff" opacity="0.35"/><circle cx="515" cy="53" r="1.0" fill="#fff" opacity="0.5"/><circle cx="250" cy="43" r="0.6" fill="#fff" opacity="0.35"/><circle cx="354" cy="37" r="1.8" fill="#fff" opacity="0.9"/><circle cx="103" cy="148" r="1.8" fill="#fff" opacity="0.35"/><circle cx="227" cy="59" r="0.8" fill="#fff" opacity="0.9"/><circle cx="355" cy="84" r="1.2" fill="#fff" opacity="0.7"/><circle cx="302" cy="3" r="1.8" fill="#fff" opacity="0.9"/><circle cx="540" cy="3" r="0.8" fill="#fff" opacity="0.7"/><circle cx="487" cy="96" r="0.8" fill="#fff" opacity="0.7"/><circle cx="258" cy="45" r="0.6" fill="#fff" opacity="0.9"/><circle cx="559" cy="58" r="1.8" fill="#fff" opacity="0.9"/><circle cx="461" cy="91" r="0.6" fill="#fff" opacity="0.35"/><circle cx="51" cy="29" r="1.8" fill="#fff" opacity="0.5"/><circle cx="161" cy="56" r="1.8" fill="#fff" opacity="0.7"/><circle cx="221" cy="58" r="1.0" fill="#fff" opacity="0.5"/><circle cx="484" cy="70" r="90" fill="url(#glow)"/><circle cx="484" cy="70" r="32" fill="#e6eaff" opacity="0.9"/><path d="M0,300 L0,190 L57,219 L110,150 L178,213 L230,200 L281,212 L330,130 L381,201 L450,190 L532,216 L600,160 L600,300 Z" fill="#ffffff" opacity="0.08"/><path d="M0,300 L0,230 L80,243 L150,200 L227,256 L300,235 L358,252 L420,205 L506,234 L600,225 L600,300 Z" fill="#050819" opacity="0.65"/><path d="M-10.0,234.0 L-2.6,245.3 L-6.9,243.0 L-0.6,256.7 L-6.1,254.4 L1.4,268.1 L-5.2,265.7 L3.4,279.4 L-4.4,277.1 L5.4,290.8 L-8.0,290.8 L-8.0,300.0 L-12.0,300.0 L-12.0,290.8 L-25.4,290.8 L-15.6,277.1 L-23.4,279.4 L-14.8,265.7 L-21.4,268.1 L-13.9,254.4 L-19.4,256.7 L-13.1,243.0 L-17.4,245.3 Z" fill="#040714"/><path d="M10.8,194.5 L21.3,212.6 L15.2,209.0 L24.1,230.8 L16.4,227.1 L27.0,248.9 L17.6,245.2 L29.8,267.1 L18.8,263.4 L32.7,285.2 L12.8,285.2 L12.8,300.0 L8.8,300.0 L8.8,285.2 L-11.1,285.2 L2.8,263.4 L-8.3,267.1 L4.0,245.2 L-5.4,248.9 L5.2,227.1 L-2.6,230.8 L6.4,209.0 L0.3,212.6 Z" fill="#040714"/><path d="M28.1,202.8 L38.8,219.5 L32.6,216.1 L41.7,236.2 L33.8,232.8 L44.6,252.9 L35.0,249.5 L47.5,269.7 L36.3,266.3 L50.4,286.4 L30.1,286.4 L30.1,300.0 L26.1,300.0 L26.1,286.4 L5.8,286.4 L19.9,266.3 L8.7,269.7 L21.2,249.5 L11.6,252.9 L22.4,232.8 L14.5,236.2 L23.6,216.1 L17.4,219.5 Z" fill="#040714"/><paLine truncated
|
||||
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 300" preserveAspectRatio="xMidYMid slice"><defs>
|
||||
<linearGradient id="sky" x1="0" y1="0" x2="0.4" y2="1">
|
||||
<stop offset="0" stop-color="#0f2a55"/><stop offset="0.7" stop-color="#1f5f8f"/><stop offset="1" stop-color="#0b2240"/></linearGradient>
|
||||
<radialGradient id="glow" cx="0.5" cy="0.5" r="0.5">
|
||||
<stop offset="0" stop-color="#ffffff" stop-opacity="0.45"/><stop offset="1" stop-color="#ffffff" stop-opacity="0"/></radialGradient>
|
||||
</defs><rect width="600" height="300" fill="url(#sky)"/><circle cx="574" cy="161" r="0.6" fill="#fff" opacity="0.35"/><circle cx="51" cy="142" r="1.0" fill="#fff" opacity="0.7"/><circle cx="364" cy="103" r="1.8" fill="#fff" opacity="0.5"/><circle cx="600" cy="109" r="1.8" fill="#fff" opacity="0.7"/><circle cx="327" cy="76" r="1.0" fill="#fff" opacity="0.35"/><circle cx="523" cy="62" r="1.0" fill="#fff" opacity="0.9"/><circle cx="254" cy="150" r="0.8" fill="#fff" opacity="0.5"/><circle cx="142" cy="4" r="1.0" fill="#fff" opacity="0.5"/><circle cx="82" cy="87" r="1.8" fill="#fff" opacity="0.5"/><circle cx="597" cy="76" r="1.2" fill="#fff" opacity="0.7"/><circle cx="474" cy="60" r="1.2" fill="#fff" opacity="0.5"/><circle cx="573" cy="68" r="1.2" fill="#fff" opacity="0.5"/><circle cx="294" cy="157" r="1.8" fill="#fff" opacity="0.7"/><circle cx="397" cy="77" r="1.2" fill="#fff" opacity="0.7"/><circle cx="341" cy="156" r="1.2" fill="#fff" opacity="0.9"/><circle cx="395" cy="160" r="0.8" fill="#fff" opacity="0.7"/><circle cx="464" cy="82" r="1.0" fill="#fff" opacity="0.9"/><circle cx="187" cy="35" r="1.8" fill="#fff" opacity="0.7"/><circle cx="560" cy="106" r="0.6" fill="#fff" opacity="0.7"/><circle cx="436" cy="154" r="0.8" fill="#fff" opacity="0.35"/><circle cx="35" cy="111" r="1.0" fill="#fff" opacity="0.5"/><circle cx="409" cy="156" r="1.8" fill="#fff" opacity="0.5"/><circle cx="512" cy="42" r="0.8" fill="#fff" opacity="0.35"/><circle cx="254" cy="122" r="0.6" fill="#fff" opacity="0.35"/><circle cx="217" cy="29" r="0.6" fill="#fff" opacity="0.35"/><circle cx="69" cy="11" r="0.6" fill="#fff" opacity="0.35"/><circle cx="224" cy="22" r="0.8" fill="#fff" opacity="0.5"/><circle cx="314" cy="0" r="1.8" fill="#fff" opacity="0.35"/><circle cx="476" cy="42" r="0.6" fill="#fff" opacity="0.35"/><circle cx="207" cy="105" r="0.6" fill="#fff" opacity="0.7"/><circle cx="202" cy="5" r="1.2" fill="#fff" opacity="0.35"/><circle cx="541" cy="128" r="1.8" fill="#fff" opacity="0.5"/><circle cx="284" cy="38" r="1.0" fill="#fff" opacity="0.35"/><circle cx="15" cy="134" r="0.8" fill="#fff" opacity="0.9"/><circle cx="292" cy="56" r="1.0" fill="#fff" opacity="0.7"/><circle cx="157" cy="165" r="0.6" fill="#fff" opacity="0.5"/><circle cx="402" cy="43" r="0.8" fill="#fff" opacity="0.5"/><circle cx="102" cy="77" r="0.8" fill="#fff" opacity="0.35"/><circle cx="597" cy="40" r="1.2" fill="#fff" opacity="0.35"/><circle cx="150" cy="101" r="1.8" fill="#fff" opacity="0.7"/><circle cx="154" cy="72" r="1.8" fill="#fff" opacity="0.35"/><circle cx="91" cy="65" r="0.8" fill="#fff" opacity="0.35"/><circle cx="307" cy="15" r="0.6" fill="#fff" opacity="0.35"/><circle cx="12" cy="128" r="0.6" fill="#fff" opacity="0.5"/><circle cx="15" cy="114" r="1.2" fill="#fff" opacity="0.7"/><circle cx="321" cy="65" r="0.8" fill="#fff" opacity="0.9"/><circle cx="255" cy="4" r="1.8" fill="#fff" opacity="0.35"/><circle cx="529" cy="158" r="1.8" fill="#fff" opacity="0.5"/><circle cx="552" cy="113" r="1.2" fill="#fff" opacity="0.7"/><circle cx="12" cy="163" r="0.6" fill="#fff" opacity="0.7"/><circle cx="174" cy="167" r="1.0" fill="#fff" opacity="0.7"/><circle cx="11" cy="117" r="0.6" fill="#fff" opacity="0.35"/><circle cx="184" cy="143" r="0.6" fill="#fff" opacity="0.9"/><circle cx="36" cy="108" r="1.2" fill="#fff" opacity="0.5"/><circle cx="534" cy="104" r="0.6" fill="#fff" opacity="0.7"/><circle cx="14" cy="52" r="0.6" fill="#fff" opacity="0.5"/><circle cx="453" cy="33" r="1.8" fill="#fff" opacity="0.7"/><circle cx="235" cy="79" r="1.0" fill="#fff" opacity="0.9"/><circle cx="533" cy="43" r="0.6" fill="#fff" opacity="0.35"/><circle cx="370" cy="57" r="1.2" fill="#fff" opacity="0.5"/><circle cx="463" cy="70" r="90" fill="url(#glow)"/><circle cx="463" cy="70" r="32" fill="#e6eaff" opacity="0.9"/><path d="M0,300 L0,190 L45,213 L110,150 L176,224 L230,200 L280,217 L330,130 L389,216 L450,190 L520,211 L600,160 L600,300 Z" fill="#ffffff" opacity="0.08"/><path d="M0,300 L0,230 L75,253 L150,200 L230,258 L300,235 L365,248 L420,205 L506,241 L600,225 L600,300 Z" fill="#050819" opacity="0.65"/><path d="M-10.0,234.4 L-3.5,245.7 L-7.3,243.4 L-1.8,257.0 L-6.5,254.7 L-0.0,268.3 L-5.8,266.0 L1.7,279.5 L-5.1,277.2 L3.5,290.8 L-8.0,290.8 L-8.0,300.0 L-12.0,300.0 L-12.0,290.8 L-23.5,290.8 L-14.9,277.2 L-21.7,279.5 L-14.2,266.0 L-20.0,268.3 L-13.5,254.7 L-18.2,257.0 L-12.7,243.4 L-16.5,245.7 Z" fill="#040714"/><path d="M12.1,194.9 L23.0,213.0 L16.7,209.3 L25.9,231.0 L17.9,227.4 L28.9,249.1 L19.2,245.4 L31.8,267.2 L20.4,263.5 L34.8,285.3 L14.1,285.3 L14.1,300.0 L10.1,300.0 L10.1,285.3 L-10.5,285.3 L3.9,263.5 L-7.5,267.2 L5.1,245.4 L-4.6,249.1 L6.4,227.4 L-1.6,231.0 L7.6,209.3 L1.3,213.0 Z" fill="#040714"/><path d="M36.0,244.2 L41.4,253.8 L38.2,251.9 L42.8,263.4 L38.8,261.5 L44.3,273.0 L39.5,271.1 L45.7,282.6 L40.1,280.7 L47.2,292.2 L38.0,292.2 L38.0,300.0 L34.0,300.0 L34.0,292.2 L24.7,292.2 L31.9,280.7 L26.2,282.6 L32.5,271.1 L27.7,273.0 L33.1,261.5 L29.1,263.4 L33.7,251.9 L30.6,253.8 Z" fill=Line truncated
|
||||
|
After Width: | Height: | Size: 9.8 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 300" preserveAspectRatio="xMidYMid slice"><defs>
|
||||
<linearGradient id="sky" x1="0" y1="0" x2="0.4" y2="1">
|
||||
<stop offset="0" stop-color="#2a1450"/><stop offset="0.7" stop-color="#7a2f86"/><stop offset="1" stop-color="#24104a"/></linearGradient>
|
||||
<radialGradient id="glow" cx="0.5" cy="0.5" r="0.5">
|
||||
<stop offset="0" stop-color="#ffffff" stop-opacity="0.45"/><stop offset="1" stop-color="#ffffff" stop-opacity="0"/></radialGradient>
|
||||
</defs><rect width="600" height="300" fill="url(#sky)"/><circle cx="143" cy="93" r="1.0" fill="#fff" opacity="0.9"/><circle cx="375" cy="11" r="0.6" fill="#fff" opacity="0.9"/><circle cx="156" cy="40" r="1.2" fill="#fff" opacity="0.9"/><circle cx="238" cy="146" r="0.8" fill="#fff" opacity="0.5"/><circle cx="521" cy="89" r="0.6" fill="#fff" opacity="0.35"/><circle cx="96" cy="163" r="0.6" fill="#fff" opacity="0.7"/><circle cx="468" cy="140" r="1.0" fill="#fff" opacity="0.9"/><circle cx="357" cy="156" r="1.2" fill="#fff" opacity="0.9"/><circle cx="237" cy="136" r="1.2" fill="#fff" opacity="0.5"/><circle cx="527" cy="17" r="0.8" fill="#fff" opacity="0.9"/><circle cx="130" cy="164" r="1.2" fill="#fff" opacity="0.7"/><circle cx="253" cy="142" r="1.8" fill="#fff" opacity="0.7"/><circle cx="320" cy="69" r="0.8" fill="#fff" opacity="0.7"/><circle cx="409" cy="158" r="1.0" fill="#fff" opacity="0.5"/><circle cx="419" cy="55" r="1.8" fill="#fff" opacity="0.35"/><circle cx="428" cy="36" r="1.8" fill="#fff" opacity="0.7"/><circle cx="171" cy="11" r="1.2" fill="#fff" opacity="0.35"/><circle cx="206" cy="11" r="0.8" fill="#fff" opacity="0.35"/><circle cx="176" cy="131" r="0.6" fill="#fff" opacity="0.35"/><circle cx="363" cy="129" r="1.2" fill="#fff" opacity="0.7"/><circle cx="331" cy="157" r="1.0" fill="#fff" opacity="0.5"/><circle cx="599" cy="53" r="0.6" fill="#fff" opacity="0.35"/><circle cx="360" cy="5" r="0.8" fill="#fff" opacity="0.9"/><circle cx="175" cy="45" r="0.6" fill="#fff" opacity="0.7"/><circle cx="188" cy="163" r="1.2" fill="#fff" opacity="0.9"/><circle cx="276" cy="88" r="1.8" fill="#fff" opacity="0.35"/><circle cx="372" cy="160" r="1.8" fill="#fff" opacity="0.7"/><circle cx="259" cy="122" r="0.8" fill="#fff" opacity="0.7"/><circle cx="262" cy="44" r="1.0" fill="#fff" opacity="0.7"/><circle cx="7" cy="71" r="1.8" fill="#fff" opacity="0.7"/><circle cx="12" cy="105" r="0.8" fill="#fff" opacity="0.35"/><circle cx="380" cy="57" r="1.0" fill="#fff" opacity="0.7"/><circle cx="365" cy="47" r="1.2" fill="#fff" opacity="0.35"/><circle cx="354" cy="162" r="0.6" fill="#fff" opacity="0.7"/><circle cx="151" cy="78" r="1.8" fill="#fff" opacity="0.7"/><circle cx="106" cy="31" r="1.0" fill="#fff" opacity="0.7"/><circle cx="180" cy="64" r="0.6" fill="#fff" opacity="0.5"/><circle cx="186" cy="38" r="1.0" fill="#fff" opacity="0.5"/><circle cx="197" cy="115" r="0.6" fill="#fff" opacity="0.35"/><circle cx="360" cy="161" r="0.8" fill="#fff" opacity="0.9"/><circle cx="486" cy="163" r="0.6" fill="#fff" opacity="0.7"/><circle cx="445" cy="37" r="1.8" fill="#fff" opacity="0.9"/><circle cx="162" cy="134" r="0.6" fill="#fff" opacity="0.5"/><circle cx="189" cy="142" r="1.8" fill="#fff" opacity="0.5"/><circle cx="518" cy="58" r="0.6" fill="#fff" opacity="0.7"/><circle cx="354" cy="72" r="1.8" fill="#fff" opacity="0.7"/><circle cx="279" cy="108" r="1.0" fill="#fff" opacity="0.9"/><circle cx="341" cy="6" r="1.2" fill="#fff" opacity="0.5"/><circle cx="120" cy="81" r="1.8" fill="#fff" opacity="0.9"/><circle cx="335" cy="168" r="0.8" fill="#fff" opacity="0.35"/><circle cx="447" cy="142" r="1.8" fill="#fff" opacity="0.7"/><circle cx="326" cy="151" r="0.6" fill="#fff" opacity="0.7"/><circle cx="72" cy="42" r="0.6" fill="#fff" opacity="0.5"/><circle cx="538" cy="153" r="1.8" fill="#fff" opacity="0.35"/><circle cx="8" cy="127" r="0.8" fill="#fff" opacity="0.7"/><circle cx="143" cy="3" r="1.8" fill="#fff" opacity="0.9"/><circle cx="32" cy="155" r="0.6" fill="#fff" opacity="0.7"/><circle cx="75" cy="165" r="1.8" fill="#fff" opacity="0.9"/><circle cx="487" cy="10" r="0.8" fill="#fff" opacity="0.5"/><circle cx="73" cy="151" r="0.6" fill="#fff" opacity="0.5"/><circle cx="409" cy="70" r="90" fill="url(#glow)"/><circle cx="409" cy="70" r="32" fill="#e6eaff" opacity="0.9"/><path d="M0,300 L0,190 L50,218 L110,150 L163,228 L230,200 L280,221 L330,130 L388,215 L450,190 L520,212 L600,160 L600,300 Z" fill="#ffffff" opacity="0.08"/><path d="M0,300 L0,230 L75,239 L150,200 L222,256 L300,235 L366,255 L420,205 L503,234 L600,225 L600,300 Z" fill="#050819" opacity="0.65"/><path d="M-10.0,221.0 L-3.1,234.6 L-7.1,231.8 L-1.2,248.2 L-6.3,245.4 L0.6,261.8 L-5.5,259.0 L2.5,275.4 L-4.7,272.6 L4.4,288.9 L-8.0,288.9 L-8.0,300.0 L-12.0,300.0 L-12.0,288.9 L-24.4,288.9 L-15.3,272.6 L-22.5,275.4 L-14.5,259.0 L-20.6,261.8 L-13.7,245.4 L-18.8,248.2 L-12.9,231.8 L-16.9,234.6 Z" fill="#040714"/><path d="M12.6,219.1 L20.7,233.0 L16.0,230.2 L22.9,246.9 L16.9,244.1 L25.1,260.8 L17.8,258.0 L27.3,274.8 L18.7,271.9 L29.5,288.7 L14.6,288.7 L14.6,300.0 L10.6,300.0 L10.6,288.7 L-4.4,288.7 L6.4,271.9 L-2.2,274.8 L7.3,258.0 L0.0,260.8 L8.2,244.1 L2.2,246.9 L9.1,230.2 L4.4,233.0 Z" fill="#040714"/><path d="M28.4,245.7 L33.7,255.0 L30.7,253.1 L35.2,264.4 L31.3,262.5 L36.6,273.7 L31.9,271.8 L38.0,283.1 L32.5,281.2 L39.5,292.4 L30.4,292.4 L30.4,300.0 L26.4,300.0 L26.4,292.4 L17.4,292.4 L24.4,281.2 L18.8,283.1 L25.0,271.8 L20.3,273.7 L25.6,262.5 L21.7,264.4 L26.2,253.1 L23.1,255.0 Z" fill="#0407Line truncated
|
||||
|
After Width: | Height: | Size: 9.8 KiB |
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 900" preserveAspectRatio="xMidYMax slice"><defs>
|
||||
<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#0a1033" stop-opacity="0"/><stop offset="0.12" stop-color="#0b1440"/>
|
||||
<stop offset="0.55" stop-color="#132068"/><stop offset="1" stop-color="#070b24"/></linearGradient>
|
||||
<radialGradient id="planet" cx="0.3" cy="0.8" r="0.8">
|
||||
<stop offset="0" stop-color="#2f4fd8" stop-opacity="0.5"/><stop offset="1" stop-color="#101a5a" stop-opacity="0.1"/></radialGradient>
|
||||
<radialGradient id="spark" cx="0.5" cy="0.5" r="0.5">
|
||||
<stop offset="0" stop-color="#cfe0ff"/><stop offset="0.25" stop-color="#6f9bff" stop-opacity="0.6"/>
|
||||
<stop offset="1" stop-color="#6f9bff" stop-opacity="0"/></radialGradient>
|
||||
<linearGradient id="peak" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#2e4cc4"/><stop offset="1" stop-color="#0d1546"/></linearGradient>
|
||||
<linearGradient id="peak2" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#1b2a82"/><stop offset="1" stop-color="#0a1038"/></linearGradient>
|
||||
<linearGradient id="fade" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0.6" stop-color="#070b24" stop-opacity="0"/><stop offset="1" stop-color="#070b24" stop-opacity="0.95"/></linearGradient>
|
||||
</defs><rect width="480" height="900" fill="url(#sky)"/><circle cx="217" cy="291" r="1.2" fill="#fff" opacity="0.9"/><circle cx="244" cy="305" r="0.8" fill="#fff" opacity="0.9"/><circle cx="302" cy="412" r="0.6" fill="#fff" opacity="0.9"/><circle cx="146" cy="47" r="0.6" fill="#fff" opacity="0.9"/><circle cx="463" cy="340" r="1.8" fill="#fff" opacity="0.5"/><circle cx="299" cy="432" r="0.6" fill="#fff" opacity="0.35"/><circle cx="17" cy="457" r="1.8" fill="#fff" opacity="0.35"/><circle cx="373" cy="170" r="1.8" fill="#fff" opacity="0.5"/><circle cx="249" cy="333" r="1.2" fill="#fff" opacity="0.35"/><circle cx="318" cy="238" r="1.0" fill="#fff" opacity="0.9"/><circle cx="479" cy="518" r="0.6" fill="#fff" opacity="0.7"/><circle cx="151" cy="119" r="1.0" fill="#fff" opacity="0.35"/><circle cx="34" cy="398" r="1.2" fill="#fff" opacity="0.35"/><circle cx="406" cy="201" r="0.6" fill="#fff" opacity="0.35"/><circle cx="102" cy="482" r="0.6" fill="#fff" opacity="0.9"/><circle cx="180" cy="369" r="1.2" fill="#fff" opacity="0.35"/><circle cx="272" cy="103" r="1.0" fill="#fff" opacity="0.7"/><circle cx="42" cy="173" r="1.2" fill="#fff" opacity="0.35"/><circle cx="65" cy="368" r="0.6" fill="#fff" opacity="0.35"/><circle cx="223" cy="253" r="1.8" fill="#fff" opacity="0.5"/><circle cx="215" cy="99" r="0.8" fill="#fff" opacity="0.9"/><circle cx="309" cy="61" r="1.2" fill="#fff" opacity="0.5"/><circle cx="0" cy="449" r="1.8" fill="#fff" opacity="0.7"/><circle cx="479" cy="10" r="0.8" fill="#fff" opacity="0.9"/><circle cx="478" cy="313" r="1.8" fill="#fff" opacity="0.35"/><circle cx="20" cy="76" r="1.2" fill="#fff" opacity="0.7"/><circle cx="5" cy="317" r="1.0" fill="#fff" opacity="0.9"/><circle cx="35" cy="47" r="1.8" fill="#fff" opacity="0.5"/><circle cx="7" cy="192" r="1.8" fill="#fff" opacity="0.9"/><circle cx="61" cy="305" r="1.8" fill="#fff" opacity="0.5"/><circle cx="416" cy="95" r="0.8" fill="#fff" opacity="0.7"/><circle cx="436" cy="425" r="0.8" fill="#fff" opacity="0.5"/><circle cx="76" cy="327" r="1.8" fill="#fff" opacity="0.5"/><circle cx="330" cy="202" r="1.2" fill="#fff" opacity="0.35"/><circle cx="202" cy="54" r="0.6" fill="#fff" opacity="0.7"/><circle cx="114" cy="366" r="1.0" fill="#fff" opacity="0.9"/><circle cx="395" cy="310" r="1.0" fill="#fff" opacity="0.5"/><circle cx="446" cy="508" r="0.8" fill="#fff" opacity="0.5"/><circle cx="230" cy="340" r="1.8" fill="#fff" opacity="0.35"/><circle cx="135" cy="477" r="0.8" fill="#fff" opacity="0.35"/><circle cx="33" cy="214" r="0.8" fill="#fff" opacity="0.35"/><circle cx="22" cy="147" r="1.8" fill="#fff" opacity="0.5"/><circle cx="44" cy="72" r="1.2" fill="#fff" opacity="0.7"/><circle cx="315" cy="359" r="1.8" fill="#fff" opacity="0.5"/><circle cx="283" cy="480" r="1.2" fill="#fff" opacity="0.7"/><circle cx="336" cy="501" r="0.6" fill="#fff" opacity="0.35"/><circle cx="231" cy="380" r="1.0" fill="#fff" opacity="0.5"/><circle cx="480" cy="39" r="1.8" fill="#fff" opacity="0.7"/><circle cx="354" cy="468" r="0.8" fill="#fff" opacity="0.7"/><circle cx="169" cy="356" r="0.6" fill="#fff" opacity="0.9"/><circle cx="453" cy="16" r="1.2" fill="#fff" opacity="0.35"/><circle cx="300" cy="199" r="1.8" fill="#fff" opacity="0.35"/><circle cx="292" cy="42" r="0.6" fill="#fff" opacity="0.7"/><circle cx="422" cy="379" r="1.2" fill="#fff" opacity="0.9"/><circle cx="211" cy="436" r="0.6" fill="#fff" opacity="0.35"/><circle cx="149" cy="46" r="0.6" fill="#fff" opacity="0.5"/><circle cx="460" cy="59" r="1.8" fill="#fff" opacity="0.9"/><circle cx="123" cy="6" r="1.0" fill="#fff" opacity="0.5"/><circle cx="326" cy="105" r="0.8" fill="#fff" opacity="0.7"/><circle cx="317" cy="230" r="0.8" fill="#fff" opacity="0.7"/><circle cx="194" cy="130" r="1.2" fill="#fff" opacity="0.5"/><circle cx="423" cy="200" r="1.8" fill="#fff" opacity="0.7"/><circle cx="101" cy="70" r="1.0" fill="#fff" opacity="0.35"/><circle cx="341" cy="494" r="1.0" fill="#fff" opacity="0.5"/><circle cx="54" cy="245" r="0.8" fill="#fff" opacity="0.9"/><circle cx="184" cy="270" r="1.0" fill="#fff" opacity="0.9"/><circle cx="154" cy="431" r="1.0" fill="#fff" opacity="0.35"/><circle cx="326" cy="146" r="1.0" fill="#fff" opacity="0.7"/><circle cx="312" cy="293" r="0.8" fill="#fff" opacity="0.9"/><circle cx="218" cy="13" r="1.0" fill="#fff" opacity="0.5"/><circle cx="374" cy="414" r="0.6" fill="#fff" opacity="0.9"/><circle cx="52" cy="278" r="1.0" fill="#fff" opacity="0.35"/><circle cx="329" cy="104" r="1.2" fill="#fff" opacity="0.7"/><circle cx="86" cy="6" r="1.2" fill="#fff" opacity="0.35"/><circle cx="86" cy="142" r="1.0" fill="#fff" opacity="0.5"/><circle cx="189" cy="412" r="0.8" fill="#fff" opacity="0.35"/><circle cx="197" cy="464" r="1.2" fill="#fff" opacity="0.5"/><circle cx="216" cy="102" r="0.6" fill="#fff" opacity="0.9"/><circle cx="264" cy="339" r="1.8" fill="#fff" opacity="0.7"/><circle cx="223" cy="339" r="0.8" fill="#fff" opacity="0.35"/><circle cx="347" cy="426" r="0.6" fill="#fff" opacity="0.5"/><circle cx="116" cyLine truncated
|
||||
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-arrow-down"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M12 5v14" />
|
||||
<path d="m19 12-7 7-7-7" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 343 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-arrow-up"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m5 12 7-7 7 7" />
|
||||
<path d="M12 19V5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 340 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-ban"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M4.929 4.929 19.07 19.071" />
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 359 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-bell-ring"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10.268 21a2 2 0 0 0 3.464 0" />
|
||||
<path d="M22 8c0-2.3-.8-4.3-2-6" />
|
||||
<path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" />
|
||||
<path d="M4 2C2.8 3.7 2 5.7 2 8" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 549 B |
@@ -0,0 +1,24 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-calendar-days"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M8 2v4" />
|
||||
<path d="M16 2v4" />
|
||||
<rect width="18" height="18" x="3" y="4" rx="2" />
|
||||
<path d="M3 10h18" />
|
||||
<path d="M8 14h.01" />
|
||||
<path d="M12 14h.01" />
|
||||
<path d="M16 14h.01" />
|
||||
<path d="M8 18h.01" />
|
||||
<path d="M12 18h.01" />
|
||||
<path d="M16 18h.01" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 568 B |
@@ -0,0 +1,20 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-calendar-plus"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M16 19h6" />
|
||||
<path d="M16 2v4" />
|
||||
<path d="M19 16v6" />
|
||||
<path d="M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5" />
|
||||
<path d="M3 10h18" />
|
||||
<path d="M8 2v4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 488 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-circle-check"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="m9 12 2 2 4-4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 356 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-circle-x"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="m15 9-6 6" />
|
||||
<path d="m9 9 6 6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 372 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-clapperboard"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z" />
|
||||
<path d="m6.2 5.3 3.1 3.9" />
|
||||
<path d="m12.4 3.4 3.1 4" />
|
||||
<path d="M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 498 B |
@@ -0,0 +1,28 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-cpu"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M12 20v2" />
|
||||
<path d="M12 2v2" />
|
||||
<path d="M17 20v2" />
|
||||
<path d="M17 2v2" />
|
||||
<path d="M2 12h2" />
|
||||
<path d="M2 17h2" />
|
||||
<path d="M2 7h2" />
|
||||
<path d="M20 12h2" />
|
||||
<path d="M20 17h2" />
|
||||
<path d="M20 7h2" />
|
||||
<path d="M7 20v2" />
|
||||
<path d="M7 2v2" />
|
||||
<rect x="4" y="4" width="16" height="16" rx="2" />
|
||||
<rect x="8" y="8" width="8" height="8" rx="1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 664 B |
@@ -0,0 +1,22 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-film"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<rect width="18" height="18" x="3" y="3" rx="2" />
|
||||
<path d="M7 3v18" />
|
||||
<path d="M3 7.5h4" />
|
||||
<path d="M3 12h18" />
|
||||
<path d="M3 16.5h4" />
|
||||
<path d="M17 3v18" />
|
||||
<path d="M17 7.5h4" />
|
||||
<path d="M17 16.5h4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 507 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-flask-conical"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2" />
|
||||
<path d="M6.453 15h11.094" />
|
||||
<path d="M8.5 2h7" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 467 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-folder"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 419 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-gauge"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m12 14 4-4" />
|
||||
<path d="M3.34 19a10 10 0 1 1 17.32 0" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 354 B |
@@ -0,0 +1,19 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-id-card"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M16 10h2" />
|
||||
<path d="M16 14h2" />
|
||||
<path d="M6.17 15a3 3 0 0 1 5.66 0" />
|
||||
<circle cx="9" cy="11" r="2" />
|
||||
<rect x="2" y="5" width="20" height="14" rx="2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 462 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-inbox"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<polyline points="22 12 16 12 14 15 10 15 8 12 2 12" />
|
||||
<path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 464 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-key-round"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z" />
|
||||
<circle cx="16.5" cy="7.5" r=".5" fill="currentColor" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 533 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-mail"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" />
|
||||
<rect x="2" y="4" width="20" height="16" rx="2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 391 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-megaphone"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z" />
|
||||
<path d="M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14" />
|
||||
<path d="M8 6v8" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 511 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-message-square-plus"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" />
|
||||
<path d="M12 8v6" />
|
||||
<path d="M9 11h6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 475 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-plug"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M12 22v-5" />
|
||||
<path d="M15 8V2" />
|
||||
<path d="M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z" />
|
||||
<path d="M9 8V2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 438 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-rotate-ccw"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
|
||||
<path d="M3 3v5h5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 378 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-scroll-text"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M15 12h-5" />
|
||||
<path d="M15 8h-5" />
|
||||
<path d="M19 17V5a2 2 0 0 0-2-2H4" />
|
||||
<path d="M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 501 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-upload"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M12 3v12" />
|
||||
<path d="m17 8-5-5-5 5" />
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 395 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-user-check"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m16 11 2 2 4-4" />
|
||||
<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
|
||||
<circle cx="9" cy="7" r="4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 409 B |
@@ -0,0 +1,25 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-user-cog"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10 15H6a4 4 0 0 0-4 4v2" />
|
||||
<path d="m14.305 16.53.923-.382" />
|
||||
<path d="m15.228 13.852-.923-.383" />
|
||||
<path d="m16.852 12.228-.383-.923" />
|
||||
<path d="m16.852 17.772-.383.924" />
|
||||
<path d="m19.148 12.228.383-.923" />
|
||||
<path d="m19.53 18.696-.382-.924" />
|
||||
<path d="m20.772 13.852.924-.383" />
|
||||
<path d="m20.772 16.148.924.383" />
|
||||
<circle cx="18" cy="15" r="3" />
|
||||
<circle cx="9" cy="7" r="4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 707 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-user-round"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="8" r="5" />
|
||||
<path d="M20 21a8 8 0 0 0-16 0" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 360 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-user-x"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
|
||||
<circle cx="9" cy="7" r="4" />
|
||||
<line x1="17" x2="22" y1="8" y2="13" />
|
||||
<line x1="22" x2="17" y1="8" y2="13" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 459 B |
@@ -0,0 +1,22 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-wand-sparkles"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72" />
|
||||
<path d="m14 7 3 3" />
|
||||
<path d="M5 6v4" />
|
||||
<path d="M19 14v4" />
|
||||
<path d="M10 2v2" />
|
||||
<path d="M7 8H3" />
|
||||
<path d="M21 16h-4" />
|
||||
<path d="M11 3H9" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 613 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-react v0.563.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-zap"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 453 B |
@@ -15,6 +15,12 @@ export struct ServerItem {
|
||||
unread: int,
|
||||
// Someone streams in our channel there.
|
||||
live: bool,
|
||||
// "9 online · 7 channels" while its presence is known, else the address.
|
||||
detail: string,
|
||||
// "TeamSpeak 6", "TeamSpeak 3", "" before it was reached.
|
||||
flavor: string,
|
||||
// Gateway or query credentials: presence without joining.
|
||||
gateway: bool,
|
||||
}
|
||||
|
||||
export struct TreeItem {
|
||||
@@ -155,6 +161,8 @@ export struct FileItem {
|
||||
progress: float,
|
||||
// A picture, so the icon differs.
|
||||
picture: bool,
|
||||
// The picture itself, once downloaded: shown inline instead of the card.
|
||||
preview: image,
|
||||
}
|
||||
|
||||
export struct ChatLine {
|
||||
@@ -276,19 +284,6 @@ export struct ShareForm {
|
||||
auto-accept: bool,
|
||||
}
|
||||
|
||||
// An identity in Settings → Identities.
|
||||
export struct IdentityItem {
|
||||
id: int,
|
||||
name: string,
|
||||
// "From TeamSpeak · level 8"
|
||||
detail: string,
|
||||
// The unique id servers know it by (TeamSpeak 3 form).
|
||||
uid: string,
|
||||
initials: string,
|
||||
tint: color,
|
||||
is-default: bool,
|
||||
}
|
||||
|
||||
export struct AudioForm {
|
||||
// 0 = system default, then the devices.
|
||||
input-index: int,
|
||||
@@ -330,6 +325,438 @@ export struct AppearanceForm {
|
||||
image-cache-mb: float,
|
||||
}
|
||||
|
||||
// Home, friends, direct messages, notifications, search, events and the
|
||||
// settings pages (docs/ui.md). Lists are models Rust syncs row by row.
|
||||
|
||||
// A contact (friend, blocked or neutral) and where they are now.
|
||||
export struct ContactItem {
|
||||
uid: string,
|
||||
name: string,
|
||||
initials: string,
|
||||
tint: color,
|
||||
avatar: image,
|
||||
// "friend", "blocked" or "neutral"
|
||||
relation: string,
|
||||
online: bool,
|
||||
away: bool,
|
||||
streaming: bool,
|
||||
// What they do: "In Chill Zone", "Streaming", "Away: brb", "Offline".
|
||||
status: string,
|
||||
// Where: the server of the first session that sees them, or "Last seen
|
||||
// 2 h ago on Nightfall Guild".
|
||||
place: string,
|
||||
// "12m ago": online since (this run), else when last seen.
|
||||
when: string,
|
||||
note: string,
|
||||
// Local playback in percent.
|
||||
volume: float,
|
||||
muted: bool,
|
||||
// "Contact since 14 Jan 2022".
|
||||
since: string,
|
||||
// Every session that sees them: "Nightfall Guild · #Chill Zone".
|
||||
spots: [string],
|
||||
// A voice connection sees them: they can be messaged, poked, joined.
|
||||
reachable: bool,
|
||||
selected: bool,
|
||||
}
|
||||
|
||||
// A live stream on one of our servers (home page).
|
||||
export struct LiveItem {
|
||||
// The session (bookmark id) and the stream (directory or stream id).
|
||||
session: int,
|
||||
id: string,
|
||||
title: string,
|
||||
streamer: string,
|
||||
initials: string,
|
||||
tint: color,
|
||||
avatar: image,
|
||||
server: string,
|
||||
channel: string,
|
||||
// 0: unknown.
|
||||
viewers: int,
|
||||
// "Screen", "Camera", ...
|
||||
kind: string,
|
||||
// The server's colour, for the card's picture.
|
||||
backdrop: color,
|
||||
// In our voice channel: it can be watched at once.
|
||||
watchable: bool,
|
||||
}
|
||||
|
||||
// A chat in the recent chats and in the direct messages list.
|
||||
export struct ConversationItem {
|
||||
// Index in Rust's list (what `open-conversation` takes).
|
||||
key: int,
|
||||
// 0 server chat, 1 channel chat, 2 private chat, 3 offline message.
|
||||
kind: int,
|
||||
title: string,
|
||||
// The server's name.
|
||||
server: string,
|
||||
// "You: That works!", "Sent a file".
|
||||
preview: string,
|
||||
// "11:42", "Yesterday", "Mon", "12 Mar".
|
||||
time: string,
|
||||
// "10m ago".
|
||||
ago: string,
|
||||
unread: int,
|
||||
initials: string,
|
||||
tint: color,
|
||||
avatar: image,
|
||||
online: bool,
|
||||
selected: bool,
|
||||
}
|
||||
|
||||
// A notification of the bell.
|
||||
export struct NoticeItem {
|
||||
key: int,
|
||||
// "mention", "poke", "message", "event", "friend"
|
||||
kind: string,
|
||||
title: string,
|
||||
body: string,
|
||||
// "3 min ago"
|
||||
time: string,
|
||||
unread: bool,
|
||||
initials: string,
|
||||
tint: color,
|
||||
avatar: image,
|
||||
}
|
||||
|
||||
// A result of the search (Ctrl+K).
|
||||
export struct SearchItem {
|
||||
// "server", "channel", "person", "contact", "setting"
|
||||
kind: string,
|
||||
title: string,
|
||||
subtitle: string,
|
||||
initials: string,
|
||||
tint: color,
|
||||
avatar: image,
|
||||
// The first result of a group names it ("Servers", "People", ...).
|
||||
header: string,
|
||||
}
|
||||
|
||||
// Something on our servers: an event, a scheduled stream or server news.
|
||||
export struct HappeningItem {
|
||||
// "event", "stream", "news"
|
||||
kind: string,
|
||||
title: string,
|
||||
subtitle: string,
|
||||
// "Sat 26 Apr · 19:00"
|
||||
when: string,
|
||||
session: int,
|
||||
id: int,
|
||||
live: bool,
|
||||
}
|
||||
|
||||
// A scheduled event of a server's gateway.
|
||||
export struct EventItem {
|
||||
id: int,
|
||||
title: string,
|
||||
description: string,
|
||||
// The date block: "SAT", "26", "APR".
|
||||
weekday: string,
|
||||
day: string,
|
||||
month: string,
|
||||
// "Sat 26 Apr, 19:00 – 21:00"
|
||||
when: string,
|
||||
// "#Raid Night" or "Server-wide".
|
||||
place: string,
|
||||
// A scheduled stream: "Exploring the Lands Between · Elden Ring".
|
||||
stream: string,
|
||||
live: bool,
|
||||
going: int,
|
||||
maybe: int,
|
||||
not-going: int,
|
||||
// "going", "maybe", "not_going" or "".
|
||||
rsvp: string,
|
||||
creator: string,
|
||||
// We may edit and delete it (ours, or we moderate).
|
||||
editable: bool,
|
||||
// "Starts in 15 min", "Started 5 min ago", "".
|
||||
soon: string,
|
||||
// "Nova (going)", ...; filled once the event was opened.
|
||||
attendees: [string],
|
||||
expanded: bool,
|
||||
}
|
||||
|
||||
// The event form (create or edit).
|
||||
export struct EventForm {
|
||||
// -1: a new event.
|
||||
id: int,
|
||||
title: string,
|
||||
description: string,
|
||||
// "2026-10-04 19:00", local time.
|
||||
start: string,
|
||||
// Empty: no end.
|
||||
end: string,
|
||||
// Index into `event-channels` (0: server-wide).
|
||||
channel: int,
|
||||
stream: bool,
|
||||
stream-title: string,
|
||||
game: string,
|
||||
}
|
||||
|
||||
// An offline message to write (mail the server keeps).
|
||||
export struct OfflineForm {
|
||||
// The peer's unique id and name.
|
||||
uid: string,
|
||||
to: string,
|
||||
subject: string,
|
||||
text: string,
|
||||
}
|
||||
|
||||
// The open direct message: who, and what can be done.
|
||||
export struct DmPeer {
|
||||
open: bool,
|
||||
uid: string,
|
||||
name: string,
|
||||
initials: string,
|
||||
tint: color,
|
||||
avatar: image,
|
||||
online: bool,
|
||||
// "Online · Nightfall Guild · #Chill Zone", "Offline · last seen 2 h ago".
|
||||
status: string,
|
||||
description: string,
|
||||
groups: [string],
|
||||
note: string,
|
||||
since: string,
|
||||
// Where they are now, or where they were last seen.
|
||||
servers: [string],
|
||||
// Pictures linked in the conversation that are downloaded, newest
|
||||
// first (at most six; `media-more` counts the others), and the other
|
||||
// files: name, "2.4 MB · Today at 11:36", picture.
|
||||
media: [image],
|
||||
media-more: int,
|
||||
files: [FileItem],
|
||||
friend: bool,
|
||||
blocked: bool,
|
||||
volume: float,
|
||||
muted: bool,
|
||||
// Messages can be sent now (a voice connection that sees them).
|
||||
can-send: bool,
|
||||
// Why not: "Kairo is offline.", "Connect to Nightfall Guild to send."
|
||||
notice: string,
|
||||
// The server keeps offline messages: offer one.
|
||||
offline: bool,
|
||||
// Connect with voice to the server of this conversation.
|
||||
can-connect: bool,
|
||||
// The messages come from the store, without a session: read-only.
|
||||
stored: bool,
|
||||
// An offline message is shown instead of the conversation.
|
||||
mail: bool,
|
||||
mail-subject: string,
|
||||
mail-text: string,
|
||||
mail-time: string,
|
||||
}
|
||||
|
||||
// An identity (Profiles page); never its key.
|
||||
export struct IdentityItem {
|
||||
id: int,
|
||||
name: string,
|
||||
// Unique ids on TeamSpeak 3 and TeamSpeak 6 servers.
|
||||
uid: string,
|
||||
uid6: string,
|
||||
level: int,
|
||||
// The store's default: servers see us as this one unless a bookmark
|
||||
// names another.
|
||||
default: bool,
|
||||
// Where it came from: "Made in Voelin", "Imported", "Chosen by you".
|
||||
origin: string,
|
||||
// Raising its level: the level aimed at and the best one reached (0: no).
|
||||
improving: int,
|
||||
reached: int,
|
||||
// The bookmarks that use it.
|
||||
used-by: string,
|
||||
}
|
||||
|
||||
// An identity found in another client's files (import).
|
||||
export struct FoundIdentity {
|
||||
name: string,
|
||||
uid: string,
|
||||
level: int,
|
||||
source: string,
|
||||
// Already in our identities.
|
||||
known: bool,
|
||||
picked: bool,
|
||||
}
|
||||
|
||||
// A bookmark and the identity it connects with (Profiles page).
|
||||
export struct BookmarkIdentity {
|
||||
id: int,
|
||||
name: string,
|
||||
// Index into `identity-names` (0: the default identity).
|
||||
identity: int,
|
||||
}
|
||||
|
||||
// Camera, video and stream quality (Voice & Video page).
|
||||
export struct VideoForm {
|
||||
// Index into `cameras`.
|
||||
camera: int,
|
||||
// 0 none, 1 blur.
|
||||
background: int,
|
||||
// "auto", "1280x720", ...
|
||||
resolution: string,
|
||||
// `stream.fps` as typed.
|
||||
fps: string,
|
||||
// auto, vp8, vp9, h264, av1.
|
||||
codec: int,
|
||||
hardware: bool,
|
||||
mirror: bool,
|
||||
// everyone, friends, channel, nobody.
|
||||
permissions: int,
|
||||
// 0 auto, 1 720p, 2 1080p, 3 1440p, -1 other layers.
|
||||
quality: int,
|
||||
// kbit/s.
|
||||
bitrate: float,
|
||||
// The camera preview runs.
|
||||
preview: bool,
|
||||
}
|
||||
|
||||
// A simulcast layer of our stream (Streaming page); numbers as typed.
|
||||
export struct LayerItem {
|
||||
// "1920x1080", or a scale like "0.5".
|
||||
size: string,
|
||||
// Frames per second; "" no cap.
|
||||
fps: string,
|
||||
// kbit/s.
|
||||
bitrate: string,
|
||||
min-bitrate: string,
|
||||
max-bitrate: string,
|
||||
}
|
||||
|
||||
// An audio source mixed into our stream.
|
||||
export struct AudioSourceItem {
|
||||
// "desktop", "app", "window", "microphone", "synthetic"
|
||||
kind: string,
|
||||
name: string,
|
||||
detail: string,
|
||||
// Percent.
|
||||
gain: float,
|
||||
muted: bool,
|
||||
}
|
||||
|
||||
// Stream defaults (Streaming page).
|
||||
export struct StreamingForm {
|
||||
fps: string,
|
||||
bitrate: string,
|
||||
// auto, vp8, vp9, h264, av1.
|
||||
codec: int,
|
||||
// auto, portal, wlroots, x11.
|
||||
capture: int,
|
||||
replay-seconds: string,
|
||||
replay-memory: string,
|
||||
recording-dir: string,
|
||||
}
|
||||
|
||||
// Notification kinds: 0 off, 1 in the app, 2 also on the desktop.
|
||||
export struct NotifyForm {
|
||||
mentions: int,
|
||||
pokes: int,
|
||||
messages: int,
|
||||
events: int,
|
||||
friends: int,
|
||||
}
|
||||
|
||||
// Privacy & Safety.
|
||||
export struct PrivacyForm {
|
||||
// 0 hide, 1 show flagged.
|
||||
block-mode: int,
|
||||
// everyone, friends, nobody.
|
||||
messages: int,
|
||||
pokes: int,
|
||||
}
|
||||
|
||||
// A server's gateway (Integrations page).
|
||||
export struct GatewayItem {
|
||||
session: int,
|
||||
server: string,
|
||||
url: string,
|
||||
// "connected", "connecting", "off"
|
||||
status: string,
|
||||
features: [string],
|
||||
admin: bool,
|
||||
}
|
||||
|
||||
// A gateway configuration key (gateway administration).
|
||||
export struct ConfigItem {
|
||||
key: string,
|
||||
// JSON.
|
||||
value: string,
|
||||
source: string,
|
||||
description: string,
|
||||
kind: string,
|
||||
bootstrap: bool,
|
||||
}
|
||||
|
||||
// A gateway permission rule.
|
||||
export struct PermItem {
|
||||
action: string,
|
||||
// "Everyone", "Server groups 6, 7", "Default: server admins".
|
||||
rule: string,
|
||||
source: string,
|
||||
everyone: bool,
|
||||
server-groups: string,
|
||||
channel-groups: string,
|
||||
}
|
||||
|
||||
// A video encoder backend (Integrations page).
|
||||
export struct EncoderItem {
|
||||
name: string,
|
||||
api: string,
|
||||
codec: string,
|
||||
hardware: bool,
|
||||
ok: bool,
|
||||
// Why it does not work, or "used first".
|
||||
status: string,
|
||||
}
|
||||
|
||||
// Any registered setting (Advanced page).
|
||||
export struct SettingItem {
|
||||
key: string,
|
||||
doc: string,
|
||||
// JSON.
|
||||
value: string,
|
||||
// "set here", "command line", "config file", "default".
|
||||
source: string,
|
||||
}
|
||||
|
||||
// A recording or clip of the Stream Studio (Library).
|
||||
export struct RecordingItem {
|
||||
name: string,
|
||||
// "12.3 MB · 3 Oct 18:04".
|
||||
detail: string,
|
||||
clip: bool,
|
||||
path: string,
|
||||
}
|
||||
|
||||
// Encoders, chat history, cache and logs (Advanced page); numbers as typed.
|
||||
export struct AdvancedForm {
|
||||
encoder: string,
|
||||
hardware: bool,
|
||||
// `stream.decoder_backend`, `stream.hardware_decoding`.
|
||||
decoder: string,
|
||||
hardware-decoding: bool,
|
||||
store-history: bool,
|
||||
history-page: string,
|
||||
dedupe-ms: string,
|
||||
retention-days: string,
|
||||
cache-mb: string,
|
||||
fetch-images: bool,
|
||||
progress-ms: string,
|
||||
// `ui.image_preview_kb`.
|
||||
preview-kb: string,
|
||||
logs: string,
|
||||
crash-dir: string,
|
||||
}
|
||||
|
||||
// Who we are (My Account page).
|
||||
export struct AccountForm {
|
||||
nickname: string,
|
||||
identity: string,
|
||||
uid: string,
|
||||
uid6: string,
|
||||
level: int,
|
||||
server: string,
|
||||
}
|
||||
|
||||
export global Bridge {
|
||||
in property <[ServerItem]> servers;
|
||||
in-out property <int> current-server: -1;
|
||||
@@ -461,9 +888,9 @@ export global Bridge {
|
||||
in property <string> crash-notice;
|
||||
// Third-party notices, one entry per line, for the About page.
|
||||
in property <[string]> notices;
|
||||
// Settings → Identities: who servers see us as, and the import of the
|
||||
// official clients' identities on start (identity.import_from_teamspeak).
|
||||
in property <[IdentityItem]> identities;
|
||||
// Settings → Profiles: the identity servers see us as (the store's
|
||||
// default, from the next connection) and the import of the official
|
||||
// clients' identities on start (identity.import_from_teamspeak).
|
||||
in-out property <bool> identity-import;
|
||||
callback use-identity(int);
|
||||
callback set-identity-import(bool);
|
||||
@@ -551,6 +978,168 @@ export global Bridge {
|
||||
// A link to our voice channel (`ts3server://`) to hand to others; the
|
||||
// caller copies it.
|
||||
callback invite() -> string;
|
||||
|
||||
// Home, friends, direct messages, notifications, search, events and
|
||||
// the settings pages.
|
||||
|
||||
// Home: friends online first, live streams on our servers, the latest
|
||||
// chats, what friends do, events and server news, the Library.
|
||||
in property <[ContactItem]> friends-online;
|
||||
in property <[LiveItem]> live-rooms;
|
||||
in property <[ConversationItem]> recent-chats;
|
||||
in property <[ContactItem]> friend-activity;
|
||||
in property <[HappeningItem]> happenings;
|
||||
in property <[RecordingItem]> recordings;
|
||||
in property <string> recordings-dir;
|
||||
callback open-conversation(int);
|
||||
// The messages page and the Library were opened.
|
||||
callback open-messages();
|
||||
callback open-library();
|
||||
callback watch-live(int, string);
|
||||
callback open-happening(int);
|
||||
callback open-recording(string);
|
||||
callback open-recordings-folder();
|
||||
// Connect a bookmark with voice (the Join buttons).
|
||||
callback connect-server(int);
|
||||
|
||||
// Friends: the contacts (friends, then the others), the selected one.
|
||||
in property <[ContactItem]> contacts;
|
||||
in property <ContactItem> contact;
|
||||
in property <int> contacts-online;
|
||||
in property <int> contacts-all;
|
||||
in property <int> contacts-blocked;
|
||||
callback friends-tab(int);
|
||||
callback search-contacts(string);
|
||||
callback select-contact(string);
|
||||
// "message", "poke", "join", "watch", "friend", "block", "neutral",
|
||||
// "remove", "mute".
|
||||
callback contact-action(string, string);
|
||||
callback contact-note(string, string);
|
||||
callback contact-volume(string, float);
|
||||
|
||||
// Direct messages: the conversations, the open one (its messages are
|
||||
// `messages` while a session holds it, else `dm-messages`).
|
||||
in property <[ConversationItem]> conversations;
|
||||
in property <int> dm-unread;
|
||||
in property <int> inbox-unread;
|
||||
in property <DmPeer> dm;
|
||||
in property <[ChatLine]> dm-messages;
|
||||
callback dm-tab(int);
|
||||
callback search-conversations(string);
|
||||
// "poke", "join", "friend", "block", "mute", "connect", "delete-mail",
|
||||
// "unread-mail".
|
||||
callback dm-action(string);
|
||||
callback dm-volume(float);
|
||||
callback send-offline(OfflineForm);
|
||||
|
||||
// The bell.
|
||||
in property <[NoticeItem]> notifications;
|
||||
in property <int> notifications-unread;
|
||||
callback open-notice(int);
|
||||
callback mark-notices-read();
|
||||
callback clear-notices();
|
||||
|
||||
// The search (Ctrl+K): `search` fills the results.
|
||||
in property <[SearchItem]> search-results;
|
||||
callback search-activate(int);
|
||||
|
||||
// A server's events (gateway `events`).
|
||||
in property <bool> has-events;
|
||||
in property <[EventItem]> events;
|
||||
in property <bool> events-loading;
|
||||
in property <bool> can-create-events;
|
||||
in property <[string]> event-channels;
|
||||
callback open-events();
|
||||
callback rsvp(int, string);
|
||||
callback toggle-event(int);
|
||||
callback edit-event(int) -> EventForm;
|
||||
callback save-event(EventForm) -> string;
|
||||
callback delete-event(int);
|
||||
callback watch-event(int);
|
||||
|
||||
// A picture linked in chat, opened larger: the message and the link.
|
||||
callback open-preview(int, int) -> image;
|
||||
|
||||
// Settings pages: a section was shown (its data is loaded then).
|
||||
callback settings-section(int);
|
||||
in property <AccountForm> account;
|
||||
in property <[IdentityItem]> identities;
|
||||
in property <[string]> identity-names;
|
||||
in property <[BookmarkIdentity]> bookmark-identities;
|
||||
in property <[FoundIdentity]> found-identities;
|
||||
in property <string> identity-status;
|
||||
// "default", "delete", "export", "improve", "stop".
|
||||
callback identity-action(int, string);
|
||||
callback rename-identity(int, string);
|
||||
callback improve-target(int, int);
|
||||
callback find-identities();
|
||||
callback pick-found(int, bool);
|
||||
callback import-identities();
|
||||
callback bookmark-identity(int, int);
|
||||
|
||||
in-out property <VideoForm> video;
|
||||
in property <[string]> cameras;
|
||||
in property <image> camera-frame;
|
||||
in property <string> camera-status;
|
||||
callback video-changed(VideoForm);
|
||||
callback toggle-camera-preview();
|
||||
callback test-sound();
|
||||
|
||||
in-out property <StreamingForm> streaming;
|
||||
in property <[LayerItem]> layers;
|
||||
in property <[AudioSourceItem]> audio-sources;
|
||||
// Applications that play audio now (for an app source).
|
||||
in property <[string]> audio-apps;
|
||||
in property <bool> has-studio;
|
||||
callback streaming-changed(StreamingForm);
|
||||
callback layer-changed(int, LayerItem);
|
||||
callback add-layer();
|
||||
callback remove-layer(int);
|
||||
callback audio-source-changed(int, AudioSourceItem);
|
||||
callback add-audio-source(string, string);
|
||||
callback remove-audio-source(int);
|
||||
|
||||
in-out property <NotifyForm> notify;
|
||||
callback notify-changed(NotifyForm);
|
||||
callback test-notification();
|
||||
|
||||
in-out property <PrivacyForm> privacy;
|
||||
in property <[ContactItem]> blocked;
|
||||
callback privacy-changed(PrivacyForm);
|
||||
|
||||
in property <[GatewayItem]> gateways;
|
||||
// The gateway being administered (-1: none) and its keys and rules.
|
||||
in property <int> admin-session: -1;
|
||||
in property <[ConfigItem]> gateway-config;
|
||||
in property <[PermItem]> gateway-perms;
|
||||
in property <string> ffmpeg-status;
|
||||
in property <string> zero-copy-status;
|
||||
in property <[EncoderItem]> encoders;
|
||||
// The decoders, each codec's in the order they are tried.
|
||||
in property <[EncoderItem]> decoders;
|
||||
in property <bool> encoders-loading;
|
||||
callback gateway-admin(int);
|
||||
callback config-set(string, string);
|
||||
callback config-reset(string);
|
||||
callback config-reload();
|
||||
callback perm-set(string, bool, string, string);
|
||||
callback perm-reset(string);
|
||||
callback refresh-encoders();
|
||||
|
||||
in-out property <AdvancedForm> advanced;
|
||||
// `stream.srtp_profiles` in order, and those left out.
|
||||
in property <[string]> srtp-profiles;
|
||||
in property <[string]> srtp-unused;
|
||||
in property <[SettingItem]> all-settings;
|
||||
in property <[string]> capture-sources;
|
||||
callback advanced-changed(AdvancedForm);
|
||||
callback srtp-move(int, int);
|
||||
callback srtp-toggle(string);
|
||||
// A key's JSON value: "" when taken, else why not.
|
||||
callback setting-set(string, string) -> string;
|
||||
callback setting-reset(string);
|
||||
callback search-settings(string);
|
||||
callback open-logs();
|
||||
}
|
||||
|
||||
// Decoded images by key, from Rust's image cache (src/images.rs): each is
|
||||
|
||||
@@ -118,6 +118,47 @@ export global Icons {
|
||||
out property <image> volume-2: @image-url("assets/icons/volume-2.svg");
|
||||
out property <image> volume-x: @image-url("assets/icons/volume-x.svg");
|
||||
out property <image> x: @image-url("assets/icons/x.svg");
|
||||
// Home, friends, messages, events and the settings pages (from
|
||||
// lucide-react 0.563.0, the same ISC icons).
|
||||
out property <image> arrow-down: @image-url("assets/icons/arrow-down.svg");
|
||||
out property <image> arrow-up: @image-url("assets/icons/arrow-up.svg");
|
||||
out property <image> ban: @image-url("assets/icons/ban.svg");
|
||||
out property <image> bell-ring: @image-url("assets/icons/bell-ring.svg");
|
||||
out property <image> calendar-days: @image-url("assets/icons/calendar-days.svg");
|
||||
out property <image> calendar-plus: @image-url("assets/icons/calendar-plus.svg");
|
||||
out property <image> circle-check: @image-url("assets/icons/circle-check.svg");
|
||||
out property <image> circle-x: @image-url("assets/icons/circle-x.svg");
|
||||
out property <image> clapperboard: @image-url("assets/icons/clapperboard.svg");
|
||||
out property <image> cpu: @image-url("assets/icons/cpu.svg");
|
||||
out property <image> film: @image-url("assets/icons/film.svg");
|
||||
out property <image> flask-conical: @image-url("assets/icons/flask-conical.svg");
|
||||
out property <image> folder: @image-url("assets/icons/folder.svg");
|
||||
out property <image> gauge: @image-url("assets/icons/gauge.svg");
|
||||
out property <image> id-card: @image-url("assets/icons/id-card.svg");
|
||||
out property <image> inbox: @image-url("assets/icons/inbox.svg");
|
||||
out property <image> key-round: @image-url("assets/icons/key-round.svg");
|
||||
out property <image> mail: @image-url("assets/icons/mail.svg");
|
||||
out property <image> megaphone: @image-url("assets/icons/megaphone.svg");
|
||||
out property <image> message-square-plus: @image-url("assets/icons/message-square-plus.svg");
|
||||
out property <image> plug: @image-url("assets/icons/plug.svg");
|
||||
out property <image> rotate-ccw: @image-url("assets/icons/rotate-ccw.svg");
|
||||
out property <image> scroll-text: @image-url("assets/icons/scroll-text.svg");
|
||||
out property <image> upload: @image-url("assets/icons/upload.svg");
|
||||
out property <image> user-check: @image-url("assets/icons/user-check.svg");
|
||||
out property <image> user-cog: @image-url("assets/icons/user-cog.svg");
|
||||
out property <image> user-round: @image-url("assets/icons/user-round.svg");
|
||||
out property <image> user-x: @image-url("assets/icons/user-x.svg");
|
||||
out property <image> wand-sparkles: @image-url("assets/icons/wand-sparkles.svg");
|
||||
out property <image> zap: @image-url("assets/icons/zap.svg");
|
||||
// The app mark (full colour, not for colorize).
|
||||
out property <image> logo: @image-url("assets/logo.svg");
|
||||
// Painted backgrounds (full colour; assets/art/): the home banner, the
|
||||
// home sidebar's picture, and pictures for server and stream cards.
|
||||
out property <image> art-banner: @image-url("assets/art/banner.svg");
|
||||
out property <image> art-sidebar: @image-url("assets/art/sidebar.svg");
|
||||
out property <[image]> art-scenes: [
|
||||
@image-url("assets/art/scene-1.svg"),
|
||||
@image-url("assets/art/scene-2.svg"),
|
||||
@image-url("assets/art/scene-3.svg"),
|
||||
];
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
// navigate through these functions; Rust sets the same properties for the
|
||||
// development switch VOELIN_OPEN (src/dev.rs).
|
||||
|
||||
import { Bridge, BookmarkForm, ShareForm } from "bridge.slint";
|
||||
import { Bridge, BookmarkForm, ShareForm, EventForm, OfflineForm } from "bridge.slint";
|
||||
import { StudioBridge } from "studio-bridge.slint";
|
||||
|
||||
export enum Page {
|
||||
@@ -11,18 +11,31 @@ export enum Page {
|
||||
// A server: channels, chat or the stream viewer, members and streams.
|
||||
server,
|
||||
settings,
|
||||
// Contacts and where they are.
|
||||
friends,
|
||||
// Direct messages across servers.
|
||||
messages,
|
||||
// Recordings and clips.
|
||||
library,
|
||||
// A server's scheduled events (gateway `events`).
|
||||
events,
|
||||
// The Stream Studio (scenes, preview, mixer, going live).
|
||||
studio,
|
||||
}
|
||||
|
||||
// Sections of the settings page, in the order of its navigation.
|
||||
// Sections of the settings page (`settings-section` takes these numbers).
|
||||
export enum SettingsSection {
|
||||
voice,
|
||||
keybinds,
|
||||
streaming,
|
||||
privacy,
|
||||
appearance,
|
||||
identities,
|
||||
account,
|
||||
profiles,
|
||||
devices,
|
||||
notifications,
|
||||
integrations,
|
||||
advanced,
|
||||
}
|
||||
|
||||
// Tabs of the bottom navigation in the narrow (mobile) layout.
|
||||
@@ -42,10 +55,10 @@ export global Nav {
|
||||
// `ui.narrow_breakpoint`.
|
||||
in-out property <bool> narrow: false;
|
||||
in-out property <length> narrow-breakpoint: 800px;
|
||||
// Wide enough for a third column (home, direct messages).
|
||||
in-out property <bool> wide: true;
|
||||
in-out property <bool> right-panel-open: true;
|
||||
in-out property <length> right-panel-width: 280px;
|
||||
// Incremented to focus the search field (Ctrl+K).
|
||||
in-out property <int> search-requests;
|
||||
// The voice channel we are in (people, streams, its chat) instead of
|
||||
// the plain chat.
|
||||
in-out property <bool> voice-view: false;
|
||||
@@ -70,6 +83,25 @@ export global Nav {
|
||||
in-out property <BookmarkForm> bookmark-form;
|
||||
in-out property <ShareForm> share-form;
|
||||
|
||||
// The bell's panel, the search (Ctrl+K) and its selected result, a
|
||||
// picture opened from the chat, the event and offline message forms,
|
||||
// the friends page's tab, the direct messages' tab, the add-server
|
||||
// dialog in "join" mode (connect once saved).
|
||||
in-out property <bool> notifications-open;
|
||||
in-out property <bool> search-open;
|
||||
in-out property <string> search-text;
|
||||
in-out property <int> search-index;
|
||||
in-out property <bool> lightbox-open;
|
||||
in-out property <image> lightbox;
|
||||
in-out property <bool> event-form-open;
|
||||
in-out property <EventForm> event-form;
|
||||
in-out property <string> event-error;
|
||||
in-out property <bool> offline-form-open;
|
||||
in-out property <OfflineForm> offline-form;
|
||||
in-out property <int> friends-tab;
|
||||
in-out property <int> dm-tab;
|
||||
in-out property <bool> join-open;
|
||||
|
||||
// The phone layout (narrow windows).
|
||||
// The server's members as a page of their own (the desktop shows them
|
||||
// beside the chat).
|
||||
@@ -96,6 +128,16 @@ export global Nav {
|
||||
mobile-tab = MobileTab.home;
|
||||
}
|
||||
page = p;
|
||||
notifications-open = false;
|
||||
if p == Page.events {
|
||||
Bridge.open-events();
|
||||
}
|
||||
if p == Page.messages {
|
||||
Bridge.open-messages();
|
||||
}
|
||||
if p == Page.library {
|
||||
Bridge.open-library();
|
||||
}
|
||||
}
|
||||
|
||||
// A tab of the phone's bottom navigation, without the pages that were
|
||||
@@ -115,6 +157,66 @@ export global Nav {
|
||||
}
|
||||
settings-section = section;
|
||||
page = Page.settings;
|
||||
notifications-open = false;
|
||||
Bridge.settings-section(section == SettingsSection.voice ? 0
|
||||
: section == SettingsSection.keybinds ? 1
|
||||
: section == SettingsSection.streaming ? 2
|
||||
: section == SettingsSection.privacy ? 3
|
||||
: section == SettingsSection.appearance ? 4
|
||||
: section == SettingsSection.account ? 5
|
||||
: section == SettingsSection.profiles ? 6
|
||||
: section == SettingsSection.devices ? 7
|
||||
: section == SettingsSection.notifications ? 8
|
||||
: section == SettingsSection.integrations ? 9 : 10);
|
||||
}
|
||||
|
||||
public function open-search(text: string) {
|
||||
search-text = text;
|
||||
search-index = 0;
|
||||
search-open = true;
|
||||
notifications-open = false;
|
||||
Bridge.search(text);
|
||||
}
|
||||
|
||||
public function close-search() {
|
||||
search-open = false;
|
||||
search-text = "";
|
||||
}
|
||||
|
||||
public function open-picture(key: int, index: int) {
|
||||
lightbox = Bridge.open-preview(key, index);
|
||||
lightbox-open = true;
|
||||
}
|
||||
|
||||
public function create-event() {
|
||||
event-form = Bridge.edit-event(-1);
|
||||
event-error = "";
|
||||
event-form-open = true;
|
||||
}
|
||||
|
||||
public function edit-event(id: int) {
|
||||
event-form = Bridge.edit-event(id);
|
||||
event-error = "";
|
||||
event-form-open = true;
|
||||
}
|
||||
|
||||
public function write-offline(uid: string, to: string) {
|
||||
offline-form = { uid: uid, to: to, subject: "", text: "" };
|
||||
offline-form-open = true;
|
||||
}
|
||||
|
||||
public function join-server() {
|
||||
bookmark-form = Bridge.edit-bookmark(-1);
|
||||
join-open = true;
|
||||
bookmark-open = true;
|
||||
}
|
||||
|
||||
// The members panel of the current server.
|
||||
public function show-members() {
|
||||
show(Page.server);
|
||||
pins-open = false;
|
||||
topics-open = false;
|
||||
right-panel-open = true;
|
||||
}
|
||||
|
||||
public function close-settings() {
|
||||
@@ -133,11 +235,13 @@ export global Nav {
|
||||
|
||||
public function add-server() {
|
||||
bookmark-form = Bridge.edit-bookmark(-1);
|
||||
join-open = false;
|
||||
bookmark-open = true;
|
||||
}
|
||||
|
||||
public function edit-server(id: int) {
|
||||
bookmark-form = Bridge.edit-bookmark(id);
|
||||
join-open = false;
|
||||
bookmark-open = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,16 +147,18 @@ component FileCard inherits Rectangle {
|
||||
padding: Theme.space-3;
|
||||
padding-left: Theme.space-4;
|
||||
spacing: Theme.space-4;
|
||||
// A document in red, a picture in blue (as in the profile panel's
|
||||
// shared files and the design's file cards).
|
||||
Rectangle {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
border-radius: 20px;
|
||||
background: Theme.surface-4;
|
||||
border-radius: Theme.radius-md;
|
||||
background: file.picture ? Theme.accent-soft : Theme.danger-soft;
|
||||
Icon {
|
||||
source: file.picture ? Icons.image : Icons.file-text;
|
||||
size: Theme.icon-md;
|
||||
tint: Theme.accent-text;
|
||||
tint: file.picture ? Theme.accent-text : Theme.danger;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
@@ -202,6 +204,37 @@ component FileCard inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// A picture a message links, shown inline (downloaded into memory); a
|
||||
// click opens it larger.
|
||||
component ImageCard inherits Rectangle {
|
||||
in property <int> key;
|
||||
in property <FileItem> file;
|
||||
// As wide as the column allows, up to 520 px, keeping the picture's
|
||||
// shape (at most 340 px high).
|
||||
property <float> ratio: file.preview.height > 0 ? file.preview.width / file.preview.height : 1.6;
|
||||
max-width: min(520px, 340px * ratio);
|
||||
preferred-width: self.max-width;
|
||||
height: min(self.width, self.max-width) / ratio;
|
||||
border-radius: Theme.radius-lg;
|
||||
clip: true;
|
||||
background: Theme.surface-2;
|
||||
border-width: 1px;
|
||||
border-color: touch.has-hover ? Theme.border-strong : Theme.border;
|
||||
accessible-role: AccessibleRole.image;
|
||||
accessible-label: file.name;
|
||||
accessible-action-default => { Nav.open-picture(root.key, root.file.index); }
|
||||
Image {
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
source: root.file.preview;
|
||||
image-fit: cover;
|
||||
}
|
||||
touch := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { Nav.open-picture(root.key, root.file.index); }
|
||||
}
|
||||
}
|
||||
|
||||
// Quick reactions, pin and "start a topic" on a hovered message.
|
||||
component MessageActions inherits Rectangle {
|
||||
in property <int> key;
|
||||
@@ -353,10 +386,17 @@ export component MessageRow inherits Rectangle {
|
||||
padding-top: Theme.space-2;
|
||||
padding-bottom: Theme.space-1;
|
||||
spacing: Theme.space-2;
|
||||
for file in line.files: FileCard {
|
||||
key: line.key;
|
||||
file: file;
|
||||
max-width: 440px;
|
||||
for file in line.files: HorizontalLayout {
|
||||
alignment: start;
|
||||
if file.preview.width > 0: ImageCard {
|
||||
key: line.key;
|
||||
file: file;
|
||||
}
|
||||
if file.preview.width == 0: FileCard {
|
||||
key: line.key;
|
||||
file: file;
|
||||
max-width: 440px;
|
||||
}
|
||||
}
|
||||
}
|
||||
if line.reactions.length > 0: VerticalLayout {
|
||||
@@ -457,12 +497,15 @@ export component MessageList inherits VerticalLayout {
|
||||
export component Composer inherits HorizontalLayout {
|
||||
in property <string> placeholder;
|
||||
in property <bool> topic;
|
||||
// Files can be attached (channel chats).
|
||||
in property <bool> attach: true;
|
||||
in property <bool> enabled: true;
|
||||
padding: Theme.space-4;
|
||||
padding-left: Theme.space-5;
|
||||
padding-right: Theme.space-5;
|
||||
spacing: Theme.space-3;
|
||||
// Files go to the channel's file browser and a link into the chat.
|
||||
if !root.topic: IconButton {
|
||||
if !root.topic && root.attach: IconButton {
|
||||
icon: Icons.plus;
|
||||
label: @tr("Attach a file");
|
||||
round: true;
|
||||
@@ -485,6 +528,7 @@ export component Composer inherits HorizontalLayout {
|
||||
input := TextField {
|
||||
text <=> Nav.draft;
|
||||
bare: true;
|
||||
enabled: root.enabled;
|
||||
placeholder: root.placeholder;
|
||||
label: @tr("Message");
|
||||
accepted(text) => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, BookmarkForm, ShareForm } from "../bridge.slint";
|
||||
import { Nav } from "../nav.slint";
|
||||
import { Nav, Page } from "../nav.slint";
|
||||
import { Icon, Button, ButtonKind, IconButton, TextField, Field, Select, Toggle, ToggleRow, Slider, Modal, Card, Chip, Banner, Avatar, Status, ListView, ScrollView } from "../components/index.slint";
|
||||
import { AboutSlint } from "std-widgets.slint";
|
||||
import { StudioBridge } from "../studio-bridge.slint";
|
||||
@@ -20,10 +20,12 @@ component Footer inherits HorizontalLayout {
|
||||
// fills in itself when left empty.
|
||||
export component BookmarkDialog inherits Modal {
|
||||
in-out property <BookmarkForm> form;
|
||||
// Join by address: connect once saved.
|
||||
in property <bool> join;
|
||||
callback done();
|
||||
// The fields beyond address and password: shown when editing.
|
||||
property <bool> advanced: form.id >= 0;
|
||||
title: form.id < 0 ? @tr("Add server") : @tr("Edit server");
|
||||
title: join ? @tr("Join a server") : form.id < 0 ? @tr("Add server") : @tr("Edit server");
|
||||
subtitle: @tr("Only the address is needed; Voelin finds the rest.");
|
||||
icon: Icons.server;
|
||||
card-width: 560px;
|
||||
@@ -133,10 +135,14 @@ export component BookmarkDialog inherits Modal {
|
||||
}
|
||||
Button {
|
||||
kind: ButtonKind.primary;
|
||||
text: form.id < 0 ? @tr("Add") : @tr("Save");
|
||||
text: root.join ? @tr("Join") : form.id < 0 ? @tr("Add") : @tr("Save");
|
||||
enabled: form.address != "";
|
||||
clicked => {
|
||||
Bridge.save-bookmark(form);
|
||||
if root.join {
|
||||
Bridge.connect-voice();
|
||||
Nav.show(Page.server);
|
||||
}
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,444 @@
|
||||
// A server's scheduled events (gateway `events`): the list with answers
|
||||
// (going, maybe, not going), who answered, reminders, scheduled streams;
|
||||
// creating, editing and deleting them. Also the entries above the channel
|
||||
// tree that lead here and to the members (design mockup 03).
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, EventItem, EventForm } from "../bridge.slint";
|
||||
import { Nav, Page } from "../nav.slint";
|
||||
import { Icon, Button, ButtonKind, IconButton, Chip, LiveBadge, NavItem, TextField, Field, Select, Toggle, ToggleRow, Modal, Divider, Banner, ScrollView } from "../components/index.slint";
|
||||
|
||||
// Events and Members above the channel tree.
|
||||
export component ServerLinks inherits VerticalLayout {
|
||||
spacing: Theme.space-1;
|
||||
if Bridge.has-events: NavItem {
|
||||
icon: Icons.calendar-days;
|
||||
text: @tr("Events");
|
||||
selected: Nav.page == Page.events;
|
||||
clicked => { Nav.show(Page.events); }
|
||||
}
|
||||
// Not marked while the panel is open, as in the design: the header's
|
||||
// members button shows that.
|
||||
NavItem {
|
||||
icon: Icons.users;
|
||||
text: @tr("Members");
|
||||
clicked => { Nav.show-members(); }
|
||||
}
|
||||
}
|
||||
|
||||
// One answer button: "Going · 12".
|
||||
component RsvpButton inherits Rectangle {
|
||||
in property <string> text;
|
||||
in property <int> count;
|
||||
in property <bool> chosen;
|
||||
in property <color> tone: Theme.accent;
|
||||
callback clicked();
|
||||
height: 32px;
|
||||
width: row.preferred-width + 24px;
|
||||
border-radius: Theme.radius-pill;
|
||||
background: chosen ? tone.transparentize(0.7) : touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
||||
border-width: 1px;
|
||||
border-color: chosen ? tone : Theme.border-strong;
|
||||
accessible-role: AccessibleRole.button;
|
||||
accessible-label: text;
|
||||
accessible-checkable: true;
|
||||
accessible-checked: chosen;
|
||||
accessible-action-default => { clicked(); }
|
||||
touch := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { root.clicked(); }
|
||||
}
|
||||
row := HorizontalLayout {
|
||||
alignment: center;
|
||||
spacing: Theme.space-2;
|
||||
if root.chosen: Icon {
|
||||
source: Icons.check;
|
||||
size: 14px;
|
||||
tint: root.tone;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: root.text;
|
||||
color: root.chosen ? Theme.text : Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
font-weight: Theme.weight-medium;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
Text {
|
||||
text: root.count;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// One event as a card.
|
||||
component EventCard inherits Rectangle {
|
||||
in property <EventItem> event;
|
||||
// The phone: a smaller date, the lines wrap.
|
||||
in property <bool> compact;
|
||||
border-radius: Theme.radius-lg;
|
||||
background: Theme.surface-2.transparentize(0.25);
|
||||
border-width: 1px;
|
||||
border-color: event.live ? Theme.live : event.expanded ? Theme.accent : Theme.border;
|
||||
accessible-role: AccessibleRole.groupbox;
|
||||
accessible-label: event.title;
|
||||
HorizontalLayout {
|
||||
padding: root.compact ? Theme.space-3 : Theme.space-4;
|
||||
spacing: root.compact ? Theme.space-3 : Theme.space-4;
|
||||
// The date block.
|
||||
VerticalLayout {
|
||||
alignment: start;
|
||||
Rectangle {
|
||||
width: root.compact ? 48px : 64px;
|
||||
height: root.compact ? 58px : 72px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: Theme.accent-soft;
|
||||
border-width: 1px;
|
||||
border-color: Theme.accent.transparentize(0.5);
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
Text {
|
||||
text: root.event.weekday;
|
||||
color: Theme.accent-text;
|
||||
font-size: Theme.font-xs;
|
||||
font-weight: Theme.weight-semibold;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
Text {
|
||||
text: root.event.day;
|
||||
color: Theme.text;
|
||||
font-size: root.compact ? Theme.font-xl : Theme.font-2xl;
|
||||
font-weight: Theme.weight-bold;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
Text {
|
||||
text: root.event.month;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-xs;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
horizontal-stretch: 1;
|
||||
spacing: Theme.space-2;
|
||||
// The title, then its marks (under it where narrow).
|
||||
FlexboxLayout {
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: root.event.title;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-lg;
|
||||
font-weight: Theme.weight-semibold;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
if root.event.live: LiveBadge { }
|
||||
if root.event.stream != "" && !root.event.live: Chip {
|
||||
text: @tr("Stream");
|
||||
icon: Icons.radio;
|
||||
tint: Theme.live;
|
||||
}
|
||||
if root.event.soon != "": Chip {
|
||||
text: root.event.soon;
|
||||
icon: Icons.clock;
|
||||
tint: Theme.warning;
|
||||
}
|
||||
}
|
||||
FlexboxLayout {
|
||||
spacing: Theme.space-4;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Icon {
|
||||
source: Icons.clock;
|
||||
size: 14px;
|
||||
tint: Theme.text-muted;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: root.event.when;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Icon {
|
||||
source: Icons.hash;
|
||||
size: 14px;
|
||||
tint: Theme.text-muted;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: root.event.place;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
}
|
||||
}
|
||||
}
|
||||
if root.event.stream != "": HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Icon {
|
||||
source: Icons.monitor;
|
||||
size: 14px;
|
||||
tint: Theme.live;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: root.event.stream;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if root.event.description != "": Text {
|
||||
text: root.event.description;
|
||||
color: Theme.text-secondary;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
// The answers, then what can be done; they wrap where narrow.
|
||||
FlexboxLayout {
|
||||
spacing: Theme.space-2;
|
||||
RsvpButton {
|
||||
text: @tr("Going");
|
||||
count: root.event.going;
|
||||
chosen: root.event.rsvp == "going";
|
||||
tone: Theme.success;
|
||||
clicked => { Bridge.rsvp(root.event.id, root.event.rsvp == "going" ? "" : "going"); }
|
||||
}
|
||||
RsvpButton {
|
||||
text: @tr("Maybe");
|
||||
count: root.event.maybe;
|
||||
chosen: root.event.rsvp == "maybe";
|
||||
tone: Theme.warning;
|
||||
clicked => { Bridge.rsvp(root.event.id, root.event.rsvp == "maybe" ? "" : "maybe"); }
|
||||
}
|
||||
RsvpButton {
|
||||
text: @tr("Not going");
|
||||
count: root.event.not-going;
|
||||
chosen: root.event.rsvp == "not_going";
|
||||
tone: Theme.danger;
|
||||
clicked => { Bridge.rsvp(root.event.id, root.event.rsvp == "not_going" ? "" : "not_going"); }
|
||||
}
|
||||
if root.event.live: Button {
|
||||
small: true;
|
||||
kind: ButtonKind.primary;
|
||||
icon: Icons.monitor;
|
||||
text: @tr("Watch");
|
||||
clicked => { Bridge.watch-event(root.event.id); }
|
||||
}
|
||||
Button {
|
||||
small: true;
|
||||
kind: ButtonKind.ghost;
|
||||
icon: root.event.expanded ? Icons.chevron-up : Icons.users;
|
||||
text: root.event.expanded ? @tr("Hide") : @tr("Who answered");
|
||||
clicked => { Bridge.toggle-event(root.event.id); }
|
||||
}
|
||||
if root.event.editable: IconButton {
|
||||
icon: Icons.pencil;
|
||||
label: @tr("Edit {}", root.event.title);
|
||||
size: 30px;
|
||||
icon-size: Theme.icon-sm;
|
||||
clicked => { Nav.edit-event(root.event.id); }
|
||||
}
|
||||
if root.event.editable: IconButton {
|
||||
icon: Icons.trash-2;
|
||||
label: @tr("Delete {}", root.event.title);
|
||||
size: 30px;
|
||||
icon-size: Theme.icon-sm;
|
||||
tint: Theme.danger;
|
||||
clicked => { Bridge.delete-event(root.event.id); }
|
||||
}
|
||||
}
|
||||
if root.event.expanded: VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Divider { }
|
||||
Text {
|
||||
text: root.event.attendees.length == 0 ? @tr("No answers yet.") : @tr("Answers");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
}
|
||||
FlexboxLayout {
|
||||
spacing: Theme.space-2;
|
||||
for person in root.event.attendees: Chip {
|
||||
text: person;
|
||||
icon: Icons.user;
|
||||
outlined: true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: @tr("Created by {}", root.event.creator);
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The events of the current server.
|
||||
export component EventsPage inherits VerticalLayout {
|
||||
in property <bool> compact;
|
||||
padding: compact ? Theme.space-4 : Theme.space-6;
|
||||
spacing: Theme.space-4;
|
||||
// The phone's top bar already says "Events" and the server.
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
alignment: root.compact ? end : stretch;
|
||||
if !root.compact: Icon {
|
||||
source: Icons.calendar-days;
|
||||
size: 30px;
|
||||
tint: Theme.accent-text;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if !root.compact: VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
Text {
|
||||
text: @tr("Events");
|
||||
font-size: Theme.font-2xl;
|
||||
font-weight: Theme.weight-bold;
|
||||
color: Theme.text;
|
||||
}
|
||||
Text {
|
||||
text: @tr("Scheduled on {}", Bridge.server-title);
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if Bridge.can-create-events: Button {
|
||||
kind: ButtonKind.primary;
|
||||
icon: Icons.calendar-plus;
|
||||
text: @tr("Create Event");
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.create-event(); }
|
||||
}
|
||||
}
|
||||
if !Bridge.has-events: Banner {
|
||||
text: @tr("This server's gateway does not keep events (or there is no gateway).");
|
||||
icon: Icons.info;
|
||||
tone: Theme.info;
|
||||
}
|
||||
if Bridge.has-events && Bridge.events.length == 0: Text {
|
||||
text: Bridge.events-loading ? @tr("Loading events…") : @tr("Nothing scheduled. Create an event to invite people, or schedule a stream.");
|
||||
color: Theme.text-muted;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
sv := ScrollView {
|
||||
vertical-stretch: 1;
|
||||
VerticalLayout {
|
||||
width: sv.visible-width - Theme.space-2;
|
||||
spacing: Theme.space-3;
|
||||
alignment: start;
|
||||
for event in Bridge.events: EventCard {
|
||||
event: event;
|
||||
compact: root.compact;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create or edit an event.
|
||||
export component EventDialog inherits Modal {
|
||||
in-out property <EventForm> form;
|
||||
callback done();
|
||||
title: form.id < 0 ? @tr("Create Event") : @tr("Edit Event");
|
||||
subtitle: @tr("Everyone on {} can see it and answer.", Bridge.server-title);
|
||||
icon: Icons.calendar-plus;
|
||||
card-width: 560px;
|
||||
card-height: 660px;
|
||||
dismissed => { done(); }
|
||||
ScrollView {
|
||||
vertical-stretch: 1;
|
||||
VerticalLayout {
|
||||
spacing: Theme.space-4;
|
||||
padding-right: Theme.space-3;
|
||||
alignment: start;
|
||||
Field {
|
||||
label: @tr("Title");
|
||||
TextField { text <=> form.title; placeholder: @tr("Raid night"); label: @tr("Title"); }
|
||||
}
|
||||
Field {
|
||||
label: @tr("Description");
|
||||
TextField { text <=> form.description; placeholder: @tr("What happens, what to bring"); label: @tr("Description"); }
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
Field {
|
||||
label: @tr("Starts");
|
||||
hint: @tr("YYYY-MM-DD HH:MM, local time");
|
||||
TextField { text <=> form.start; placeholder: "2026-10-04 19:00"; icon: Icons.calendar; label: @tr("Starts"); }
|
||||
}
|
||||
Field {
|
||||
label: @tr("Ends (optional)");
|
||||
hint: @tr("Empty: no end");
|
||||
TextField { text <=> form.end; placeholder: "2026-10-04 21:00"; icon: Icons.clock; label: @tr("Ends"); }
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: @tr("Where");
|
||||
Select {
|
||||
model: Bridge.event-channels;
|
||||
current-index <=> form.channel;
|
||||
icon: Icons.hash;
|
||||
label: @tr("Channel");
|
||||
}
|
||||
}
|
||||
ToggleRow {
|
||||
icon: Icons.radio;
|
||||
text: @tr("A scheduled stream");
|
||||
description: @tr("Linked to the stream directory once the host goes live.");
|
||||
checked <=> form.stream;
|
||||
}
|
||||
if form.stream: HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
Field {
|
||||
label: @tr("Stream title");
|
||||
TextField { text <=> form.stream-title; label: @tr("Stream title"); }
|
||||
}
|
||||
Field {
|
||||
label: @tr("Game or subject");
|
||||
TextField { text <=> form.game; label: @tr("Game or subject"); }
|
||||
}
|
||||
}
|
||||
if Nav.event-error != "": Banner {
|
||||
text: Nav.event-error;
|
||||
tone: Theme.danger;
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: end;
|
||||
spacing: Theme.space-3;
|
||||
if form.id >= 0: Button {
|
||||
kind: ButtonKind.danger;
|
||||
icon: Icons.trash-2;
|
||||
text: @tr("Delete");
|
||||
clicked => {
|
||||
Bridge.delete-event(form.id);
|
||||
done();
|
||||
}
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
Button {
|
||||
text: @tr("Cancel");
|
||||
clicked => { done(); }
|
||||
}
|
||||
Button {
|
||||
kind: ButtonKind.primary;
|
||||
icon: Icons.check;
|
||||
text: form.id < 0 ? @tr("Create") : @tr("Save");
|
||||
enabled: form.title != "" && form.start != "";
|
||||
clicked => {
|
||||
Nav.event-error = Bridge.save-event(form);
|
||||
if Nav.event-error == "" {
|
||||
done();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
// Friends: the contacts (friend, blocked or neutral), where each is now
|
||||
// (server, channel, away, streaming), and what can be done with them:
|
||||
// message, poke, join their channel, watch their stream, the relation, a
|
||||
// note, their volume.
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, ContactItem } from "../bridge.slint";
|
||||
import { Nav, Page } from "../nav.slint";
|
||||
import { Icon, Button, ButtonKind, IconButton, Avatar, Status, Chip, LiveBadge, SegmentedTabs, SearchBox, TextField, Slider, Divider, Field, ListView, ScrollView } from "../components/index.slint";
|
||||
|
||||
// One contact: avatar, name, what they do and where, quick actions.
|
||||
component ContactRow inherits Rectangle {
|
||||
in property <ContactItem> person;
|
||||
height: 64px * Theme.font-scale;
|
||||
border-radius: Theme.radius-md;
|
||||
background: person.selected ? Theme.accent-soft : touch.has-hover ? Theme.surface-3 : transparent;
|
||||
border-width: person.selected ? 1px : 0px;
|
||||
border-color: Theme.accent;
|
||||
accessible-role: AccessibleRole.list-item;
|
||||
accessible-label: person.name;
|
||||
accessible-description: person.status;
|
||||
accessible-item-selectable: true;
|
||||
accessible-item-selected: person.selected;
|
||||
accessible-action-default => { Bridge.select-contact(person.uid); }
|
||||
touch := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { Bridge.select-contact(root.person.uid); }
|
||||
double-clicked => { Bridge.contact-action(root.person.uid, "message"); }
|
||||
}
|
||||
opacity: person.relation == "blocked" ? 0.7 : 1.0;
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-3;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-4;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
Avatar {
|
||||
size: 44px;
|
||||
initials: root.person.initials;
|
||||
tint: root.person.tint;
|
||||
image: root.person.avatar;
|
||||
label: root.person.name;
|
||||
status: !root.person.online ? Status.offline : root.person.away ? Status.idle : Status.online;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
spacing: 1px;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
Text {
|
||||
text: root.person.name;
|
||||
color: root.person.relation == "friend" ? Theme.name-text : Theme.text;
|
||||
font-size: Theme.font-md;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
if root.person.relation == "blocked": Chip {
|
||||
text: @tr("Blocked");
|
||||
icon: Icons.ban;
|
||||
tint: Theme.danger;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if root.person.streaming: LiveBadge {
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: root.person.status;
|
||||
color: root.person.online ? Theme.text-secondary : Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
if root.person.place != "": Text {
|
||||
text: root.person.place;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if root.person.relation != "blocked": HorizontalLayout {
|
||||
spacing: Theme.space-1;
|
||||
IconButton {
|
||||
icon: Icons.message-square;
|
||||
label: @tr("Message {}", root.person.name);
|
||||
filled: true;
|
||||
round: true;
|
||||
size: 34px;
|
||||
icon-size: Theme.icon-sm;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.contact-action(root.person.uid, "message"); }
|
||||
}
|
||||
if root.person.reachable: IconButton {
|
||||
icon: Icons.hand;
|
||||
label: @tr("Poke {}", root.person.name);
|
||||
filled: true;
|
||||
round: true;
|
||||
size: 34px;
|
||||
icon-size: Theme.icon-sm;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.contact-action(root.person.uid, "poke"); }
|
||||
}
|
||||
if root.person.online: IconButton {
|
||||
icon: Icons.log-in;
|
||||
label: @tr("Join {}'s channel", root.person.name);
|
||||
filled: true;
|
||||
round: true;
|
||||
size: 34px;
|
||||
icon-size: Theme.icon-sm;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.contact-action(root.person.uid, "join"); }
|
||||
}
|
||||
if root.person.streaming: IconButton {
|
||||
icon: Icons.monitor;
|
||||
label: @tr("Watch {}'s stream", root.person.name);
|
||||
filled: true;
|
||||
round: true;
|
||||
size: 34px;
|
||||
icon-size: Theme.icon-sm;
|
||||
tint: Theme.live;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.contact-action(root.person.uid, "watch"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The contacts with tabs and a search.
|
||||
export component FriendsPage inherits VerticalLayout {
|
||||
in property <bool> compact;
|
||||
padding: compact ? Theme.space-4 : Theme.space-6;
|
||||
spacing: Theme.space-4;
|
||||
// The phone's top bar names the page.
|
||||
if !root.compact: HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
if !root.compact: Icon {
|
||||
source: Icons.users;
|
||||
size: 30px;
|
||||
tint: Theme.accent-text;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: @tr("Friends");
|
||||
font-size: Theme.font-2xl;
|
||||
font-weight: Theme.weight-bold;
|
||||
color: Theme.text;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
if !root.compact: SegmentedTabs {
|
||||
max-width: 420px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
model: [@tr("Online — {}", Bridge.contacts-online), @tr("All — {}", Bridge.contacts-all), @tr("Blocked — {}", Bridge.contacts-blocked)];
|
||||
current-index: Nav.friends-tab;
|
||||
label: @tr("Which contacts");
|
||||
selected(i) => {
|
||||
Nav.friends-tab = i;
|
||||
Bridge.friends-tab(i);
|
||||
}
|
||||
}
|
||||
if !root.compact: Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
if !root.compact: SearchBox {
|
||||
max-width: 280px;
|
||||
height: 38px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
show-shortcut: false;
|
||||
placeholder: @tr("Search contacts");
|
||||
label: @tr("Search contacts");
|
||||
edited(text) => { Bridge.search-contacts(text); }
|
||||
}
|
||||
}
|
||||
if root.compact: SegmentedTabs {
|
||||
model: [@tr("Online"), @tr("All"), @tr("Blocked")];
|
||||
current-index: Nav.friends-tab;
|
||||
label: @tr("Which contacts");
|
||||
selected(i) => {
|
||||
Nav.friends-tab = i;
|
||||
Bridge.friends-tab(i);
|
||||
}
|
||||
}
|
||||
if root.compact: SearchBox {
|
||||
height: 38px;
|
||||
show-shortcut: false;
|
||||
placeholder: @tr("Search contacts");
|
||||
label: @tr("Search contacts");
|
||||
edited(text) => { Bridge.search-contacts(text); }
|
||||
}
|
||||
if Bridge.contacts.length == 0: VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
padding-top: Theme.space-6;
|
||||
alignment: start;
|
||||
Text {
|
||||
text: Nav.friends-tab == 0 ? @tr("None of your friends is online right now.")
|
||||
: Nav.friends-tab == 2 ? @tr("You have blocked no one.")
|
||||
: @tr("No contacts yet.");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-lg;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
Text {
|
||||
text: @tr("Open a person's card in a server's members panel to add them as a friend or to block them. Friends show up here on every server they are on.");
|
||||
color: Theme.text-muted;
|
||||
wrap: word-wrap;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
padding-top: Theme.space-3;
|
||||
Button {
|
||||
icon: Icons.server;
|
||||
text: @tr("Go to a server");
|
||||
clicked => { Nav.show(Page.server); }
|
||||
}
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
vertical-stretch: 1;
|
||||
accessible-role: AccessibleRole.list;
|
||||
accessible-label: @tr("Contacts");
|
||||
for person in Bridge.contacts: VerticalLayout {
|
||||
padding-bottom: Theme.space-1;
|
||||
ContactRow {
|
||||
person: person;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Everything about the selected contact (the right panel).
|
||||
export component ContactPanel inherits Rectangle {
|
||||
property <ContactItem> c: Bridge.contact;
|
||||
sv := ScrollView {
|
||||
VerticalLayout {
|
||||
width: sv.visible-width;
|
||||
padding: Theme.space-5;
|
||||
spacing: Theme.space-4;
|
||||
alignment: start;
|
||||
HorizontalLayout {
|
||||
alignment: end;
|
||||
IconButton {
|
||||
icon: Icons.x;
|
||||
label: @tr("Close");
|
||||
size: 28px;
|
||||
icon-size: Theme.icon-sm;
|
||||
clicked => { Bridge.select-contact(""); }
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
Avatar {
|
||||
size: 84px;
|
||||
initials: root.c.initials;
|
||||
tint: root.c.tint;
|
||||
image: root.c.avatar;
|
||||
label: root.c.name;
|
||||
status: !root.c.online ? Status.offline : root.c.away ? Status.idle : Status.online;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
spacing: Theme.space-1;
|
||||
Text {
|
||||
text: root.c.name;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-xl;
|
||||
font-weight: Theme.weight-semibold;
|
||||
horizontal-alignment: center;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: root.c.status;
|
||||
color: root.c.online ? Theme.success : Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-alignment: center;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
spacing: Theme.space-2;
|
||||
if root.c.relation == "friend": Chip {
|
||||
text: @tr("Friend");
|
||||
icon: Icons.user-check;
|
||||
tint: Theme.success;
|
||||
}
|
||||
if root.c.relation == "blocked": Chip {
|
||||
text: @tr("Blocked");
|
||||
icon: Icons.ban;
|
||||
tint: Theme.danger;
|
||||
}
|
||||
if root.c.streaming: LiveBadge { }
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Button {
|
||||
horizontal-stretch: 1;
|
||||
small: true;
|
||||
icon: Icons.message-square;
|
||||
text: @tr("Message");
|
||||
enabled: root.c.relation != "blocked";
|
||||
clicked => { Bridge.contact-action(root.c.uid, "message"); }
|
||||
}
|
||||
Button {
|
||||
horizontal-stretch: 1;
|
||||
small: true;
|
||||
icon: Icons.hand;
|
||||
text: @tr("Poke");
|
||||
enabled: root.c.reachable;
|
||||
clicked => { Bridge.contact-action(root.c.uid, "poke"); }
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Button {
|
||||
horizontal-stretch: 1;
|
||||
small: true;
|
||||
icon: Icons.log-in;
|
||||
text: @tr("Join");
|
||||
enabled: root.c.online;
|
||||
clicked => { Bridge.contact-action(root.c.uid, "join"); }
|
||||
}
|
||||
Button {
|
||||
horizontal-stretch: 1;
|
||||
small: true;
|
||||
icon: Icons.monitor;
|
||||
text: @tr("Watch");
|
||||
enabled: root.c.streaming;
|
||||
clicked => { Bridge.contact-action(root.c.uid, "watch"); }
|
||||
}
|
||||
}
|
||||
Divider { }
|
||||
Text {
|
||||
text: root.c.online ? @tr("Where") : @tr("Last seen");
|
||||
color: Theme.text;
|
||||
font-weight: Theme.weight-semibold;
|
||||
}
|
||||
for spot in root.c.spots: HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: Icons.server;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.text-secondary;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: spot;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-stretch: 1;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
if root.c.spots.length == 0: Text {
|
||||
text: root.c.place != "" ? root.c.place : @tr("Not seen on your servers yet.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
Divider { }
|
||||
Field {
|
||||
label: @tr("Note");
|
||||
hint: @tr("Only on this device. Press Enter to keep it.");
|
||||
TextField {
|
||||
text: root.c.note;
|
||||
placeholder: @tr("Add a note");
|
||||
icon: Icons.pencil;
|
||||
label: @tr("Note about {}", root.c.name);
|
||||
accepted(text) => { Bridge.contact-note(root.c.uid, text); }
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
HorizontalLayout {
|
||||
Text {
|
||||
text: @tr("Volume for me");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
Text {
|
||||
text: @tr("{}%", round(root.c.volume));
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
IconButton {
|
||||
icon: root.c.muted ? Icons.volume-x : Icons.volume-2;
|
||||
label: root.c.muted ? @tr("Unmute for me") : @tr("Mute for me");
|
||||
checked: root.c.muted;
|
||||
danger: true;
|
||||
size: 30px;
|
||||
icon-size: Theme.icon-sm;
|
||||
clicked => { Bridge.contact-action(root.c.uid, "mute"); }
|
||||
}
|
||||
Slider {
|
||||
horizontal-stretch: 1;
|
||||
minimum: 0;
|
||||
maximum: 400;
|
||||
step: 5;
|
||||
value: root.c.volume;
|
||||
enabled: !root.c.muted;
|
||||
label: @tr("Volume of {}", root.c.name);
|
||||
released(v) => { Bridge.contact-volume(root.c.uid, v); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Divider { }
|
||||
VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Button {
|
||||
icon: root.c.relation == "friend" ? Icons.user-x : Icons.user-plus;
|
||||
text: root.c.relation == "friend" ? @tr("Remove friend") : @tr("Add friend");
|
||||
centered: false;
|
||||
clicked => { Bridge.contact-action(root.c.uid, root.c.relation == "friend" ? "neutral" : "friend"); }
|
||||
}
|
||||
Button {
|
||||
kind: root.c.relation == "blocked" ? ButtonKind.secondary : ButtonKind.danger;
|
||||
icon: Icons.ban;
|
||||
text: root.c.relation == "blocked" ? @tr("Unblock") : @tr("Block");
|
||||
centered: false;
|
||||
clicked => { Bridge.contact-action(root.c.uid, root.c.relation == "blocked" ? "neutral" : "block"); }
|
||||
}
|
||||
Button {
|
||||
kind: ButtonKind.ghost;
|
||||
icon: Icons.trash-2;
|
||||
text: @tr("Forget this contact");
|
||||
centered: false;
|
||||
clicked => { Bridge.contact-action(root.c.uid, "remove"); }
|
||||
}
|
||||
}
|
||||
if root.c.since != "": Text {
|
||||
text: root.c.since;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,745 @@
|
||||
// Direct messages (design mockup 02): the conversations of every server at
|
||||
// the left, the open one in the middle (the chat's message list and
|
||||
// composer; pokes show in it), who it is with at the right. TeamSpeak
|
||||
// delivers private messages only to people online on the same server; the
|
||||
// server keeps offline messages (mail) for the others.
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, ConversationItem } from "../bridge.slint";
|
||||
import { Nav, Page } from "../nav.slint";
|
||||
import { Icon, Button, ButtonKind, IconButton, Avatar, Status, Chip, CountBadge, SearchBox, TextField, Field, Slider, Divider, Banner, Modal, PopupMenu, MenuEntry, ListView, ScrollView } from "../components/index.slint";
|
||||
import { MessageList, Composer } from "chat.slint";
|
||||
|
||||
// One conversation of the list.
|
||||
component ConversationRow inherits Rectangle {
|
||||
in property <ConversationItem> chat;
|
||||
height: 64px * Theme.font-scale;
|
||||
border-radius: Theme.radius-md;
|
||||
background: chat.selected ? Theme.accent-soft : touch.has-hover ? Theme.surface-3 : transparent;
|
||||
border-width: chat.selected ? 1px : 0px;
|
||||
border-color: Theme.accent;
|
||||
accessible-role: AccessibleRole.list-item;
|
||||
accessible-label: chat.title;
|
||||
accessible-description: chat.preview;
|
||||
accessible-item-selectable: true;
|
||||
accessible-item-selected: chat.selected;
|
||||
accessible-action-default => { Bridge.open-conversation(chat.key); }
|
||||
touch := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { Bridge.open-conversation(root.chat.key); }
|
||||
}
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-3;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
Avatar {
|
||||
size: 44px;
|
||||
initials: root.chat.initials;
|
||||
tint: root.chat.tint;
|
||||
image: root.chat.avatar;
|
||||
square: root.chat.kind < 2;
|
||||
label: root.chat.title;
|
||||
status: root.chat.kind == 2 ? (root.chat.online ? Status.online : Status.offline) : Status.none;
|
||||
if root.chat.kind == 3: Icon {
|
||||
source: Icons.mail;
|
||||
size: 20px;
|
||||
tint: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
spacing: 1px;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: root.chat.title;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-md;
|
||||
font-weight: root.chat.unread > 0 ? Theme.weight-bold : Theme.weight-medium;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: root.chat.time;
|
||||
color: root.chat.selected ? Theme.text-secondary : Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: root.chat.preview;
|
||||
color: root.chat.unread > 0 ? Theme.text : Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
if root.chat.unread > 0: CountBadge {
|
||||
count: root.chat.unread;
|
||||
fill: Theme.accent;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pill tabs: All, Unread, Inbox.
|
||||
component PillTab inherits Rectangle {
|
||||
in property <string> text;
|
||||
in property <bool> selected;
|
||||
in property <int> badge;
|
||||
callback clicked();
|
||||
height: 30px;
|
||||
width: row.preferred-width + 24px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: selected ? Theme.accent-soft : touch.has-hover ? Theme.surface-3 : transparent;
|
||||
border-width: selected ? 1px : 0px;
|
||||
border-color: Theme.accent;
|
||||
accessible-role: AccessibleRole.tab;
|
||||
accessible-label: text;
|
||||
accessible-item-selectable: true;
|
||||
accessible-item-selected: selected;
|
||||
accessible-action-default => { clicked(); }
|
||||
touch := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { root.clicked(); }
|
||||
}
|
||||
row := HorizontalLayout {
|
||||
alignment: center;
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: root.text;
|
||||
color: root.selected ? Theme.text : Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
font-weight: root.selected ? Theme.weight-semibold : Theme.weight-regular;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
if root.badge > 0: CountBadge {
|
||||
count: root.badge;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The list of conversations.
|
||||
export component ConversationList inherits VerticalLayout {
|
||||
padding: Theme.space-4;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Text {
|
||||
text: @tr("Messages");
|
||||
font-size: Theme.font-2xl;
|
||||
font-weight: Theme.weight-bold;
|
||||
color: Theme.text;
|
||||
vertical-alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.plus;
|
||||
label: @tr("New message");
|
||||
filled: true;
|
||||
checked: true;
|
||||
size: 34px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.open-search("@"); }
|
||||
}
|
||||
}
|
||||
SearchBox {
|
||||
height: 38px;
|
||||
show-shortcut: false;
|
||||
placeholder: @tr("Search messages…");
|
||||
label: @tr("Search messages");
|
||||
edited(text) => { Bridge.search-conversations(text); }
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
PillTab {
|
||||
text: @tr("All");
|
||||
selected: Nav.dm-tab == 0;
|
||||
clicked => {
|
||||
Nav.dm-tab = 0;
|
||||
Bridge.dm-tab(0);
|
||||
}
|
||||
}
|
||||
PillTab {
|
||||
text: @tr("Unread");
|
||||
selected: Nav.dm-tab == 1;
|
||||
badge: Bridge.dm-unread;
|
||||
clicked => {
|
||||
Nav.dm-tab = 1;
|
||||
Bridge.dm-tab(1);
|
||||
}
|
||||
}
|
||||
PillTab {
|
||||
text: @tr("Inbox");
|
||||
selected: Nav.dm-tab == 2;
|
||||
badge: Bridge.inbox-unread;
|
||||
clicked => {
|
||||
Nav.dm-tab = 2;
|
||||
Bridge.dm-tab(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.conversations.length == 0: Text {
|
||||
text: Nav.dm-tab == 2 ? @tr("No offline messages. Servers keep them for you while you are away; connect with voice to fetch them.")
|
||||
: Nav.dm-tab == 1 ? @tr("Nothing unread.")
|
||||
: @tr("No conversations yet. Message someone from their card on a server, or with the + above.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
ListView {
|
||||
vertical-stretch: 1;
|
||||
accessible-role: AccessibleRole.list;
|
||||
accessible-label: @tr("Conversations");
|
||||
for chat in Bridge.conversations: VerticalLayout {
|
||||
padding-bottom: Theme.space-1;
|
||||
ConversationRow {
|
||||
chat: chat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The open conversation (or offline message).
|
||||
export component Conversation inherits VerticalLayout {
|
||||
in property <bool> compact;
|
||||
if !Bridge.dm.open: VerticalLayout {
|
||||
vertical-stretch: 1;
|
||||
alignment: center;
|
||||
spacing: Theme.space-3;
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
Icon {
|
||||
source: Icons.messages-square;
|
||||
size: 56px;
|
||||
tint: Theme.text-disabled;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: @tr("Pick a conversation, or start one with +.");
|
||||
color: Theme.text-muted;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
if Bridge.dm.open: Rectangle {
|
||||
height: 76px;
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-5;
|
||||
padding-right: Theme.space-4;
|
||||
spacing: Theme.space-4;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
Avatar {
|
||||
size: 50px;
|
||||
initials: Bridge.dm.initials;
|
||||
tint: Bridge.dm.tint;
|
||||
image: Bridge.dm.avatar;
|
||||
label: Bridge.dm.name;
|
||||
status: Bridge.dm.online ? Status.online : Status.offline;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
spacing: 2px;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
alignment: start;
|
||||
Text {
|
||||
text: Bridge.dm.name;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-xl;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
if Bridge.dm.online: Rectangle {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
border-radius: 5px;
|
||||
background: Theme.success;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: Bridge.dm.status;
|
||||
color: Bridge.dm.online ? Theme.accent-text : Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if Bridge.dm.can-send: IconButton {
|
||||
icon: Icons.hand;
|
||||
label: @tr("Poke {}", Bridge.dm.name);
|
||||
filled: true;
|
||||
size: 42px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.dm-action("poke"); }
|
||||
}
|
||||
if Bridge.dm.online: IconButton {
|
||||
icon: Icons.log-in;
|
||||
label: @tr("Join {}'s channel", Bridge.dm.name);
|
||||
filled: true;
|
||||
size: 42px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.dm-action("join"); }
|
||||
}
|
||||
IconButton {
|
||||
icon: Bridge.dm.friend ? Icons.user-check : Icons.user-plus;
|
||||
label: Bridge.dm.friend ? @tr("Remove friend") : @tr("Add friend");
|
||||
checked: Bridge.dm.friend;
|
||||
filled: true;
|
||||
size: 42px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.dm-action("friend"); }
|
||||
}
|
||||
more := IconButton {
|
||||
icon: Icons.more-horizontal;
|
||||
label: @tr("More");
|
||||
filled: true;
|
||||
size: 42px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { menu.show(self.x + self.width - 220px, self.y + self.height + 4px); }
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
y: parent.height - 1px;
|
||||
height: 1px;
|
||||
background: Theme.border;
|
||||
}
|
||||
menu := PopupMenu {
|
||||
entries: [
|
||||
{ text: Bridge.dm.muted ? @tr("Unmute for me") : @tr("Mute for me"), icon: Icons.volume-x, enabled: true },
|
||||
{ text: @tr("Write an offline message"), icon: Icons.mail, enabled: Bridge.dm.offline },
|
||||
{ text: Bridge.dm.blocked ? @tr("Unblock") : @tr("Block"), icon: Icons.ban, enabled: true, danger: !Bridge.dm.blocked, separator: true },
|
||||
];
|
||||
activated(i) => {
|
||||
if i == 0 {
|
||||
Bridge.dm-action("mute");
|
||||
} else if i == 1 {
|
||||
Nav.write-offline(Bridge.dm.uid, Bridge.dm.name);
|
||||
} else {
|
||||
Bridge.dm-action("block");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// An offline message instead of the conversation.
|
||||
if Bridge.dm.open && Bridge.dm.mail: ScrollView {
|
||||
vertical-stretch: 1;
|
||||
VerticalLayout {
|
||||
padding: Theme.space-6;
|
||||
spacing: Theme.space-4;
|
||||
alignment: start;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: Icons.mail;
|
||||
tint: Theme.accent-text;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.dm.mail-subject;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-xl;
|
||||
font-weight: Theme.weight-semibold;
|
||||
horizontal-stretch: 1;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: Bridge.dm.mail-time;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.dm.mail-text != "" ? Bridge.dm.mail-text : @tr("Fetching the message…");
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-md;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
alignment: start;
|
||||
Button {
|
||||
kind: ButtonKind.primary;
|
||||
icon: Icons.send;
|
||||
text: @tr("Reply");
|
||||
enabled: Bridge.dm.offline;
|
||||
clicked => { Nav.write-offline(Bridge.dm.uid, Bridge.dm.name); }
|
||||
}
|
||||
Button {
|
||||
icon: Icons.mail;
|
||||
text: @tr("Mark unread");
|
||||
clicked => { Bridge.dm-action("unread-mail"); }
|
||||
}
|
||||
Button {
|
||||
kind: ButtonKind.danger;
|
||||
icon: Icons.trash-2;
|
||||
text: @tr("Delete");
|
||||
clicked => { Bridge.dm-action("delete-mail"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.dm.open && !Bridge.dm.mail && Bridge.dm.stored: MessageList {
|
||||
vertical-stretch: 1;
|
||||
model: Bridge.dm-messages;
|
||||
}
|
||||
if Bridge.dm.open && !Bridge.dm.mail && !Bridge.dm.stored: MessageList {
|
||||
vertical-stretch: 1;
|
||||
model: Bridge.messages;
|
||||
older: true;
|
||||
}
|
||||
if Bridge.dm.open && !Bridge.dm.mail && Bridge.dm.notice != "": HorizontalLayout {
|
||||
padding-left: Theme.space-5;
|
||||
padding-right: Theme.space-5;
|
||||
padding-top: Theme.space-2;
|
||||
Banner {
|
||||
text: Bridge.dm.notice;
|
||||
icon: Icons.info;
|
||||
tone: Theme.info;
|
||||
if Bridge.dm.can-connect: Button {
|
||||
small: true;
|
||||
kind: ButtonKind.primary;
|
||||
icon: Icons.log-in;
|
||||
text: @tr("Connect");
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.dm-action("connect"); }
|
||||
}
|
||||
if Bridge.dm.offline: Button {
|
||||
small: true;
|
||||
icon: Icons.mail;
|
||||
text: @tr("Offline message");
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.write-offline(Bridge.dm.uid, Bridge.dm.name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.dm.open && !Bridge.dm.mail: Composer {
|
||||
attach: false;
|
||||
enabled: Bridge.dm.can-send;
|
||||
placeholder: Bridge.dm.can-send ? @tr("Message @{}…", Bridge.dm.name) : @tr("{} cannot get messages now", Bridge.dm.name);
|
||||
}
|
||||
}
|
||||
|
||||
// The messages page: the list and the open conversation side by side.
|
||||
export component MessagesPage inherits HorizontalLayout {
|
||||
ConversationList {
|
||||
width: 310px * max(1.0, Theme.font-scale);
|
||||
}
|
||||
Rectangle {
|
||||
width: 1px;
|
||||
background: Theme.border;
|
||||
}
|
||||
Conversation {
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Who the conversation is with (the right panel).
|
||||
export component DmProfile inherits Rectangle {
|
||||
sv := ScrollView {
|
||||
VerticalLayout {
|
||||
width: sv.visible-width;
|
||||
padding: Theme.space-5;
|
||||
spacing: Theme.space-4;
|
||||
alignment: start;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
Avatar {
|
||||
size: 72px;
|
||||
initials: Bridge.dm.initials;
|
||||
tint: Bridge.dm.tint;
|
||||
image: Bridge.dm.avatar;
|
||||
label: Bridge.dm.name;
|
||||
status: Bridge.dm.online ? Status.online : Status.offline;
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
Text {
|
||||
text: Bridge.dm.name;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-xl;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.dm.online ? @tr("Online") : @tr("Offline");
|
||||
color: Bridge.dm.online ? Theme.accent-text : Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.dm.description != "": Text {
|
||||
text: "“" + Bridge.dm.description + "”";
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-md;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
if Bridge.dm.groups.length > 0: FlexboxLayout {
|
||||
spacing: Theme.space-2;
|
||||
for group in Bridge.dm.groups: Chip {
|
||||
text: group;
|
||||
icon: Icons.shield;
|
||||
outlined: true;
|
||||
}
|
||||
}
|
||||
Divider { }
|
||||
Text {
|
||||
text: @tr("About");
|
||||
color: Theme.text;
|
||||
font-weight: Theme.weight-semibold;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.dm.note != "" ? Bridge.dm.note : @tr("No note. Add one on the Friends page.");
|
||||
color: Bridge.dm.note != "" ? Theme.text-secondary : Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
if Bridge.dm.since != "": HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: Icons.calendar;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.text-secondary;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.dm.since;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
}
|
||||
Divider { }
|
||||
Text {
|
||||
text: @tr("Servers — {}", Bridge.dm.servers.length);
|
||||
color: Theme.text;
|
||||
font-weight: Theme.weight-semibold;
|
||||
}
|
||||
for server in Bridge.dm.servers: HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Rectangle {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: Theme.surface-4;
|
||||
Icon {
|
||||
source: Icons.server;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.accent-text;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: server;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
if Bridge.dm.media.length > 0: Divider { }
|
||||
if Bridge.dm.media.length > 0: Text {
|
||||
text: @tr("Shared Media — {}", Bridge.dm.media.length + Bridge.dm.media-more);
|
||||
color: Theme.text;
|
||||
font-weight: Theme.weight-semibold;
|
||||
}
|
||||
// Three pictures a row; the last cell counts the ones left out.
|
||||
if Bridge.dm.media.length > 0: grid := Rectangle {
|
||||
property <length> gap: Theme.space-2;
|
||||
property <length> cell-w: (self.width - 2 * self.gap) / 3;
|
||||
property <length> cell-h: self.cell-w * 0.75;
|
||||
property <int> cells: Bridge.dm.media.length + (Bridge.dm.media-more > 0 ? 1 : 0);
|
||||
height: ceil(self.cells / 3) * (self.cell-h + self.gap) - self.gap;
|
||||
for picture[i] in Bridge.dm.media: Rectangle {
|
||||
x: mod(i, 3) * (grid.cell-w + grid.gap);
|
||||
y: floor(i / 3) * (grid.cell-h + grid.gap);
|
||||
width: grid.cell-w;
|
||||
height: grid.cell-h;
|
||||
border-radius: Theme.radius-md;
|
||||
clip: true;
|
||||
background: Theme.surface-2;
|
||||
accessible-role: AccessibleRole.image;
|
||||
accessible-label: @tr("Picture {}", i + 1);
|
||||
accessible-action-default => {
|
||||
Nav.lightbox = picture;
|
||||
Nav.lightbox-open = true;
|
||||
}
|
||||
Image {
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
source: picture;
|
||||
image-fit: cover;
|
||||
}
|
||||
TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => {
|
||||
Nav.lightbox = picture;
|
||||
Nav.lightbox-open = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.dm.media-more > 0: Rectangle {
|
||||
x: mod(Bridge.dm.media.length, 3) * (grid.cell-w + grid.gap);
|
||||
y: floor(Bridge.dm.media.length / 3) * (grid.cell-h + grid.gap);
|
||||
width: grid.cell-w;
|
||||
height: grid.cell-h;
|
||||
border-radius: Theme.radius-md;
|
||||
background: Theme.surface-3;
|
||||
Text {
|
||||
text: "+" + Bridge.dm.media-more;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-lg;
|
||||
font-weight: Theme.weight-semibold;
|
||||
}
|
||||
}
|
||||
}
|
||||
Divider { }
|
||||
Text {
|
||||
text: @tr("Shared Files — {}", Bridge.dm.files.length);
|
||||
color: Theme.text;
|
||||
font-weight: Theme.weight-semibold;
|
||||
}
|
||||
for file in Bridge.dm.files: HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Rectangle {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
border-radius: Theme.radius-md;
|
||||
background: file.picture ? Theme.accent-soft : Theme.danger-soft;
|
||||
Icon {
|
||||
source: file.picture ? Icons.image : Icons.file-text;
|
||||
size: Theme.icon-sm;
|
||||
tint: file.picture ? Theme.accent-text : Theme.danger;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
spacing: 1px;
|
||||
Text {
|
||||
text: file.name;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: file.detail;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.dm.files.length == 0: Text {
|
||||
text: @tr("Files linked in this conversation show up here.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
Divider { }
|
||||
VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
HorizontalLayout {
|
||||
Text {
|
||||
text: @tr("Volume for me");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
Text {
|
||||
text: @tr("{}%", round(Bridge.dm.volume));
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
IconButton {
|
||||
icon: Bridge.dm.muted ? Icons.volume-x : Icons.volume-2;
|
||||
label: Bridge.dm.muted ? @tr("Unmute for me") : @tr("Mute for me");
|
||||
checked: Bridge.dm.muted;
|
||||
danger: true;
|
||||
size: 30px;
|
||||
icon-size: Theme.icon-sm;
|
||||
clicked => { Bridge.dm-action("mute"); }
|
||||
}
|
||||
Slider {
|
||||
horizontal-stretch: 1;
|
||||
minimum: 0;
|
||||
maximum: 400;
|
||||
step: 5;
|
||||
value: Bridge.dm.volume;
|
||||
enabled: !Bridge.dm.muted;
|
||||
label: @tr("Volume of {}", Bridge.dm.name);
|
||||
released(v) => { Bridge.dm-volume(v); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write an offline message (the server keeps it until they read it).
|
||||
export component OfflineDialog inherits Modal {
|
||||
in-out property <string> subject;
|
||||
in-out property <string> body;
|
||||
callback done();
|
||||
title: @tr("Offline message to {}", Nav.offline-form.to);
|
||||
subtitle: @tr("The server keeps it until {} reads it.", Nav.offline-form.to);
|
||||
icon: Icons.mail;
|
||||
card-width: 520px;
|
||||
card-height: 380px;
|
||||
dismissed => { done(); }
|
||||
Field {
|
||||
label: @tr("Subject");
|
||||
TextField {
|
||||
text <=> root.subject;
|
||||
placeholder: @tr("Subject");
|
||||
label: @tr("Subject");
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: @tr("Message");
|
||||
TextField {
|
||||
text <=> root.body;
|
||||
placeholder: @tr("Your message");
|
||||
label: @tr("Message");
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
vertical-stretch: 1;
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: end;
|
||||
spacing: Theme.space-3;
|
||||
Button {
|
||||
text: @tr("Cancel");
|
||||
clicked => { root.done(); }
|
||||
}
|
||||
Button {
|
||||
kind: ButtonKind.primary;
|
||||
icon: Icons.send;
|
||||
text: @tr("Send");
|
||||
enabled: root.body != "";
|
||||
clicked => {
|
||||
Bridge.send-offline({ uid: Nav.offline-form.uid, to: Nav.offline-form.to, subject: root.subject, text: root.body });
|
||||
root.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,35 +195,24 @@ export component YouPage inherits ScrollView {
|
||||
text: @tr("Settings");
|
||||
small: true;
|
||||
}
|
||||
NavItem {
|
||||
icon: Icons.mic;
|
||||
text: @tr("Voice & Video");
|
||||
// Every section, in the order of the phone's settings design.
|
||||
for item in [
|
||||
{ icon: Icons.user-round, text: @tr("My Account"), section: SettingsSection.account },
|
||||
{ icon: Icons.users, text: @tr("Profiles"), section: SettingsSection.profiles },
|
||||
{ icon: Icons.palette, text: @tr("Appearance"), section: SettingsSection.appearance },
|
||||
{ icon: Icons.mic, text: @tr("Voice & Video"), section: SettingsSection.voice },
|
||||
{ icon: Icons.radio, text: @tr("Streaming"), section: SettingsSection.streaming },
|
||||
{ icon: Icons.bell, text: @tr("Notifications"), section: SettingsSection.notifications },
|
||||
{ icon: Icons.shield, text: @tr("Privacy & Safety"), section: SettingsSection.privacy },
|
||||
{ icon: Icons.smartphone, text: @tr("Devices"), section: SettingsSection.devices },
|
||||
{ icon: Icons.keyboard, text: @tr("Keybinds"), section: SettingsSection.keybinds },
|
||||
{ icon: Icons.puzzle, text: @tr("Integrations"), section: SettingsSection.integrations },
|
||||
{ icon: Icons.settings, text: @tr("Advanced"), section: SettingsSection.advanced },
|
||||
]: NavItem {
|
||||
icon: item.icon;
|
||||
text: item.text;
|
||||
chevron: true;
|
||||
clicked => { Nav.open-settings(SettingsSection.voice); }
|
||||
}
|
||||
NavItem {
|
||||
icon: Icons.keyboard;
|
||||
text: @tr("Keybinds");
|
||||
chevron: true;
|
||||
clicked => { Nav.open-settings(SettingsSection.keybinds); }
|
||||
}
|
||||
NavItem {
|
||||
icon: Icons.radio;
|
||||
text: @tr("Streaming");
|
||||
chevron: true;
|
||||
clicked => { Nav.open-settings(SettingsSection.streaming); }
|
||||
}
|
||||
NavItem {
|
||||
icon: Icons.shield;
|
||||
text: @tr("Privacy & Safety");
|
||||
chevron: true;
|
||||
clicked => { Nav.open-settings(SettingsSection.privacy); }
|
||||
}
|
||||
NavItem {
|
||||
icon: Icons.palette;
|
||||
text: @tr("Appearance");
|
||||
chevron: true;
|
||||
clicked => { Nav.open-settings(SettingsSection.appearance); }
|
||||
clicked => { Nav.open-settings(item.section); }
|
||||
}
|
||||
NavItem {
|
||||
icon: Icons.info;
|
||||
|
||||
@@ -0,0 +1,482 @@
|
||||
// Things over the page: the bell's notifications, the search (Ctrl+K), a
|
||||
// picture from the chat opened larger.
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, NoticeItem, SearchItem } from "../bridge.slint";
|
||||
import { Nav, Page, SettingsSection } from "../nav.slint";
|
||||
import { Icon, Button, ButtonKind, IconButton, Avatar, Status, Chip, CountBadge, TextField, Kbd, Divider, ListView, ScrollView } from "../components/index.slint";
|
||||
|
||||
// One notification.
|
||||
component NoticeRow inherits Rectangle {
|
||||
in property <NoticeItem> notice;
|
||||
min-height: 64px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: touch.has-hover ? Theme.surface-4 : notice.unread ? Theme.accent-soft.transparentize(0.6) : transparent;
|
||||
accessible-role: AccessibleRole.list-item;
|
||||
accessible-label: notice.title;
|
||||
accessible-description: notice.body;
|
||||
accessible-action-default => { Bridge.open-notice(notice.key); Nav.notifications-open = false; }
|
||||
touch := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => {
|
||||
Bridge.open-notice(root.notice.key);
|
||||
Nav.notifications-open = false;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
padding: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
VerticalLayout {
|
||||
alignment: start;
|
||||
Rectangle {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
Avatar {
|
||||
size: 40px;
|
||||
initials: root.notice.initials;
|
||||
tint: root.notice.tint;
|
||||
image: root.notice.avatar;
|
||||
label: root.notice.title;
|
||||
}
|
||||
Rectangle {
|
||||
x: 24px;
|
||||
y: 24px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 10px;
|
||||
background: root.notice.kind == "poke" ? Theme.warning
|
||||
: root.notice.kind == "mention" ? Theme.accent
|
||||
: root.notice.kind == "event" ? #8b5cf6
|
||||
: root.notice.kind == "friend" ? Theme.success : Theme.info;
|
||||
border-width: 2px;
|
||||
border-color: Theme.surface-3;
|
||||
Icon {
|
||||
source: root.notice.kind == "poke" ? Icons.hand
|
||||
: root.notice.kind == "mention" ? Icons.at-sign
|
||||
: root.notice.kind == "event" ? Icons.calendar
|
||||
: root.notice.kind == "friend" ? Icons.user-check : Icons.message-square;
|
||||
size: 11px;
|
||||
tint: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
horizontal-stretch: 1;
|
||||
spacing: 2px;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: root.notice.title;
|
||||
color: Theme.text;
|
||||
font-weight: root.notice.unread ? Theme.weight-semibold : Theme.weight-medium;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: root.notice.time;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
}
|
||||
}
|
||||
if root.notice.body != "": Text {
|
||||
text: root.notice.body;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
overflow: elide;
|
||||
max-height: 36px * Theme.font-scale;
|
||||
}
|
||||
}
|
||||
if root.notice.unread: Rectangle {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
border-radius: 4px;
|
||||
background: Theme.accent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The bell's panel: mentions, pokes, messages, event reminders, friends
|
||||
// coming online; requests to watch our stream and saved crash reports.
|
||||
export component NotificationsPanel inherits Rectangle {
|
||||
width: 400px;
|
||||
background: Theme.surface-3;
|
||||
border-radius: Theme.radius-lg;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border-strong;
|
||||
clip: true;
|
||||
accessible-role: AccessibleRole.groupbox;
|
||||
accessible-label: @tr("Notifications");
|
||||
// Clicks inside stay inside.
|
||||
TouchArea { }
|
||||
VerticalLayout {
|
||||
padding: Theme.space-3;
|
||||
spacing: Theme.space-2;
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-2;
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: @tr("Notifications");
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-lg;
|
||||
font-weight: Theme.weight-semibold;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
if Bridge.notifications-unread > 0: CountBadge {
|
||||
count: Bridge.notifications-unread;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
Button {
|
||||
small: true;
|
||||
kind: ButtonKind.ghost;
|
||||
icon: Icons.check;
|
||||
text: @tr("Mark all read");
|
||||
enabled: Bridge.notifications-unread > 0;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.mark-notices-read(); }
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.trash-2;
|
||||
label: @tr("Clear all");
|
||||
size: 30px;
|
||||
icon-size: Theme.icon-sm;
|
||||
enabled: Bridge.notifications.length > 0;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.clear-notices(); }
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.settings;
|
||||
label: @tr("Notification settings");
|
||||
size: 30px;
|
||||
icon-size: Theme.icon-sm;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => {
|
||||
Nav.notifications-open = false;
|
||||
Nav.open-settings(SettingsSection.notifications);
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.share-requests > 0: Rectangle {
|
||||
height: 48px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: share-touch.has-hover ? Theme.surface-4 : Theme.live-soft;
|
||||
share-touch := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => {
|
||||
Nav.notifications-open = false;
|
||||
Nav.open-share();
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: Icons.monitor-up;
|
||||
tint: Theme.live;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: @tr("{} want to watch your stream", Bridge.share-requests);
|
||||
color: Theme.text;
|
||||
vertical-alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.crash-notice != "": Rectangle {
|
||||
min-height: 48px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: Theme.warning-soft;
|
||||
HorizontalLayout {
|
||||
padding: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: Icons.triangle-alert;
|
||||
tint: Theme.warning;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.crash-notice;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.notifications.length == 0 && Bridge.share-requests == 0: VerticalLayout {
|
||||
padding: Theme.space-6;
|
||||
spacing: Theme.space-2;
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
Icon {
|
||||
source: Icons.bell;
|
||||
size: 36px;
|
||||
tint: Theme.text-disabled;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: @tr("Nothing new. Mentions, pokes, messages, event reminders and friends coming online show up here.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-alignment: center;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
vertical-stretch: 1;
|
||||
min-height: Bridge.notifications.length > 0 ? 200px : 0px;
|
||||
for notice in Bridge.notifications: NoticeRow {
|
||||
notice: notice;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A result of the search.
|
||||
component ResultRow inherits VerticalLayout {
|
||||
in property <SearchItem> item;
|
||||
in property <bool> selected;
|
||||
callback clicked();
|
||||
if root.item.header != "": Text {
|
||||
text: root.item.header;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
font-weight: Theme.weight-semibold;
|
||||
height: 28px;
|
||||
vertical-alignment: bottom;
|
||||
}
|
||||
Rectangle {
|
||||
height: 46px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: root.selected ? Theme.accent-soft : touch.has-hover ? Theme.surface-4 : transparent;
|
||||
border-width: root.selected ? 1px : 0px;
|
||||
border-color: Theme.accent;
|
||||
accessible-role: AccessibleRole.list-item;
|
||||
accessible-label: root.item.title;
|
||||
accessible-description: root.item.subtitle;
|
||||
accessible-item-selectable: true;
|
||||
accessible-item-selected: root.selected;
|
||||
accessible-action-default => { root.clicked(); }
|
||||
touch := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { root.clicked(); }
|
||||
}
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-3;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
if root.item.kind == "person" || root.item.kind == "contact" || root.item.kind == "server": Avatar {
|
||||
size: 32px;
|
||||
square: root.item.kind == "server";
|
||||
initials: root.item.initials;
|
||||
tint: root.item.tint;
|
||||
image: root.item.avatar;
|
||||
label: root.item.title;
|
||||
status: root.item.kind == "person" ? Status.online : Status.none;
|
||||
}
|
||||
if root.item.kind == "channel" || root.item.kind == "setting": Rectangle {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: Theme.surface-4;
|
||||
Icon {
|
||||
source: root.item.kind == "channel" ? Icons.hash : Icons.settings;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.accent-text;
|
||||
}
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
Text {
|
||||
text: root.item.title;
|
||||
color: Theme.text;
|
||||
font-weight: Theme.weight-medium;
|
||||
overflow: elide;
|
||||
}
|
||||
if root.item.subtitle != "": Text {
|
||||
text: root.item.subtitle;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if root.selected: Icon {
|
||||
source: Icons.arrow-right;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.accent-text;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The search (Ctrl+K): servers, channels, people and settings pages; the
|
||||
// arrow keys pick a result, Enter opens it, Escape closes.
|
||||
export component SearchPalette inherits Rectangle {
|
||||
background: Theme.scrim;
|
||||
accessible-role: AccessibleRole.none;
|
||||
TouchArea {
|
||||
clicked => { Nav.close-search(); }
|
||||
}
|
||||
card := Rectangle {
|
||||
x: (parent.width - self.width) / 2;
|
||||
y: min(80px, parent.height / 10);
|
||||
width: min(parent.width - 24px, 640px);
|
||||
height: min(parent.height - self.y - 24px, 540px);
|
||||
background: Theme.surface;
|
||||
border-radius: Theme.radius-xl;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border-strong;
|
||||
clip: true;
|
||||
accessible-role: AccessibleRole.groupbox;
|
||||
accessible-label: @tr("Search");
|
||||
TouchArea { }
|
||||
VerticalLayout {
|
||||
padding: Theme.space-4;
|
||||
spacing: Theme.space-3;
|
||||
input := TextField {
|
||||
height: 46px;
|
||||
text: Nav.search-text;
|
||||
icon: Icons.search;
|
||||
font-size: Theme.font-md;
|
||||
placeholder: @tr("Search servers, channels, people, settings…");
|
||||
label: @tr("Search");
|
||||
init => { self.focus(); }
|
||||
edited(text) => {
|
||||
Nav.search-text = text;
|
||||
Nav.search-index = 0;
|
||||
results.content-y = 0;
|
||||
Bridge.search(text);
|
||||
}
|
||||
accepted => {
|
||||
if Bridge.search-results.length > 0 {
|
||||
Bridge.search-activate(Nav.search-index);
|
||||
Nav.close-search();
|
||||
}
|
||||
}
|
||||
key-pressed(event) => {
|
||||
if event.text == Key.DownArrow {
|
||||
Nav.search-index = min(Bridge.search-results.length - 1, Nav.search-index + 1);
|
||||
if (Nav.search-index + 1) * 52px > results.visible-height - results.content-y {
|
||||
results.content-y = results.visible-height - (Nav.search-index + 1) * 52px;
|
||||
}
|
||||
return accept;
|
||||
}
|
||||
if event.text == Key.UpArrow {
|
||||
Nav.search-index = max(0, Nav.search-index - 1);
|
||||
if Nav.search-index * 52px < -results.content-y {
|
||||
results.content-y = -Nav.search-index * 52px;
|
||||
}
|
||||
return accept;
|
||||
}
|
||||
if event.text == Key.Escape {
|
||||
Nav.close-search();
|
||||
return accept;
|
||||
}
|
||||
reject
|
||||
}
|
||||
}
|
||||
if Bridge.search-results.length == 0: Text {
|
||||
text: Nav.search-text == "" ? @tr("Type to find a server, a channel, a person or a settings page.") : @tr("Nothing matches “{}”.", Nav.search-text);
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
results := ScrollView {
|
||||
vertical-stretch: 1;
|
||||
VerticalLayout {
|
||||
alignment: start;
|
||||
for item[i] in Bridge.search-results: ResultRow {
|
||||
item: item;
|
||||
selected: i == Nav.search-index;
|
||||
clicked => {
|
||||
Bridge.search-activate(i);
|
||||
Nav.close-search();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Divider { }
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
Kbd { text: "↑"; }
|
||||
Kbd { text: "↓"; }
|
||||
Text {
|
||||
text: @tr("to choose");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
Rectangle {
|
||||
width: Theme.space-4;
|
||||
}
|
||||
Kbd { text: "Enter"; }
|
||||
Text {
|
||||
text: @tr("to open");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
Rectangle {
|
||||
width: Theme.space-4;
|
||||
}
|
||||
Kbd { text: "Esc"; }
|
||||
Text {
|
||||
text: @tr("to close");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A picture from the chat, as large as the window allows.
|
||||
export component Lightbox inherits Rectangle {
|
||||
background: #000000d8;
|
||||
accessible-role: AccessibleRole.image;
|
||||
accessible-label: @tr("Picture");
|
||||
TouchArea {
|
||||
clicked => { Nav.lightbox-open = false; }
|
||||
}
|
||||
FocusScope {
|
||||
init => { self.focus(); }
|
||||
key-pressed(event) => {
|
||||
if event.text == Key.Escape {
|
||||
Nav.lightbox-open = false;
|
||||
return accept;
|
||||
}
|
||||
reject
|
||||
}
|
||||
}
|
||||
Image {
|
||||
x: 40px;
|
||||
y: 40px;
|
||||
width: parent.width - 80px;
|
||||
height: parent.height - 80px;
|
||||
source: Nav.lightbox;
|
||||
image-fit: contain;
|
||||
}
|
||||
IconButton {
|
||||
x: parent.width - self.width - Theme.space-4;
|
||||
y: Theme.space-4;
|
||||
icon: Icons.x;
|
||||
label: @tr("Close");
|
||||
round: true;
|
||||
filled: true;
|
||||
clicked => { Nav.lightbox-open = false; }
|
||||
}
|
||||
}
|
||||
@@ -198,25 +198,29 @@ export component TopBar inherits Rectangle {
|
||||
HorizontalLayout {
|
||||
horizontal-stretch: 1;
|
||||
alignment: center;
|
||||
search := SearchBox {
|
||||
// Opens the search (Ctrl+K does too).
|
||||
Rectangle {
|
||||
max-width: 680px;
|
||||
height: 40px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
placeholder: Bridge.current-server >= 0 ? @tr("Search channels and people in {}…", Bridge.server-title) : @tr("Search channels and people…");
|
||||
label: @tr("Search");
|
||||
edited(text) => { Bridge.search(text); }
|
||||
SearchBox {
|
||||
read-only: true;
|
||||
placeholder: @tr("Search servers, channels, people or settings…");
|
||||
label: @tr("Search");
|
||||
}
|
||||
TouchArea {
|
||||
mouse-cursor: MouseCursor.text;
|
||||
clicked => { Nav.open-search(""); }
|
||||
}
|
||||
}
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.bell;
|
||||
label: Bridge.share-requests > 0 ? @tr("{} requests to watch your stream", Bridge.share-requests) : @tr("Notifications");
|
||||
dot: Bridge.share-requests > 0 || Bridge.crash-notice != "";
|
||||
label: Bridge.notifications-unread > 0 ? @tr("{} new notifications", Bridge.notifications-unread) : @tr("Notifications");
|
||||
dot: Bridge.notifications-unread > 0 || Bridge.share-requests > 0 || Bridge.crash-notice != "";
|
||||
checked: Nav.notifications-open;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => {
|
||||
if Bridge.share-requests > 0 {
|
||||
Nav.open-share();
|
||||
}
|
||||
}
|
||||
clicked => { Nav.notifications-open = !Nav.notifications-open; }
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.users;
|
||||
@@ -241,9 +245,6 @@ export component TopBar inherits Rectangle {
|
||||
clicked => { Nav.open-about(); }
|
||||
}
|
||||
}
|
||||
// Ctrl+K focuses the search.
|
||||
property <int> requests: Nav.search-requests;
|
||||
changed requests => { search.focus(); }
|
||||
}
|
||||
|
||||
// A sidebar panel: the page's navigation (@children) above the voice card
|
||||
|
||||
@@ -158,6 +158,14 @@ export component MobileShell inherits Rectangle {
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if !root.voice: IconButton {
|
||||
icon: Icons.search;
|
||||
label: @tr("Search");
|
||||
round: true;
|
||||
filled: true;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.open-search(""); }
|
||||
}
|
||||
// The voice channel we are in, from any page.
|
||||
if !root.voice && Bridge.voice-connected: IconButton {
|
||||
icon: Icons.volume-2;
|
||||
@@ -177,9 +185,10 @@ export component MobileShell inherits Rectangle {
|
||||
label: @tr("Notifications");
|
||||
round: true;
|
||||
filled: true;
|
||||
dot: Bridge.share-requests > 0 || Bridge.crash-notice != "";
|
||||
checked: Nav.notifications-open;
|
||||
dot: Bridge.notifications-unread > 0 || Bridge.share-requests > 0 || Bridge.crash-notice != "";
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.mobile-tab = MobileTab.activity; Nav.show(Page.server); }
|
||||
clicked => { Nav.notifications-open = !Nav.notifications-open; }
|
||||
}
|
||||
if root.voice: PeoplePill {
|
||||
y: (parent.height - self.height) / 2;
|
||||
@@ -255,34 +264,34 @@ export component MobileShell inherits Rectangle {
|
||||
NavTab {
|
||||
icon: Icons.home;
|
||||
text: @tr("Home");
|
||||
selected: Nav.mobile-tab == MobileTab.home && Nav.page != Page.settings;
|
||||
selected: Nav.page == Page.home || Nav.page == Page.friends || Nav.page == Page.messages || Nav.page == Page.library || (Nav.mobile-tab == MobileTab.home && Nav.page == Page.server);
|
||||
clicked => { Nav.show-tab(MobileTab.home); }
|
||||
}
|
||||
NavTab {
|
||||
icon: Icons.server;
|
||||
text: @tr("Servers");
|
||||
selected: Nav.mobile-tab == MobileTab.servers && Nav.page != Page.settings;
|
||||
selected: (Nav.mobile-tab == MobileTab.servers && Nav.page == Page.server) || Nav.page == Page.events;
|
||||
dot: Bridge.voice-connected;
|
||||
clicked => { Nav.show-tab(MobileTab.servers); }
|
||||
}
|
||||
NavTab {
|
||||
icon: Icons.message-circle;
|
||||
text: @tr("Chats");
|
||||
selected: Nav.mobile-tab == MobileTab.chat && Nav.page != Page.settings;
|
||||
selected: Nav.mobile-tab == MobileTab.chat && Nav.page == Page.server;
|
||||
badge: root.unread;
|
||||
clicked => { Nav.show-tab(MobileTab.chat); }
|
||||
}
|
||||
NavTab {
|
||||
icon: Icons.activity;
|
||||
text: @tr("Activity");
|
||||
selected: Nav.mobile-tab == MobileTab.activity && Nav.page != Page.settings;
|
||||
selected: Nav.mobile-tab == MobileTab.activity && Nav.page == Page.server;
|
||||
badge: Bridge.share-requests;
|
||||
clicked => { Nav.show-tab(MobileTab.activity); }
|
||||
}
|
||||
NavTab {
|
||||
icon: Icons.user;
|
||||
text: @tr("You");
|
||||
selected: Nav.mobile-tab == MobileTab.you || Nav.page == Page.settings;
|
||||
selected: (Nav.mobile-tab == MobileTab.you && Nav.page == Page.server) || Nav.page == Page.settings;
|
||||
clicked => { Nav.show-tab(MobileTab.you); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,9 @@ for Home's friends list, and records sightings in one write per change. A
|
||||
contact's mute and volume apply to their voice in every session. Messages of
|
||||
blocked contacts are flagged (`ChatMessage::blocked`, live and in history);
|
||||
their private messages and pokes are dropped or flagged per
|
||||
`privacy.block_mode`. `stream.permissions = friends` lets friends watch our
|
||||
`privacy.block_mode`. `privacy.private_messages` and `privacy.pokes`
|
||||
(everyone, friends, nobody) drop those of everyone else.
|
||||
`stream.permissions = friends` lets friends watch our
|
||||
stream without asking and asks for everyone else.
|
||||
|
||||
## Streams
|
||||
|
||||
@@ -176,7 +176,7 @@ identity the official client uses by default (field 5 of its payload, below;
|
||||
TeamSpeak 6's before TeamSpeak 3's) becomes Voelin's default when Voelin has
|
||||
none, or only the one it created on its own the first time it started,
|
||||
which nobody chose. That happens once: the created identity is kept, and
|
||||
choosing it again in Settings → Identities makes it the user's own, which
|
||||
choosing it again in Settings → Profiles makes it the user's own, which
|
||||
no import replaces; identities that were imported or chosen are never
|
||||
replaced. The store keeps where each identity came from and which one is the
|
||||
default (`identities.origin`: `created`, `imported`, `user`;
|
||||
@@ -185,13 +185,20 @@ named `Default` of an older database as created). What happened is shown
|
||||
once in the status line (the toast on desktop), by nickname, e.g. "You now
|
||||
use your TeamSpeak identity "X"; your previous one is kept". The runtime
|
||||
setting `identity.import_from_teamspeak` (default on, also in Settings →
|
||||
Identities) turns it off, e.g. `--set identity.import_from_teamspeak=false`.
|
||||
Profiles) turns it off, e.g. `--set identity.import_from_teamspeak=false`.
|
||||
The sample data of `VOELIN_DEMO_UI` never imports.
|
||||
|
||||
**Settings → Identities** lists the stored identities with where they came
|
||||
from, their security level and unique id; "Use as default" picks the one
|
||||
servers see from the next connection on. `voelinctl identity list` shows
|
||||
the same (origin and default).
|
||||
**Settings → Profiles** lists the stored identities with where they came
|
||||
from ("Made in Voelin", "Imported", "Chosen by you"), their security level
|
||||
and unique ids; "Use as default" picks the one servers see from the next
|
||||
connection on (`Store::set_default_identity` as the user's choice). The
|
||||
store's default is the only default: a server connects with the identity its
|
||||
bookmark names, if any (Profiles → Identity per server), else with the
|
||||
store's default, and My Account shows the one the current server uses. The
|
||||
page also renames, exports, deletes and raises the security level of
|
||||
identities, and finds and imports the official clients' identities by
|
||||
hand. `voelinctl identity list` shows the same (origin and default).
|
||||
`VOELIN_OPEN=settings:profiles` (or `settings:identities`) opens it.
|
||||
|
||||
- **Import** prints what it found as nickname, unique id and security level —
|
||||
all three are public, everything else in an identity is the private key —
|
||||
|
||||
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 155 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 48 KiB |