Compare commits
40 Commits
feat/somet
...
main
Author | SHA1 | Date | |
---|---|---|---|
678ec08491 | |||
c43e551e59 | |||
601bcc6cd4 | |||
1df752f2ad | |||
ce031beeea | |||
e37cfd562d | |||
c1ae2313ac | |||
1c8dd7d4f1 | |||
89363030cb | |||
0a1f296ac3 | |||
54e90bce18 | |||
5cc03e6800 | |||
eea0086005 | |||
817975356b | |||
41abfaae15 | |||
d4f80f2c7f | |||
0b81065271 | |||
5478867683 | |||
8533b9d128 | |||
d79c0d0286 | |||
6ef4c7db0f | |||
e8cbf65e8b | |||
e4ee378ac0 | |||
3b68ce9591 | |||
12a43adf75 | |||
7726dff664 | |||
94d766c893 | |||
b7ca41a0f3 | |||
0ad488ba72 | |||
7cd8538a0d | |||
e40a4dd701 | |||
20ecb13171 | |||
934fd83287 | |||
6cf2ff56a3
|
|||
87c1a1fdb2
|
|||
ff354f0ccb
|
|||
00f5c58e39 | |||
21ff2cd443 | |||
8c022a46c4 | |||
a7986e304c
|
2
.drone.yml
Normal file
2
.drone.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
kind: template
|
||||||
|
load: cuddle-empty-plan.yaml
|
1897
Cargo.lock
generated
1897
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
40
Cargo.toml
40
Cargo.toml
@@ -1,8 +1,8 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
uuid = { version = "1.3.0", features = ["v4", "serde"] }
|
uuid = { version = "1.8.0", features = ["v4", "serde"] }
|
||||||
chrono = { version = "0.4.23", features = ["serde"] }
|
chrono = { version = "0.4.38", features = ["serde"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
|
||||||
|
|
||||||
@@ -16,34 +16,34 @@ crate-type = ["cdylib", "rlib"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
console_error_panic_hook = "0.1"
|
console_error_panic_hook = "0.1"
|
||||||
console_log = "0.2"
|
console_log = "1.0"
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
leptos = { version = "*", default-features = false, features = ["serde"] }
|
leptos = { version = "*", features = ["serde"] }
|
||||||
leptos_dom = { version = "*", default-features = false }
|
leptos_dom = { version = "*" }
|
||||||
leptos_meta = { version = "*", default-features = false }
|
leptos_meta = { version = "*" }
|
||||||
leptos_axum = { version = "*", default-features = false, optional = true }
|
leptos_axum = { version = "*", optional = true }
|
||||||
leptos_router = { version = "*", default-features = false }
|
leptos_router = { version = "*" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
simple_logger = "4"
|
simple_logger = "5"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
axum = { version = "0.6.1", optional = true }
|
axum = { version = "0.7.5", optional = true }
|
||||||
tower = { version = "0.4.13", optional = true }
|
tower = { version = "0.4.13", optional = true }
|
||||||
tower-http = { version = "0.3.4", features = ["fs"], optional = true }
|
tower-http = { version = "0.5.2", features = ["fs"], optional = true }
|
||||||
tokio = { version = "1", features = ["time"], optional = true }
|
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"], optional = true }
|
||||||
wasm-bindgen = "0.2"
|
wasm-bindgen = "0.2"
|
||||||
tracing-subscriber = { version = "0.3.16", optional = true, features = [
|
tracing-subscriber = { version = "0.3.18", optional = true, features = [
|
||||||
"env-filter",
|
"env-filter",
|
||||||
] }
|
] }
|
||||||
tracing = { version = "0.1.37", features = ["log"], optional = true }
|
tracing = { version = "0.1.40", features = ["log"], optional = true }
|
||||||
anyhow = { version = "1.0.71" }
|
anyhow = { version = "1.0.86" }
|
||||||
|
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
chrono = { workspace = true }
|
chrono = { workspace = true }
|
||||||
uuid = { workspace = true, features = ["v4", "wasm-bindgen", "js", "serde"] }
|
uuid = { workspace = true, features = ["v4", "js", "serde"] }
|
||||||
graphql_client = { version = "0.13.0", features = ["reqwest"] }
|
graphql_client = { version = "0.14.0", features = ["reqwest"] }
|
||||||
reqwasm = "0.5.0"
|
reqwasm = "0.5.0"
|
||||||
serde_json = "1.0.96"
|
serde_json = "1.0.117"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]
|
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]
|
||||||
@@ -61,6 +61,10 @@ ssr = [
|
|||||||
"dep:tracing",
|
"dep:tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[package.metadata.cargo-all-features]
|
||||||
|
denylist = ["axum", "tower", "tower-http", "tokio", "sqlx", "leptos_axum"]
|
||||||
|
skip_feature_sets = [["ssr", "hydrate"]]
|
||||||
|
|
||||||
[package.metadata.leptos]
|
[package.metadata.leptos]
|
||||||
# The name used by wasm-bindgen/cargo-leptos for the JS/WASM bundle. Defaults to the crate name
|
# The name used by wasm-bindgen/cargo-leptos for the JS/WASM bundle. Defaults to the crate name
|
||||||
output-name = "como_web"
|
output-name = "como_web"
|
||||||
|
11
cuddle.yaml
11
cuddle.yaml
@@ -5,6 +5,17 @@ base: "git@git.front.kjuulh.io:kjuulh/cuddle-rust-plan.git"
|
|||||||
vars:
|
vars:
|
||||||
service: "como-web"
|
service: "como-web"
|
||||||
deployments: "git@git.front.kjuulh.io:como/deployments.git"
|
deployments: "git@git.front.kjuulh.io:como/deployments.git"
|
||||||
|
registry: "kasperhermansen"
|
||||||
|
|
||||||
|
please:
|
||||||
|
project:
|
||||||
|
owner: kjuulh
|
||||||
|
repository: "como-web"
|
||||||
|
branch: main
|
||||||
|
settings:
|
||||||
|
api_url: https://git.front.kjuulh.io
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
scripts:
|
scripts:
|
||||||
render_como_templates:
|
render_como_templates:
|
||||||
|
95
end2end/package-lock.json
generated
95
end2end/package-lock.json
generated
@@ -13,61 +13,96 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@playwright/test": {
|
"node_modules/@playwright/test": {
|
||||||
"version": "1.28.0",
|
"version": "1.50.1",
|
||||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.28.0.tgz",
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.50.1.tgz",
|
||||||
"integrity": "sha512-vrHs5DFTPwYox5SGKq/7TDn/S4q6RA1zArd7uhO6EyP9hj3XgZBBM12ktMbnDQNxh/fL1IUKsTNLxihmsU38lQ==",
|
"integrity": "sha512-Jii3aBg+CEDpgnuDxEp/h7BimHcUTDlpEtce89xEumlJ5ef2hqepZ+PWp1DDpYC/VO9fmWVI1IlEaoI5fK9FXQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "*",
|
"playwright": "1.50.1"
|
||||||
"playwright-core": "1.28.0"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/fsevents": {
|
||||||
"version": "18.11.9",
|
"version": "2.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||||
"integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
|
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/playwright-core": {
|
|
||||||
"version": "1.28.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.28.0.tgz",
|
|
||||||
"integrity": "sha512-nJLknd28kPBiCNTbqpu6Wmkrh63OEqJSFw9xOfL9qxfNwody7h6/L3O2dZoWQ6Oxcm0VOHjWmGiCUGkc0X3VZA==",
|
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/playwright": {
|
||||||
|
"version": "1.50.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.50.1.tgz",
|
||||||
|
"integrity": "sha512-G8rwsOQJ63XG6BbKj2w5rHeavFjy5zynBA9zsJMMtBoe/Uf757oG12NXz6e6OirF7RCrTVAKFXbLmn1RbL7Qaw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"playwright-core": "1.50.1"
|
||||||
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/playwright-core": {
|
||||||
|
"version": "1.50.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.50.1.tgz",
|
||||||
|
"integrity": "sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"playwright-core": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@playwright/test": {
|
"@playwright/test": {
|
||||||
"version": "1.28.0",
|
"version": "1.50.1",
|
||||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.28.0.tgz",
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.50.1.tgz",
|
||||||
"integrity": "sha512-vrHs5DFTPwYox5SGKq/7TDn/S4q6RA1zArd7uhO6EyP9hj3XgZBBM12ktMbnDQNxh/fL1IUKsTNLxihmsU38lQ==",
|
"integrity": "sha512-Jii3aBg+CEDpgnuDxEp/h7BimHcUTDlpEtce89xEumlJ5ef2hqepZ+PWp1DDpYC/VO9fmWVI1IlEaoI5fK9FXQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "*",
|
"playwright": "1.50.1"
|
||||||
"playwright-core": "1.28.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"fsevents": {
|
||||||
"version": "18.11.9",
|
"version": "2.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||||
"integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
|
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"playwright": {
|
||||||
|
"version": "1.50.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.50.1.tgz",
|
||||||
|
"integrity": "sha512-G8rwsOQJ63XG6BbKj2w5rHeavFjy5zynBA9zsJMMtBoe/Uf757oG12NXz6e6OirF7RCrTVAKFXbLmn1RbL7Qaw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"fsevents": "2.3.2",
|
||||||
|
"playwright-core": "1.50.1"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"playwright-core": {
|
"playwright-core": {
|
||||||
"version": "1.28.0",
|
"version": "1.50.1",
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.28.0.tgz",
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.50.1.tgz",
|
||||||
"integrity": "sha512-nJLknd28kPBiCNTbqpu6Wmkrh63OEqJSFw9xOfL9qxfNwody7h6/L3O2dZoWQ6Oxcm0VOHjWmGiCUGkc0X3VZA==",
|
"integrity": "sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
renovate.json
Normal file
3
renovate.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||||
|
}
|
@@ -1,20 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
tmux new-window -n dev
|
zellij run -- sh -c "cuddle x leptos:dev"
|
||||||
|
|
||||||
# allow for user input
|
zellij run -- sh -c "cuddle x tailwind:watch"
|
||||||
tmux split-window -h
|
|
||||||
|
|
||||||
# leptos
|
|
||||||
tmux send-keys -t dev "cuddle x leptos:dev" C-m
|
|
||||||
|
|
||||||
tmux split-window -v
|
|
||||||
# tailwind
|
|
||||||
tmux send-keys -t dev "cuddle x tailwind:watch" C-m
|
|
||||||
|
|
||||||
# set user input to first
|
|
||||||
tmux select-pane -t 0
|
|
||||||
|
|
||||||
|
|
||||||
tmux attach-session -t dev
|
|
||||||
|
|
||||||
|
2
something/.drone.yml
Normal file
2
something/.drone.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
kind: template
|
||||||
|
load: cuddle-empty-plan.yaml
|
1
something/.gitignore
vendored
Normal file
1
something/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.cuddle/
|
16
something/cuddle.yaml
Normal file
16
something/cuddle.yaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# yaml-language-server: $schema=https://git.front.kjuulh.io/kjuulh/cuddle/raw/branch/main/schemas/base.json
|
||||||
|
|
||||||
|
base: "git@git.front.kjuulh.io:kjuulh/cuddle-empty-plan.git"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
service: "como-web"
|
||||||
|
registry: kasperhermansen
|
||||||
|
|
||||||
|
please:
|
||||||
|
project:
|
||||||
|
owner: kjuulh
|
||||||
|
repository: "como-web"
|
||||||
|
branch: main
|
||||||
|
settings:
|
||||||
|
api_url: https://git.front.kjuulh.io
|
||||||
|
|
3
something/renovate.json
Normal file
3
something/renovate.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||||
|
}
|
26
src/app.rs
26
src/app.rs
@@ -8,44 +8,44 @@ use crate::routes::features_view::FeaturesView;
|
|||||||
use crate::routes::home::HomePage;
|
use crate::routes::home::HomePage;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn App(cx: Scope) -> impl IntoView {
|
pub fn App() -> impl IntoView {
|
||||||
// Provides context that manages stylesheets, titles, meta tags, etc.
|
// Provides context that manages stylesheets, titles, meta tags, etc.
|
||||||
provide_meta_context(cx);
|
provide_meta_context();
|
||||||
|
|
||||||
view! { cx,
|
view! {
|
||||||
<Stylesheet id="leptos" href="/pkg/como_web.css"/>
|
<Stylesheet id="leptos" href="/pkg/como_web.css"/>
|
||||||
<Router>
|
<Router>
|
||||||
<main>
|
<main>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route
|
<Route
|
||||||
path=""
|
path=""
|
||||||
view=|cx| {
|
view=|| {
|
||||||
view! { cx, <HomePage/> }
|
view! { <HomePage/> }
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/dash"
|
path="/dash"
|
||||||
view=|cx| {
|
view=|| {
|
||||||
view! { cx, <DashboardLayout/> }
|
view! { <DashboardLayout/> }
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Route
|
<Route
|
||||||
path=""
|
path=""
|
||||||
view=|cx| {
|
view=|| {
|
||||||
view! { cx, <DashHomePage/> }
|
view! { <DashHomePage/> }
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="home"
|
path="home"
|
||||||
view=|cx| {
|
view=|| {
|
||||||
view! { cx, <DashHomePage/> }
|
view! { <DashHomePage/> }
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
path="/features"
|
path="/features"
|
||||||
view=|cx| {
|
view=|| {
|
||||||
view! { cx, <FeaturesView/> }
|
view! { <FeaturesView/> }
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
|
@@ -5,8 +5,8 @@ use crate::features::command_line::CommandLine;
|
|||||||
use crate::features::navbar_projects::NavbarProjects;
|
use crate::features::navbar_projects::NavbarProjects;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn DashNav(cx: Scope) -> impl IntoView {
|
pub fn DashNav() -> impl IntoView {
|
||||||
view! { cx,
|
view! {
|
||||||
<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 sticky top-0 select-none bg-gray-800">
|
||||||
<div>
|
<div>
|
||||||
<a href="/dash/home" class="text-xl">
|
<a href="/dash/home" class="text-xl">
|
||||||
@@ -35,8 +35,8 @@ pub fn DashNav(cx: Scope) -> impl IntoView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn DashboardLayout(cx: Scope) -> impl IntoView {
|
pub fn DashboardLayout() -> impl IntoView {
|
||||||
view! { cx,
|
view! {
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<DashNav/>
|
<DashNav/>
|
||||||
<div id="content" class="px-0.5 flex-grow">
|
<div id="content" class="px-0.5 flex-grow">
|
||||||
|
@@ -3,28 +3,26 @@ 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},
|
||||||
};
|
};
|
||||||
use axum::response::Response as AxumResponse;
|
use axum::response::Response as AxumResponse;
|
||||||
use tower::ServiceExt;
|
use tower::ServiceExt;
|
||||||
use tower_http::services::ServeDir;
|
use tower_http::services::ServeDir;
|
||||||
use std::sync::Arc;
|
use leptos::{LeptosOptions, view};
|
||||||
use leptos::{LeptosOptions, Errors, view};
|
use crate::app::App;
|
||||||
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();
|
||||||
|
|
||||||
if res.status() == StatusCode::OK {
|
if res.status() == StatusCode::OK {
|
||||||
res.into_response()
|
res.into_response()
|
||||||
} else{
|
} else{
|
||||||
let handler = leptos_axum::render_app_to_stream(
|
let handler = leptos_axum::render_app_to_stream(
|
||||||
options.to_owned(),
|
options.to_owned(),
|
||||||
move |cx| view!{ cx, <App/> }
|
move || view!{ <App/> }
|
||||||
);
|
);
|
||||||
handler(req).await.into_response()
|
handler(req).await.into_response()
|
||||||
}
|
}
|
||||||
|
@@ -6,50 +6,50 @@ pub struct CommandLineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn CommandLineModalView(cx: Scope) -> impl IntoView {
|
pub fn CommandLineModalView() -> impl IntoView {
|
||||||
view! { cx, <div>"modal"</div> }
|
view! { <div>"modal"</div> }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn CommandLineModal(cx: Scope) -> impl IntoView {
|
pub fn CommandLineModal() -> impl IntoView {
|
||||||
let state =
|
let state =
|
||||||
use_context::<RwSignal<CommandLineState>>(cx).expect("command line state must be provided");
|
use_context::<RwSignal<CommandLineState>>().expect("command line state must be provided");
|
||||||
|
|
||||||
let (hidden, _) = create_slice(cx, state, |state| state.hidden, |state, n| state.hidden = n);
|
let (hidden, _) = create_slice(state, |state| state.hidden, |state, n| state.hidden = n);
|
||||||
|
|
||||||
view! { cx,
|
view! {
|
||||||
{move || {
|
{move || {
|
||||||
if !hidden.get() {
|
if !hidden.get() {
|
||||||
view! { cx, <CommandLineModalView/> }
|
view! { <CommandLineModalView/> }
|
||||||
} else {
|
} else {
|
||||||
view! { cx, }
|
view! { }.into_view()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn CommandLine(cx: Scope, children: Children) -> impl IntoView {
|
pub fn CommandLine(children: Children) -> impl IntoView {
|
||||||
let state = create_rw_signal(cx, CommandLineState { hidden: true });
|
let state = create_rw_signal(CommandLineState { hidden: true });
|
||||||
provide_context(cx, state);
|
provide_context(state);
|
||||||
let (hidden, set_hidden) =
|
let (hidden, set_hidden) =
|
||||||
create_slice(cx, state, |state| state.hidden, |state, n| state.hidden = n);
|
create_slice(state, |state| state.hidden, |state, n| state.hidden = n);
|
||||||
|
|
||||||
leptos_dom::helpers::window_event_listener(ev::keypress, move |event| {
|
leptos_dom::helpers::window_event_listener(ev::keypress, move |event| {
|
||||||
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.set(!hidden.get());
|
||||||
log!("toggle command")
|
//log!("toggle command")
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
view! { cx,
|
view! {
|
||||||
<div>
|
<div>
|
||||||
<div>{children(cx)}</div>
|
<div>{children()}</div>
|
||||||
<CommandLineModal/>
|
<CommandLineModal/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@@ -24,17 +24,14 @@ pub async fn get_projects_list() -> anyhow::Result<Vec<GetProjectsListViewGetPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn DashboardItemView(cx: Scope, item: GetProjectsListViewGetProjectsItems) -> impl IntoView {
|
pub fn DashboardItemView(item: GetProjectsListViewGetProjectsItems) -> impl IntoView {
|
||||||
view! { cx, <div class="dashboard-list-item dashboard-item">{item.title}</div> }
|
view! { <div class="dashboard-list-item dashboard-item">{item.title}</div> }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn DashboardProjectItemView(
|
pub fn DashboardProjectItemView(project: GetProjectsListViewGetProjects) -> impl IntoView {
|
||||||
cx: Scope,
|
view! {
|
||||||
project: GetProjectsListViewGetProjects,
|
<div class="dashboard-list-item dashboard-list-project">
|
||||||
) -> impl IntoView {
|
|
||||||
view! { cx,
|
|
||||||
<div class="dashboard-list-item dashboard-list-project">
|
|
||||||
<a href=format!("/dash/project/{}", & project.id) class="project-item flex flex-row">
|
<a href=format!("/dash/project/{}", & project.id) class="project-item flex flex-row">
|
||||||
<div class="space-x-2">
|
<div class="space-x-2">
|
||||||
<span>{&project.name}</span>
|
<span>{&project.name}</span>
|
||||||
@@ -48,46 +45,49 @@ pub fn DashboardProjectItemView(
|
|||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn DashboardListView(
|
pub fn DashboardListView(
|
||||||
cx: Scope,
|
|
||||||
projects: Resource<(), Vec<GetProjectsListViewGetProjects>>,
|
projects: Resource<(), Vec<GetProjectsListViewGetProjects>>,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
let projects_view = move || {
|
let projects_view = move || {
|
||||||
projects.with(cx, |projects| {
|
projects.with(|projects| {
|
||||||
|
if projects.is_none() {
|
||||||
|
return Vec::new();
|
||||||
|
}
|
||||||
|
let projects = projects.as_ref().unwrap();
|
||||||
|
|
||||||
if projects.is_empty() {
|
if projects.is_empty() {
|
||||||
return vec![view! { cx, <div class="project-item">"No projects"</div> }.into_any()];
|
return vec![view! { <div class="project-item">"No projects"</div> }.into_any()];
|
||||||
}
|
}
|
||||||
|
|
||||||
projects
|
projects
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|project| !project.items.is_empty())
|
.filter(|project| !project.items.is_empty())
|
||||||
.map(|project| {
|
.map(|project| {
|
||||||
view! { cx,
|
view! {
|
||||||
<div>
|
<div>
|
||||||
<DashboardProjectItemView project=project.clone()/>
|
<DashboardProjectItemView project=project.clone()/>
|
||||||
{&project
|
{&project
|
||||||
.items
|
.items
|
||||||
.clone()
|
.clone()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|item| {
|
.map(|item| {
|
||||||
view! { cx, <DashboardItemView item=item/> }
|
view! { <DashboardItemView item=item/> }
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into_view(cx)}
|
.into_view()}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
.into_any()
|
.into_any()
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
view! { cx, <div class="project-items">{projects_view}</div> }
|
view! {<div class="project-items">{projects_view}</div> }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn DashboardList(cx: Scope) -> impl IntoView {
|
pub fn DashboardList() -> impl IntoView {
|
||||||
let projects =
|
let projects = create_local_resource(|| (), |_| async { get_projects_list().await.unwrap() });
|
||||||
create_local_resource(cx, || (), |_| async { get_projects_list().await.unwrap() });
|
|
||||||
|
|
||||||
view! { cx, <DashboardListView projects=projects/> }
|
view! {<DashboardListView projects=projects/> }
|
||||||
}
|
}
|
||||||
|
@@ -25,20 +25,24 @@ pub async fn get_projects_list() -> anyhow::Result<Vec<GetProjectsListViewGetPro
|
|||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn NavbarProjectsView(
|
pub fn NavbarProjectsView(
|
||||||
cx: Scope,
|
|
||||||
projects: Resource<(), Vec<GetProjectsListViewGetProjects>>,
|
projects: Resource<(), Vec<GetProjectsListViewGetProjects>>,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
let projects_view = move || {
|
let projects_view = move || {
|
||||||
projects.with(cx, |projects| {
|
projects.with(|projects| {
|
||||||
|
if projects.is_none() {
|
||||||
|
return Vec::new()
|
||||||
|
}
|
||||||
|
let projects = projects.as_ref().unwrap();
|
||||||
|
|
||||||
|
|
||||||
if projects.is_empty() {
|
if projects.is_empty() {
|
||||||
return vec![view! { cx, <div class="project-item">"No projects"</div> }.into_any()];
|
return vec![view! { <div class="project-item">"No projects"</div> }.into_any()];
|
||||||
}
|
}
|
||||||
|
|
||||||
projects
|
projects
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|project| {
|
.map(|project| {
|
||||||
view! { cx,
|
view! {
|
||||||
<a href=format!("/dash/project/{}", & project.id) class="project-item">
|
<a href=format!("/dash/project/{}", & project.id) class="project-item">
|
||||||
|
|
||||||
|
|
||||||
@@ -53,13 +57,13 @@ pub fn NavbarProjectsView(
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
view! { cx, <div class="project-items space-y-1">{projects_view}</div> }
|
view! { <div class="project-items space-y-1">{projects_view}</div> }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn NavbarProjects(cx: Scope) -> impl IntoView {
|
pub fn NavbarProjects() -> impl IntoView {
|
||||||
let projects =
|
let projects =
|
||||||
create_local_resource(cx, || (), |_| async { get_projects_list().await.unwrap() });
|
create_local_resource(|| (), |_| async { get_projects_list().await.unwrap() });
|
||||||
|
|
||||||
view! { cx, <NavbarProjectsView projects=projects/> }
|
view! { <NavbarProjectsView projects=projects/> }
|
||||||
}
|
}
|
||||||
|
@@ -19,8 +19,8 @@ if #[cfg(feature = "hydrate")] {
|
|||||||
|
|
||||||
console_error_panic_hook::set_once();
|
console_error_panic_hook::set_once();
|
||||||
|
|
||||||
leptos::mount_to_body(move |cx| {
|
leptos::mount_to_body(move || {
|
||||||
view! { cx, <App/> }
|
view! { <App/> }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,19 +18,19 @@ async fn main() {
|
|||||||
let addr = conf.leptos_options.site_addr;
|
let addr = conf.leptos_options.site_addr;
|
||||||
let leptos_options = conf.leptos_options;
|
let leptos_options = conf.leptos_options;
|
||||||
// Generate the list of routes in your Leptos App
|
// Generate the list of routes in your Leptos App
|
||||||
let routes = generate_route_list(|cx| view! { cx, <App/> }).await;
|
let routes = generate_route_list(App);
|
||||||
|
|
||||||
como_web::api::register();
|
como_web::api::register();
|
||||||
|
|
||||||
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, || view! { <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`
|
||||||
log!("listening on http://{}", &addr);
|
// log!("listening on http://{}", &addr);
|
||||||
axum::Server::bind(&addr)
|
axum::Server::bind(&addr)
|
||||||
.serve(app.into_make_service())
|
.serve(app.into_make_service())
|
||||||
.await
|
.await
|
||||||
|
@@ -3,8 +3,8 @@ use leptos::*;
|
|||||||
use crate::features::dashboard_list_view::DashboardList;
|
use crate::features::dashboard_list_view::DashboardList;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn DashHomePage(cx: Scope) -> impl IntoView {
|
pub fn DashHomePage() -> impl IntoView {
|
||||||
view! { cx,
|
view! {
|
||||||
<div class="home-dash">
|
<div class="home-dash">
|
||||||
<DashboardList/>
|
<DashboardList/>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -5,9 +5,8 @@ use crate::features::navbar_projects::gen::queries::get_projects_list_view::GetP
|
|||||||
use crate::features::navbar_projects::NavbarProjectsView;
|
use crate::features::navbar_projects::NavbarProjectsView;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn FeaturesView(cx: Scope) -> impl IntoView {
|
pub fn FeaturesView() -> impl IntoView {
|
||||||
let projects = create_local_resource(
|
let projects = create_local_resource(
|
||||||
cx,
|
|
||||||
|| (),
|
|| (),
|
||||||
|_| async {
|
|_| async {
|
||||||
vec![
|
vec![
|
||||||
@@ -24,9 +23,9 @@ 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(|| (), |_| async { Vec::new() });
|
||||||
|
|
||||||
view! { cx,
|
view! {
|
||||||
<div>
|
<div>
|
||||||
<div class="space-y-5 p-2">
|
<div class="space-y-5 p-2">
|
||||||
<h1>"NavbarProjects"</h1>
|
<h1>"NavbarProjects"</h1>
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Navbar(cx: Scope) -> impl IntoView {
|
pub fn Navbar() -> impl IntoView {
|
||||||
view! { cx,
|
view! {
|
||||||
<div class="flex flex-row justify-between items-center bg-gray-800 p-4">
|
<div class="flex flex-row justify-between items-center bg-gray-800 p-4">
|
||||||
<div class="flex flex-row items-center">
|
<div class="flex flex-row items-center">
|
||||||
<div class="text-2xl text-white font-bold">"Como - Todo"</div>
|
<div class="text-2xl text-white font-bold">"Como - Todo"</div>
|
||||||
@@ -19,8 +19,8 @@ pub fn Navbar(cx: Scope) -> impl IntoView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn HomePage(cx: Scope) -> impl IntoView {
|
pub fn HomePage() -> impl IntoView {
|
||||||
view! { cx,
|
view! {
|
||||||
<Navbar/>
|
<Navbar/>
|
||||||
<h1 class="text-xl text-red-50">"Welcome to Leptos!"</h1>
|
<h1 class="text-xl text-red-50">"Welcome to Leptos!"</h1>
|
||||||
}
|
}
|
||||||
|
@@ -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.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user