euv_example/pages/settings/
fn.rs1use super::*;
2
3pub(crate) fn mount_settings_appearance_card(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
14 let p: ThemePalette = tokens.get_palette();
15 let scheme_sig: Signal<DesignScheme> = state.get_theme().get_scheme();
16 let mode_sig: Signal<ThemeMode> = state.get_theme().get_mode();
17 let initial_mode_idx: usize = match mode_sig.get_untracked() {
18 ThemeMode::Light => 0,
19 ThemeMode::Dark => 1,
20 };
21 let mode_sel_sig: Signal<usize> = Signal::new(initial_mode_idx);
22 let (mode_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
23 Effect::new(move || {
24 let sel: usize = mode_sel_sig.get();
25 if sel == 0 {
26 let _: bool = mode_sig.set_if_changed(ThemeMode::Light);
27 } else if sel == 1 {
28 let _: bool = mode_sig.set_if_changed(ThemeMode::Dark);
29 } else {
30 let sys: ThemeMode = use_system_theme().get();
31 let _: bool = mode_sig.set_if_changed(sys);
32 }
33 })
34 });
35 let mode_options: Vec<String> = vec![
36 MODE_LIGHT_STR.to_string(),
37 MODE_DARK_STR.to_string(),
38 MODE_SYSTEM_STR.to_string(),
39 ];
40 let mode_segmented_node: NodeId = view! {
41 EuvSegmented {
42 options: mode_options
43 selected: mode_sel_sig
44 tokens: tokens
45 }
46 };
47 let all_schemes: [DesignScheme; 17] = DesignScheme::all();
48 let scheme_buttons: Vec<NodeId> = all_schemes
49 .into_iter()
50 .map(|scheme: DesignScheme| {
51 let on_pick = move |_: &UiEvent| {
52 let _: bool = scheme_sig.set_if_changed(scheme);
53 };
54 let btn_style = move || -> Style {
55 let live: ThemeTokens = use_live_tokens(tokens);
56 let live_p: ThemePalette = live.get_palette();
57 let live_g: ThemeGeometry = live.get_geometry();
58 let active: bool = scheme_sig.get() == scheme;
59 let bg: Color = if active {
60 live_p.get_primary()
61 } else {
62 live_p.get_card()
63 };
64 let border: Color = if active {
65 live_p.get_primary()
66 } else {
67 live_p.get_border()
68 };
69 Style::default()
70 .row()
71 .width(Length::Percent(100.0))
72 .height(Length::Px(live_g.get_control_sm()))
73 .padding(Edges::symmetric(0.0, SPACE_SM))
74 .align(AlignItems::Center)
75 .gap(SPACE_SM)
76 .overflow(Overflow::Hidden)
77 .background(bg)
78 .border(live_g.get_border_width(), border)
79 .radius(live_g.get_radius_md())
80 .cursor(CursorIcon::Pointer)
81 };
82 let dot_style = move || -> Style {
83 let mode: ThemeMode = mode_sig.get();
84 let preview: ThemePalette = ThemeTokens::resolve(scheme, mode).get_palette();
85 let live_p: ThemePalette = use_live_tokens(tokens).get_palette();
86 Style::default()
87 .width(Length::Px(10.0))
88 .height(Length::Px(10.0))
89 .flex_shrink(0.0)
90 .background(preview.get_primary())
91 .border(1.0, live_p.get_border())
92 .radius(PILL_RADIUS)
93 };
94 let lbl_style = move || -> Style {
95 let live: ThemeTokens = use_live_tokens(tokens);
96 let live_p: ThemePalette = live.get_palette();
97 let active: bool = scheme_sig.get() == scheme;
98 let fg: Color = if active {
99 live_p.get_primary_foreground()
100 } else {
101 live_p.get_foreground()
102 };
103 Style::default()
104 .flex_grow(1.0)
105 .flex_shrink(1.0)
106 .min_width(Length::Px(0.0))
107 .font_size(12.5)
108 .font_weight(FontWeight::Medium)
109 .color(fg)
110 .overflow(Overflow::Hidden)
111 .text_overflow(TextOverflow::Ellipsis)
112 };
113 view! {
114 row {
115 bind_style: btn_style
116 role: A11yRole::Button
117 on_click: on_pick
118 view {
119 bind_style: dot_style
120 }
121 text {
122 bind_style: lbl_style
123 { scheme.as_str().to_string() }
124 }
125 }
126 }
127 })
128 .collect();
129 let contrast_sample_style = move || -> Style {
130 let live: ThemeTokens = use_live_tokens(tokens);
131 let live_p: ThemePalette = live.get_palette();
132 let live_g: ThemeGeometry = live.get_geometry();
133 Style::default()
134 .column()
135 .width(Length::Percent(100.0))
136 .padding(Edges::all(SPACE_MD))
137 .gap(SPACE_XS)
138 .background(live_p.get_background())
139 .border(live_g.get_border_width(), live_p.get_border())
140 .radius(live_g.get_radius_md())
141 .overflow(Overflow::Hidden)
142 };
143 let contrast_head_style = move || -> Style {
144 let live: ThemeTokens = use_live_tokens(tokens);
145 Style::default()
146 .width(Length::Percent(100.0))
147 .font_size(13.0)
148 .font_weight(FontWeight::SemiBold)
149 .color(live.get_palette().get_foreground())
150 };
151 let contrast_body_style = move || -> Style {
152 let live: ThemeTokens = use_live_tokens(tokens);
153 Style::default()
154 .width(Length::Percent(100.0))
155 .font_size(12.0)
156 .color(live.get_palette().get_muted_foreground())
157 };
158 let card_node: NodeId = view! {
159 EuvCard {
160 title: SETTINGS_APPEARANCE_TITLE.to_string()
161 tokens: tokens
162 subtitle: SETTINGS_APPEARANCE_SUB
163 column {
164 style: {
165 width: Length::Percent(100.0)
166 gap: SPACE_SM
167 }
168 text {
169 style: {
170 width: Length::Percent(100.0)
171 font_size: 13.5
172 font_weight: FontWeight::SemiBold
173 color: p.get_foreground()
174 }
175 { SETTINGS_MODE_HEADING }
176 }
177 text {
178 style: {
179 width: Length::Percent(100.0)
180 font_size: 12.0
181 color: p.get_muted_foreground()
182 }
183 { SETTINGS_MODE_SUB }
184 }
185 { mode_segmented_node }
186 }
187 column {
188 style: {
189 width: Length::Percent(100.0)
190 gap: SPACE_SM
191 }
192 text {
193 style: {
194 width: Length::Percent(100.0)
195 font_size: 13.5
196 font_weight: FontWeight::SemiBold
197 color: p.get_foreground()
198 }
199 { SETTINGS_SCHEME_HEADING }
200 }
201 text {
202 style: {
203 width: Length::Percent(100.0)
204 font_size: 12.0
205 color: p.get_muted_foreground()
206 }
207 { SETTINGS_SCHEME_SUB }
208 }
209 grid {
210 style: {
211 width: Length::Percent(100.0)
212 columns: 2
213 gap: SPACE_SM
214 }
215 ..scheme_buttons
216 }
217 }
218 column {
219 style: {
220 width: Length::Percent(100.0)
221 gap: SPACE_SM
222 }
223 text {
224 style: {
225 width: Length::Percent(100.0)
226 font_size: 13.5
227 font_weight: FontWeight::SemiBold
228 color: p.get_foreground()
229 }
230 { SETTINGS_CONTRAST_TITLE }
231 }
232 text {
233 style: {
234 width: Length::Percent(100.0)
235 font_size: 12.0
236 color: p.get_muted_foreground()
237 }
238 { SETTINGS_CONTRAST_SUB }
239 }
240 view {
241 bind_style: contrast_sample_style
242 text {
243 bind_style: contrast_head_style
244 { SETTINGS_CONTRAST_SAMPLE_HEAD }
245 }
246 text {
247 bind_style: contrast_body_style
248 { SETTINGS_CONTRAST_SAMPLE_BODY }
249 }
250 }
251 row {
252 style: {
253 width: Length::Percent(100.0)
254 flex_wrap: FlexWrap::Wrap
255 gap: SPACE_SM
256 }
257 EuvBadge {
258 label: SETTINGS_BADGE_PREVIEW_PRIMARY.to_string()
259 tone: EuvTone::Primary
260 tokens: tokens
261 }
262 EuvBadge {
263 label: SETTINGS_BADGE_PREVIEW_SUCCESS.to_string()
264 tone: EuvTone::Success
265 tokens: tokens
266 }
267 EuvBadge {
268 label: SETTINGS_BADGE_PREVIEW_WARNING.to_string()
269 tone: EuvTone::Warning
270 tokens: tokens
271 }
272 EuvBadge {
273 label: SETTINGS_BADGE_PREVIEW_DANGER.to_string()
274 tone: EuvTone::Destructive
275 tokens: tokens
276 }
277 }
278 EuvActionRow {
279 EuvButton {
280 label: SETTINGS_BTN_PREVIEW_PRI.to_string()
281 tokens: tokens
282 sm()
283 }
284 EuvButton {
285 label: SETTINGS_BTN_PREVIEW_SEC.to_string()
286 tokens: tokens
287 secondary()
288 sm()
289 }
290 EuvButton {
291 label: SETTINGS_BTN_PREVIEW_OUT.to_string()
292 tokens: tokens
293 outline()
294 sm()
295 }
296 }
297 }
298 }
299 };
300 let ctx: Context = current_context();
301 ctx.get_scene().with_write(
302 |tree: &mut SceneTree| {
303 tree.attach_scope(card_node, mode_scope);
304 },
305 (),
306 );
307 card_node
308}
309
310pub(crate) fn mount_settings_chrome_card(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
321 let p: ThemePalette = tokens.get_palette();
322 let auto_hide_sig: Signal<bool> = state.get_auto_hide_chrome();
323 let show_fps_sig: Signal<bool> = state.get_show_fps_hud();
324 let swipe_sig: Signal<bool> = state.get_swipe_routing();
325 view! {
326 EuvCard {
327 title: SETTINGS_NAV_TITLE.to_string()
328 tokens: tokens
329 subtitle: SETTINGS_NAV_SUB
330 column {
331 style: {
332 width: Length::Percent(100.0)
333 gap: SPACE_SM
334 }
335 EuvSwitch {
336 checked: auto_hide_sig
337 label: SETTINGS_AUTO_HIDE_LABEL.to_string()
338 tokens: tokens
339 }
340 text {
341 style: {
342 width: Length::Percent(100.0)
343 font_size: 12.0
344 color: p.get_muted_foreground()
345 }
346 { SETTINGS_AUTO_HIDE_DESC }
347 }
348 }
349 column {
350 style: {
351 width: Length::Percent(100.0)
352 gap: SPACE_SM
353 }
354 EuvSwitch {
355 checked: show_fps_sig
356 label: SETTINGS_SHOW_FPS_LABEL.to_string()
357 tokens: tokens
358 }
359 text {
360 style: {
361 width: Length::Percent(100.0)
362 font_size: 12.0
363 color: p.get_muted_foreground()
364 }
365 { SETTINGS_SHOW_FPS_DESC }
366 }
367 }
368 column {
369 style: {
370 width: Length::Percent(100.0)
371 gap: SPACE_SM
372 }
373 EuvSwitch {
374 checked: swipe_sig
375 label: SETTINGS_SWIPE_ROUTING_LABEL.to_string()
376 tokens: tokens
377 }
378 text {
379 style: {
380 width: Length::Percent(100.0)
381 font_size: 12.0
382 color: p.get_muted_foreground()
383 }
384 { SETTINGS_SWIPE_ROUTING_DESC }
385 }
386 }
387 }
388 }
389}
390
391pub(crate) fn mount_settings_motion_card(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
402 let p: ThemePalette = tokens.get_palette();
403 let g: ThemeGeometry = tokens.get_geometry();
404 let reduced_motion_sig: Signal<bool> = state.get_reduced_motion();
405 view! {
406 EuvCard {
407 title: SETTINGS_MOTION_TITLE.to_string()
408 tokens: tokens
409 subtitle: SETTINGS_MOTION_SUB
410 column {
411 style: {
412 width: Length::Percent(100.0)
413 gap: SPACE_SM
414 }
415 EuvSwitch {
416 checked: reduced_motion_sig
417 label: SETTINGS_REDUCED_MOTION_LABEL.to_string()
418 tokens: tokens
419 }
420 text {
421 style: {
422 width: Length::Percent(100.0)
423 font_size: 12.0
424 color: p.get_muted_foreground()
425 }
426 { SETTINGS_REDUCED_MOTION_DESC }
427 }
428 }
429 column {
430 style: {
431 width: Length::Percent(100.0)
432 gap: SPACE_SM
433 }
434 text {
435 style: {
436 width: Length::Percent(100.0)
437 font_size: 13.5
438 font_weight: FontWeight::SemiBold
439 color: p.get_foreground()
440 }
441 { SETTINGS_MOTION_RHYTHM_TITLE }
442 }
443 column {
444 style: {
445 width: Length::Percent(100.0)
446 padding: Edges::all(SPACE_MD)
447 gap: SPACE_XS
448 background: p.get_background()
449 border: (g.get_border_width(), p.get_border())
450 radius: g.get_radius_md()
451 overflow: Overflow::Hidden
452 }
453 text {
454 style: {
455 width: Length::Percent(100.0)
456 font_size: 12.5
457 font_weight: FontWeight::SemiBold
458 color: p.get_primary()
459 }
460 { SETTINGS_MOTION_MICRO_TITLE }
461 }
462 text {
463 style: {
464 width: Length::Percent(100.0)
465 font_size: 12.0
466 color: p.get_muted_foreground()
467 }
468 { SETTINGS_MOTION_MICRO_DESC }
469 }
470 }
471 column {
472 style: {
473 width: Length::Percent(100.0)
474 padding: Edges::all(SPACE_MD)
475 gap: SPACE_XS
476 background: p.get_background()
477 border: (g.get_border_width(), p.get_border())
478 radius: g.get_radius_md()
479 overflow: Overflow::Hidden
480 }
481 text {
482 style: {
483 width: Length::Percent(100.0)
484 font_size: 12.5
485 font_weight: FontWeight::SemiBold
486 color: p.get_primary()
487 }
488 { SETTINGS_MOTION_STD_TITLE }
489 }
490 text {
491 style: {
492 width: Length::Percent(100.0)
493 font_size: 12.0
494 color: p.get_muted_foreground()
495 }
496 { SETTINGS_MOTION_STD_DESC }
497 }
498 }
499 column {
500 style: {
501 width: Length::Percent(100.0)
502 padding: Edges::all(SPACE_MD)
503 gap: SPACE_XS
504 background: p.get_background()
505 border: (g.get_border_width(), p.get_border())
506 radius: g.get_radius_md()
507 overflow: Overflow::Hidden
508 }
509 text {
510 style: {
511 width: Length::Percent(100.0)
512 font_size: 12.5
513 font_weight: FontWeight::SemiBold
514 color: p.get_primary()
515 }
516 { SETTINGS_MOTION_EMPH_TITLE }
517 }
518 text {
519 style: {
520 width: Length::Percent(100.0)
521 font_size: 12.0
522 color: p.get_muted_foreground()
523 }
524 { SETTINGS_MOTION_EMPH_DESC }
525 }
526 }
527 text {
528 style: {
529 width: Length::Percent(100.0)
530 font_size: 11.5
531 italic: true
532 color: p.get_muted_foreground()
533 }
534 { SETTINGS_MOTION_EASING_NOTE }
535 }
536 }
537 }
538 }
539}
540
541pub(crate) fn mount_settings_runtime_card(
553 state: &ShowcaseState,
554 action_log: Signal<String>,
555 tokens: ThemeTokens,
556) -> NodeId {
557 let p: ThemePalette = tokens.get_palette();
558 let g: ThemeGeometry = tokens.get_geometry();
559 let platform: PlatformKind = current_platform();
560 let vp_sig: Signal<Size> = use_viewport_size();
561 let safe_area_sig: Signal<SafeAreaInsets> = use_safe_area();
562 let state_reset: ShowcaseState = state.clone();
563 let platform_line: String = format!("{platform:?}");
564 let vp_line = move || -> String {
565 let vp: Size = vp_sig.get();
566 format!("{:.0}x{:.0} px", vp.get_width(), vp.get_height())
567 };
568 let sa_line = move || -> String {
569 let sa: SafeAreaInsets = safe_area_sig.get();
570 format!(
571 "T{:.0} R{:.0} B{:.0} L{:.0}",
572 sa.get_top(),
573 sa.get_right(),
574 sa.get_bottom(),
575 sa.get_left()
576 )
577 };
578 let action_log_text = move || -> String { action_log.get() };
579 let on_open_github = move |_: &UiEvent| {
580 let _: bool = open_external_url(PROJECT_GITHUB_URL);
581 let _: bool = action_log.set(SETTINGS_ACTION_LOG_GITHUB.to_string());
582 };
583 let on_reset_defaults = move |_: &UiEvent| {
584 state_reset.reset_preferences_to_defaults();
585 let _: bool = action_log.set(SETTINGS_ACTION_LOG_RESET.to_string());
586 };
587 view! {
588 EuvCard {
589 title: SETTINGS_RUNTIME_TITLE.to_string()
590 tokens: tokens
591 subtitle: SETTINGS_RUNTIME_SUB
592 grid {
593 style: {
594 width: Length::Percent(100.0)
595 columns: 2
596 gap: SPACE_SM
597 }
598 column {
599 style: {
600 width: Length::Percent(100.0)
601 padding: Edges::all(SPACE_SM)
602 gap: SPACE_XS
603 background: p.get_background()
604 border: (g.get_border_width(), p.get_border())
605 radius: g.get_radius_sm()
606 overflow: Overflow::Hidden
607 }
608 text {
609 style: {
610 width: Length::Percent(100.0)
611 font_size: 11.5
612 color: p.get_muted_foreground()
613 }
614 { SETTINGS_KPI_PLATFORM }
615 }
616 text {
617 style: {
618 width: Length::Percent(100.0)
619 font_size: 13.0
620 font_weight: FontWeight::SemiBold
621 color: p.get_foreground()
622 }
623 { platform_line }
624 }
625 }
626 column {
627 style: {
628 width: Length::Percent(100.0)
629 padding: Edges::all(SPACE_SM)
630 gap: SPACE_XS
631 background: p.get_background()
632 border: (g.get_border_width(), p.get_border())
633 radius: g.get_radius_sm()
634 overflow: Overflow::Hidden
635 }
636 text {
637 style: {
638 width: Length::Percent(100.0)
639 font_size: 11.5
640 color: p.get_muted_foreground()
641 }
642 { SETTINGS_KPI_RENDERER }
643 }
644 text {
645 style: {
646 width: Length::Percent(100.0)
647 font_size: 13.0
648 font_weight: FontWeight::SemiBold
649 color: p.get_foreground()
650 }
651 { SETTINGS_KPI_RENDERER_VAL }
652 }
653 }
654 column {
655 style: {
656 width: Length::Percent(100.0)
657 padding: Edges::all(SPACE_SM)
658 gap: SPACE_XS
659 background: p.get_background()
660 border: (g.get_border_width(), p.get_border())
661 radius: g.get_radius_sm()
662 overflow: Overflow::Hidden
663 }
664 text {
665 style: {
666 width: Length::Percent(100.0)
667 font_size: 11.5
668 color: p.get_muted_foreground()
669 }
670 { SETTINGS_KPI_VIEWPORT }
671 }
672 text {
673 style: {
674 width: Length::Percent(100.0)
675 font_size: 13.0
676 font_weight: FontWeight::SemiBold
677 color: p.get_foreground()
678 }
679 { vp_line }
680 }
681 }
682 column {
683 style: {
684 width: Length::Percent(100.0)
685 padding: Edges::all(SPACE_SM)
686 gap: SPACE_XS
687 background: p.get_background()
688 border: (g.get_border_width(), p.get_border())
689 radius: g.get_radius_sm()
690 overflow: Overflow::Hidden
691 }
692 text {
693 style: {
694 width: Length::Percent(100.0)
695 font_size: 11.5
696 color: p.get_muted_foreground()
697 }
698 { SETTINGS_KPI_SAFE_AREA }
699 }
700 text {
701 style: {
702 width: Length::Percent(100.0)
703 font_size: 13.0
704 font_weight: FontWeight::SemiBold
705 color: p.get_foreground()
706 }
707 { sa_line }
708 }
709 }
710 }
711 EuvActionRow {
712 EuvButton {
713 label: SETTINGS_BTN_GITHUB.to_string()
714 tokens: tokens
715 secondary()
716 sm()
717 on_click: on_open_github
718 }
719 EuvButton {
720 label: SETTINGS_BTN_RESET.to_string()
721 tokens: tokens
722 outline()
723 sm()
724 on_click: on_reset_defaults
725 }
726 }
727 text {
728 style: {
729 width: Length::Percent(100.0)
730 font_size: 12.0
731 font_family: FontFamily::Monospace
732 color: p.get_primary()
733 }
734 { action_log_text }
735 }
736 }
737 }
738}
739
740pub(crate) fn mount_settings_adaptive_render_card(
751 state: &ShowcaseState,
752 tokens: ThemeTokens,
753) -> NodeId {
754 let p: ThemePalette = tokens.get_palette();
755 let g: ThemeGeometry = tokens.get_geometry();
756 let auto_switch_sig: Signal<bool> = state.get_adaptive_auto_switch();
757 let active_backend_sig: Signal<String> = state.get_adaptive_active_backend();
758 let rec_backend_sig: Signal<String> = state.get_adaptive_recommended_backend();
759 let cpu_mirror_sig: Signal<bool> = state.get_adaptive_cpu_mirror_active();
760 let timing_src_sig: Signal<String> = state.get_adaptive_present_timing_source();
761 let upload_strat_sig: Signal<String> = state.get_adaptive_upload_strategy();
762 let attempts_sig: Signal<u64> = state.get_adaptive_handoff_attempts();
763 let successes_sig: Signal<u64> = state.get_adaptive_handoff_successes();
764 let aborts_sig: Signal<u64> = state.get_adaptive_handoff_aborts();
765 let init_idx: usize = if auto_switch_sig.get_untracked() {
766 1
767 } else {
768 0
769 };
770 let switch_sel_sig: Signal<usize> = Signal::new(init_idx);
771 let (sync_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
772 let _: Effect = Effect::new(move || {
773 let expected: usize = if auto_switch_sig.get() { 1 } else { 0 };
774 let _: bool = switch_sel_sig.set_if_changed(expected);
775 });
776 Effect::new(move || {
777 let next_auto: bool = switch_sel_sig.get() == 1;
778 let _: bool = auto_switch_sig.set_if_changed(next_auto);
779 })
780 });
781 let switch_options: Vec<String> = vec![
782 SETTINGS_ADAPTIVE_OPT_RECOMMEND.to_string(),
783 SETTINGS_ADAPTIVE_OPT_AUTO.to_string(),
784 ];
785 let switch_segmented: NodeId = view! {
786 EuvSegmented {
787 options: switch_options
788 selected: switch_sel_sig
789 tokens: tokens
790 }
791 };
792 let switch_mode_val = move || -> String {
793 if auto_switch_sig.get() {
794 SETTINGS_ADAPTIVE_OPT_AUTO.to_string()
795 } else {
796 SETTINGS_ADAPTIVE_OPT_RECOMMEND.to_string()
797 }
798 };
799 let active_backend_val = move || -> String { active_backend_sig.get() };
800 let rec_backend_val = move || -> String { rec_backend_sig.get() };
801 let cpu_mirror_val = move || -> String {
802 if cpu_mirror_sig.get() {
803 SETTINGS_ADAPTIVE_MIRROR_YES.to_string()
804 } else {
805 SETTINGS_ADAPTIVE_MIRROR_NO.to_string()
806 }
807 };
808 let timing_src_val = move || -> String { timing_src_sig.get() };
809 let upload_strat_val = move || -> String { upload_strat_sig.get() };
810 let handoffs_val = move || -> String {
811 format!(
812 "{} / {} / {}",
813 attempts_sig.get(),
814 successes_sig.get(),
815 aborts_sig.get()
816 )
817 };
818 let card_node: NodeId = view! {
819 EuvCard {
820 title: SETTINGS_ADAPTIVE_TITLE.to_string()
821 tokens: tokens
822 subtitle: SETTINGS_ADAPTIVE_SUB
823 column {
824 style: {
825 width: Length::Percent(100.0)
826 gap: SPACE_SM
827 }
828 text {
829 style: {
830 width: Length::Percent(100.0)
831 font_size: 13.5
832 font_weight: FontWeight::SemiBold
833 color: p.get_foreground()
834 }
835 { SETTINGS_ADAPTIVE_MODE_HEADING }
836 }
837 text {
838 style: {
839 width: Length::Percent(100.0)
840 font_size: 12.0
841 color: p.get_muted_foreground()
842 }
843 { SETTINGS_ADAPTIVE_MODE_SUB }
844 }
845 { switch_segmented }
846 }
847 grid {
848 style: {
849 width: Length::Percent(100.0)
850 columns: 2
851 gap: SPACE_SM
852 }
853 column {
854 style: {
855 width: Length::Percent(100.0)
856 padding: Edges::all(SPACE_SM)
857 gap: SPACE_XS
858 background: p.get_background()
859 border: (g.get_border_width(), p.get_border())
860 radius: g.get_radius_sm()
861 overflow: Overflow::Hidden
862 }
863 text {
864 style: {
865 width: Length::Percent(100.0)
866 font_size: 11.5
867 color: p.get_muted_foreground()
868 }
869 { SETTINGS_ADAPTIVE_KPI_SWITCH_MODE }
870 }
871 text {
872 style: {
873 width: Length::Percent(100.0)
874 font_size: 13.0
875 font_weight: FontWeight::SemiBold
876 color: p.get_foreground()
877 }
878 { switch_mode_val }
879 }
880 }
881 column {
882 style: {
883 width: Length::Percent(100.0)
884 padding: Edges::all(SPACE_SM)
885 gap: SPACE_XS
886 background: p.get_background()
887 border: (g.get_border_width(), p.get_border())
888 radius: g.get_radius_sm()
889 overflow: Overflow::Hidden
890 }
891 text {
892 style: {
893 width: Length::Percent(100.0)
894 font_size: 11.5
895 color: p.get_muted_foreground()
896 }
897 { SETTINGS_ADAPTIVE_KPI_ACTIVE_BACKEND }
898 }
899 text {
900 style: {
901 width: Length::Percent(100.0)
902 font_size: 13.0
903 font_weight: FontWeight::SemiBold
904 color: p.get_foreground()
905 }
906 { active_backend_val }
907 }
908 }
909 column {
910 style: {
911 width: Length::Percent(100.0)
912 padding: Edges::all(SPACE_SM)
913 gap: SPACE_XS
914 background: p.get_background()
915 border: (g.get_border_width(), p.get_border())
916 radius: g.get_radius_sm()
917 overflow: Overflow::Hidden
918 }
919 text {
920 style: {
921 width: Length::Percent(100.0)
922 font_size: 11.5
923 color: p.get_muted_foreground()
924 }
925 { SETTINGS_ADAPTIVE_KPI_RECOMMENDED_BACKEND }
926 }
927 text {
928 style: {
929 width: Length::Percent(100.0)
930 font_size: 13.0
931 font_weight: FontWeight::SemiBold
932 color: p.get_foreground()
933 }
934 { rec_backend_val }
935 }
936 }
937 column {
938 style: {
939 width: Length::Percent(100.0)
940 padding: Edges::all(SPACE_SM)
941 gap: SPACE_XS
942 background: p.get_background()
943 border: (g.get_border_width(), p.get_border())
944 radius: g.get_radius_sm()
945 overflow: Overflow::Hidden
946 }
947 text {
948 style: {
949 width: Length::Percent(100.0)
950 font_size: 11.5
951 color: p.get_muted_foreground()
952 }
953 { SETTINGS_ADAPTIVE_KPI_CPU_MIRROR }
954 }
955 text {
956 style: {
957 width: Length::Percent(100.0)
958 font_size: 13.0
959 font_weight: FontWeight::SemiBold
960 color: p.get_foreground()
961 }
962 { cpu_mirror_val }
963 }
964 }
965 column {
966 style: {
967 width: Length::Percent(100.0)
968 padding: Edges::all(SPACE_SM)
969 gap: SPACE_XS
970 background: p.get_background()
971 border: (g.get_border_width(), p.get_border())
972 radius: g.get_radius_sm()
973 overflow: Overflow::Hidden
974 }
975 text {
976 style: {
977 width: Length::Percent(100.0)
978 font_size: 11.5
979 color: p.get_muted_foreground()
980 }
981 { SETTINGS_ADAPTIVE_KPI_TIMING_SOURCE }
982 }
983 text {
984 style: {
985 width: Length::Percent(100.0)
986 font_size: 13.0
987 font_weight: FontWeight::SemiBold
988 color: p.get_foreground()
989 }
990 { timing_src_val }
991 }
992 }
993 column {
994 style: {
995 width: Length::Percent(100.0)
996 padding: Edges::all(SPACE_SM)
997 gap: SPACE_XS
998 background: p.get_background()
999 border: (g.get_border_width(), p.get_border())
1000 radius: g.get_radius_sm()
1001 overflow: Overflow::Hidden
1002 }
1003 text {
1004 style: {
1005 width: Length::Percent(100.0)
1006 font_size: 11.5
1007 color: p.get_muted_foreground()
1008 }
1009 { SETTINGS_ADAPTIVE_KPI_UPLOAD_STRATEGY }
1010 }
1011 text {
1012 style: {
1013 width: Length::Percent(100.0)
1014 font_size: 13.0
1015 font_weight: FontWeight::SemiBold
1016 color: p.get_foreground()
1017 }
1018 { upload_strat_val }
1019 }
1020 }
1021 column {
1022 style: {
1023 width: Length::Percent(100.0)
1024 padding: Edges::all(SPACE_SM)
1025 gap: SPACE_XS
1026 background: p.get_background()
1027 border: (g.get_border_width(), p.get_border())
1028 radius: g.get_radius_sm()
1029 overflow: Overflow::Hidden
1030 }
1031 text {
1032 style: {
1033 width: Length::Percent(100.0)
1034 font_size: 11.5
1035 color: p.get_muted_foreground()
1036 }
1037 { SETTINGS_ADAPTIVE_KPI_HANDOFFS }
1038 }
1039 text {
1040 style: {
1041 width: Length::Percent(100.0)
1042 font_size: 13.0
1043 font_weight: FontWeight::SemiBold
1044 color: p.get_foreground()
1045 }
1046 { handoffs_val }
1047 }
1048 }
1049 column {
1050 style: {
1051 width: Length::Percent(100.0)
1052 padding: Edges::all(SPACE_SM)
1053 gap: SPACE_XS
1054 background: p.get_background()
1055 border: (g.get_border_width(), p.get_border())
1056 radius: g.get_radius_sm()
1057 overflow: Overflow::Hidden
1058 }
1059 text {
1060 style: {
1061 width: Length::Percent(100.0)
1062 font_size: 11.5
1063 color: p.get_muted_foreground()
1064 }
1065 { SETTINGS_ADAPTIVE_KPI_EQUIVALENCE }
1066 }
1067 text {
1068 style: {
1069 width: Length::Percent(100.0)
1070 font_size: 13.0
1071 font_weight: FontWeight::SemiBold
1072 color: p.get_foreground()
1073 }
1074 { SETTINGS_ADAPTIVE_EQUIVALENCE_VAL }
1075 }
1076 }
1077 }
1078 }
1079 };
1080 let ctx: Context = current_context();
1081 ctx.get_scene().with_write(
1082 |tree: &mut SceneTree| {
1083 tree.attach_scope(card_node, sync_scope);
1084 },
1085 (),
1086 );
1087 card_node
1088}
1089
1090pub fn mount_settings_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
1101 let action_log: Signal<String> = Signal::new(SETTINGS_ACTION_LOG_READY.to_string());
1102 let appearance_card: NodeId = mount_settings_appearance_card(state, tokens);
1103 let chrome_card: NodeId = mount_settings_chrome_card(state, tokens);
1104 let motion_card: NodeId = mount_settings_motion_card(state, tokens);
1105 let adaptive_card: NodeId = mount_settings_adaptive_render_card(state, tokens);
1106 let runtime_card: NodeId = mount_settings_runtime_card(state, action_log, tokens);
1107 let top_grid: NodeId = mount_responsive_grid(vec![chrome_card, motion_card], 2);
1108 view! {
1109 EuvPage {
1110 title: SETTINGS_TITLE.to_string()
1111 subtitle: SETTINGS_SUBTITLE.to_string()
1112 tokens: tokens
1113 { appearance_card }
1114 { top_grid }
1115 { adaptive_card }
1116 { runtime_card }
1117 }
1118 }
1119}