feat: with updated stuff

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-08-20 21:19:28 +02:00
parent 8ee2ca5c14
commit 9ae09deae7
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
11 changed files with 544 additions and 462 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ test-results/
end2end/playwright-report/
playwright/.cache/
.cuddle/
.helix/

892
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ use leptos_router::*;
use crate::common::layout::DashboardLayout;
use crate::routes::dash::home::DashHomePage;
use crate::routes::features_view::FeaturesView;
use crate::routes::features_view::features_view;
use crate::routes::home::HomePage;
#[component]
@ -45,7 +45,7 @@ pub fn App(cx: Scope) -> impl IntoView {
<Route
path="/features"
view=|cx| {
view! { cx, <FeaturesView/> }
features_view(cx)
}
/>
</Routes>

View File

@ -7,7 +7,7 @@ use crate::features::navbar_projects::NavbarProjects;
#[component]
pub fn DashNav(cx: Scope) -> impl IntoView {
view! { cx,
<nav class="min-w-[200px] p-4 space-y-4 h-screen sticky top-0 select-none bg-gray-800">
<nav class="min-w-[200px] p-4 space-y-4 h-screen max-h-screen sticky top-0 select-none bg-gray-800 overflow-auto">
<div>
<a href="/dash/home" class="text-xl">
"como"

View File

@ -3,7 +3,7 @@ use cfg_if::cfg_if;
cfg_if! { if #[cfg(feature = "ssr")] {
use axum::{
body::{boxed, Body, BoxBody},
extract::Extension,
extract::State,
response::IntoResponse,
http::{Request, Response, StatusCode, Uri},
};
@ -14,8 +14,7 @@ cfg_if! { if #[cfg(feature = "ssr")] {
use leptos::{LeptosOptions, Errors, view};
use crate::app::{App, AppProps};
pub async fn file_and_error_handler(uri: Uri, Extension(options): Extension<Arc<LeptosOptions>>, req: Request<Body>) -> AxumResponse {
let options = &*options;
pub async fn file_and_error_handler(uri: Uri, State(options): State<LeptosOptions>, req: Request<Body>) -> AxumResponse {
let root = options.site_root.clone();
let res = get_static_file(uri.clone(), &root).await.unwrap();

View File

@ -22,7 +22,7 @@ pub fn CommandLineModal(cx: Scope) -> impl IntoView {
if !hidden.get() {
view! { cx, <CommandLineModalView/> }
} else {
view! { cx, }
view! { cx, <div></div> }.into_view(cx)
}
}}
}
@ -39,7 +39,7 @@ pub fn CommandLine(cx: Scope, children: Children) -> impl IntoView {
if event.ctrl_key() {
match event.code().as_str() {
"KeyK" => {
set_hidden(!hidden.get());
//set_hidden(!hidden.get());
log!("toggle command")
}
_ => {}

View File

@ -30,7 +30,6 @@ pub fn NavbarProjectsView(
) -> impl IntoView {
let projects_view = move || {
projects.with(cx, |projects| {
if projects.is_empty() {
return vec![view! { cx, <div class="project-item">"No projects"</div> }.into_any()];
}
@ -40,9 +39,6 @@ pub fn NavbarProjectsView(
.map(|project| {
view! { cx,
<a href=format!("/dash/project/{}", & project.id) class="project-item">
<div class="project-item-name hover:dark:bg-blue-700 rounded-md p-0.5 px-2">
{&project.name}
</div>

View File

@ -24,9 +24,9 @@ async fn main() {
let app = Router::new()
.route("/api/*fn_name", post(leptos_axum::handle_server_fns))
.leptos_routes(leptos_options.clone(), routes, |cx| view! { cx, <App/> })
.leptos_routes(&leptos_options.clone(), routes, |cx| view! { cx, <App/> })
.fallback(file_and_error_handler)
.layer(Extension(Arc::new(leptos_options)));
.with_state(leptos_options);
// run our app with hyper
// `axum::Server` is a re-export of `hyper::Server`

View File

@ -1,11 +1,12 @@
use leptos::*;
use leptos::{ev, html::*, *};
use uuid::Uuid;
use crate::features::navbar_projects::gen::queries::get_projects_list_view::GetProjectsListViewGetProjects;
use crate::features::navbar_projects::NavbarProjectsView;
use crate::features::navbar_projects::{
NavbarProjects, NavbarProjectsProps, NavbarProjectsView, NavbarProjectsViewProps,
};
#[component]
pub fn FeaturesView(cx: Scope) -> impl IntoView {
pub fn features_view(cx: Scope) -> impl IntoView {
let projects = create_local_resource(
cx,
|| (),
@ -26,19 +27,22 @@ pub fn FeaturesView(cx: Scope) -> impl IntoView {
let emptyProjects: Resource<(), Vec<GetProjectsListViewGetProjects>> =
create_local_resource(cx, || (), |_| async { Vec::new() });
view! { cx,
<div>
<div class="space-y-5 p-2">
<h1>"NavbarProjects"</h1>
<h2>"Projects"</h2>
<div class="feature-case">
<NavbarProjectsView projects=projects/>
</div>
<h2>"no projects"</h2>
<div class="feature-case">
<NavbarProjectsView projects=emptyProjects/>
</div>
</div>
</div>
}
return div(cx).child(
div(cx)
.classes("space-y-5 p-2")
.child(h1(cx).child("NavbarProjects"))
.child(h2(cx).child("Projects"))
.child(
div(cx)
.classes("feature-case")
.child(NavbarProjectsView(cx, NavbarProjectsViewProps { projects })),
)
.child(h2(cx).child("no projects"))
.child(div(cx).classes("feature-case").child(NavbarProjectsView(
cx,
NavbarProjectsViewProps {
projects: emptyProjects,
},
))),
);
}

View File

@ -1,5 +1,5 @@
/*
! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com
! tailwindcss v3.3.3 | MIT License | https://tailwindcss.com
*/
/*
@ -191,6 +191,10 @@ select,
textarea {
font-family: inherit;
/* 1 */
font-feature-settings: inherit;
/* 1 */
font-variation-settings: inherit;
/* 1 */
font-size: 100%;
/* 1 */
font-weight: inherit;
@ -341,6 +345,14 @@ menu {
padding: 0;
}
/*
Reset default styling for dialogs.
*/
dialog {
padding: 0;
}
/*
Prevent resizing textareas horizontally by default.
*/
@ -558,6 +570,10 @@ video {
height: 100vh;
}
.max-h-screen {
max-height: 100vh;
}
.min-w-\[200px\] {
min-width: 200px;
}
@ -618,6 +634,10 @@ video {
margin-bottom: calc(1.25rem * var(--tw-space-y-reverse));
}
.overflow-auto {
overflow: auto;
}
.rounded-md {
border-radius: 0.375rem;
}