chore: revamp theme
This commit is contained in:
@@ -10,6 +10,7 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
ui = { path = "../ui" }
|
||||
theme = { path = "../theme" }
|
||||
common = { path = "../common" }
|
||||
global = { path = "../global" }
|
||||
chats = { path = "../chats" }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use account::Account;
|
||||
use anyhow::Error;
|
||||
use global::get_client;
|
||||
@@ -9,11 +11,10 @@ use gpui::{
|
||||
use nostr_sdk::prelude::*;
|
||||
use serde::Deserialize;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::sync::Arc;
|
||||
use theme::{ActiveTheme, Theme, ThemeMode};
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
dock_area::{dock::DockPlacement, panel::PanelView, DockArea, DockItem},
|
||||
theme::{ActiveTheme, Appearance, Theme},
|
||||
ContextModal, IconName, Root, Sizable, TitleBar,
|
||||
};
|
||||
|
||||
@@ -324,7 +325,7 @@ impl Render for ChatSpace {
|
||||
.xsmall()
|
||||
.ghost()
|
||||
.map(|this| {
|
||||
if cx.theme().appearance.is_dark() {
|
||||
if cx.theme().mode.is_dark() {
|
||||
this.icon(IconName::Sun)
|
||||
} else {
|
||||
this.icon(IconName::Moon)
|
||||
@@ -332,15 +333,15 @@ impl Render for ChatSpace {
|
||||
})
|
||||
.on_click(cx.listener(
|
||||
|_, _, window, cx| {
|
||||
if cx.theme().appearance.is_dark() {
|
||||
if cx.theme().mode.is_dark() {
|
||||
Theme::change(
|
||||
Appearance::Light,
|
||||
ThemeMode::Light,
|
||||
Some(window),
|
||||
cx,
|
||||
);
|
||||
} else {
|
||||
Theme::change(
|
||||
Appearance::Dark,
|
||||
ThemeMode::Dark,
|
||||
Some(window),
|
||||
cx,
|
||||
);
|
||||
|
||||
@@ -27,7 +27,8 @@ use nostr_sdk::{
|
||||
};
|
||||
use smol::Timer;
|
||||
use std::{collections::HashSet, mem, sync::Arc, time::Duration};
|
||||
use ui::{theme::Theme, Root};
|
||||
use theme::Theme;
|
||||
use ui::Root;
|
||||
|
||||
pub(crate) mod asset;
|
||||
pub(crate) mod chatspace;
|
||||
@@ -286,7 +287,6 @@ fn main() {
|
||||
// Open a window with default options
|
||||
cx.open_window(opts, |window, cx| {
|
||||
// Automatically sync theme with system appearance
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
window
|
||||
.observe_window_appearance(|window, cx| {
|
||||
Theme::sync_system_appearance(Some(window), cx);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use anyhow::{anyhow, Error};
|
||||
use async_utility::task::spawn;
|
||||
use chats::{
|
||||
@@ -8,7 +10,7 @@ use chats::{
|
||||
use common::{nip96_upload, profile::SharedProfile};
|
||||
use global::{constants::IMAGE_SERVICE, get_client};
|
||||
use gpui::{
|
||||
div, img, impl_internal_actions, list, prelude::FluentBuilder, px, relative, svg, white,
|
||||
div, img, impl_internal_actions, list, prelude::FluentBuilder, px, red, relative, svg, white,
|
||||
AnyElement, App, AppContext, Context, Element, Empty, Entity, EventEmitter, Flatten,
|
||||
FocusHandle, Focusable, InteractiveElement, IntoElement, ListAlignment, ListState, ObjectFit,
|
||||
ParentElement, PathPromptOptions, Render, SharedString, StatefulInteractiveElement, Styled,
|
||||
@@ -18,7 +20,7 @@ use nostr_sdk::prelude::*;
|
||||
use serde::Deserialize;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use smol::fs;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
dock_area::panel::{Panel, PanelEvent},
|
||||
@@ -27,7 +29,6 @@ use ui::{
|
||||
notification::Notification,
|
||||
popup_menu::PopupMenu,
|
||||
text::RichText,
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
v_flex, ContextModal, Disableable, Icon, IconName, Sizable, Size, StyledExt,
|
||||
};
|
||||
|
||||
@@ -388,7 +389,7 @@ impl Chat {
|
||||
.entry(item.id)
|
||||
.or_insert_with(|| RichText::new(item.content.to_owned(), &item.mentions));
|
||||
|
||||
this.hover(|this| this.bg(cx.theme().accent.step(cx, ColorScaleStep::ONE)))
|
||||
this.hover(|this| this.bg(cx.theme().surface_background))
|
||||
.text_sm()
|
||||
.child(
|
||||
div()
|
||||
@@ -397,10 +398,8 @@ impl Chat {
|
||||
.top_0()
|
||||
.w(px(2.))
|
||||
.h_full()
|
||||
.bg(cx.theme().transparent)
|
||||
.group_hover("", |this| {
|
||||
this.bg(cx.theme().accent.step(cx, ColorScaleStep::NINE))
|
||||
}),
|
||||
.bg(cx.theme().border_transparent)
|
||||
.group_hover("", |this| this.bg(cx.theme().element_active)),
|
||||
)
|
||||
.child(img(item.author.shared_avatar()).size_8().flex_shrink_0())
|
||||
.child(
|
||||
@@ -419,9 +418,7 @@ impl Chat {
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_color(
|
||||
cx.theme().base.step(cx, ColorScaleStep::NINE),
|
||||
)
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.child(item.ago()),
|
||||
),
|
||||
)
|
||||
@@ -437,12 +434,12 @@ impl Chat {
|
||||
.top_0()
|
||||
.w(px(2.))
|
||||
.h_full()
|
||||
.bg(cx.theme().transparent)
|
||||
.group_hover("", |this| this.bg(cx.theme().danger)),
|
||||
.bg(cx.theme().border_transparent)
|
||||
.group_hover("", |this| this.bg(red())),
|
||||
)
|
||||
.child(img("brand/avatar.png").size_8().flex_shrink_0())
|
||||
.text_sm()
|
||||
.text_color(cx.theme().danger)
|
||||
.text_color(red())
|
||||
.child(content.clone()),
|
||||
RoomMessage::Announcement => this
|
||||
.w_full()
|
||||
@@ -453,13 +450,13 @@ impl Chat {
|
||||
.justify_center()
|
||||
.text_center()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::NINE))
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.line_height(relative(1.3))
|
||||
.child(
|
||||
svg()
|
||||
.path("brand/coop.svg")
|
||||
.size_10()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::THREE)),
|
||||
.text_color(cx.theme().elevated_surface_background),
|
||||
)
|
||||
.child(DESC),
|
||||
})
|
||||
@@ -492,10 +489,12 @@ impl Panel for Chat {
|
||||
.items_center()
|
||||
.size_5()
|
||||
.rounded_full()
|
||||
.bg(cx.theme().accent.step(cx, ColorScaleStep::THREE))
|
||||
.child(Icon::new(IconName::UsersThreeFill).xsmall().text_color(
|
||||
cx.theme().accent.step(cx, ColorScaleStep::TWELVE),
|
||||
)),
|
||||
.bg(cx.theme().element_disabled)
|
||||
.child(
|
||||
Icon::new(IconName::UsersThreeFill)
|
||||
.xsmall()
|
||||
.text_color(cx.theme().icon_accent),
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
@@ -567,7 +566,7 @@ impl Render for Chat {
|
||||
))
|
||||
.size_16()
|
||||
.shadow_lg()
|
||||
.rounded(px(cx.theme().radius))
|
||||
.rounded(cx.theme().radius)
|
||||
.object_fit(ObjectFit::ScaleDown),
|
||||
)
|
||||
.child(
|
||||
@@ -580,7 +579,7 @@ impl Render for Chat {
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.rounded_full()
|
||||
.bg(cx.theme().danger)
|
||||
.bg(red())
|
||||
.child(
|
||||
Icon::new(IconName::Close)
|
||||
.size_2()
|
||||
@@ -603,9 +602,7 @@ impl Render for Chat {
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_1()
|
||||
.text_color(
|
||||
cx.theme().base.step(cx, ColorScaleStep::ELEVEN),
|
||||
)
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child(
|
||||
Button::new("upload")
|
||||
.icon(Icon::new(IconName::Upload))
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
use std::{
|
||||
collections::{BTreeSet, HashSet},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use anyhow::Error;
|
||||
use chats::ChatRegistry;
|
||||
use common::{profile::SharedProfile, random_name};
|
||||
use global::get_client;
|
||||
use gpui::{
|
||||
div, img, impl_internal_actions, prelude::FluentBuilder, px, relative, uniform_list, App,
|
||||
div, img, impl_internal_actions, prelude::FluentBuilder, px, red, relative, uniform_list, App,
|
||||
AppContext, Context, Entity, FocusHandle, InteractiveElement, IntoElement, ParentElement,
|
||||
Render, SharedString, StatefulInteractiveElement, Styled, Subscription, Task, TextAlign,
|
||||
Window,
|
||||
@@ -12,15 +17,11 @@ use nostr_sdk::prelude::*;
|
||||
use serde::Deserialize;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use smol::Timer;
|
||||
use std::{
|
||||
collections::{BTreeSet, HashSet},
|
||||
time::Duration,
|
||||
};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
dock_area::dock::DockPlacement,
|
||||
input::{InputEvent, TextInput},
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
ContextModal, Disableable, Icon, IconName, Sizable, Size, StyledExt,
|
||||
};
|
||||
|
||||
@@ -335,24 +336,18 @@ impl Render for Compose {
|
||||
div()
|
||||
.px_3()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::ELEVEN))
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child(DESCRIPTION),
|
||||
)
|
||||
.when_some(self.error_message.read(cx).as_ref(), |this, msg| {
|
||||
this.child(
|
||||
div()
|
||||
.px_3()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().danger)
|
||||
.child(msg.clone()),
|
||||
)
|
||||
this.child(div().px_3().text_xs().text_color(red()).child(msg.clone()))
|
||||
})
|
||||
.child(
|
||||
div().px_3().flex().flex_col().child(
|
||||
div()
|
||||
.h_10()
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().base.step(cx, ColorScaleStep::FIVE))
|
||||
.border_color(cx.theme().border)
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_1()
|
||||
@@ -399,9 +394,7 @@ impl Render for Compose {
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.text_color(
|
||||
cx.theme().base.step(cx, ColorScaleStep::ELEVEN),
|
||||
)
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child("Your recently contacts will appear here."),
|
||||
),
|
||||
)
|
||||
@@ -445,19 +438,13 @@ impl Render for Compose {
|
||||
this.child(
|
||||
Icon::new(IconName::CheckCircleFill)
|
||||
.small()
|
||||
.text_color(
|
||||
cx.theme().accent.step(
|
||||
cx,
|
||||
ColorScaleStep::NINE,
|
||||
),
|
||||
),
|
||||
.text_color(cx.theme().icon_accent),
|
||||
)
|
||||
})
|
||||
.hover(|this| {
|
||||
this.bg(cx
|
||||
.theme()
|
||||
.base
|
||||
.step(cx, ColorScaleStep::THREE))
|
||||
.elevated_surface_background)
|
||||
})
|
||||
.on_click(move |_, window, cx| {
|
||||
window.dispatch_action(
|
||||
|
||||
@@ -4,19 +4,19 @@ use account::Account;
|
||||
use common::create_qr;
|
||||
use global::get_client_keys;
|
||||
use gpui::{
|
||||
div, img, prelude::FluentBuilder, relative, AnyElement, App, AppContext, Context, Entity,
|
||||
div, img, prelude::FluentBuilder, red, relative, AnyElement, App, AppContext, Context, Entity,
|
||||
EventEmitter, FocusHandle, Focusable, Image, IntoElement, ParentElement, Render, SharedString,
|
||||
Styled, Subscription, Window,
|
||||
};
|
||||
use nostr_connect::prelude::*;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
dock_area::panel::{Panel, PanelEvent},
|
||||
input::{InputEvent, TextInput},
|
||||
notification::Notification,
|
||||
popup_menu::PopupMenu,
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
ContextModal, Disableable, Sizable, Size, StyledExt,
|
||||
};
|
||||
|
||||
@@ -307,9 +307,7 @@ impl Render for Login {
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_color(
|
||||
cx.theme().base.step(cx, ColorScaleStep::ELEVEN),
|
||||
)
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child("Continue with Private Key or Bunker"),
|
||||
),
|
||||
)
|
||||
@@ -334,7 +332,7 @@ impl Render for Login {
|
||||
div()
|
||||
.text_xs()
|
||||
.text_center()
|
||||
.text_color(cx.theme().danger)
|
||||
.text_color(red())
|
||||
.child(error),
|
||||
)
|
||||
}),
|
||||
@@ -348,7 +346,7 @@ impl Render for Login {
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.bg(cx.theme().base.step(cx, ColorScaleStep::TWO))
|
||||
.bg(cx.theme().surface_background)
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
@@ -364,17 +362,13 @@ impl Render for Login {
|
||||
div()
|
||||
.font_semibold()
|
||||
.line_height(relative(1.2))
|
||||
.text_color(
|
||||
cx.theme().base.step(cx, ColorScaleStep::TWELVE),
|
||||
)
|
||||
.text_color(cx.theme().text)
|
||||
.child("Continue with Nostr Connect"),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_color(
|
||||
cx.theme().base.step(cx, ColorScaleStep::ELEVEN),
|
||||
)
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child("Use Nostr Connect apps to scan the code"),
|
||||
),
|
||||
)
|
||||
@@ -391,10 +385,10 @@ impl Render for Login {
|
||||
.gap_2()
|
||||
.rounded_2xl()
|
||||
.shadow_md()
|
||||
.when(cx.theme().appearance.is_dark(), |this| {
|
||||
this.shadow_none().border_1().border_color(
|
||||
cx.theme().base.step(cx, ColorScaleStep::SIX),
|
||||
)
|
||||
.when(cx.theme().mode.is_dark(), |this| {
|
||||
this.shadow_none()
|
||||
.border_1()
|
||||
.border_color(cx.theme().border)
|
||||
})
|
||||
.bg(cx.theme().background)
|
||||
.child(img(qr).h_64()),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use account::Account;
|
||||
use async_utility::task::spawn;
|
||||
use common::nip96_upload;
|
||||
@@ -9,13 +11,12 @@ use gpui::{
|
||||
};
|
||||
use nostr_sdk::prelude::*;
|
||||
use smol::fs;
|
||||
use std::str::FromStr;
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
dock_area::panel::{Panel, PanelEvent},
|
||||
input::TextInput,
|
||||
popup_menu::PopupMenu,
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
Disableable, Icon, IconName, Sizable, Size, StyledExt,
|
||||
};
|
||||
|
||||
@@ -290,7 +291,7 @@ impl Render for NewAccount {
|
||||
.my_2()
|
||||
.w_full()
|
||||
.h_px()
|
||||
.bg(cx.theme().base.step(cx, ColorScaleStep::THREE)),
|
||||
.bg(cx.theme().elevated_surface_background),
|
||||
)
|
||||
.child(
|
||||
Button::new("submit")
|
||||
|
||||
@@ -2,11 +2,11 @@ use gpui::{
|
||||
div, relative, svg, AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle,
|
||||
Focusable, IntoElement, ParentElement, Render, SharedString, Styled, Window,
|
||||
};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
dock_area::panel::{Panel, PanelEvent},
|
||||
popup_menu::PopupMenu,
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
Icon, IconName, StyledExt,
|
||||
};
|
||||
|
||||
@@ -91,7 +91,7 @@ impl Render for Onboarding {
|
||||
svg()
|
||||
.path("brand/coop.svg")
|
||||
.size_16()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::THREE)),
|
||||
.text_color(cx.theme().elevated_surface_background),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
@@ -103,11 +103,7 @@ impl Render for Onboarding {
|
||||
.line_height(relative(1.3))
|
||||
.child(TITLE),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::ELEVEN))
|
||||
.child(SUBTITLE),
|
||||
),
|
||||
.child(div().text_color(cx.theme().text_muted).child(SUBTITLE)),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
|
||||
@@ -2,16 +2,16 @@ use async_utility::task::spawn;
|
||||
use common::nip96_upload;
|
||||
use global::{constants::IMAGE_SERVICE, get_client};
|
||||
use gpui::{
|
||||
div, img, prelude::FluentBuilder, px, App, AppContext, Context, Entity, Flatten, IntoElement,
|
||||
div, img, prelude::FluentBuilder, App, AppContext, Context, Entity, Flatten, IntoElement,
|
||||
ParentElement, PathPromptOptions, Render, Styled, Task, Window,
|
||||
};
|
||||
use nostr_sdk::prelude::*;
|
||||
use smol::fs;
|
||||
use std::{str::FromStr, time::Duration};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
input::TextInput,
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
ContextModal, Disableable, IconName, Sizable, Size,
|
||||
};
|
||||
|
||||
@@ -249,8 +249,8 @@ impl Render for Profile {
|
||||
div()
|
||||
.w_full()
|
||||
.h_32()
|
||||
.bg(cx.theme().base.step(cx, ColorScaleStep::TWO))
|
||||
.rounded(px(cx.theme().radius))
|
||||
.bg(cx.theme().surface_background)
|
||||
.rounded(cx.theme().radius)
|
||||
.flex()
|
||||
.flex_col()
|
||||
.items_center()
|
||||
|
||||
@@ -7,10 +7,10 @@ use gpui::{
|
||||
};
|
||||
use nostr_sdk::prelude::*;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
input::{InputEvent, TextInput},
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
ContextModal, Disableable, IconName, Sizable,
|
||||
};
|
||||
|
||||
@@ -241,8 +241,8 @@ impl Relays {
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.rounded(px(cx.theme().radius))
|
||||
.bg(cx.theme().base.step(cx, ColorScaleStep::THREE))
|
||||
.rounded(cx.theme().radius)
|
||||
.bg(cx.theme().elevated_surface_background)
|
||||
.text_xs()
|
||||
.child(item)
|
||||
.child(
|
||||
@@ -298,7 +298,7 @@ impl Render for Relays {
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::ELEVEN))
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child(MESSAGE),
|
||||
)
|
||||
.child(
|
||||
@@ -320,7 +320,7 @@ impl Render for Relays {
|
||||
.label("Add")
|
||||
.small()
|
||||
.ghost()
|
||||
.rounded(px(cx.theme().radius))
|
||||
.rounded_md()
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
this.add(window, cx)
|
||||
})),
|
||||
|
||||
@@ -6,19 +6,19 @@ use chats::ChatRegistry;
|
||||
use common::profile::SharedProfile;
|
||||
use global::{constants::SEARCH_RELAYS, get_client};
|
||||
use gpui::{
|
||||
div, img, prelude::FluentBuilder, px, relative, uniform_list, App, AppContext, Context, Entity,
|
||||
InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled, Subscription,
|
||||
Task, Window,
|
||||
div, img, prelude::FluentBuilder, px, red, relative, uniform_list, App, AppContext, Context,
|
||||
Entity, InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled,
|
||||
Subscription, Task, Window,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use nostr_sdk::prelude::*;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
dock_area::dock::DockPlacement,
|
||||
indicator::Indicator,
|
||||
input::{InputEvent, TextInput},
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
ContextModal, Disableable, IconName, Sizable,
|
||||
};
|
||||
|
||||
@@ -202,8 +202,6 @@ impl Search {
|
||||
|
||||
impl Render for Search {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let mute_color = cx.theme().base.step(cx, ColorScaleStep::NINE);
|
||||
|
||||
div()
|
||||
.size_full()
|
||||
.flex()
|
||||
@@ -233,7 +231,7 @@ impl Render for Search {
|
||||
div()
|
||||
.px_3()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().danger)
|
||||
.text_color(red())
|
||||
.child(error.clone()),
|
||||
)
|
||||
})
|
||||
@@ -254,7 +252,7 @@ impl Render for Search {
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.text_sm()
|
||||
.text_color(mute_color)
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child("No one with that query could be found.")
|
||||
} else {
|
||||
this.child(
|
||||
@@ -278,7 +276,7 @@ impl Render for Search {
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.rounded(px(cx.theme().radius))
|
||||
.rounded(cx.theme().radius)
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
@@ -305,7 +303,10 @@ impl Render for Search {
|
||||
this.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.text_color(mute_color)
|
||||
.text_color(
|
||||
cx.theme()
|
||||
.text_muted,
|
||||
)
|
||||
.child(nip05),
|
||||
)
|
||||
},
|
||||
@@ -335,10 +336,7 @@ impl Render for Search {
|
||||
),
|
||||
)
|
||||
.hover(|this| {
|
||||
this.bg(cx
|
||||
.theme()
|
||||
.base
|
||||
.step(cx, ColorScaleStep::THREE))
|
||||
this.bg(cx.theme().elevated_surface_background)
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use gpui::{
|
||||
div, prelude::FluentBuilder, px, App, ClickEvent, Div, InteractiveElement, IntoElement,
|
||||
div, prelude::FluentBuilder, App, ClickEvent, Div, InteractiveElement, IntoElement,
|
||||
ParentElement, RenderOnce, SharedString, StatefulInteractiveElement, Styled, Window,
|
||||
};
|
||||
use ui::{
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
Icon,
|
||||
};
|
||||
use theme::ActiveTheme;
|
||||
use ui::Icon;
|
||||
|
||||
type Handler = Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
||||
|
||||
@@ -49,16 +47,12 @@ impl RenderOnce for SidebarButton {
|
||||
|
||||
self.base
|
||||
.id(self.label.clone())
|
||||
.rounded(px(cx.theme().radius))
|
||||
.rounded(cx.theme().radius)
|
||||
.when_some(self.icon, |this, icon| {
|
||||
this.child(
|
||||
div()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::ELEVEN))
|
||||
.child(icon),
|
||||
)
|
||||
this.child(div().text_color(cx.theme().text_muted).child(icon))
|
||||
})
|
||||
.child(self.label.clone())
|
||||
.hover(|this| this.bg(cx.theme().base.step(cx, ColorScaleStep::THREE)))
|
||||
.hover(|this| this.bg(cx.theme().elevated_surface_background))
|
||||
.on_click(move |ev, window, cx| handler(ev, window, cx))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use gpui::{
|
||||
div, percentage, prelude::FluentBuilder, px, App, ClickEvent, Div, Img, InteractiveElement,
|
||||
div, percentage, prelude::FluentBuilder, App, ClickEvent, Div, Img, InteractiveElement,
|
||||
IntoElement, ParentElement as _, RenderOnce, SharedString, StatefulInteractiveElement, Styled,
|
||||
Window,
|
||||
};
|
||||
use ui::{
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
tooltip::Tooltip,
|
||||
Collapsible, Icon, IconName, Sizable, StyledExt,
|
||||
};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{tooltip::Tooltip, Collapsible, Icon, IconName, Sizable, StyledExt};
|
||||
|
||||
type Handler = Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
||||
|
||||
@@ -96,9 +93,9 @@ impl RenderOnce for Parent {
|
||||
.gap_2()
|
||||
.px_2()
|
||||
.h_8()
|
||||
.rounded(px(cx.theme().radius))
|
||||
.rounded(cx.theme().radius)
|
||||
.text_sm()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::ELEVEN))
|
||||
.text_color(cx.theme().text_muted)
|
||||
.font_medium()
|
||||
.child(
|
||||
Icon::new(IconName::CaretDown)
|
||||
@@ -118,7 +115,7 @@ impl RenderOnce for Parent {
|
||||
Tooltip::new(tooltip.clone(), window, cx).into()
|
||||
})
|
||||
})
|
||||
.hover(|this| this.bg(cx.theme().base.step(cx, ColorScaleStep::THREE)))
|
||||
.hover(|this| this.bg(cx.theme().elevated_surface_background))
|
||||
.on_click(move |ev, window, cx| handler(ev, window, cx)),
|
||||
)
|
||||
.when(!self.collapsed, |this| {
|
||||
@@ -204,9 +201,9 @@ impl RenderOnce for Folder {
|
||||
.gap_2()
|
||||
.px_2()
|
||||
.h_8()
|
||||
.rounded(px(cx.theme().radius))
|
||||
.rounded(cx.theme().radius)
|
||||
.text_sm()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::ELEVEN))
|
||||
.text_color(cx.theme().text_muted)
|
||||
.font_medium()
|
||||
.child(
|
||||
Icon::new(IconName::CaretDown)
|
||||
@@ -226,7 +223,7 @@ impl RenderOnce for Folder {
|
||||
Tooltip::new(tooltip.clone(), window, cx).into()
|
||||
})
|
||||
})
|
||||
.hover(|this| this.bg(cx.theme().base.step(cx, ColorScaleStep::THREE)))
|
||||
.hover(|this| this.bg(cx.theme().elevated_surface_background))
|
||||
.on_click(move |ev, window, cx| handler(ev, window, cx)),
|
||||
)
|
||||
.when(!self.collapsed, |this| {
|
||||
@@ -291,7 +288,7 @@ impl RenderOnce for FolderItem {
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.text_sm()
|
||||
.rounded(px(cx.theme().radius))
|
||||
.rounded(cx.theme().radius)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
@@ -312,11 +309,11 @@ impl RenderOnce for FolderItem {
|
||||
.items_center()
|
||||
.size_5()
|
||||
.rounded_full()
|
||||
.bg(cx.theme().accent.step(cx, ColorScaleStep::THREE))
|
||||
.bg(cx.theme().element_disabled)
|
||||
.child(
|
||||
Icon::new(IconName::UsersThreeFill).xsmall().text_color(
|
||||
cx.theme().accent.step(cx, ColorScaleStep::TWELVE),
|
||||
),
|
||||
Icon::new(IconName::UsersThreeFill)
|
||||
.xsmall()
|
||||
.text_color(cx.theme().text_accent),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -328,11 +325,11 @@ impl RenderOnce for FolderItem {
|
||||
div()
|
||||
.flex_shrink_0()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::TEN))
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.child(description),
|
||||
)
|
||||
})
|
||||
.hover(|this| this.bg(cx.theme().base.step(cx, ColorScaleStep::THREE)))
|
||||
.hover(|this| this.bg(cx.theme().elevated_surface_background))
|
||||
.on_click(move |ev, window, cx| handler(ev, window, cx))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ use gpui::{
|
||||
ScrollHandle, SharedString, StatefulInteractiveElement, Styled, Task, Window,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonCustomVariant, ButtonVariants},
|
||||
dock_area::{
|
||||
@@ -23,7 +24,6 @@ use ui::{
|
||||
},
|
||||
popup_menu::{PopupMenu, PopupMenuExt},
|
||||
skeleton::Skeleton,
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
IconName, Sizable, StyledExt,
|
||||
};
|
||||
|
||||
@@ -305,7 +305,7 @@ impl Render for Sidebar {
|
||||
.items_center()
|
||||
.text_xs()
|
||||
.font_semibold()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::NINE))
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.child("Messages")
|
||||
.child(
|
||||
Button::new("menu")
|
||||
@@ -320,13 +320,10 @@ impl Render for Sidebar {
|
||||
.small()
|
||||
.custom(
|
||||
ButtonCustomVariant::new(window, cx)
|
||||
.foreground(
|
||||
cx.theme().base.step(cx, ColorScaleStep::NINE),
|
||||
)
|
||||
.color(cx.theme().transparent)
|
||||
.hover(cx.theme().transparent)
|
||||
.active(cx.theme().transparent)
|
||||
.border(cx.theme().transparent),
|
||||
.foreground(cx.theme().text_placeholder)
|
||||
.color(cx.theme().ghost_element_background)
|
||||
.hover(cx.theme().ghost_element_background)
|
||||
.active(cx.theme().ghost_element_background),
|
||||
)
|
||||
.on_click(cx.listener(move |this, _, _, cx| {
|
||||
this.split_into_folders(cx);
|
||||
|
||||
@@ -3,10 +3,10 @@ use gpui::{
|
||||
div, App, AppContext, Context, Entity, FocusHandle, InteractiveElement, IntoElement,
|
||||
ParentElement, Render, Styled, Window,
|
||||
};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::{Button, ButtonVariants},
|
||||
input::TextInput,
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
ContextModal, Size,
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ impl Render for Subject {
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::ELEVEN))
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child("Subject:"),
|
||||
)
|
||||
.child(self.input.clone())
|
||||
@@ -98,7 +98,7 @@ impl Render for Subject {
|
||||
div()
|
||||
.text_xs()
|
||||
.italic()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::NINE))
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.child(HELP_TEXT),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -2,11 +2,11 @@ use gpui::{
|
||||
div, svg, AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
IntoElement, ParentElement, Render, SharedString, Styled, Window,
|
||||
};
|
||||
use theme::ActiveTheme;
|
||||
use ui::{
|
||||
button::Button,
|
||||
dock_area::panel::{Panel, PanelEvent},
|
||||
popup_menu::PopupMenu,
|
||||
theme::{scale::ColorScaleStep, ActiveTheme},
|
||||
StyledExt,
|
||||
};
|
||||
|
||||
@@ -87,12 +87,12 @@ impl Render for Welcome {
|
||||
svg()
|
||||
.path("brand/coop.svg")
|
||||
.size_12()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::THREE)),
|
||||
.text_color(cx.theme().elevated_surface_background),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.child("coop on nostr.")
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::NINE))
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.font_semibold()
|
||||
.text_sm(),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user