diff --git a/common/locales/en-US/main.ftl b/common/locales/en-US/main.ftl index bd380717470..86861bd5983 100644 --- a/common/locales/en-US/main.ftl +++ b/common/locales/en-US/main.ftl @@ -41,7 +41,8 @@ uplink = Uplink .download-update = Download Update .date-time-format = %d/%m/%Y %I:%M %p .open-devtools = Open Console - + .clear-unreads = Clear Unreads + community = Community .invited = You're Invited! .join = Join diff --git a/common/src/state/action.rs b/common/src/state/action.rs index 2b59509c8d4..5f82ec39456 100644 --- a/common/src/state/action.rs +++ b/common/src/state/action.rs @@ -194,6 +194,8 @@ pub enum Action<'a> { ClearUnreads(Uuid), #[display(fmt = "ClearActiveUnreads")] ClearActiveUnreads, + #[display(fmt = "ClearAllUnreads")] + ClearAllUnreads, #[display(fmt = "Config {_0}")] Config(ConfigAction), } diff --git a/common/src/state/mod.rs b/common/src/state/mod.rs index e162b615fb0..307f910c4a8 100644 --- a/common/src/state/mod.rs +++ b/common/src/state/mod.rs @@ -260,6 +260,7 @@ impl State { self.clear_unreads(id); } } + Action::ClearAllUnreads => self.chats.all.values_mut().for_each(|c| c.clear_unreads()), Action::SetChatDraft(chat_id, value) => self.set_chat_draft(&chat_id, value), Action::ClearChatDraft(chat_id) => self.clear_chat_draft(&chat_id), Action::SetChatAttachments(chat_id, value) => { diff --git a/docs/new-dev.md b/docs/new-dev.md index 0b80045129b..fb22ca2f6a4 100644 --- a/docs/new-dev.md +++ b/docs/new-dev.md @@ -4,11 +4,11 @@ This document contains some useful resources for anyone wishing to contribute to ## Quick Start -1. Get a TL;DR about Satellite and Uplink from [the doc](docs/what.md) +1. Get a TL;DR about Satellite and Uplink from [the doc](https://github.com/Satellite-im/Uplink/blob/dev/docs/architecture.md) 2. Ensure you run physical and automated tests before submitting a PR for review. We work really hard to have no regressions even if a new feature may be "more important". -3. Review both open and closed [issues](https://github.com/ssatellite-im/Uplink/issues), there may be others working on a similar feature. +3. Review both open and closed [issues](https://github.com/satellite-im/Uplink/issues), there may be others working on a similar feature. 4. Be aware that unless you explicitly state otherwise, contributions you make to this project will be under the licensing rights of the original author's, Satellite.im's, specified license terms (to be outlined in the repository). diff --git a/kit/src/components/nav/mod.rs b/kit/src/components/nav/mod.rs index 825f449cd37..c73c9384fd0 100644 --- a/kit/src/components/nav/mod.rs +++ b/kit/src/components/nav/mod.rs @@ -1,9 +1,13 @@ use dioxus::prelude::*; +use uuid::Uuid; -use crate::elements::{ - button::Button, - tooltip::{ArrowPosition, Tooltip}, - Appearance, +use crate::{ + components::context_menu::ContextMenu, + elements::{ + button::Button, + tooltip::{ArrowPosition, Tooltip}, + Appearance, + }, }; use common::icons::outline::Shape as Icon; pub type To = &'static str; @@ -16,6 +20,7 @@ pub struct Route<'a> { pub with_badge: Option, pub loading: Option, pub child: Option>, + pub context_items: Option>, } impl Default for Route<'_> { @@ -27,6 +32,7 @@ impl Default for Route<'_> { with_badge: None, loading: None, child: None, + context_items: None, } } } @@ -98,7 +104,8 @@ pub fn Nav<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> { let active = use_state(cx, || get_active(&cx)); let bubble = cx.props.bubble.unwrap_or_default(); let tooltip_direction = cx.props.tooltip_direction.unwrap_or(ArrowPosition::Bottom); - + // For some reason if you dont do this the first render will not have a context menu + let uuid = use_ref(cx, || Uuid::new_v4().to_string()); cx.render(rsx!( div { aria_label: "button-nav", @@ -109,6 +116,7 @@ pub fn Nav<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> { let badge = get_badge(route); let key: String = route.name.clone(); let name: String = route.name.clone(); + let name2: String = name.to_lowercase(); let aria_label: String = route.name.clone(); // todo: don't show the tooltip if bubble is true let tooltip = if cx.props.bubble.is_some() { @@ -120,7 +128,7 @@ pub fn Nav<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> { })) }; - rsx!( + let btn = rsx!( div { position: "relative", display: "inline-grid", @@ -141,7 +149,18 @@ pub fn Nav<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> { }, route.child.as_ref() } - ) + ); + match route.context_items.as_ref() { + None => btn, + Some(items) => { + rsx!(ContextMenu{ + id: format!("route-{}-{}", name2, uuid.read()), + key: "{name2}-{uuid.read()}", + items: items.clone(), + btn + }) + } + } }) } )) diff --git a/kit/src/elements/tooltip/style.scss b/kit/src/elements/tooltip/style.scss index d1e1764d867..7af69e06d53 100644 --- a/kit/src/elements/tooltip/style.scss +++ b/kit/src/elements/tooltip/style.scss @@ -30,6 +30,9 @@ margin-top: var(--border-radius); top: 100%; } +.tooltip-arrow-top-right { + right: 0; +} .tooltip-arrow-bottom, .tooltip-arrow-bottom-left, .tooltip-arrow-bottom-right { diff --git a/ui/src/layouts/chats/presentation/sidebar/search.rs b/ui/src/layouts/chats/presentation/sidebar/search.rs index 0a3fffdb24b..a7dad761479 100644 --- a/ui/src/layouts/chats/presentation/sidebar/search.rs +++ b/ui/src/layouts/chats/presentation/sidebar/search.rs @@ -108,10 +108,11 @@ pub fn search_friends<'a>(cx: Scope<'a, SearchProps<'a>>) -> Element<'a> { div { padding_right: "32px", aria_label: "search-result-blocked-user", + display: "flex", IconElement { size: 40, fill: "var(--text-color-muted)", - icon: Icon::NoSymbol, + icon: Icon::UserBlocked, }, } ) @@ -273,11 +274,12 @@ pub fn search_friends<'a>(cx: Scope<'a, SearchProps<'a>>) -> Element<'a> { rsx!( div { padding_right: "32px", + display: "flex", aria_label: "search-result-blocked-user-in-group", IconElement { size: 40, fill: "var(--text-color-muted)", - icon: Icon::NoSymbol, + icon: Icon::UserBlocked, }, } ) diff --git a/ui/src/layouts/chats/style.scss b/ui/src/layouts/chats/style.scss index 2b29dcd74dd..79466081da4 100644 --- a/ui/src/layouts/chats/style.scss +++ b/ui/src/layouts/chats/style.scss @@ -243,6 +243,10 @@ padding-left: 16px; padding-bottom: 4px; margin-bottom: 4px; + div { + margin-top: auto; + margin-bottom: auto; + } #profile-image { margin: var(--gap-less); //TODO(Lucas): Look to it, should be width: var(--height-input); @@ -548,9 +552,6 @@ animation: none; } } -.tooltip-arrow-top-right { - margin-right: 50px; -} #compose { .typing-indicator { width: 100%; diff --git a/ui/src/layouts/storage/files_layout/mod.rs b/ui/src/layouts/storage/files_layout/mod.rs index 8d8f3eb951d..f7b4f83ef42 100644 --- a/ui/src/layouts/storage/files_layout/mod.rs +++ b/ui/src/layouts/storage/files_layout/mod.rs @@ -177,7 +177,7 @@ pub fn FilesLayout(cx: Scope<'_>) -> Element<'_> { aria_label: "upload-file".into(), tooltip: cx.render(rsx!( Tooltip { - arrow_position: ArrowPosition::Top, + arrow_position: ArrowPosition::TopRight, text: get_local_text("files.upload"), } )), diff --git a/ui/src/main.rs b/ui/src/main.rs index 15776605f80..63b6bac5f0d 100644 --- a/ui/src/main.rs +++ b/ui/src/main.rs @@ -1114,6 +1114,15 @@ fn AppNav<'a>( unreads.to_string(), })) }), + context_items: (unreads > 0).then(|| { + cx.render(rsx!(ContextItem { + aria_label: "clear-unreads".into(), + text: get_local_text("uplink.clear-unreads"), + onpress: move |_| { + state.write().mutate(Action::ClearAllUnreads); + } + },)) + }), ..UIRoute::default() }; let settings_route = UIRoute {