feat: remove former MultiEntry component and unused ProviderEntry page

This commit is contained in:
alphafetus committed 2025-10-16 11:58:25 -04:00
1 parent 86bd471c1e
commit 208bea2d09
20 files changed
+129 -426

No files matched your search

+11 -8
View File
@@ -7,17 +7,20 @@ use serde_dynamo::{from_item, to_item};
use crate::app::Unauthenticated;
use crate::common::{ExpandableInfo, UserClaims};
use crate::components::{ActionButton, CheckboxList, Loading, MultiEntryRewrite, OutlinedTextField, Panel, RadioList, Row, Select};
use crate::components::{
ActionButton, CheckboxList, Loading, MultiEntry, OutlinedTextField, Panel, RadioList, Row,
Select,
};
use crate::input;
use leptos::leptos_dom::logging::console_log;
use leptos::prelude::*;
use leptos_oidc::{Algorithm, AuthLoaded, AuthSignal, Authenticated};
use traits::{AsReactive, ReactiveCapture};
use crate::input;
use std::collections::HashMap;
use traits::{AsReactive, ReactiveCapture};
/// # Get Student Info
/// Gets a student's information given their `subject`.
///
///
/// All information is found by using a `GetItemCommand` in the student application DynamoDB table.
#[server(GetSubmission, endpoint = "/get-submission")]
pub async fn get_submission(subject: String) -> Result<ExpandableInfo, ServerFnError> {
@@ -25,7 +28,7 @@ pub async fn get_submission(subject: String) -> Result<ExpandableInfo, ServerFnE
let dbclient = Client::new(&config);
console_log(format!("Getting values from API using subject {}", subject).as_str());
// Gets the item from the database. It only returns an error if the database
// experiences an error - not if the item is not found.
match dbclient
@@ -54,7 +57,7 @@ pub async fn get_submission(subject: String) -> Result<ExpandableInfo, ServerFnE
/// # Create Sample Submission
/// Creates a submission given a full `StudentInfo` struct.
///
///
/// All information is stored using a `PutItemCommand` in the student application DynamoDB table.
#[server(CreateSampleSubmission, endpoint = "/create-sample-submission")]
pub async fn create_sample_submission(student_info: ExpandableInfo) -> Result<(), ServerFnError> {
@@ -93,7 +96,7 @@ pub async fn log_expandable(info: ExpandableInfo) -> Result<(), ServerFnError> {
// Manually specify the type here since we're not able to infer the type later.
let item: HashMap<String, AttributeValue> = to_item(info)?;
console_log(format!("Converted into a DynamoDB item: {:?}", item).as_str());
Ok(())
}
@@ -265,7 +268,7 @@ pub fn HomePage() -> impl IntoView {
/>
</Row>
<Row>
<MultiEntryRewrite
<MultiEntry
data_map = expandable_react.data
data_member = "test"
name_member = "first_name"
+1 -2
View File
@@ -1,5 +1,4 @@
mod about_page;
mod home_page;
mod provider_entry;
pub use self::{about_page::*, home_page::*, provider_entry::*};
pub use self::{about_page::*, home_page::*};
-50
View File
@@ -1,50 +0,0 @@
use std::collections::HashMap;
use crate::app::Unauthenticated;
use crate::common::UserClaims;
use crate::components::{Loading, MultiEntry, MultiEntryData, MultiEntryMember, OutlinedTextField, ValueType};
use leptos::leptos_dom::logging::console_log;
use leptos::prelude::*;
use leptos_oidc::{Algorithm, AuthLoaded, AuthSignal, Authenticated, LogoutLink};
#[component]
pub fn ProviderEntry() -> impl IntoView {
let auth = use_context::<AuthSignal>().expect("Couldn't find auth signal");
let auth_data = auth
.get()
.authenticated()
.and_then(|data| data.decoded_access_token::<UserClaims>(Algorithm::RS256, &["account"]));
let multi_entries: RwSignal<Vec<MultiEntryData>> = RwSignal::new(vec![]);
console_log(format!("User claims: {auth_data:?}").as_str());
view! (
<AuthLoaded fallback=Loading>
<Authenticated unauthenticated=Unauthenticated>
<LogoutLink class="text-logout">"Sign out"</LogoutLink>
<h1>This is the provider entry page</h1>
<h2>It would usually have a series of questions that we ask the providers</h2>
<div>
// Much of this is just a placeholder.
<OutlinedTextField
placeholder = "Testing information..."
name = "testing_input"
label = "This is a testing question."
data_member = "testing"
data_map = RwSignal::new(HashMap::new())
value = RwSignal::new(ValueType::String(None))
/>
</div>
<div>
<p>This is an example of the multientry element.</p>
<MultiEntry
entries=multi_entries
name_member=Signal::from(MultiEntryMember::from_str("Entry Name", "name"))
info_member=Signal::from(MultiEntryMember::from_str("Entry Info", "info"))
schema=vec![MultiEntryMember::from_str("Entry Name", "name"), MultiEntryMember::from_str("Entry Info", "info")]
/>
</div>
</Authenticated>
</AuthLoaded>
)
}