chore: change current machine
This commit is contained in:
1 parent
6e462754c1
commit
07ae69c8ae
10 files changed
+1332
-96
No files matched your search
Generated
+1240
-83
File diff suppressed because it is too large.
Load diff
+3
-1
@@ -15,7 +15,9 @@ leptos_axum = { version = "0.7.0", optional = true }
|
||||
leptos_meta = { version = "0.7.0" }
|
||||
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
|
||||
wasm-bindgen = { version = "=0.2.100", optional = true }
|
||||
semester = "1.0.3"
|
||||
aws-sdk-dynamodb = "1.74.0"
|
||||
aws-config = "1.6.2"
|
||||
serde = "1.0.219"
|
||||
|
||||
[features]
|
||||
hydrate = [
|
||||
|
||||
+3
-1
@@ -5,7 +5,7 @@ use leptos_router::{
|
||||
StaticSegment,
|
||||
};
|
||||
|
||||
use crate::pages::HomePage;
|
||||
use crate::pages::{HomePage, AboutPage, ProviderEntry};
|
||||
|
||||
pub fn shell(options: LeptosOptions) -> impl IntoView {
|
||||
view! {
|
||||
@@ -43,6 +43,8 @@ pub fn App() -> impl IntoView {
|
||||
<main>
|
||||
<Routes fallback=|| "Page not found.".into_view()>
|
||||
<Route path=StaticSegment("") view=HomePage/>
|
||||
<Route path=StaticSegment("about") view=AboutPage/>
|
||||
<Route path=StaticSegment("providers") view=ProviderEntry/>
|
||||
</Routes>
|
||||
</main>
|
||||
</Router>
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
|
||||
#[component]
|
||||
pub fn ActionButton(
|
||||
#[prop(optional, default = String::from("button"))]
|
||||
button_type: String,
|
||||
#[prop(optional, default = RwSignal::new(false))]
|
||||
disabled: RwSignal<bool>,
|
||||
#[prop(optional, default = String::from("button"))] button_type: String,
|
||||
#[prop(optional, default = RwSignal::new(false))] disabled: RwSignal<bool>,
|
||||
children: Children,
|
||||
) -> impl IntoView {
|
||||
view! {
|
||||
<button
|
||||
class="m-3 p-3 rounded-lg text-white"
|
||||
class="m-1.5 p-2 rounded-lg text-white transition-all duration-400"
|
||||
class=(["bg-red-700", "hover:bg-red-800"], move || !disabled.get())
|
||||
class=("bg-gray-600", move || disabled.get())
|
||||
class=(["bg-gray-600", "pointer-events-none"], move || disabled.get())
|
||||
r#type=button_type
|
||||
disabled=move || disabled.get()
|
||||
>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
mod action_button;
|
||||
mod text_field;
|
||||
|
||||
pub use self::{
|
||||
action_button::ActionButton,
|
||||
text_field::OutlinedTextField
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
use leptos::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn OutlinedTextField(
|
||||
#[prop(default = String::from(""))] placeholder: String,
|
||||
#[prop(default = RwSignal::new("".to_string()))] value: RwSignal<String>,
|
||||
#[prop(default = RwSignal::new(false))] disabled: RwSignal<bool>
|
||||
) -> impl IntoView {
|
||||
view! (
|
||||
<input
|
||||
class="flex-row border-2 m-1.5 p-1.5 rounded-md bg-transparent mt-6 relative transition-all duration-400"
|
||||
class=(["border-red-700"], move || !disabled.get())
|
||||
class=(["border-gray-600", "pointer-events-none"], move || disabled.get())
|
||||
r#type="text"
|
||||
disabled={disabled.get()}
|
||||
placeholder={placeholder}
|
||||
prop:value=value
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
use leptos::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn AboutPage() -> impl IntoView {
|
||||
view! (
|
||||
<h1>About</h1>
|
||||
<p>"This is the about page! There isn't anything here yet."</p>
|
||||
)
|
||||
}
|
||||
+37
-4
@@ -1,19 +1,52 @@
|
||||
use leptos::prelude::*;
|
||||
use aws_sdk_dynamodb as dynamodb;
|
||||
use aws_sdk_dynamodb::operation::get_item::GetItemOutput;
|
||||
use leptos::server_fn::serde::{Serialize, Deserialize};
|
||||
use crate::components::{ActionButton, OutlinedTextField};
|
||||
|
||||
use crate::components::ActionButton;
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct StudentSubmission {
|
||||
testing_value: Option<String>
|
||||
}
|
||||
|
||||
#[server]
|
||||
pub async fn create_sample_submission() -> Result<StudentSubmission, ServerFnError> {
|
||||
let config = aws_config::load_defaults().await;
|
||||
let dbclient = aws_sdk_dynamodb::Client::new(&config);
|
||||
|
||||
match dbclient
|
||||
.get_item()
|
||||
.table_name("student-applications")
|
||||
.key("Email", dynamodb::model::AttributeValue::S("google_1234567".to_string()))
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
Ok(output) => {
|
||||
println!("Found submission with passed key.");
|
||||
Ok(StudentSubmission {
|
||||
testing_value: None
|
||||
})
|
||||
}
|
||||
Err(e) => Err(Error::unhandled(e))
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn HomePage() -> impl IntoView {
|
||||
// Creates a reactive value to update the button
|
||||
let count = RwSignal::new(0);
|
||||
let button_disabled = RwSignal::new(false);
|
||||
let elements_disabled = RwSignal::new(false);
|
||||
let on_click = move |_| {
|
||||
*count.write() += 1;
|
||||
*button_disabled.write() = count.get() == 25;
|
||||
*elements_disabled.write() = count.get() == 10;
|
||||
};
|
||||
let get_submission = ServerAction::<CreateSampleSubmission>::new();
|
||||
|
||||
view! {
|
||||
<h1>"Welcome to Leptos!"</h1>
|
||||
<ActionButton on:click=on_click disabled={button_disabled}>"Click Me: " {count}</ActionButton>
|
||||
<OutlinedTextField
|
||||
placeholder="Testing...".to_string()
|
||||
disabled={elements_disabled} />
|
||||
<ActionButton on:click=on_click disabled={elements_disabled}>"Click Me: " {count}</ActionButton>
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -1,5 +1,9 @@
|
||||
mod home_page;
|
||||
mod about_page;
|
||||
mod provider_entry;
|
||||
|
||||
pub use self::{
|
||||
home_page::*
|
||||
home_page::*,
|
||||
about_page::*,
|
||||
provider_entry::*,
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
use leptos::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn ProviderEntry() -> impl IntoView {
|
||||
view! (
|
||||
<h1>This is the provider entry page</h1>
|
||||
<h2>It would usually have a series of questions that we ask the providers</h2>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user