Skip to content

Commit 3c88bd3

Browse files
authored
New link sharing dialog for detailed link sharing (#11137)
1 parent f47dab6 commit 3c88bd3

File tree

25 files changed

+682
-34
lines changed

25 files changed

+682
-34
lines changed

crates/store/re_log_types/src/index/time_cell.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,25 @@ impl TimeCell {
174174
TimeType::Sequence => typ.format(value, timestamp_format),
175175
}
176176
}
177+
178+
pub fn format(&self, timestamp_format: super::TimestampFormat) -> String {
179+
let Self { typ, value } = *self;
180+
181+
match typ {
182+
TimeType::DurationNs => {
183+
crate::Duration::from_nanos(value.into()).format_subsecond_as_relative()
184+
}
185+
186+
TimeType::TimestampNs => {
187+
crate::Timestamp::from_nanos_since_epoch(value.into()).format(timestamp_format)
188+
}
189+
190+
TimeType::Sequence => typ.format(value, timestamp_format),
191+
}
192+
}
177193
}
178194

195+
// TODO(andreas): Should remove this in favor or explicit format methods above.
179196
impl std::fmt::Display for TimeCell {
180197
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
181198
match self.typ {

crates/viewer/re_ui/data/dark_theme.ron

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"large_button_corner_radius": 6,
55
"small_icon_size": 14,
66
"modal_button_width": 50,
7+
"default_modal_width": 400,
78

89
"Alias": {
910
"native_frame_stroke": {
@@ -289,6 +290,19 @@
289290
"color": "{Gray.400}",
290291
"width": 1
291292
},
293+
294+
"bg_fill_inverse": {
295+
"color": "{Gray.800}"
296+
},
297+
"bg_fill_inverse-hover": {
298+
"color": "{Gray.850}"
299+
},
300+
"text_inverse": {
301+
"color": "{Gray.250}"
302+
},
303+
"icon_inverse": {
304+
"color": "{Gray.250}"
305+
},
292306
},
293307

294308
"alert_success": {
Lines changed: 11 additions & 0 deletions
Loading

crates/viewer/re_ui/data/light_theme.ron

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"large_button_corner_radius": 6,
55
"small_icon_size": 14,
66
"modal_button_width": 50,
7+
"default_modal_width": 400,
78

89
"Alias": {
910
"native_frame_stroke": {
@@ -288,6 +289,19 @@
288289
"color": "{Gray.400}",
289290
"width": 1
290291
},
292+
293+
"bg_fill_inverse": {
294+
"color": "{Gray.250}"
295+
},
296+
"bg_fill_inverse-hover": {
297+
"color": "{Gray.150}"
298+
},
299+
"text_inverse": {
300+
"color": "{Gray.1000}"
301+
},
302+
"icon_inverse": {
303+
"color": "{Gray.1000}"
304+
},
291305
},
292306

293307
"alert_success": {

crates/viewer/re_ui/src/command.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ pub enum UICommand {
8989
#[cfg(debug_assertions)]
9090
ResetEguiMemory,
9191

92+
Share,
9293
CopyDirectLink,
9394

9495
CopyTimeRangeLink,
@@ -288,6 +289,7 @@ impl UICommand {
288289
"Reset egui memory, useful for debugging UI code.",
289290
),
290291

292+
Self::Share => ("Share…", "Share the current screen as a link"),
291293
Self::CopyDirectLink => (
292294
"Copy direct link",
293295
"Try to copy a shareable link to the current screen. This is not supported for all data sources & viewer states.",
@@ -436,6 +438,7 @@ impl UICommand {
436438
#[cfg(debug_assertions)]
437439
Self::ResetEguiMemory => smallvec![],
438440

441+
Self::Share => smallvec![cmd(Key::L)],
439442
Self::CopyDirectLink => smallvec![],
440443

441444
Self::CopyTimeRangeLink => smallvec![],

crates/viewer/re_ui/src/design_tokens.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pub struct DesignTokens {
5959
pub large_button_corner_radius: f32,
6060
pub small_icon_size: Vec2,
6161
pub modal_button_width: f32,
62+
pub default_modal_width: f32,
6263

6364
// All these colors can be found in dark_theme.ron and light_theme.ron:
6465
pub top_bar_color: Color32,
@@ -217,6 +218,11 @@ pub struct DesignTokens {
217218

218219
// Table filter UI
219220
pub table_filter_frame_stroke: Stroke,
221+
222+
pub bg_fill_inverse: Color32,
223+
pub bg_fill_inverse_hover: Color32,
224+
pub text_inverse: Color32,
225+
pub icon_inverse: Color32,
220226
}
221227

222228
impl DesignTokens {
@@ -244,6 +250,7 @@ impl DesignTokens {
244250
large_button_corner_radius: get_scalar("large_button_corner_radius")?,
245251
small_icon_size: Vec2::splat(get_scalar("small_icon_size")?),
246252
modal_button_width: get_scalar("modal_button_width")?,
253+
default_modal_width: get_scalar("default_modal_width")?,
247254

248255
top_bar_color: get_color("top_bar_color"),
249256
bottom_bar_color: get_color("bottom_bar_color"),
@@ -358,6 +365,11 @@ impl DesignTokens {
358365

359366
code_keyword_color: get_color("code_keyword_color"),
360367
table_filter_frame_stroke: get_stroke("table_filter_frame_stroke"),
368+
369+
bg_fill_inverse: get_color("bg_fill_inverse"),
370+
bg_fill_inverse_hover: get_color("bg_fill_inverse-hover"),
371+
text_inverse: get_color("text_inverse"),
372+
icon_inverse: get_color("icon_inverse"),
361373
})
362374
}
363375

crates/viewer/re_ui/src/icons.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ pub const CLOSE_SMALL: Icon = icon_from_path!("../data/icons/close_small.svg");
165165
pub const EXTERNAL_LINK: Icon = icon_from_path!("../data/icons/external_link.svg");
166166
pub const DISCORD: Icon = icon_from_path!("../data/icons/discord.svg");
167167

168+
pub const URL: Icon = icon_from_path!("../data/icons/url.svg");
169+
168170
pub const CONTAINER_HORIZONTAL: Icon = icon_from_path!("../data/icons/container_horizontal.svg");
169171
pub const CONTAINER_GRID: Icon = icon_from_path!("../data/icons/container_grid.svg");
170172
pub const CONTAINER_TABS: Icon = icon_from_path!("../data/icons/container_tabs.svg");

crates/viewer/re_ui/src/modal.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ impl ModalHandler {
6060
None
6161
}
6262
}
63+
64+
/// Whether the modal is currently open.
65+
pub fn is_open(&self) -> bool {
66+
self.modal.is_some()
67+
}
6368
}
6469

6570
/// Show a modal window with Rerun style using [`egui::Modal`].
@@ -192,6 +197,8 @@ impl ModalWrapper {
192197
}
193198
if let Some(max_width) = self.max_width {
194199
ui.set_max_width(max_width);
200+
} else {
201+
ui.set_max_width(tokens.default_modal_width);
195202
}
196203

197204
if let Some(min_height) = self.min_height {

crates/viewer/re_ui/src/notifications.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ impl NotificationUi {
303303

304304
ui.horizontal_top(|ui| {
305305
if !notifications.is_empty() {
306-
ui.label(format!("Notifications ({})", notifications.len()));
306+
ui.strong(format!("Notifications ({})", notifications.len()));
307307
} else {
308-
ui.label("Notifications");
308+
ui.strong("Notifications");
309309
}
310310
ui.with_layout(egui::Layout::top_down(egui::Align::Max), |ui| {
311311
if ui.small_icon_button(&icons::CLOSE, "Close").clicked() {
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)