Skip to content

Commit

Permalink
Simplify Welcome Screen and use card-based layout for examples (#5699)
Browse files Browse the repository at this point in the history
### What

* Closes #5452 

Note: the "Source code" links are functional but disabled, as the
example manifest must be updated to include the corresponding URL, see
follow-up issues.

Follow-up:
- #5700 
- #5701 

Before/After:

<img width="844" alt="image"
src="https://github.com/rerun-io/rerun/assets/49431240/ded75ce3-600d-4c0c-bfa0-7742e9fad503">

<img width="1043" alt="image"
src="https://github.com/rerun-io/rerun/assets/49431240/87f33dc9-154f-42b0-bdda-3647c71a6c90">



### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/5699/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/5699/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/5699/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/5699)
- [Docs
preview](https://rerun.io/preview/6766af1787603295c4d4970a1c98849677409942/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/6766af1787603295c4d4970a1c98849677409942/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
  • Loading branch information
abey79 authored Mar 27, 2024
1 parent 4636188 commit 8cf3f92
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 556 deletions.
Binary file added crates/re_ui/data/icons/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed crates/re_ui/data/images/configure-card.png
Binary file not shown.
Binary file removed crates/re_ui/data/images/live-data-card.png
Binary file not shown.
Binary file removed crates/re_ui/data/images/recorded-data-card.png
Binary file not shown.
14 changes: 7 additions & 7 deletions crates/re_ui/src/design_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,21 @@ fn apply_design_tokens(ctx: &egui::Context) -> DesignTokens {
// TODO(ab): font sizes should come from design tokens
egui_style
.text_styles
.insert(ReUi::welcome_screen_h1(), egui::FontId::proportional(28.0));
.insert(ReUi::welcome_screen_h1(), egui::FontId::proportional(41.0));
egui_style
.text_styles
.insert(ReUi::welcome_screen_h2(), egui::FontId::proportional(24.0));
egui_style
.text_styles
.insert(ReUi::welcome_screen_h3(), egui::FontId::proportional(15.0));
.insert(ReUi::welcome_screen_h2(), egui::FontId::proportional(27.0));
egui_style.text_styles.insert(
ReUi::welcome_screen_example_title(),
egui::FontId::proportional(16.0),
egui::FontId::proportional(13.0),
);
egui_style.text_styles.insert(
ReUi::welcome_screen_body(),
egui::FontId::proportional(13.0),
egui::FontId::proportional(15.0),
);
egui_style
.text_styles
.insert(ReUi::welcome_screen_tag(), egui::FontId::proportional(10.5));

let panel_bg_color = get_aliased_color(&json, "{Alias.Color.Surface.Default.value}");
// let floating_color = get_aliased_color(&json, "{Alias.Color.Surface.Floating.value}");
Expand Down
16 changes: 1 addition & 15 deletions crates/re_ui/src/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,4 @@ pub const LINK: Icon = Icon::new("link", include_bytes!("../data/icons/link.png"
pub const COMPONENT: Icon = Icon::new("component", include_bytes!("../data/icons/component.png"));

pub const STORE: Icon = Icon::new("store", include_bytes!("../data/icons/store.png"));

pub const WELCOME_SCREEN_CONFIGURE: Icon = Icon::new(
"welcome_screen_configure",
include_bytes!("../data/images/configure-card.png"),
);

pub const WELCOME_SCREEN_LIVE_DATA: Icon = Icon::new(
"welcome_screen_live_data",
include_bytes!("../data/images/live-data-card.png"),
);

pub const WELCOME_SCREEN_RECORDED_DATA: Icon = Icon::new(
"welcome_screen_recorded_data",
include_bytes!("../data/images/recorded-data-card.png"),
);
pub const GITHUB: Icon = Icon::new("github", include_bytes!("../data/icons/github.png"));
10 changes: 5 additions & 5 deletions crates/re_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ impl ReUi {
egui::TextStyle::Name("welcome-screen-h2".into())
}

#[inline]
pub fn welcome_screen_h3() -> egui::TextStyle {
egui::TextStyle::Name("welcome-screen-h3".into())
}

#[inline]
pub fn welcome_screen_example_title() -> egui::TextStyle {
egui::TextStyle::Name("welcome-screen-example-title".into())
Expand All @@ -129,6 +124,11 @@ impl ReUi {
egui::TextStyle::Name("welcome-screen-body".into())
}

#[inline]
pub fn welcome_screen_tag() -> egui::TextStyle {
egui::TextStyle::Name("welcome-screen-tag".into())
}

pub fn welcome_screen_tab_bar_style(ui: &mut egui::Ui) {
ui.spacing_mut().item_spacing.x = 16.0;
ui.visuals_mut().selection.bg_fill = egui::Color32::TRANSPARENT;
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl AppState {
.frame(viewport_frame)
.show_inside(ui, |ui| {
if show_welcome {
welcome_screen.ui(ui, re_ui, rx, command_sender);
welcome_screen.ui(ui, re_ui, command_sender);
} else {
viewport.viewport_ui(ui, &ctx);
}
Expand Down
8 changes: 3 additions & 5 deletions crates/re_viewer/src/ui/top_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,9 @@ fn website_link_ui(ui: &mut egui::Ui) {
.on_hover_cursor(egui::CursorIcon::PointingHand)
.on_hover_text(url);
if response.clicked() {
ui.ctx().output_mut(|o| {
o.open_url = Some(egui::output::OpenUrl {
url: url.to_owned(),
new_tab: true,
});
ui.ctx().open_url(egui::output::OpenUrl {
url: url.to_owned(),
new_tab: true,
});
}
}
Expand Down
Loading

0 comments on commit 8cf3f92

Please sign in to comment.