Added a membersstore for storing temp information

This commit is contained in:
xeovalyte 2024-07-19 12:17:49 +02:00
parent 0dbbb889f6
commit e418456a82
Signed by: xeovalyte
SSH Key Fingerprint: SHA256:kSQDrQDmKzljJzfGYcd3m9RqHi4h8rSwkZ3sQ9kBURo
5 changed files with 188 additions and 0 deletions

View File

@ -881,6 +881,31 @@ html {
}
}
.input {
flex-shrink: 1;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
height: 3rem;
padding-left: 1rem;
padding-right: 1rem;
font-size: 1rem;
line-height: 2;
line-height: 1.5rem;
border-radius: var(--rounded-btn, 0.5rem);
border-width: 1px;
border-color: transparent;
--tw-bg-opacity: 1;
background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity)));
}
.input[type="number"]::-webkit-inner-spin-button,
.input-md[type="number"]::-webkit-inner-spin-button {
margin-top: -1rem;
margin-bottom: -1rem;
margin-inline-end: -1rem;
}
.navbar {
display: flex;
align-items: center;
@ -999,10 +1024,114 @@ html {
}
}
.input input {
--tw-bg-opacity: 1;
background-color: var(--fallback-p,oklch(var(--p)/var(--tw-bg-opacity)));
background-color: transparent;
}
.input input:focus {
outline: 2px solid transparent;
outline-offset: 2px;
}
.input[list]::-webkit-calendar-picker-indicator {
line-height: 1em;
}
.input:focus,
.input:focus-within {
box-shadow: none;
border-color: var(--fallback-bc,oklch(var(--bc)/0.2));
outline-style: solid;
outline-width: 2px;
outline-offset: 2px;
outline-color: var(--fallback-bc,oklch(var(--bc)/0.2));
}
.input:has(> input[disabled]),
.input-disabled,
.input:disabled,
.input[disabled] {
cursor: not-allowed;
--tw-border-opacity: 1;
border-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-border-opacity)));
--tw-bg-opacity: 1;
background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity)));
color: var(--fallback-bc,oklch(var(--bc)/0.4));
}
.input:has(> input[disabled])::-moz-placeholder, .input-disabled::-moz-placeholder, .input:disabled::-moz-placeholder, .input[disabled]::-moz-placeholder {
color: var(--fallback-bc,oklch(var(--bc)/var(--tw-placeholder-opacity)));
--tw-placeholder-opacity: 0.2;
}
.input:has(> input[disabled])::placeholder,
.input-disabled::placeholder,
.input:disabled::placeholder,
.input[disabled]::placeholder {
color: var(--fallback-bc,oklch(var(--bc)/var(--tw-placeholder-opacity)));
--tw-placeholder-opacity: 0.2;
}
.input:has(> input[disabled]) > input[disabled] {
cursor: not-allowed;
}
.input::-webkit-date-and-time-value {
text-align: inherit;
}
.join > :where(*:not(:first-child)):is(.btn) {
margin-inline-start: calc(var(--border-btn) * -1);
}
.mockup-browser .mockup-browser-toolbar .input {
position: relative;
margin-left: auto;
margin-right: auto;
display: block;
height: 1.75rem;
width: 24rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
--tw-bg-opacity: 1;
background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity)));
padding-left: 2rem;
direction: ltr;
}
.mockup-browser .mockup-browser-toolbar .input:before {
content: "";
position: absolute;
left: 0.5rem;
top: 50%;
aspect-ratio: 1 / 1;
height: 0.75rem;
--tw-translate-y: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
border-radius: 9999px;
border-width: 2px;
border-color: currentColor;
opacity: 0.6;
}
.mockup-browser .mockup-browser-toolbar .input:after {
content: "";
position: absolute;
left: 1.25rem;
top: 50%;
height: 0.5rem;
--tw-translate-y: 25%;
--tw-rotate: -45deg;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
border-radius: 9999px;
border-width: 1px;
border-color: currentColor;
opacity: 0.6;
}
@keyframes modal-pop {
0% {
opacity: 0;

View File

@ -1,2 +1,3 @@
pub mod model;
#[cfg(feature = "server")]
pub mod surrealdb;

1
src/util/model.rs Normal file
View File

@ -0,0 +1 @@
pub mod member;

15
src/util/model/member.rs Normal file
View File

@ -0,0 +1,15 @@
mod migration;
pub struct Member {
id: String,
name: Name,
hours: Vec<String>,
groups: Vec<String>,
diploma: Option<String>,
registration_token: Option<String>,
}
pub struct Name {
first: String,
last: String,
}

View File

@ -0,0 +1,42 @@
use super::Member;
use once_cell::sync::Lazy;
use std::collections::HashMap;
// Create a store for saving information when migrating to a new members list
static MEMBERS_STORE: Lazy<MembersStore> = Lazy::new(|| MembersStore::new());
struct MembersStore {
store: HashMap<u16, Vec<Member>>,
count: u16,
}
impl MembersStore {
fn new() -> Self {
Self {
store: HashMap::new(),
count: 0,
}
}
fn insert(&mut self, input: Vec<Member>) -> u16 {
let count = self.count + 1;
self.store.insert(count, input);
count
}
fn get(&self, key: &u16) -> Option<&Vec<Member>> {
self.store.get(key)
}
fn remove(&mut self, key: &u16) -> Option<Vec<Member>> {
self.store.remove(key)
}
}
impl Member {
async fn migrate() {}
}
fn csv_to_vec(input: String) -> Result<Vec<Member>, ()> {
Ok(vec![])
}