From 5fd2022e22fbc9029da577f3a62f5f4f65126480 Mon Sep 17 00:00:00 2001 From: GyulyVGC Date: Wed, 12 Mar 2025 23:50:17 +0100 Subject: [PATCH] update footer buttons and links --- resources/fonts/subset/icons.ttf | Bin 15940 -> 16436 bytes src/gui/components/footer.rs | 72 +++++++++++++++++++++++++---- src/translations/translations_4.rs | 8 ++++ src/utils/types/icon.rs | 10 +++- src/utils/types/web_page.rs | 18 +++++--- 5 files changed, 91 insertions(+), 17 deletions(-) diff --git a/resources/fonts/subset/icons.ttf b/resources/fonts/subset/icons.ttf index 4a725cfc64b3298ea02b265c872744ad717c7ef7..19195ac1745261fc441c39d343e92c003110872a 100644 GIT binary patch delta 1149 zcmX|AZD?C%6h7zPo15GwH_6RcbCaygSCg$@iAkGmZId*vcCOuA)h?ShC|Oz;upe<7 z(!n&Hy3#-Tqp3qChz=RUU$TyFV?XL(Y!gJMQt1!HK?{QTqkp6z^u}{9;(K`Cm-C$S zemu{6-Uk7bUE)D?_S|{?FaAxsKsUv&Y2=8Y?DUSkZt4FUjC2&W-#;8#Q0L7Z z=3a3LGdNJs;xbR^oq+Y9u-r);R36~dwgC8uJXI+laB!ApE14Px=z(l~g7Ieo8c!NO zG`=NBO$4A@X-#D&Kob}>L`c3B9oM^UyRkGO~PFJ&A29MXb zr)94{5DbM|Bhh{PwcVhty`!@$7Jnv@?CwdWNrr>H(AN){Y_6VX=j)@axqhFu*Vymb zEpD)>*BCUuYg{tkFg`S0Gd&bjV$qy1pEcjIj9Qj0Ppo6stCC-uk#0!e*m&F9w$E)( z?M3^N!{fN(JldRSUUetj758WEEt!+U@@w*jC+L~--1NGx^ox_1$jMLI|d^eOoh`e*qlzOY3w$(DciS8tIroqAz7BNUGj+IvAO&! zpLQ91I?KGFCQ2SjS(ju}@$|y0S7Uk~Z@w&;+EKbwx^wuX81mRb1?hX)IyN8Lb{ zL*jTx{Nz#NA&Y2WoVNErwy9Wg{69!X**JViO;?{oEf`>bCh}CHc882f2?J8+pE!bV zaZrmXE6QbM2L)zFQwo8!pkxukq!rlBs3$t4R~JU(Y>+43t|TE27b%hIi89a{M;gqi zML0S_i=?CRPX-Ezg@ODDhB=X6GCS^o{e?*{iL|N5h04v)~?B{m!`o0 z=un0dy{S~@M)lZU8A!HL)OGF3)fCpT1SF0KM{nK^g!*4(O8~n=xIbGEi;v5~Yd{gE zSY=ooFV&%B$LmH_q@-83&edRjpXyWX;IzAadg;90dKxA zF=aSpzX-1oo*5a-ikpXTU4U|faH$|p6E=xs94Ck1{bwJY>t}PE{=^)sOD9} z)Igf}XZ6d`1$QRgmAi)cZ)m6#t-bl{v$8+%E2<3(EWr{|k}XP~SvEkWh>+D)KMg!0 zBoE024uj;4Br*?lASUG%p7z?u+Pm6rZHGeg#{WyM7C|T3D7whT(2cmXqqy87@6qWE zMw8iMZES+g?hu@=X7>rt$(B>z(`RHFINRFh^PfB49td6tT?}_nu1-X|5bKUhx0DrW zK*>v=l$L?x89vT0@yq-czpvTU>}z|qle)C-iSE7rzW$~DhhfyPW{er6Ph^dD6UW30qdILrv+X54N;z#MN8B;%*cF1p1L4T&TkYlEs8+vd zOCe{1x?)hk0xKFpeZvj`PMS@#G})8&GkShSeF*d>Xho0^2Q_^#1_KF03kidl#-O_7 J;|~1QhJORxhU)+T diff --git a/src/gui/components/footer.rs b/src/gui/components/footer.rs index c7efcd0b..2637687c 100644 --- a/src/gui/components/footer.rs +++ b/src/gui/components/footer.rs @@ -17,6 +17,7 @@ use crate::gui::styles::types::gradient_type::GradientType; use crate::gui::styles::types::style_type::StyleType; use crate::gui::types::message::Message; use crate::translations::translations_2::new_version_available_translation; +use crate::translations::translations_4::share_feedback_translation; use crate::utils::formatted_strings::APP_VERSION; use crate::utils::types::icon::Icon; use crate::utils::types::web_page::WebPage; @@ -42,8 +43,10 @@ pub fn footer<'a>( .padding([0, 20]) .align_y(Alignment::Center) .push(release_details_row) - .push(get_button_website(font)) + .push(get_button_feedback(font, language)) + .push(get_button_wiki(font)) .push(get_button_github(font)) + .push(get_button_news(font)) .push(get_button_sponsor(font)) .push( Column::new() @@ -67,24 +70,49 @@ pub fn footer<'a>( .class(ContainerType::Gradient(color_gradient)) } -fn get_button_website<'a>(font: Font) -> Tooltip<'a, Message, StyleType> { +fn get_button_feedback<'a>(font: Font, language: Language) -> Tooltip<'a, Message, StyleType> { let content = button( - Icon::Globe + Icon::Feedback .to_text() - .size(17) + .size(15) .align_x(Alignment::Center) .align_y(Alignment::Center) .line_height(LineHeight::Relative(1.0)), ) + .padding(Padding::ZERO.top(2)) .height(30) .width(30) - .on_press(Message::OpenWebPage(WebPage::Website)); + .on_press(Message::OpenWebPage(WebPage::Issues)); Tooltip::new( content, - row_open_link_tooltip("Website", font), + row_open_link_tooltip(share_feedback_translation(language), font), Position::Top, ) + .gap(10) + .class(ContainerType::Tooltip) +} + +fn get_button_wiki<'a>(font: Font) -> Tooltip<'a, Message, StyleType> { + let content = button( + Icon::Book + .to_text() + .size(19) + .align_x(Alignment::Center) + .align_y(Alignment::Center) + .line_height(LineHeight::Relative(1.0)), + ) + .padding(Padding::ZERO.top(1)) + .height(35) + .width(35) + .on_press(Message::OpenWebPage(WebPage::Wiki)); + + Tooltip::new( + content, + row_open_link_tooltip("Sniffnet Wiki", font), + Position::Top, + ) + .gap(7.5) .class(ContainerType::Tooltip) } @@ -106,6 +134,29 @@ fn get_button_github<'a>(font: Font) -> Tooltip<'a, Message, StyleType> { row_open_link_tooltip("GitHub", font), Position::Top, ) + .gap(5) + .class(ContainerType::Tooltip) +} + +fn get_button_news<'a>(font: Font) -> Tooltip<'a, Message, StyleType> { + let content = button( + Icon::News + .to_text() + .size(16) + .align_x(Alignment::Center) + .align_y(Alignment::Center) + .line_height(LineHeight::Relative(1.0)), + ) + .height(35) + .width(35) + .on_press(Message::OpenWebPage(WebPage::WebsiteNews)); + + Tooltip::new( + content, + row_open_link_tooltip("Sniffnet News", font), + Position::Top, + ) + .gap(7.5) .class(ContainerType::Tooltip) } @@ -122,13 +173,14 @@ fn get_button_sponsor<'a>(font: Font) -> Tooltip<'a, Message, StyleType> { .padding(Padding::ZERO.top(2)) .height(30) .width(30) - .on_press(Message::OpenWebPage(WebPage::Sponsor)); + .on_press(Message::OpenWebPage(WebPage::WebsiteSponsor)); Tooltip::new( content, row_open_link_tooltip("Sponsor", font), Position::Top, ) + .gap(10) .class(ContainerType::Tooltip) } @@ -151,9 +203,10 @@ fn get_release_details<'a>( if boolean_response { // a newer release is available on GitHub let button = button( - Text::new('!'.to_string()) + Icon::Update + .to_text() .class(TextType::Danger) - .size(28) + .size(18) .align_x(Alignment::Center) .align_y(Alignment::Center) .line_height(LineHeight::Relative(0.8)), @@ -168,6 +221,7 @@ fn get_release_details<'a>( row_open_link_tooltip(new_version_available_translation(language), font), Position::Top, ) + .gap(7.5) .class(ContainerType::Tooltip); ret_val = ret_val.push(Space::with_width(10)).push(tooltip); } else { diff --git a/src/translations/translations_4.rs b/src/translations/translations_4.rs index 88ce5d98..9c731959 100644 --- a/src/translations/translations_4.rs +++ b/src/translations/translations_4.rs @@ -11,3 +11,11 @@ pub fn reserved_address_translation(language: Language, info: &str) -> String { _ => format!("Reserved address ({info})"), } } + +pub fn share_feedback_translation(language: Language) -> &'static str { + match language { + Language::EN => "Share your feedback", + Language::IT => "Condividi il tuo feedback", + _ => "Share your feedback", + } +} diff --git a/src/utils/types/icon.rs b/src/utils/types/icon.rs index 7945c600..94d0fc98 100644 --- a/src/utils/types/icon.rs +++ b/src/utils/types/icon.rs @@ -17,17 +17,19 @@ pub enum Icon { Copy, Generals, Error, + Feedback, File, Forbidden, Funnel, GitHub, - Globe, + // Globe, HalfSun, Hourglass1, Hourglass2, Hourglass3, Inspect, Lightning, + News, Notification, OpenLink, Overview, @@ -42,6 +44,7 @@ pub enum Icon { Star, ThumbnailOpen, ThumbnailClose, + Update, Warning, Waves, } @@ -64,7 +67,7 @@ impl Icon { Icon::Forbidden => 'x', Icon::Funnel => 'V', Icon::GitHub => 'H', - Icon::Globe => 'c', + // Icon::Globe => 'c', Icon::HalfSun => 'K', Icon::Hourglass1 => '1', Icon::Hourglass2 => '2', @@ -89,6 +92,9 @@ impl Icon { Icon::ThumbnailOpen => 's', Icon::ThumbnailClose => 'r', Icon::Book => 'B', + Icon::Feedback => '=', + Icon::News => '>', + Icon::Update => '<', } } diff --git a/src/utils/types/web_page.rs b/src/utils/types/web_page.rs index 168ae19a..44514926 100644 --- a/src/utils/types/web_page.rs +++ b/src/utils/types/web_page.rs @@ -3,12 +3,16 @@ pub enum WebPage { /// Sniffnet's GitHub repository. Repo, - /// Sniffnet's website main page. - Website, + // /// Sniffnet's website main page. + // Website, /// Sniffnet's website/download page. WebsiteDownload, - /// My sponsor page - Sponsor, + /// Sniffnet's website/news page. + WebsiteNews, + /// Sniffnet's website/sponsor page. + WebsiteSponsor, + /// Sniffnet issues + Issues, /// Sniffnet issue #60 on GitHub IssueLanguages, /// Sniffnet Wiki @@ -21,9 +25,11 @@ impl WebPage { pub fn get_url(&self) -> &str { match self { WebPage::Repo => "https://github.com/GyulyVGC/sniffnet", - WebPage::Website => "https://www.sniffnet.net", - WebPage::Sponsor => "https://github.com/sponsors/GyulyVGC", + // WebPage::Website => "https://www.sniffnet.net", + WebPage::WebsiteSponsor => "https://www.sniffnet.net/sponsor", WebPage::WebsiteDownload => "https://www.sniffnet.net/download", + WebPage::WebsiteNews => "https://www.sniffnet.net/news", + WebPage::Issues => "https://github.com/GyulyVGC/sniffnet/issues", WebPage::IssueLanguages => "https://github.com/GyulyVGC/sniffnet/issues/60", WebPage::Wiki => "https://github.com/GyulyVGC/sniffnet/wiki", WebPage::MyGitHub => "https://github.com/GyulyVGC",