Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Improve about panel, add Feedback help menu item
Ilya685d5b60127a
diff --git a/apps/desktop-gpui/locales/de.toml b/apps/desktop-gpui/locales/de.tomlindex 7efe52697..f79661958 100644--- a/apps/desktop-gpui/locales/de.toml+++ b/apps/desktop-gpui/locales/de.toml@@ -24,6 +24,11 @@ quit = "Cap beenden"services = "Dienste"settings = "Einstellungen…"+[menu.about]+licensed = "Lizenziert unter AGPL-3.0"+website = "Website"+commit = "Commit"+[menu.file]close_window = "Fenster schließen"title = "Ablage"@@ -52,6 +57,7 @@ zoom = "Zoomen"[menu.help]title = "Hilfe"+feedback = "Feedback geben…"changelog = "Änderungsprotokoll"dashboard = "Dashboard"documentation = "Dokumentation"diff --git a/apps/desktop-gpui/locales/en.toml b/apps/desktop-gpui/locales/en.tomlindex d6cb83384..a7d40c0e7 100644--- a/apps/desktop-gpui/locales/en.toml+++ b/apps/desktop-gpui/locales/en.toml@@ -24,6 +24,11 @@ quit = "Quit Cap"services = "Services"settings = "Settings…"+[menu.about]+licensed = "Licensed under AGPL-3.0"+website = "Website"+commit = "Commit"+[menu.file]close_window = "Close Window"title = "File"@@ -52,6 +57,7 @@ zoom = "Zoom"[menu.help]title = "Help"+feedback = "Give Feedback…"changelog = "Changelog"dashboard = "Dashboard"documentation = "Documentation"diff --git a/apps/desktop-gpui/locales/es.toml b/apps/desktop-gpui/locales/es.tomlindex 8d89271b9..0f1b11c61 100644--- a/apps/desktop-gpui/locales/es.toml+++ b/apps/desktop-gpui/locales/es.toml@@ -24,6 +24,11 @@ quit = "Salir de Cap"services = "Servicios"settings = "Ajustes…"+[menu.about]+licensed = "Licenciado bajo AGPL-3.0"+website = "Sitio web"+commit = "Commit"+[menu.file]close_window = "Cerrar ventana"title = "Archivo"@@ -52,6 +57,7 @@ zoom = "Zoom"[menu.help]title = "Ayuda"+feedback = "Dar comentarios…"changelog = "Registro de cambios"dashboard = "Panel"documentation = "Documentación"diff --git a/apps/desktop-gpui/locales/fr.toml b/apps/desktop-gpui/locales/fr.tomlindex 84c3fed94..2c8c84c77 100644--- a/apps/desktop-gpui/locales/fr.toml+++ b/apps/desktop-gpui/locales/fr.toml@@ -24,6 +24,11 @@ quit = "Quitter Cap"services = "Services"settings = "Paramètres…"+[menu.about]+licensed = "Sous licence AGPL-3.0"+website = "Site web"+commit = "Commit"+[menu.file]close_window = "Fermer la fenêtre"title = "Fichier"@@ -52,6 +57,7 @@ zoom = "Réduire/agrandir"[menu.help]title = "Aide"+feedback = "Donner son avis…"changelog = "Journal des modifications"dashboard = "Tableau de bord"documentation = "Documentation"diff --git a/apps/desktop-gpui/locales/hi.toml b/apps/desktop-gpui/locales/hi.tomlindex 894c461c4..9d5f2611f 100644--- a/apps/desktop-gpui/locales/hi.toml+++ b/apps/desktop-gpui/locales/hi.toml@@ -24,6 +24,11 @@ quit = "Cap से बाहर निकलें"services = "सेवाएँ"settings = "सेटिंग्स…"+[menu.about]+licensed = "AGPL-3.0 के अंतर्गत लाइसेंस प्राप्त"+website = "वेबसाइट"+commit = "कमिट"+[menu.file]close_window = "विंडो बंद करें"title = "फ़ाइल"@@ -52,6 +57,7 @@ zoom = "ज़ूम करें"[menu.help]title = "सहायता"+feedback = "प्रतिक्रिया दें…"changelog = "चेंजलॉग"dashboard = "डैशबोर्ड"documentation = "दस्तावेज़ीकरण"diff --git a/apps/desktop-gpui/locales/ja.toml b/apps/desktop-gpui/locales/ja.tomlindex a79e312d4..7bd47eb33 100644--- a/apps/desktop-gpui/locales/ja.toml+++ b/apps/desktop-gpui/locales/ja.toml@@ -24,6 +24,11 @@ quit = "Capを終了"services = "サービス"settings = "設定…"+[menu.about]+licensed = "AGPL-3.0ライセンス"+website = "ウェブサイト"+commit = "コミット"+[menu.file]close_window = "ウィンドウを閉じる"title = "ファイル"@@ -52,6 +57,7 @@ zoom = "拡大/縮小"[menu.help]title = "ヘルプ"+feedback = "フィードバックを送る…"changelog = "変更履歴"dashboard = "ダッシュボード"documentation = "ドキュメント"diff --git a/apps/desktop-gpui/locales/zh-CN.toml b/apps/desktop-gpui/locales/zh-CN.tomlindex 8891d3c7e..1f13215db 100644--- a/apps/desktop-gpui/locales/zh-CN.toml+++ b/apps/desktop-gpui/locales/zh-CN.toml@@ -24,6 +24,11 @@ quit = "退出 Cap"services = "服务"settings = "设置…"+[menu.about]+licensed = "基于 AGPL-3.0 许可"+website = "网站"+commit = "提交"+[menu.file]close_window = "关闭窗口"title = "文件"@@ -52,6 +57,7 @@ zoom = "缩放"[menu.help]title = "帮助"+feedback = "提供反馈…"changelog = "更新日志"dashboard = "仪表盘"documentation = "文档"diff --git a/apps/desktop-gpui/src/menus.rs b/apps/desktop-gpui/src/menus.rsindex 6e50cb5e4..64b6ab374 100644--- a/apps/desktop-gpui/src/menus.rs+++ b/apps/desktop-gpui/src/menus.rs@@ -150,6 +150,7 @@ actions!(HelpCenter,HelpStatus,HelpDiscord,+ HelpFeedback,/// `PredefinedMenuItem::close_window` -- ⌘W. Present twice in the/// Tauri menu (File and Window), one action either way.CloseWindow,@@ -217,6 +218,9 @@ pub fn init(cx: &mut App) {cx.on_action(|_: &HelpCenter, cx: &mut App| cx.open_url("https://help.cap.so/"));cx.on_action(|_: &HelpStatus, cx: &mut App| cx.open_url("https://cap.openstatus.dev/"));cx.on_action(|_: &HelpDiscord, cx: &mut App| cx.open_url("https://cap.link/discord"));+ cx.on_action(|_: &HelpFeedback, cx: &mut App| {+ app_windows::open_settings(crate::settings_window::Page::Feedback, cx)+ });cx.on_action(|_: &CloseWindow, cx: &mut App| close_key_window(cx));cx.on_action(|_: &Minimize, cx: &mut App| with_key_native(cx, platform::minimize_native));cx.on_action(|_: &Zoom, cx: &mut App| with_key_native(cx, platform::zoom_native));@@ -428,6 +432,8 @@ pub fn build_menus(update_status: &updates::UpdateStatus, settings_enabled: boolname: tr::menu::help::title().into(),disabled: false,items: vec![+ MenuItem::action(tr::menu::help::feedback(), HelpFeedback),+ MenuItem::separator(),MenuItem::action(tr::menu::help::changelog(), Changelog),MenuItem::separator(),MenuItem::action(tr::menu::help::dashboard(), HelpDashboard),@@ -1277,6 +1283,8 @@ mod tests {("Help".into(),vec![+ "Feedback".into(),+ "-".into(),"Changelog".into(),"-".into(),"Dashboard".into(),diff --git a/apps/desktop-gpui/src/platform.rs b/apps/desktop-gpui/src/platform.rsindex e24b9d1d5..fece25060 100644--- a/apps/desktop-gpui/src/platform.rs+++ b/apps/desktop-gpui/src/platform.rs@@ -707,6 +707,8 @@ mod mac {const SETTINGS_ROW: isize = 3;const FILE_MENU: isize = 1;const OPEN_RECENT_ROW: isize = 1;+ const HELP_MENU: isize = 5;+ const FEEDBACK_ROW: isize = 0;/// `PredefinedMenuItem::about`, which on macOS is `orderFrontStandardAboutPanelWithOptions:`./// Ordering a window front re-enters gpui's window callbacks, so call it@@ -747,26 +749,37 @@ mod mac {}}- const ABOUT_CREDITS: &[(&str, Option<&str>)] = &[- ("Copyright \u{a9} 2023-present Cap Software, Inc.", None),- (- "Licensed under AGPL-3.0",- Some("https://github.com/CapSoftware/Cap/blob/main/LICENSE"),- ),- ("Website", Some("https://cap.so")),- ("Documentation", Some("https://cap.so/docs")),- ("Help Center", Some("https://help.cap.so/")),- ("Discord Community", Some("https://cap.link/discord")),- ("GitHub", Some("https://github.com/CapSoftware/Cap")),- (- "Report an Issue",- Some("https://github.com/CapSoftware/Cap/issues"),- ),- ];+ /// Each entry is one centred line. A `Some` URL makes the line a link.+ /// Kept short: a long credits block makes AppKit add a scroll view.+ fn about_credit_lines() -> Vec<(String, Option<&'static str>)> {+ use crate::i18n::tr;+ vec![+ (+ "Copyright \u{a9} 2023-present Cap Software, Inc.".into(),+ None,+ ),+ (+ tr::menu::about::licensed().into(),+ Some("https://github.com/CapSoftware/Cap/blob/main/LICENSE"),+ ),+ (tr::menu::about::website().into(), Some("https://cap.so")),+ ]+ }++ const COMMIT_FONT_SIZE: f64 = 10.0;++ /// The build's commit, when the build recorded one.+ fn commit_line() -> Option<String> {+ option_env!("CAP_BUILD_REVISION").map(|revision| {+ let short = &revision[..revision.len().min(7)];+ format!("{}: {short}", crate::i18n::tr::menu::about::commit())+ })+ }fn about_credits() -> Retained<objc2_foundation::NSMutableAttributedString> {use objc2::{AnyThread, ClassType};use objc2_app_kit::{+ NSColor, NSFont, NSFontAttributeName, NSForegroundColorAttributeName,NSLinkAttributeName, NSMutableParagraphStyle, NSParagraphStyleAttributeName,NSTextAlignment,};@@ -776,10 +789,20 @@ mod mac {let style = NSMutableParagraphStyle::new();style.setAlignment(NSTextAlignment::Center);- let paragraph: &AnyObject = style.as_super();+ let centred: &AnyObject = style.as_super();++ let spaced = NSMutableParagraphStyle::new();+ spaced.setAlignment(NSTextAlignment::Center);+ spaced.setParagraphSpacing(12.0);+ let spaced: &AnyObject = spaced.as_super();++ let commit_style = NSMutableParagraphStyle::new();+ commit_style.setAlignment(NSTextAlignment::Center);+ commit_style.setParagraphSpacingBefore(12.0);+ let commit_style: &AnyObject = commit_style.as_super();let credits = NSMutableAttributedString::from_nsstring(&NSString::from_str(""));- for (text, link) in ABOUT_CREDITS {+ let append = |text: &str, link: Option<&str>, paragraph: &AnyObject, subdued: bool| {let line_text = NSString::from_str(&format!("{text}\n"));let link = link.and_then(|url| NSURL::URLWithString(&NSString::from_str(url)));@@ -789,6 +812,16 @@ mod mac {keys.push(unsafe { NSLinkAttributeName });values.push(link.as_super());}+ let color;+ let font;+ if subdued {+ color = NSColor::tertiaryLabelColor();+ font = NSFont::systemFontOfSize(COMMIT_FONT_SIZE);+ keys.push(unsafe { NSForegroundColorAttributeName });+ values.push(color.as_super());+ keys.push(unsafe { NSFontAttributeName });+ values.push(font.as_super());+ }let attributes = NSDictionary::from_slices(&keys, &values);let line = unsafe {NSAttributedString::initWithString_attributes(@@ -798,6 +831,15 @@ mod mac {)};credits.appendAttributedString(&line);+ };++ let lines = about_credit_lines();+ for (index, (text, link)) in lines.iter().enumerate() {+ let paragraph = if index == 0 { spaced } else { centred };+ append(text, *link, paragraph, false);+ }+ if let Some(commit) = commit_line() {+ append(&commit, None, commit_style, true);}credits}@@ -837,6 +879,14 @@ mod mac {set_nsmenu_system_symbol(&settings, "gear");set_nsmenu_item_prefers_visible_image(&settings);}+ if let Some(feedback) = main_menu+ .itemAtIndex(HELP_MENU)+ .and_then(|item| item.submenu())+ .and_then(|menu| menu.itemAtIndex(FEEDBACK_ROW))+ {+ set_nsmenu_system_symbol(&feedback, "exclamationmark.bubble");+ set_nsmenu_item_prefers_visible_image(&feedback);+ }if let Some(quit) = &app_menu.numberOfItems().checked_sub(1)