From b46666a703e2f1111b59dc5dd396d8e3533d5388 Mon Sep 17 00:00:00 2001 From: Albin Chaboissier Date: Fri, 28 Nov 2025 17:52:13 +0100 Subject: [PATCH] Indicators --- assets/Makefile | 3 +- assets/a.bmp | Bin 0 -> 4278 bytes assets/a.svg | 52 ++++++++++++ assets/co2-icon.bmp | Bin 4278 -> 4278 bytes assets/co2-icon.svg | 58 +++++++------ assets/humidity-icon.bmp | Bin 4278 -> 4278 bytes assets/humidity-icon.svg | 40 ++++++--- assets/indic-falling.bmp | Bin 0 -> 538 bytes assets/indic-falling.svg | 97 +++++++++++++++++++++ assets/indic-rising.bmp | Bin 4278 -> 538 bytes assets/indic-rising.svg | 2 +- assets/indic-steady.bmp | Bin 0 -> 538 bytes assets/indic-steady.svg | 97 +++++++++++++++++++++ assets/temperature-icon.bmp | Bin 4278 -> 4278 bytes assets/temperature-icon.svg | 164 +++++++++++++++++++----------------- assets/voc-icon.bmp | Bin 4278 -> 4278 bytes assets/voc-icon.svg | 21 +++-- src/images.rs | 12 ++- src/main.rs | 57 +++++++++---- 19 files changed, 463 insertions(+), 140 deletions(-) create mode 100644 assets/a.bmp create mode 100644 assets/a.svg create mode 100644 assets/indic-falling.bmp create mode 100644 assets/indic-falling.svg create mode 100644 assets/indic-steady.bmp create mode 100644 assets/indic-steady.svg diff --git a/assets/Makefile b/assets/Makefile index a260f5c..c4b9027 100644 --- a/assets/Makefile +++ b/assets/Makefile @@ -1,6 +1,5 @@ SVGS = $(wildcard ./*.svg) TARGET_BMPS = $(SVGS:.svg=.bmp) -SIZE = 45 BACKCOLOR = 080808 .PHONY: all @@ -15,5 +14,5 @@ clean: @convert $< -background "#$(BACKCOLOR)" -alpha remove -define bmp:subtype=RGB565 $@ %.png: %.svg - inkscape -h $(SIZE) -w $(SIZE) $< -o $@ + inkscape $< -o $@ diff --git a/assets/a.bmp b/assets/a.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3141fb54f0646a900271f71cf436457ce7a00e35 GIT binary patch literal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m6Z4UbQ>%WAzpKq`j{JO$Q>Qu z*Rh)_yWS_VE3GnPxavv#`T$fgQG?MKjqOh6UkHAe#RbgQncGh&t24a{-^`9Qjv(72 zF@$dxVJ9NwQdza0u&Sc0`UJ#z?7Dgr*`7>I?9x8P_#`B!X4GhR>=Dilq}~a8Fvo?B zE7;%#R%Hct#L-)1Ykx2bqEQrtvMw-6(X#`Xk$ zY)@Xu;c9$l7HNT%$ML!-TdOpCm-{#DcpdE4?X!o8+|l`}Dht6urbY_-;uglqE=IBB~USS|Ykc4A&tnWq=_aa#MzMVS?e7OhHH$QdOx7 z$($t%ERoPL0$H+jMQjZ1Kp8S2K_~pb&pF4J^e%*M$=BuVZ~OWA`Tu{rPd?-={JjzX zZSmX>pNy5ah-lvv`9 z&Se>o!tQgQM!2fAO_sqj=PK+W0X&cSw15_bJEh^?0ZV2>4jeB}*W)BJID(#YP5i`Fo zY>(a6;vp?IoLS+j_czKkmY`PI@kF%MLT@_kGcGf>A>tn_pdRkjr81JETi6rvSY#vA zEFJb1W>$elDll7SS3I{M=HfB9I8Fek!M@Dg;34MQP*jDn?Neu(8)d=#C>Gy~u|aF! z$j~MSUFyPnSL_l{nFk}ROA<+Ha*DZQ#{MK52xUv+W*Q+%q${*w$9>#!8#OBmrQx1W z!U`v`;T&!DVy5bK_(!3H$3WvGY?mK7bqd(~G^!jDyN?{&Y?75X?DCRbz-m%JUdhBET76c~ATPk`G*6U1Y4pBIlX+v2Z*|@g zmf5;a?5a?|J2!WB46n{g#fk2Vx4RhWvsLd0=Df<2_!{-SoHwHT + id="layer1" + transform="translate(0.08272917,0.15224179)"> + 2 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.74984px;font-family:'ProFont IIx Nerd Font Propo';-inkscape-font-specification:'ProFont IIx Nerd Font Propo';fill:#00ade7;fill-opacity:1;stroke-width:0.296867" + x="9.2658949" + y="8.814003">2 C + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.34054px;font-family:'ProFont IIx Nerd Font Propo';-inkscape-font-specification:'ProFont IIx Nerd Font Propo';fill:#00ade7;fill-opacity:1;stroke-width:0.458785" + x="0.056607485" + y="9.7028713">C O + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.34054px;font-family:'ProFont IIx Nerd Font Propo';-inkscape-font-specification:'ProFont IIx Nerd Font Propo';fill:#00ade7;fill-opacity:1;stroke-width:0.458785" + x="4.6601677" + y="7.3943286">O diff --git a/assets/humidity-icon.bmp b/assets/humidity-icon.bmp index 320db13d5decdb7297a767691619d61e4d12a8a9..1b72f132b9844665258e14db5748c01b518eb164 100644 GIT binary patch literal 4278 zcmb7`J#X7E5QashXrT^8grb9%6a+-uL%TF{mn?CdWN7Ek*&=^r?b@YFfY@=6KhngJ zva~;$=xOe<*J9zkfEq_0k*W1TS1lz$@*?v<# z|M8-_%5L@f7X-hb1;Ojb?%w{#v-9tN2On;CUhRDOBX)OpU!I(t^vdh$_4Rf5{`t?X z!Kd?gX1cyVp`Egw$o8+2qd1Kx(KMPwX*`NmhdGICWA|kmFT-3E@Xf_COyge53QcS! zClRO8HF7bFn)rTp8fT!DQf)gEY3#G9o2}$Lvh&+o^T=&~7rQ5~!Zsd0zY1Npsk4<_ zddYt4FT=X_I{U(54ILFjsb?!Wl;bjTP`B>QB5rriK8pFQWq9C-wFAf79Wk#WTgf|6 zbT1|~HCA29blfq!AbZS4b0wBrwT{{NF({{OB{NXnq}i-81@B~_oU%utVg=(2i{F)8 zfu0djPT4cia7adRBJHF1FNl9An<}^q>HOw4wd9J-vuq`4^v%io&E$mT2fK$XyAN!C z2CA=g3VyP?!Lkp4-PPK9C5!>PVxoo->hYdYF@Gp0GAaBr3?oeh1}!iS>fMEoCS2 z5|l5=`x%w|j#UD^glvrQLL9f`6x=n1u=_@9KsHyN30I9Z+ItdD84DI$oXzd$s<9QD z*X&$STf1~8+#cxE4LiR_kwDmacykoVh`mnn3stGi^d_d zbS~^pH{`l6t0%n1uHf9%W2b>aoI2ylrCam)dGKakJyp$SzB=M#D|rjqr4WmU6QyGN zs}Q&ARjoCumXDpteP+`_Xnp*BvRdTX75r>nPcT<#jWjk2k&6-YvL*X`X-44r0J*x? zeC}$}tyjRji}W$u<3^FWx3Lq6Cn8IqwvgLwQYqm6(|ljt8O{3Mu3Mky7m(LA*;YkL v!*&<8o^eL#-N@Z^S87aM>|%{-MpxZ>w9cwsE3_WJ2|JOlY+Gq`{RY8*F9fa} literal 4278 zcmc(iJ&zJW7{_;VMrUmfVrK7WGX=aV3KftT^y51(#-{62sG{p|VK;1_E)o6ox4?n`kzPSZ4e^Ys4Y z{Nrtdh8OLl!wYd9@rU~UfA)xPc_VDGE7oF-aLY$tb3LYez%RlHTWjA5y9ftI-r!;< zycXsfb^o4R%;DO>x3iZ#+i@3yvf)cU6URnaXS#cmvALCQV{bVrZn2qR^o(C2KWAIR z^CI@l>{Fp5xUiNvJ4fbmoeWO$9PDA>>SF)nYPNagI zxiW%yhwU|vQ+=6MMQV8aTcT1{oxt`f;!IM}d;*v7l=$C8~p*b8azhtb`a>~apc^wKlPxxPbpUFJZo zV&)WlSUKy;NHtF8(rQx{SB%1#L$y%rgvyRM)J8Q2Xx{dAB{fYHi|DoCR9Ypiq&&tN zQLYeW-EEwmtxlP=LryNVRk_TL#7?BBIvMMD+Ps6cL|3D;BMy=1yJA62?i;LVVvlgG zzw=NID`(D3YmkXe(Q2xJs=Wtj4|7JC+2r|@wH?~q7$3H%GP5I2iqsWZRo#^FYM-5r z9dXEqwRP77@w8_4JhQVSvF|IQF=tDIUFPU-SJig0W85`mS`>`Xhdo2&?d|4bM?67q zO_faQVD28Ts za>tI|*WT1`g;4>uI(Nh!jVM|l-9 - - - + - + + diff --git a/assets/indic-falling.bmp b/assets/indic-falling.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c56a0358a09dd1aefcd7a4c0c584a7cf2de96c7c GIT binary patch literal 538 zcmZ?rm11H5gDxOh1H@cFECR%g3<3_t*;r4jg5uV($ds`m~H0FnVhy<*O@h9`i)@PK{N|82gr8hfIvkLMF$ug zN-Hp&U^wBZfGo-|gW(3l4TT8^F+~TE2nZtdGpvA#F|2^7M5scjgqQ_aIRm7U;R2iw zGV_8XN0Y!~gQkF{h@^z1grQbDK~+svO%+8JAZ!wF z + + + + + + + + + + + + diff --git a/assets/indic-rising.bmp b/assets/indic-rising.bmp index 704080e1d561bbaca580acf63da2f0a1059662d3..0fb32f02ba925b70b631b57e142320acd3324d73 100644 GIT binary patch literal 538 zcmZ?rm11H5gDxOh1H@cFECR%g3<3_t*;r4jg5uV($ds`m~H0FnVhy<*O@h9`i)@PK{N|82gr8hfWX5Nhb3Ta z2;C&`-150)lK`@4s^$yF7mlf#2(iNwAQ2Em=wD_C6I*5oQHf9ml35J4sSU0QB$ftN z`P>qw6GT6^bmV9fU{O>7LRC#wO%Sc3*dzdP1+q$4O-!*=%_f1Rl5IlIgxrMPgr5nu z3N4ic`Q{Cq4m$$AVFS5PlNBMN!>-8+5>w$q7GvRp_+%Aar3zFPNR$(- a@+AvIAB0rmJi~T|O^Fj(45Z%$t`7jMLxP3? literal 4278 zcmcJRv2W8r6vkcUVqcsLmJpJs5=%*2i!zuD$OD5bQjjVJm{}ar3}j$nWua26s!Qjt ziAWb_#N2=^^&enGO^_*MMPlSG*UQ;w`)tRMC&#|Km)|{q{_dQ;ryn(G`8h$~Z_#n@ z=Gc%lse-O|(fI2+TsYR<+}RGy%XVSg4D26HV7JY@{Cw=OevY^_ ze0!?rxz{}Gu1Trv+%~i6S!@@279)nQJgcXP`C|4+^FvyM$@tp0M?$)YJ=O8k6Gb3Y zKAk;pW|8r%fenl_WzyI!LsV~ctd&AfW)~sjd6Hd|#4busqsQ6p1UE-DNN&Yz=h>iu z&iowwQ;o8xI-g&xJ&WuGVfK-h$91CF0{bYmn!@Z!%IX%;__2w_+|Jl#ln&3pRA=mU z{SoHkYvvcm?rBHbSfA;@Xq#R0(DW?NnpnP#BZvj*pP(GiIz;(x6BsjntoJmwI}-Lt zqdTc@<9w3cG60Hslf+b~L3{9MYgGxZgWQ8>ktd4T<^93y;xGMz+3T!vp2oNF{)O2| z?<_vIXuFHvdH=iaf3G)LpSW%Zjx@R^1N+=2KIxiKpUj)YC)6eLCU!~7=-xQ?9Ql+e zH?hcjl&~?sr(M8#ZK&?ogUT_u24?kD^|D%*@1hvUA0jbW_SWS~lw($}!7&Ib`}LtZ zuU#MxUG(7}T%%R< z|6|{)jS`AClrJhH^K1u}QN6!Xn#>T^g!F8K^>ktWptZ-@4qS)6y>cEU$2B1%enCIR zYsQ?Ux^aIIy3grMD^FuP@Ov)LG?cA6W%1{9wgX?PS$<#0!-(smbP?M@d)Gj)ng;Uc z&`ODNaZAj0;1xVc*$GanSF6<>=jLHM(1lMD9KQ|R403keq@qXaK}eeexg}7U-9wfp fG;@Sj6n?S`SplQWipj6?vT-(kFXiRpd`bEXth$MZ diff --git a/assets/indic-rising.svg b/assets/indic-rising.svg index b2fce48..2507ddb 100644 --- a/assets/indic-rising.svg +++ b/assets/indic-rising.svg @@ -29,7 +29,7 @@ inkscape:export-bgcolor="#080808ff" inkscape:zoom="32" inkscape:cx="3.46875" - inkscape:cy="9.15625" + inkscape:cy="9.140625" inkscape:window-width="1916" inkscape:window-height="1032" inkscape:window-x="0" diff --git a/assets/indic-steady.bmp b/assets/indic-steady.bmp new file mode 100644 index 0000000000000000000000000000000000000000..af79bb947d48df4863592f79dd35082173835666 GIT binary patch literal 538 zcmZ?rm11H5gDxOh1H@cFECR%g3<3_t*;r4jg5uV($ds`m~H0FnVhy<*O@h9`i)@PK{N|82gr8hfWX5Nhb3Ta z2;C&`-150)lK`@4s^$yF7mlf#2(iNwAQ2Em=wD_C6I*5oQHf9ml35J4sSU0QB$ftN z`P>qw6GT6^1nRa-%zEs3*zpJu9(H`}nV98h*f87SD=KW5-LM!{#NlhhY*f96L3)8E lVzGk*n_IBC*^vX&Z;l)Ym54BK + + + + + + + + + + + + diff --git a/assets/temperature-icon.bmp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-9y~SDF%{Iq8 zOQj0*?aW1MY%T01ET|9NE?FCAGr`Z78}e+w)0xYPPR;R`w3p|x)BX^TNx#LqnY5W7 z_c@E?|G7=Mt(HA?=6U7%h6T<-^w`tXPOm9FF~+>4T)$1<)cz39O}QU}NessR0?oTi A{r~^~ literal 4278 zcmeH~F=*RB6hKd;v~DLsDHsarc_|)RFwNqnAZIBaGPqlygKr6VG@Sw+d_xC!2^o{g z^5~(1hf*@h9y4|+c#<>5qbL-z^#A)h`%bc?*h#loNV?O%dw2Km|9{{62R~eGzrUm#s`UHISonmoS8;X!!^h7j(?8YL&)pZhUl-2a-rn=0qodbw zKR!Dv~|PHJhiCNqr#suzk@Uv!U!rp6;FhC5v5Y z4Sw+(`|`$dned#FvH%BL)FI( zBwJuTn8ja8>>TTSn8(yIo9#5QXZr%BE4?e)4e42yaWv4Fs|nd}n@zK#Ifi}3jJ$Dg zO7uz#In<^?E6a^VHk&B246`otXr*`3b8o8Vc!(nfGJC#SVzW`(EJE4bLjpV3?bJSy zq;5-ei}X9e245^>Cq_*(^%tAnzQ8%%MkoHUCS<>DcD$F$Yx4I}+hjHwcHKI6ifvGA zZG(+c>^tP|_v$;aLSpl_a|8?lv6!1G7!T*i5YP&tR*Ve_O) z##qwe#PA(crz?VHNFL95SZP7Nq3pPsU~)+JOfq_dTH4a?kRBc0%0Ui($Q zsx=a*h(Ni8$_+s0ZOR6~iZ*6j@r2^}AkHV82Cm6daR_yJH#Y4I=B2U>xvt9hDDD@q zm;P<;A(dIA^$=3_wQL*bN6N3(&D*c0X~{1-D}w(4!4pba*(=$8CwK1 f{BHj{f$U(|o_gbzHpp_yEL1EtLZ? diff --git a/assets/temperature-icon.svg b/assets/temperature-icon.svg index be31f2b..2ada07b 100644 --- a/assets/temperature-icon.svg +++ b/assets/temperature-icon.svg @@ -1,22 +1,20 @@ - - - - - - - - - - + inkscape:current-layer="layer1" /> + + + + + + + + + + + + diff --git a/assets/voc-icon.bmp b/assets/voc-icon.bmp index 57c0fba2b139c09208bb9d46e1883991fac1feaf..7ffb243a19aa0eec52d1a6abf781569c302b24b7 100644 GIT binary patch literal 4278 zcmZ?r-6p^Q23lw0m>idgJ2*R0)8+sJYZ*FkcV=e+=Ghy4}H}L z+#x3_*ZP{#*w|P&EiFwAh}mY&oXKg+b)8uwrr!vr9YnJrbAW6WMOwj8voS-K_FeFw+Ym3yT9yBr%xmYAoT68P}AE zpoTXkCSmFwH5*r$td4@kFoM>Emc?C2X$Mw5dtyl&Af2$h3b6+g-q`9(-)xAA_tl8J zxDJ{>`;hV{LN@XovGwIpFdJL>2MgO(NM#=^FCv$Ru(A(CL&`r`td6E{SV$n~;Sna8 zUa0LP4kw5YJ<-HbRblcV=?OJV(Cf=wEO`?-AL3#YQ(q1hvw6_^53qcAItsOaK!~RU V?mwW0HzI9PgEeY4W+>7&OaL189LfLy literal 4278 zcmZ?r-6p^Q23lw0m`qFhF~BU0)8+sJYZ*FkcV=e+=Ghy4}H}L z+#x3_*ZP{#*w|P&EiFwAh}mY&oXKg+b)8uwrr!vr9YnJrbAW6|4qCxcvoS-K9$|7= zqAQ4acvu4BN>m-Gny7Avx%;?fKuaZ89Ps5*SJhnLy33~$tsq7Dxhm((#0)s#`Q zQNshoLk|<*Y}EV!;a#2s(TOa}q6iXWQN&aa%UQ$4?5?28b1>n$Vn~=E%R+4moNzW;oI#Ok6buTF@aZB_PB#oFJ~#Nk)hvSTI?b4`A-bR;OX+JXo!D zc@Ac7j64UE9WG`k39u-l!$fdPF%eiE!QdhRh<^`Dz(kN~m@Imj!1&apVR1=KGht>8 z7qeLuk6R)`i2oJ|Ad3-V!{QV@Opt3WQ2v0JjV)(k%RLY=V(YY_V)k)M-)v+EaW{)1 hvKS#Yq#VL*LqN=;4v8L@)G-xe%Bb0xp*eKJ1OOCv@Sy+z diff --git a/assets/voc-icon.svg b/assets/voc-icon.svg index 32d241c..8aec3ee 100644 --- a/assets/voc-icon.svg +++ b/assets/voc-icon.svg @@ -1,11 +1,13 @@ + + style="fill:#cacaca;fill-opacity:1;stroke:none;stroke-width:2.01407;stroke-opacity:1" /> diff --git a/src/images.rs b/src/images.rs index 2d7244a..a8b4a9f 100644 --- a/src/images.rs +++ b/src/images.rs @@ -8,6 +8,11 @@ thread_local! { pub static TEMPERATURE_ICON: UnsafeCell>> = const { UnsafeCell::new(MaybeUninit::zeroed()) }; pub static VOC_ICON: UnsafeCell>> = const { UnsafeCell::new(MaybeUninit::zeroed()) }; pub static CO2_ICON: UnsafeCell>> = const { UnsafeCell::new(MaybeUninit::zeroed()) }; + + // Tendency indicators + pub static TENDENCY_RISING: UnsafeCell>> = const { UnsafeCell::new(MaybeUninit::zeroed()) }; + pub static TENDENCY_STEADY: UnsafeCell>> = const { UnsafeCell::new(MaybeUninit::zeroed()) }; + pub static TENDENCY_FALLING: UnsafeCell>> = const { UnsafeCell::new(MaybeUninit::zeroed()) }; } macro_rules! load_image { @@ -28,12 +33,15 @@ macro_rules! get_image { }; } -pub fn prepare_images() -{ +pub fn prepare_images() { unsafe { load_image!(HUMIDITY_ICON, "../assets/humidity-icon.bmp"); load_image!(TEMPERATURE_ICON, "../assets/temperature-icon.bmp"); load_image!(VOC_ICON, "../assets/voc-icon.bmp"); load_image!(CO2_ICON, "../assets/co2-icon.bmp"); + + load_image!(TENDENCY_RISING, "../assets/indic-rising.bmp"); + load_image!(TENDENCY_STEADY, "../assets/indic-steady.bmp"); + load_image!(TENDENCY_FALLING, "../assets/indic-falling.bmp"); } } diff --git a/src/main.rs b/src/main.rs index cb7c2f1..0672883 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -#![feature(unsafe_cell_access)] +//#![feature(unsafe_cell_access)] mod images; @@ -45,13 +45,13 @@ fn main() { fn hello_view() -> impl View { VStack::new(( HStack::new(( - main_menu_indicator(MenuIndicatorType::Temperature(31.5)), - main_menu_indicator(MenuIndicatorType::Humidity(36.2)), + main_menu_indicator(MenuIndicatorType::Temperature(31.5), Tendency::Falling), + main_menu_indicator(MenuIndicatorType::Humidity(36.2), Tendency::Steady), )) .with_spacing(5), HStack::new(( - main_menu_indicator(MenuIndicatorType::Co2(1329)), - main_menu_indicator(MenuIndicatorType::Voc(29)), + main_menu_indicator(MenuIndicatorType::Co2(1329), Tendency::Rising), + main_menu_indicator(MenuIndicatorType::Voc(29), Tendency::Falling), )) .with_spacing(5), )) @@ -99,7 +99,7 @@ impl MenuIndicatorType { } } -fn main_menu_indicator(indicator_type: MenuIndicatorType) -> impl View { +fn main_menu_indicator(indicator_type: MenuIndicatorType, tendency: Tendency) -> impl View { Rectangle .corner_radius(10) .stroked(FRAME_STROKE) @@ -112,14 +112,23 @@ fn main_menu_indicator(indicator_type: MenuIndicatorType) -> impl View { VStack::new(( HStack::new(( Spacer::default(), - buoyant::view::Image::new(get_image!( - indicator_type.get_corresponding_icon() - )), + ZStack::new(( + Rectangle + .corner_radius(10) + //.stroked_offset(5, StrokeOffset::Outer) + .foreground_color(Rgb565::new(4, 9, 4)), + buoyant::view::Image::new(get_image!( + indicator_type.get_corresponding_icon() + )), + )) + .flex_frame() + .with_max_size(53, 53) + .with_min_size(53, 53), Spacer::default(), )), HStack::new(( Spacer::default(), - tendency_indicator(Tendency::Rising), + tendency_indicator(tendency), Text::new(indicator_type.get_value_str(), &PROFONT_24_POINT), Text::new( indicator_type.get_corresponding_unit_string(), @@ -145,10 +154,26 @@ pub enum Tendency { Falling, } -fn tendency_indicator(tendency: Tendency) -> impl View { - Rectangle - .foreground_color(Rgb565::WHITE) - .flex_frame() - .with_min_size(10, 20) - .with_max_size(10, 20) +impl Tendency { + pub fn get_corresponding_icon( + &self, + ) -> &'static std::thread::LocalKey>>> { + match self { + Self::Rising => &images::TENDENCY_RISING, + Self::Steady => &images::TENDENCY_STEADY, + Self::Falling => &images::TENDENCY_FALLING, + } + } +} + +fn tendency_indicator(tendency: Tendency) -> impl View { + HStack::new(( + Image::new(get_image!(tendency.get_corresponding_icon())) + .flex_frame() + .with_min_size(10, 20) + .with_max_size(10, 20), + Spacer::default(), + )) + .flex_frame() + .with_max_width(15) }