MCPcopy Create free account
hub / github.com/Moosync/Moosync / UpdateModal

Function UpdateModal

src/modals/update_modal.rs:26–68  ·  view source on GitHub ↗
(#[prop()] metadata: UpdateMetadata)

Source from the content-addressed store, hash-verified

24#[tracing::instrument(level = "debug", skip(metadata))]
25#[component]
26pub fn UpdateModal(#[prop()] metadata: UpdateMetadata) -> impl IntoView {
27 let modal_store: RwSignal<ModalStore> = expect_context();
28 let close_modal = move |_| modal_store.update(|m| m.clear_active_modal());
29
30 let trigger_update = move |ev| {
31 spawn_local(async move {
32 close_modal(ev);
33 if let Err(e) = install_update().await {
34 tracing::error!("Failed to install update: {:?}", e);
35 }
36 });
37 };
38
39 tracing::info!("Got update {:?}", metadata);
40
41 view! {
42 <GenericModal size=move || "modal-lg".into()>
43 <div class="container-fluid p-0 mt-4">
44 <div class="row no-gutters d-flex">
45 <div class="col">
46 <h4>An update is available. Do you want to update?</h4>
47 </div>
48 </div>
49 <div class="row row-cols-auto mt-3 mr-4">
50 <button
51 on:click=close_modal
52 class="btn btn-secondary cancel-button ml-auto"
53 type="button"
54 >
55 Cancel
56 </button>
57 <button
58 on:click=trigger_update
59 class="btn btn-secondary confirm-button ml-3"
60 type="button"
61 >
62 Confirm
63 </button>
64 </div>
65 </div>
66 </GenericModal>
67 }
68}

Callers 1

check_for_updatesFunction · 0.85

Calls 2

install_updateFunction · 0.85
clear_active_modalMethod · 0.80

Tested by

no test coverage detected