diff --git a/package-lock.json b/package-lock.json index cca8a7f..c105687 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,8 +5,7 @@ "packages": { "": { "dependencies": { - "@tailwindcss/cli": "^4.1.5", - "sass": "^1.92.0" + "@tailwindcss/cli": "^4.1.5" }, "devDependencies": { "tailwindcss": "^4.1.13" @@ -589,21 +588,6 @@ "node": ">=8" } }, - "node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "license": "MIT", - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", @@ -647,12 +631,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, - "node_modules/immutable": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.3.tgz", - "integrity": "sha512-+chQdDfvscSF1SJqv2gn4SRO2ZyS3xL3r7IW/wWEEzrzLisnOlKiQu5ytC/BVNcS15C39WT2Hg/bjKjDMcu+zg==", - "license": "MIT" - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -975,48 +953,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/readdirp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", - "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", - "license": "MIT", - "engines": { - "node": ">= 14.18.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/sass": { - "version": "1.92.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.92.0.tgz", - "integrity": "sha512-KDNI0BxgIRDAfJgzNm5wuy+4yOCIZyrUbjSpiU/JItfih+KGXAVefKL53MTml054MmBA3DDKIBMSI/7XLxZJ3A==", - "license": "MIT", - "dependencies": { - "chokidar": "^4.0.0", - "immutable": "^5.0.2", - "source-map-js": ">=0.6.2 <2.0.0" - }, - "bin": { - "sass": "sass.js" - }, - "engines": { - "node": ">=14.0.0" - }, - "optionalDependencies": { - "@parcel/watcher": "^2.4.1" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/tailwindcss": { "version": "4.1.13", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.13.tgz", diff --git a/src/app.rs b/src/app.rs index d8b7104..e854ce4 100644 --- a/src/app.rs +++ b/src/app.rs @@ -7,7 +7,7 @@ use leptos_router::{ }; use url::Url; -use crate::pages::{AboutPage, HomePage, ProviderEntry, UnauthenticatedPage}; +use crate::pages::{AboutPage, HomePage, UnauthenticatedPage}; pub fn shell(options: LeptosOptions) -> impl IntoView { view! { @@ -67,7 +67,6 @@ pub fn App() -> impl IntoView { - diff --git a/src/common/expandable_info.rs b/src/common/expandable_info.rs index ebb0f8f..8f6c2b4 100644 --- a/src/common/expandable_info.rs +++ b/src/common/expandable_info.rs @@ -1,16 +1,16 @@ -use std::collections::HashMap; -use serde::{Deserialize, Serialize}; +use crate::common::ValueType; use macros::Reactive; -use crate::components::ValueType; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; /// This struct allows for completely open-ended data storage. -/// +/// /// The `HashMap` allows the application to store an arbitrary number of values which are accessible /// using a `String` as a key, allowing for simple shifting of stored values. All information is /// stored using the `ValueType` enum, which provides some simple methods to verify the type of the /// stored value. It *must* have a main key member name so that a database will know how to store /// the data. -/// +/// /// In the future, this should also be optimized to store properly within a DynamoDB table. As of /// now, the table will simply create a single massive `Map` field that contains all the stored /// information in the `HashMap`. We'd prefer to be able to get single values if possible, diff --git a/src/common/form_schema.rs b/src/common/form_schema.rs index 5ebd963..84e2816 100644 --- a/src/common/form_schema.rs +++ b/src/common/form_schema.rs @@ -1,18 +1,121 @@ -use serde::{Serialize, Deserialize}; +use crate::common::ValueType; +use crate::components::{CheckboxList, OutlinedTextField, RadioList, Row, Select}; +use leptos::either::EitherOf5; +use leptos::prelude::RwSignal; +use leptos::{IntoView, view}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; /// Defines a series of options that allow a user to define a form. #[derive(Serialize, Deserialize, Clone, Debug)] -pub enum InputType{ - /// Represents a text input. Requires a `String` key. The entered value will be returned as a - /// single `String` value. - Text, - /// Represents a number input. Requires a `String` key. The entered value will be returned as a - /// single `i32` value. - Number, - /// Represents a radio input. Requires a `String` key and a series of options. The selected - /// value will be returned as a single `String` value. - Radio(Vec), - /// Represents a checkbox input. Requires a `String` key and a series of options. The selected - /// value will be returned as a `Vec`. - Checkbox(Vec) +pub enum InputType { + /// Represents a text input. Requires a `String` key, `String` label, and `String` placeholder. + /// The entered value will be returned as a single `String` value. + Text(String, String, String), + /// Represents a number input. Requires a `String` key, `String` label, and a `String` placeholder. + /// The entered value will be returned as a `String`, and will be parseable into any number type + /// (i.e. an `i32`, `i64`, etc) + Number(String, String, String), + /// Represents a radio input. Requires a `String` key, `String` label, and a series of `String` + /// options. The selected value will be returned as a `String`. + Radio(String, String, Vec), + /// Represents a checkbox input. Requires a `String` key, `String` label, and a series of `String` + /// options. The selected values will be returned as a `Vec`. + Checkbox(String, String, Vec), + /// Represents a dropdown input. Requires a `String` key, `String` label, and a series + /// of `String` options. The selected value will be returned as a `String`. + Select(String, String, Vec), +} + +impl InputType { + pub fn into_view(self, data_map: RwSignal>) -> impl IntoView { + view! { + {match self { + InputType::Text(member, label, placeholder) => + EitherOf5::A(view! { + + + + }), + InputType::Number(member, label, placeholder) => + EitherOf5::B(view! { + + }), + InputType::Checkbox(member, label, options) => + EitherOf5::C(view! { + + }), + InputType::Radio(member, label, options) => + EitherOf5::D(view! { + + }), + InputType::Select(member, label, options) => + EitherOf5::E(view! { +