style: apply rustfmt

This commit is contained in:
alphafetus committed 2026-01-12 14:55:32 -05:00
1 parent 0742e833da
commit 865410b6f2
1 file changed
+71 -50
+71 -50
View File
@@ -40,20 +40,13 @@ pub fn ScholarshipInfoPage() -> impl IntoView {
// Remember that we only want to show the page after we've got authentication information
// and if there's data for us to use.
view! {
<Banner
title="R15 Scholarships"
logo="/PHS_Stacked_Acronym.png"
path="/"
/>
<Banner title="R15 Scholarships" logo="/PHS_Stacked_Acronym.png" path="/" />
<ToastList>
<AuthLoaded fallback=Loading>
<Authenticated unauthenticated=UnauthenticatedPage>
<div class="flex flex-row align-top items-start">
<div class="flex flex-col flex-1" />
<ScholarshipList
refresh_token=list_refresh
on_delete=on_delete
/>
<ScholarshipList refresh_token=list_refresh on_delete=on_delete />
<Transition fallback=Loading>
<ScholarshipForm
scholarship_id=scholarship_id
@@ -183,37 +176,41 @@ fn ScholarshipList(
});
view! {
<dialog
node_ref=delete_dialog_ref
class="m-auto p-2"
>
<dialog node_ref=delete_dialog_ref class="m-auto p-2">
<h2 class="text-2xl font-bold">"Confirm Deletion"</h2>
<p>
"Are you sure you want to delete "
{move || {
pending_delete.get().map(|s| {
s.data.get("name").unwrap_or(&ValueType::String(None))
pending_delete
.get()
.map(|s| {
s.data
.get("name")
.unwrap_or(&ValueType::String(None))
.as_string()
.unwrap_or_default()
.unwrap_or("<no name found>".to_string())
})
}}
"?"
}} "?"
</p>
<ActionButton
on:click=move |_| {
let subject = pending_delete.get().map(|s| s.subject.clone()).unwrap_or_default();
let subject = pending_delete
.get()
.map(|s| s.subject.clone())
.unwrap_or_default();
log!("Deleting scholarship with subject {}", subject);
delete_action.dispatch(DeleteProviderScholarship {
delete_action
.dispatch(DeleteProviderScholarship {
scholarship_id: subject,
provider_id: provider_id.get().unwrap_or_default()
provider_id: provider_id.get().unwrap_or_default(),
});
}
disabled=modal_disabled
>"Confirm"</ActionButton>
<ActionButton
on:click=move |_| pending_delete.set(None)
>"Cancel"</ActionButton>
>
"Confirm"
</ActionButton>
<ActionButton on:click=move |_| pending_delete.set(None)>"Cancel"</ActionButton>
</dialog>
<div class="w-75">
<Panel>
@@ -223,31 +220,42 @@ fn ScholarshipList(
<Transition fallback=Loading>
<div class="flex flex-col gap-2">
{move || {
scholarships.get().map(|result| {
scholarships
.get()
.map(|result| {
match result {
Ok(list) => {
let views = list.iter().map(|entry| {
let views = list
.iter()
.map(|entry| {
view! {
<ScholarshipListEntry scholarship=entry.clone()
on_delete=Callback::new(on_item_delete)/>
<ScholarshipListEntry
scholarship=entry.clone()
on_delete=Callback::new(on_item_delete)
/>
}
});
Either::Left(views.collect_view())
}
Err(err) => {
Either::Right(view! {
Either::Right(
view! {
<div>
<p>"Failed to load scholarship list: "{err.to_string()}</p>
</div>
},
)
}
}
})
}
}
}).collect_view()
.collect_view()
}}
</div>
<div>
<div class="p-2 bg-red-800 rounded-md text-center text-white hover:bg-red-900 transition-all cursor-pointer"
on:click=create_on_click>
<div
class="p-2 bg-red-800 rounded-md text-center text-white hover:bg-red-900 transition-all cursor-pointer"
on:click=create_on_click
>
"Create New"
</div>
</div>
@@ -307,13 +315,15 @@ fn ScholarshipListEntry(
<span>{name}</span>
</div>
<div class="flex flex-row">
<div class="p-2 flex-1 bg-red-800 border-r border-white rounded-bl-md text-white text-center
<div
class="p-2 flex-1 bg-red-800 border-r border-white rounded-bl-md text-white text-center
hover:bg-red-900 cursor-pointer transition-all"
on:click=edit_click
>
"Edit"
</div>
<div class="p-2 flex-1 bg-red-800 border-l border-white rounded-br-md text-white text-center
<div
class="p-2 flex-1 bg-red-800 border-l border-white rounded-br-md text-white text-center
hover:bg-red-900 cursor-pointer transition-all"
on:click=move |_| on_delete.run(scholarship.clone())
>
@@ -490,16 +500,22 @@ fn ScholarshipForm(
<Panel>
<Show
when=move || scholarship_id.get().is_some()
fallback=|| view! { <p>"Choose a scholarship from the right, or create a new one."</p> }
fallback=|| {
view! { <p>"Choose a scholarship from the right, or create a new one."</p> }
}
>
<Suspense fallback=Loading>
<ValidatedForm on_submit=Callback::new(on_submit)>
<ValidatedForm on_submit=Callback::new(
on_submit,
)>
{move || {
scholarship_info.get()
scholarship_info
.get()
.map(|res_scholarship| {
match res_scholarship {
Ok(_) => {
Either::Left(view! {
Either::Left(
view! {
<Row>
<h1 class="text-3xl font-bold">
"Scholarship Info Form (test)"
@@ -584,7 +600,10 @@ fn ScholarshipForm(
<RadioList
data_member="essay_prompt"
data_map=form_data
items=vec!["Test 1", "Test 2", "Test 3"].iter().map(|s| s.to_string()).collect()
items=vec!["Test 1", "Test 2", "Test 3"]
.iter()
.map(|s| s.to_string())
.collect()
disabled=elements_disabled
label="If so, select a prompt from the list below."
/>
@@ -634,22 +653,24 @@ fn ScholarshipForm(
displayed_text=misc_text
/>
</Row>
})
},
)
}
Err(err) => {
Either::Right(view! {
Either::Right(
view! {
<p>"Error while getting scholarship: "{err.to_string()}</p>
},
)
}
}
})
}
}
}).collect_view()
.collect_view()
}}
</ValidatedForm>
<ActionButton
on:click=move |_| {
<ActionButton on:click=move |_| {
create_comps.dispatch(CreateTestComparisons {});
}
>"Create Comparisons"</ActionButton>
}>"Create Comparisons"</ActionButton>
</Suspense>
</Show>
</Panel>