chore: cleanup warnings and unused code
This commit is contained in:
1 parent
9925e753d8
commit
75a8f2d6d4
13 files changed
+6
-187
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
use leptos::prelude::*;
|
||||
use leptos_meta::{provide_meta_context, MetaTags, Stylesheet, Title};
|
||||
use leptos_oidc::{
|
||||
Auth, AuthLoaded, AuthParameters, AuthSignal, Authenticated, Challenge, LoginLink, LogoutLink,
|
||||
Auth, AuthParameters, AuthSignal, Challenge, LoginLink,
|
||||
};
|
||||
use leptos_router::{
|
||||
components::{Route, Router, Routes},
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct FormDefinition {
|
||||
sections: Vec<Section>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct Section {
|
||||
questions: Vec<QuestionType>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
enum QuestionType {
|
||||
Text,
|
||||
Email,
|
||||
Number,
|
||||
Dropdown,
|
||||
Checkbox,
|
||||
Radio,
|
||||
Multi,
|
||||
}
|
||||
|
||||
struct TextInput {}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct QuestionComponent {
|
||||
question_type: QuestionType,
|
||||
label: Option<String>,
|
||||
placeholder: Option<String>,
|
||||
|
||||
// Used in <select> and <checkbox> elements
|
||||
options: Option<HashMap<String, String>>,
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#[derive(Clone)]
|
||||
pub struct LoanerUser {
|
||||
pub first_name: String,
|
||||
pub last_name: String,
|
||||
pub email: String,
|
||||
pub has_loan: bool,
|
||||
}
|
||||
|
||||
impl LoanerUser {
|
||||
pub fn new() -> Self {
|
||||
LoanerUser {
|
||||
first_name: "".to_string(),
|
||||
last_name: "".to_string(),
|
||||
email: "".to_string(),
|
||||
has_loan: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
mod form_definition;
|
||||
mod loaner_user;
|
||||
mod student_info;
|
||||
mod user;
|
||||
|
||||
pub use self::{loaner_user::*, student_info::*, user::*};
|
||||
pub use self::{student_info::*, user::*};
|
||||
@@ -1,4 +1,4 @@
|
||||
use leptos::{leptos_dom::logging::console_log, prelude::*};
|
||||
use leptos::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn Checkbox(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::components::ActionButton;
|
||||
use leptos::{leptos_dom::logging::console_log, prelude::*};
|
||||
use leptos::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -32,7 +32,7 @@ pub struct MultiEntryMember {
|
||||
|
||||
impl MultiEntryMember {
|
||||
/// Creates a new MultiEntryMember struct.
|
||||
pub fn new() -> Self {
|
||||
pub fn _new() -> Self {
|
||||
Self {
|
||||
display_name: String::new(),
|
||||
member_name: String::new(),
|
||||
@@ -40,7 +40,7 @@ impl MultiEntryMember {
|
||||
}
|
||||
|
||||
/// Creates a new MultiEntryMember struct with the specified information.
|
||||
pub fn from(display_name: String, member_name: String) -> Self {
|
||||
pub fn _new_with_data(display_name: String, member_name: String) -> Self {
|
||||
Self {
|
||||
display_name,
|
||||
member_name,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use leptos::prelude::event_target_value;
|
||||
|
||||
pub mod app;
|
||||
mod common;
|
||||
mod components;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::collections::HashMap;
|
||||
#[cfg(feature = "ssr")]
|
||||
use aws_sdk_dynamodb::{error::ProvideErrorMetadata, types::AttributeValue, Client};
|
||||
use crate::app::Unauthenticated;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
//! Contains the action selection component.
|
||||
|
||||
use leptos::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn ActionSelection() -> impl IntoView {
|
||||
view! {}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
//! This defines the base component of the Chromebook loaner kiosk application.
|
||||
//! There are going to be 3 definitive screens that the users are able to see and use:
|
||||
//! - The username entry screen: users will enter their name and email.
|
||||
//! - The action selection screen: users will be given a choice regarding their loaner status.
|
||||
//! - The completion screen: users will be given a success message should their information save.
|
||||
//! Refer to each component's file for more information about how they work.
|
||||
|
||||
use super::{action_selection::ActionSelection, user_entry::UserEntry};
|
||||
use crate::common::LoanerUser;
|
||||
use leptos::prelude::*;
|
||||
|
||||
/// Used to keep track of the currently displayed controls.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub enum LoanerKioskState {
|
||||
UserEntry,
|
||||
ActionSelection,
|
||||
Complete,
|
||||
}
|
||||
|
||||
/// The base Chromebook loaner kiosk component.
|
||||
///
|
||||
/// Controls the state of the loaner application and gives a space for the subcomponents to display.
|
||||
#[component]
|
||||
pub fn LoanerKiosk() -> impl IntoView {
|
||||
let current_state = RwSignal::new(LoanerKioskState::UserEntry);
|
||||
let user = RwSignal::new(LoanerUser::new());
|
||||
|
||||
view! {
|
||||
<div class="flex w-screen h-screen justify-center items-center">
|
||||
<UserEntry
|
||||
on_submit={move || { current_state.set(LoanerKioskState::ActionSelection); }}
|
||||
user={user}
|
||||
shown={current_state.get() == LoanerKioskState::UserEntry}
|
||||
/>
|
||||
<ActionSelection
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
mod action_selection;
|
||||
mod loaner_kiosk;
|
||||
mod user_entry;
|
||||
@@ -1,72 +0,0 @@
|
||||
//! Contains the user entry component.
|
||||
//! It would be preferred if the user was restricted to a real user account. This is the URL:
|
||||
//! https://admin.googleapis.com/admin/directory/v1/users?domain=region15.org&projection=BASIC&query=isArchived=false%20isAdmin=false
|
||||
//! Once they select this, they can then check in/out the loaners under their account.
|
||||
//! That means that the Leptos server will now REQUIRE a user token of some sort, probably
|
||||
//! a service account. That's going to be a pain to set up.
|
||||
//! For example's sake here, we're just going to take a first name, last name, and email address.
|
||||
|
||||
use crate::common::LoanerUser;
|
||||
use crate::components::{ActionButton, OutlinedTextField};
|
||||
use leptos::leptos_dom::logging::console_log;
|
||||
use leptos::prelude::*;
|
||||
|
||||
/// The user entry component for the loaner kiosk.
|
||||
///
|
||||
/// Users are able to input their first name, last name, and email address. In the future, this
|
||||
/// component should call out to a server function that allows the application to check if the
|
||||
/// information provided is correct. This may be by creating storing a series of user records
|
||||
/// or simply querying Google's Admin API to check if the user is valid.
|
||||
#[component]
|
||||
pub fn UserEntry(
|
||||
/// A callback function used when the control has determined this stage is finished.
|
||||
#[prop()]
|
||||
mut on_submit: impl FnMut() + 'static,
|
||||
/// The global user record.
|
||||
#[prop()]
|
||||
user: RwSignal<LoanerUser>,
|
||||
/// Whether this control is shown. Required for use with CSS animations.
|
||||
#[prop()]
|
||||
shown: bool,
|
||||
) -> impl IntoView {
|
||||
let disabled = RwSignal::new(false);
|
||||
let on_click = move |_| {
|
||||
disabled.set(true);
|
||||
on_submit();
|
||||
console_log("Clicked!");
|
||||
disabled.set(false);
|
||||
};
|
||||
|
||||
view! {
|
||||
<div
|
||||
class="transition-all duration-300 flex flex-col"
|
||||
class=(["opacity-100 delay-300"], shown)
|
||||
class=(["opacity-0"], !shown)
|
||||
>
|
||||
<OutlinedTextField
|
||||
label="First Name".into()
|
||||
placeholder="John".into()
|
||||
disabled={disabled}
|
||||
value=RwSignal::new("".to_owned())
|
||||
/>
|
||||
<OutlinedTextField
|
||||
label="Last Name".into()
|
||||
placeholder="Smith".into()
|
||||
disabled={disabled}
|
||||
value=RwSignal::new("".to_owned())
|
||||
/>
|
||||
<OutlinedTextField
|
||||
label="Region 15 Email".into()
|
||||
placeholder="jsmith@region15.org".into()
|
||||
disabled={disabled}
|
||||
value=RwSignal::new("".to_owned())
|
||||
/>
|
||||
<ActionButton
|
||||
on:click=on_click
|
||||
disabled={disabled}
|
||||
>
|
||||
"Submit"
|
||||
</ActionButton>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
mod about_page;
|
||||
mod home_page;
|
||||
mod loaner_kiosk;
|
||||
mod provider_entry;
|
||||
|
||||
pub use self::{about_page::*, home_page::*, provider_entry::*};
|
||||
Reference in new issue
Block a user