Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/align-gpui/src/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const GITHUB: &str = r#"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24
/// Export destination folder.
const FOLDER: &str = r#"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M1.75 4.25h4l1.5 1.5h7v6.5a1.25 1.25 0 0 1-1.25 1.25H3a1.25 1.25 0 0 1-1.25-1.25v-8z" fill="none" stroke="white" stroke-width="1.4" stroke-linejoin="round"/></svg>"#;

/// Heart used for the reserved support action.
/// Heart used for the support (donation) action.
const HEART: &str = r#"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M8 13.4S2.2 10.1 2.2 5.8A2.9 2.9 0 0 1 8 5.2a2.9 2.9 0 0 1 5.8.6C13.8 10.1 8 13.4 8 13.4z" fill="none" stroke="white" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round"/></svg>"#;

pub struct IconPaths {
Expand Down
2 changes: 2 additions & 0 deletions crates/align-gpui/src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
use velopack::{UpdateCheck, UpdateInfo, UpdateManager, VelopackAsset, sources::GithubSource};

pub const REPOSITORY_URL: &str = "https://github.com/FedyaLight/align";
/// One-time donation, the `custom` link in `.github/FUNDING.yml`.
pub const DONATION_URL: &str = "https://www.patreon.com/fedyalight/posts/support-once-170786295";

#[derive(Default)]
pub enum UpdateState {
Expand Down
28 changes: 9 additions & 19 deletions crates/align-gpui/src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6276,13 +6276,12 @@ fn export_support_button(
id: &'static str,
icon: String,
label: &'static str,
enabled: bool,
action: impl Fn(&mut AlignApp, &ClickEvent, &mut Window, &mut Context<AlignApp>) + 'static,
) -> impl IntoElement {
let reduced = super::motion::reduced_motion();
let accent = theme.accent;
let separator = theme.separator;
let mut button = div()
let button = div()
.id(id)
.flex_1()
.h(px(32.))
Expand All @@ -6297,20 +6296,13 @@ fn export_support_button(
.font_weight(gpui::FontWeight(550.0))
.text_color(rgb(theme.icon))
.child(svg_icon(icon, 13., theme.icon))
.child(label);
if enabled {
button = button
.cursor_pointer()
.hover(|this| this.bg(rgb(theme.button_hover)))
.active(|this| this.opacity(0.62))
.on_click(cx.listener(move |this, event, window, cx| {
action(this, event, window, cx);
}));
} else {
button = button
.opacity(0.48)
.tooltip(hover_tip("Support options coming soon.".to_string(), theme));
}
.child(label)
.cursor_pointer()
.hover(|this| this.bg(rgb(theme.button_hover)))
.active(|this| this.opacity(0.62))
.on_click(cx.listener(move |this, event, window, cx| {
action(this, event, window, cx);
}));

button.with_animation(
SharedString::from(format!("{id}-highlight")),
Expand Down Expand Up @@ -6503,7 +6495,6 @@ fn export_success_sheet(
"export-success-star",
icons().github.clone(),
"Star on GitHub",
true,
|_, _, _, cx| cx.open_url(updater::REPOSITORY_URL),
))
.child(export_support_button(
Expand All @@ -6512,8 +6503,7 @@ fn export_success_sheet(
"export-success-support",
icons().heart.clone(),
"Support Align",
false,
|_, _, _, _| {},
|_, _, _, cx| cx.open_url(updater::DONATION_URL),
)),
);

Expand Down
Loading