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/ end2end/playwright-report/
playwright/.cache/ playwright/.cache/
.cuddle/ .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::common::layout::DashboardLayout;
use crate::routes::dash::home::DashHomePage; use crate::routes::dash::home::DashHomePage;
use crate::routes::features_view::FeaturesView; use crate::routes::features_view::features_view;
use crate::routes::home::HomePage; use crate::routes::home::HomePage;
#[component] #[component]
@ -45,7 +45,7 @@ pub fn App(cx: Scope) -> impl IntoView {
<Route <Route
path="/features" path="/features"
view=|cx| { view=|cx| {
view! { cx, <FeaturesView/> } features_view(cx)
} }
/> />
</Routes> </Routes>

View File

@ -7,7 +7,7 @@ use crate::features::navbar_projects::NavbarProjects;
#[component] #[component]
pub fn DashNav(cx: Scope) -> impl IntoView { pub fn DashNav(cx: Scope) -> impl IntoView {
view! { cx, 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> <div>
<a href="/dash/home" class="text-xl"> <a href="/dash/home" class="text-xl">
"como" "como"

View File

@ -3,7 +3,7 @@ use cfg_if::cfg_if;
cfg_if! { if #[cfg(feature = "ssr")] { cfg_if! { if #[cfg(feature = "ssr")] {
use axum::{ use axum::{
body::{boxed, Body, BoxBody}, body::{boxed, Body, BoxBody},
extract::Extension, extract::State,
response::IntoResponse, response::IntoResponse,
http::{Request, Response, StatusCode, Uri}, http::{Request, Response, StatusCode, Uri},
}; };
@ -14,8 +14,7 @@ cfg_if! { if #[cfg(feature = "ssr")] {
use leptos::{LeptosOptions, Errors, view}; use leptos::{LeptosOptions, Errors, view};
use crate::app::{App, AppProps}; use crate::app::{App, AppProps};
pub async fn file_and_error_handler(uri: Uri, Extension(options): Extension<Arc<LeptosOptions>>, req: Request<Body>) -> AxumResponse { pub async fn file_and_error_handler(uri: Uri, State(options): State<LeptosOptions>, req: Request<Body>) -> AxumResponse {
let options = &*options;
let root = options.site_root.clone(); let root = options.site_root.clone();
let res = get_static_file(uri.clone(), &root).await.unwrap(); 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() { if !hidden.get() {
view! { cx, <CommandLineModalView/> } view! { cx, <CommandLineModalView/> }
} else { } 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() { if event.ctrl_key() {
match event.code().as_str() { match event.code().as_str() {
"KeyK" => { "KeyK" => {
set_hidden(!hidden.get()); //set_hidden(!hidden.get());
log!("toggle command") log!("toggle command")
} }
_ => {} _ => {}

View File

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

View File

@ -24,9 +24,9 @@ async fn main() {
let app = Router::new() let app = Router::new()
.route("/api/*fn_name", post(leptos_axum::handle_server_fns)) .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) .fallback(file_and_error_handler)
.layer(Extension(Arc::new(leptos_options))); .with_state(leptos_options);
// run our app with hyper // run our app with hyper
// `axum::Server` is a re-export of `hyper::Server` // `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 uuid::Uuid;
use crate::features::navbar_projects::gen::queries::get_projects_list_view::GetProjectsListViewGetProjects; 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 features_view(cx: Scope) -> impl IntoView {
pub fn FeaturesView(cx: Scope) -> impl IntoView {
let projects = create_local_resource( let projects = create_local_resource(
cx, cx,
|| (), || (),
@ -26,19 +27,22 @@ pub fn FeaturesView(cx: Scope) -> impl IntoView {
let emptyProjects: Resource<(), Vec<GetProjectsListViewGetProjects>> = let emptyProjects: Resource<(), Vec<GetProjectsListViewGetProjects>> =
create_local_resource(cx, || (), |_| async { Vec::new() }); create_local_resource(cx, || (), |_| async { Vec::new() });
view! { cx, return div(cx).child(
<div> div(cx)
<div class="space-y-5 p-2"> .classes("space-y-5 p-2")
<h1>"NavbarProjects"</h1> .child(h1(cx).child("NavbarProjects"))
<h2>"Projects"</h2> .child(h2(cx).child("Projects"))
<div class="feature-case"> .child(
<NavbarProjectsView projects=projects/> div(cx)
</div> .classes("feature-case")
<h2>"no projects"</h2> .child(NavbarProjectsView(cx, NavbarProjectsViewProps { projects })),
<div class="feature-case"> )
<NavbarProjectsView projects=emptyProjects/> .child(h2(cx).child("no projects"))
</div> .child(div(cx).classes("feature-case").child(NavbarProjectsView(
</div> cx,
</div> 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 { textarea {
font-family: inherit; font-family: inherit;
/* 1 */ /* 1 */
font-feature-settings: inherit;
/* 1 */
font-variation-settings: inherit;
/* 1 */
font-size: 100%; font-size: 100%;
/* 1 */ /* 1 */
font-weight: inherit; font-weight: inherit;
@ -341,6 +345,14 @@ menu {
padding: 0; padding: 0;
} }
/*
Reset default styling for dialogs.
*/
dialog {
padding: 0;
}
/* /*
Prevent resizing textareas horizontally by default. Prevent resizing textareas horizontally by default.
*/ */
@ -558,6 +570,10 @@ video {
height: 100vh; height: 100vh;
} }
.max-h-screen {
max-height: 100vh;
}
.min-w-\[200px\] { .min-w-\[200px\] {
min-width: 200px; min-width: 200px;
} }
@ -618,6 +634,10 @@ video {
margin-bottom: calc(1.25rem * var(--tw-space-y-reverse)); margin-bottom: calc(1.25rem * var(--tw-space-y-reverse));
} }
.overflow-auto {
overflow: auto;
}
.rounded-md { .rounded-md {
border-radius: 0.375rem; border-radius: 0.375rem;
} }