1
1
use crate :: { color, component:: text, icon, image, theme, widget:: * } ;
2
2
use iced:: {
3
- widget:: { column, container, row, text :: IntoFragment , tooltip} ,
3
+ widget:: { column, container, row, tooltip} ,
4
4
Alignment , Length ,
5
5
} ;
6
+ use std:: borrow:: Cow ;
6
7
use std:: fmt:: Display ;
7
8
8
9
pub fn locked_hardware_wallet < ' a , T : ' a , K : Display > (
9
10
kind : K ,
10
- pairing_code : Option < impl IntoFragment < ' a > > ,
11
+ pairing_code : Option < impl Into < Cow < ' a , str > > + Display > ,
11
12
) -> Container < ' a , T > {
12
13
Container :: new (
13
14
column ( vec ! [
@@ -37,7 +38,7 @@ pub fn supported_hardware_wallet<'a, T: 'a, K: Display, V: Display, F: Display>(
37
38
kind : K ,
38
39
version : Option < V > ,
39
40
fingerprint : F ,
40
- alias : Option < impl IntoFragment < ' a > > ,
41
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
41
42
) -> Container < ' a , T > {
42
43
Container :: new (
43
44
column ( vec ! [
@@ -61,8 +62,8 @@ pub fn warning_hardware_wallet<'a, T: 'static, K: Display, V: Display, F: Displa
61
62
kind : K ,
62
63
version : Option < V > ,
63
64
fingerprint : F ,
64
- alias : Option < impl IntoFragment < ' a > > ,
65
- warning : & ' static str ,
65
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
66
+ warning : & ' a str ,
66
67
) -> Container < ' a , T > {
67
68
container (
68
69
row ( vec ! [
@@ -82,7 +83,7 @@ pub fn warning_hardware_wallet<'a, T: 'static, K: Display, V: Display, F: Displa
82
83
. into( ) ,
83
84
column( vec![ tooltip:: Tooltip :: new(
84
85
icon:: warning_icon( ) ,
85
- warning,
86
+ iced :: widget :: text! ( "{}" , warning) ,
86
87
tooltip:: Position :: Bottom ,
87
88
)
88
89
. style( theme:: card:: simple)
@@ -155,7 +156,7 @@ pub fn processing_hardware_wallet<'a, T: 'a, K: Display, V: Display, F: Display>
155
156
kind : K ,
156
157
version : Option < V > ,
157
158
fingerprint : F ,
158
- alias : Option < impl IntoFragment < ' a > > ,
159
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
159
160
) -> Container < ' a , T > {
160
161
container (
161
162
row ( vec ! [
@@ -184,36 +185,43 @@ pub fn processing_hardware_wallet<'a, T: 'a, K: Display, V: Display, F: Display>
184
185
. padding ( 10 )
185
186
}
186
187
187
- pub fn selected_hardware_wallet < T : ' static , K : Display , V : Display , F : Display > (
188
+ pub fn selected_hardware_wallet < ' a , T : ' a , K : Display , V : Display , F : Display > (
188
189
kind : K ,
189
190
version : Option < V > ,
190
191
fingerprint : F ,
191
- alias : Option < impl IntoFragment < ' static > > ,
192
- warning : Option < & ' static str > ,
193
- ) -> Container < ' static , T > {
192
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
193
+ warning : Option < impl Into < Cow < ' a , str > > + Display > ,
194
+ ) -> Container < ' a , T > {
194
195
container (
195
- Row :: new ( )
196
- . push (
197
- column ( vec ! [
198
- Row :: new( )
199
- . spacing( 5 )
200
- . push_maybe( alias. map( |a| text:: p1_bold( a) ) )
201
- . push( text:: p1_regular( format!( "#{}" , fingerprint) ) )
202
- . into( ) ,
203
- Row :: new( )
204
- . spacing( 5 )
205
- . push( text:: caption( kind. to_string( ) ) )
206
- . push_maybe( version. map( |v| text:: caption( v. to_string( ) ) ) )
207
- . into( ) ,
208
- ] )
209
- . width ( Length :: Fill ) ,
210
- )
211
- . push_maybe ( warning. map ( |w| {
212
- tooltip:: Tooltip :: new ( icon:: warning_icon ( ) , w, tooltip:: Position :: Bottom )
213
- . style ( theme:: card:: simple)
214
- } ) )
215
- . push ( image:: success_mark_icon ( ) . width ( Length :: Fixed ( 50.0 ) ) )
216
- . align_y ( Alignment :: Center ) ,
196
+ row ( vec ! [
197
+ column( vec![
198
+ Row :: new( )
199
+ . spacing( 5 )
200
+ . push_maybe( alias. map( text:: p1_bold) )
201
+ . push( text:: p1_regular( format!( "#{}" , fingerprint) ) )
202
+ . into( ) ,
203
+ Row :: new( )
204
+ . spacing( 5 )
205
+ . push( text:: caption( kind. to_string( ) ) )
206
+ . push_maybe( version. map( |v| text:: caption( v) ) )
207
+ . into( ) ,
208
+ ] )
209
+ . width( Length :: Fill )
210
+ . into( ) ,
211
+ // if let Some(w) = warning {
212
+ // tooltip::Tooltip::new(
213
+ // icon::warning_icon(),
214
+ // iced::widget::text!("{}", w),
215
+ // tooltip::Position::Bottom,
216
+ // )
217
+ // .style(theme::card::simple)
218
+ // .into()
219
+ // } else {
220
+ // Row::new().into()
221
+ // },
222
+ image:: success_mark_icon( ) . width( Length :: Fixed ( 50.0 ) ) . into( ) ,
223
+ ] )
224
+ . align_y ( Alignment :: Center ) ,
217
225
)
218
226
. padding ( 10 )
219
227
}
@@ -222,7 +230,7 @@ pub fn sign_success_hardware_wallet<'a, T: 'a, K: Display, V: Display, F: Displa
222
230
kind : K ,
223
231
version : Option < V > ,
224
232
fingerprint : F ,
225
- alias : Option < impl IntoFragment < ' a > > ,
233
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
226
234
) -> Container < ' a , T > {
227
235
container (
228
236
row ( vec ! [
@@ -257,7 +265,7 @@ pub fn registration_success_hardware_wallet<'a, T: 'a, K: Display, V: Display, F
257
265
kind : K ,
258
266
version : Option < V > ,
259
267
fingerprint : F ,
260
- alias : Option < impl IntoFragment < ' a > > ,
268
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
261
269
) -> Container < ' a , T > {
262
270
container (
263
271
row ( vec ! [
@@ -385,7 +393,7 @@ pub fn unsupported_version_hardware_wallet<'a, T: 'static, K: Display, V: Displa
385
393
386
394
pub fn sign_success_hot_signer < ' a , T : ' a , F : Display > (
387
395
fingerprint : F ,
388
- alias : Option < impl IntoFragment < ' a > > ,
396
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
389
397
) -> Container < ' a , T > {
390
398
container (
391
399
row ( vec ! [
@@ -417,7 +425,7 @@ pub fn sign_success_hot_signer<'a, T: 'a, F: Display>(
417
425
418
426
pub fn selected_hot_signer < ' a , T : ' a , F : Display > (
419
427
fingerprint : F ,
420
- alias : Option < impl IntoFragment < ' a > > ,
428
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
421
429
) -> Container < ' a , T > {
422
430
container (
423
431
row ( vec ! [
@@ -446,7 +454,7 @@ pub fn selected_hot_signer<'a, T: 'a, F: Display>(
446
454
447
455
pub fn unselected_hot_signer < ' a , T : ' a , F : Display > (
448
456
fingerprint : F ,
449
- alias : Option < impl IntoFragment < ' a > > ,
457
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
450
458
) -> Container < ' a , T > {
451
459
Container :: new (
452
460
column ( vec ! [
@@ -470,7 +478,7 @@ pub fn unselected_hot_signer<'a, T: 'a, F: Display>(
470
478
471
479
pub fn hot_signer < ' a , T : ' a , F : Display > (
472
480
fingerprint : F ,
473
- alias : Option < impl IntoFragment < ' a > > ,
481
+ alias : Option < impl Into < Cow < ' a , str > > + Display > ,
474
482
) -> Container < ' a , T > {
475
483
Container :: new (
476
484
column ( vec ! [
0 commit comments