Skip to content

Commit

Permalink
Merge branch 'dev' into big_numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
WanderingHogan authored Nov 7, 2023
2 parents b164cb5 + 2a53adc commit 6ad5946
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 51 deletions.
35 changes: 1 addition & 34 deletions .github/workflows/ui-test-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,6 @@ env:
CARGO_TERM_COLOR: always

jobs:
build-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout App directory 🔖
uses: actions/checkout@v3

- name: Get latest package list
run: sudo apt-get update

- name: Install libwebkit2gtk
run: sudo apt-get install -y build-essential pkg-config libssl-dev libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev librust-alsa-sys-dev dpkg-dev gzip webkit2gtk-driver xvfb libxdo-dev

- name: Set up cargo cache 🛠️
uses: Swatinem/rust-cache@v2

- name: Install Rust 💿
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.0
override: true

- name: Build executable 🖥️
run: cargo build --release -F production_mode

build-mac:
runs-on: macos-13
steps:
Expand Down Expand Up @@ -475,14 +450,7 @@ jobs:
publish-results:
if: always()
needs:
[
build-ubuntu,
build-mac,
build-windows,
test-mac,
test-windows-chats,
test-windows,
]
[build-mac, build-windows, test-mac, test-windows-chats, test-windows]
runs-on: ubuntu-latest
permissions:
checks: write
Expand Down Expand Up @@ -574,7 +542,6 @@ jobs:
remove-artifacts:
needs:
[
build-ubuntu,
build-mac,
build-windows,
test-mac,
Expand Down
3 changes: 2 additions & 1 deletion common/locales/en-US/main.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions common/src/state/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ pub enum Action<'a> {
ClearUnreads(Uuid),
#[display(fmt = "ClearActiveUnreads")]
ClearActiveUnreads,
#[display(fmt = "ClearAllUnreads")]
ClearAllUnreads,
#[display(fmt = "Config {_0}")]
Config(ConfigAction),
}
Expand Down
1 change: 1 addition & 0 deletions common/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Background
- The Uplink repository consists of two `Cargo` projects: `kit` (a library) and `uplink` (the executable).
- Uplink relies on [Warp](https://github.com/Satellite-im/Warp) and [Dioxus](https://github.com/DioxusLabs/dioxus). It is assumed the reader is familiar with the [Dioxus Documentation](https://dioxuslabs.com/guide/).
- Uplink relies on [Warp](https://github.com/Satellite-im/Warp) and [Dioxus](https://github.com/DioxusLabs/dioxus). It is assumed the reader is familiar with the [Dioxus Documentation](https://dioxuslabs.com/learn/0.4).
- At a high level, Warp sends messages (it does much more), while Uplink is just the UI. Sending and receiving messages is asynchronous, and Uplink has a separate module to handle this: `warp_runner`. All the data for the Uplink UI is contained in a `State` struct. Changing the `State` struct drives the UI. When `warp_runner` handles an event from the `Warp`, `State` is modified, and the entire UI is re-rendered.

## Running the Application
Expand Down
4 changes: 2 additions & 2 deletions docs/new-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
33 changes: 26 additions & 7 deletions kit/src/components/nav/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -16,6 +20,7 @@ pub struct Route<'a> {
pub with_badge: Option<String>,
pub loading: Option<bool>,
pub child: Option<Element<'a>>,
pub context_items: Option<Element<'a>>,
}

impl Default for Route<'_> {
Expand All @@ -27,6 +32,7 @@ impl Default for Route<'_> {
with_badge: None,
loading: None,
child: None,
context_items: None,
}
}
}
Expand Down Expand Up @@ -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",
Expand All @@ -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() {
Expand All @@ -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",
Expand All @@ -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
})
}
}
})
}
))
Expand Down
3 changes: 3 additions & 0 deletions kit/src/elements/tooltip/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions ui/src/layouts/chats/presentation/sidebar/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
)
Expand Down Expand Up @@ -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,
},
}
)
Expand Down
7 changes: 4 additions & 3 deletions ui/src/layouts/chats/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -548,9 +552,6 @@
animation: none;
}
}
.tooltip-arrow-top-right {
margin-right: 50px;
}
#compose {
.typing-indicator {
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/layouts/storage/files_layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
)),
Expand Down
9 changes: 9 additions & 0 deletions ui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6ad5946

Please sign in to comment.