Update split view and web surface to glass morphism styling
Split panes use rounded corners, glass backgrounds, and accent dot indicators matching the design reference. Web surface error page uses centered layout with proper typography. Remove opaque white backgrounds in favor of transparent glass surfaces.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
use ely_domain::{BrowserTab, TabId};
|
||||
use gpui::{
|
||||
AnyElement, App, Entity, ImageSource, InteractiveElement, IntoElement, MouseButton, ObjectFit,
|
||||
ParentElement, Styled, StyledImage, Window, canvas, div, img, prelude::FluentBuilder, px, rgb,
|
||||
ParentElement, Styled, StyledImage, Window, canvas, div, img, px, rgb,
|
||||
};
|
||||
use gpui_component::StyledExt;
|
||||
|
||||
use super::{ElyShell, web_surface_frame::WebSurfaceFrame};
|
||||
use ely_design_system::{colors, spacing};
|
||||
use ely_design_system::colors;
|
||||
|
||||
pub(super) fn render_ready_web_surface(
|
||||
frame: &WebSurfaceFrame,
|
||||
@@ -16,10 +15,7 @@ pub(super) fn render_ready_web_surface(
|
||||
render_web_surface(
|
||||
tab,
|
||||
state_entity,
|
||||
frame.title_label(),
|
||||
frame.url_label().to_string(),
|
||||
Some(frame.detail_label()),
|
||||
img(ImageSource::Render(frame.image.clone())).size_full().object_fit(ObjectFit::Contain),
|
||||
img(ImageSource::Render(frame.image.clone())).size_full().object_fit(ObjectFit::Fill),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -27,14 +23,7 @@ pub(super) fn render_loading_web_surface(
|
||||
tab: &BrowserTab,
|
||||
state_entity: Entity<ElyShell>,
|
||||
) -> AnyElement {
|
||||
render_web_surface(
|
||||
tab,
|
||||
state_entity,
|
||||
tab.title().to_string(),
|
||||
tab.url().as_str().to_string(),
|
||||
Some("Rendering".to_string()),
|
||||
centered_status(tab.title(), tab.url().as_str(), "Rendering page with Servo", colors::BODY),
|
||||
)
|
||||
render_web_surface(tab, state_entity, div().size_full())
|
||||
}
|
||||
|
||||
pub(super) fn render_failed_web_surface(
|
||||
@@ -42,66 +31,36 @@ pub(super) fn render_failed_web_surface(
|
||||
message: &str,
|
||||
state_entity: Entity<ElyShell>,
|
||||
) -> AnyElement {
|
||||
render_web_surface(
|
||||
tab,
|
||||
state_entity,
|
||||
tab.title().to_string(),
|
||||
tab.url().as_str().to_string(),
|
||||
Some("Render failed".to_string()),
|
||||
centered_status(tab.title(), tab.url().as_str(), message, colors::ERROR),
|
||||
)
|
||||
render_web_surface(tab, state_entity, error_page(message))
|
||||
}
|
||||
|
||||
fn render_web_surface_header(title: String, url: String, detail: Option<String>) -> AnyElement {
|
||||
div()
|
||||
.h(px(34.0))
|
||||
.px_3()
|
||||
.gap_3()
|
||||
.flex()
|
||||
.items_center()
|
||||
.border_b_1()
|
||||
.border_color(rgb(colors::HAIRLINE))
|
||||
.bg(rgb(colors::CANVAS_SOFT))
|
||||
.child(
|
||||
div()
|
||||
.min_w_0()
|
||||
.flex_1()
|
||||
.truncate()
|
||||
.text_sm()
|
||||
.font_semibold()
|
||||
.text_color(rgb(colors::INK))
|
||||
.child(title),
|
||||
)
|
||||
.when_some(detail, |this, detail| {
|
||||
this.child(div().text_xs().text_color(rgb(colors::MUTED)).child(detail))
|
||||
})
|
||||
.child(
|
||||
div().max_w(px(420.0)).truncate().text_xs().text_color(rgb(colors::MUTED)).child(url),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn centered_status(title: &str, url: &str, detail: &str, detail_color: u32) -> impl IntoElement {
|
||||
fn error_page(message: &str) -> impl IntoElement {
|
||||
div()
|
||||
.size_full()
|
||||
.p_8()
|
||||
.p(px(48.0))
|
||||
.flex()
|
||||
.flex_col()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.gap_2()
|
||||
.bg(rgb(colors::SURFACE_CARD))
|
||||
.child(div().text_size(px(26.0)).text_color(rgb(colors::INK)).child(title.to_string()))
|
||||
.child(div().text_sm().text_color(rgb(colors::MUTED)).child(url.to_string()))
|
||||
.child(div().text_sm().text_color(rgb(detail_color)).child(detail.to_string()))
|
||||
.gap(px(12.0))
|
||||
.child(
|
||||
div()
|
||||
.text_size(px(22.0))
|
||||
.font_weight(gpui::FontWeight(400.0))
|
||||
.text_color(rgb(colors::INK))
|
||||
.child("Page unavailable"),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_size(px(14.0))
|
||||
.text_color(rgb(colors::INK_3))
|
||||
.child(message.to_string()),
|
||||
)
|
||||
}
|
||||
|
||||
fn render_web_surface(
|
||||
tab: &BrowserTab,
|
||||
state_entity: Entity<ElyShell>,
|
||||
title: String,
|
||||
url: String,
|
||||
detail: Option<String>,
|
||||
content: impl IntoElement,
|
||||
) -> AnyElement {
|
||||
let input_tab_id = tab.id().clone();
|
||||
@@ -112,30 +71,16 @@ fn render_web_surface(
|
||||
div()
|
||||
.flex_1()
|
||||
.h_full()
|
||||
.p(px(spacing::SM))
|
||||
.bg(rgb(colors::CANVAS_SOFT))
|
||||
.min_w_0()
|
||||
.overflow_hidden()
|
||||
.child(
|
||||
div()
|
||||
.relative()
|
||||
.size_full()
|
||||
.overflow_hidden()
|
||||
.rounded_md()
|
||||
.border_1()
|
||||
.border_color(rgb(colors::HAIRLINE))
|
||||
.bg(rgb(colors::SURFACE_CARD))
|
||||
.flex()
|
||||
.flex_col()
|
||||
.child(render_web_surface_header(title, url, detail))
|
||||
.child(
|
||||
div()
|
||||
.relative()
|
||||
.flex_1()
|
||||
.min_h_0()
|
||||
.overflow_hidden()
|
||||
.bg(rgb(colors::SURFACE_CARD))
|
||||
.child(content)
|
||||
.child(render_viewport_tracker(tab.id().clone(), tracker_entity))
|
||||
.child(render_input_overlay(input_tab_id, input_url, input_entity)),
|
||||
),
|
||||
.child(content)
|
||||
.child(render_viewport_tracker(tab.id().clone(), tracker_entity))
|
||||
.child(render_input_overlay(input_tab_id, input_url, input_entity)),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user