Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
6e16fc6b2b
commit
71b5a63700
1219
Cargo.lock
generated
1219
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
14
crates/como_web/.gitignore
vendored
Normal file
14
crates/como_web/.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
/target/
|
||||||
|
pkg
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# node e2e test tools and outputs
|
||||||
|
node_modules/
|
||||||
|
test-results/
|
||||||
|
end2end/playwright-report/
|
||||||
|
playwright/.cache/
|
||||||
|
.cuddle/
|
2980
crates/como_web/Cargo.lock
generated
Normal file
2980
crates/como_web/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
108
crates/como_web/Cargo.toml
Normal file
108
crates/como_web/Cargo.toml
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
[package]
|
||||||
|
name = "como_web"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
console_error_panic_hook = "0.1"
|
||||||
|
console_log = "0.2"
|
||||||
|
cfg-if = "1"
|
||||||
|
lazy_static = "1"
|
||||||
|
leptos = { version = "*", features = ["serde"] }
|
||||||
|
leptos_dom = { version = "*" }
|
||||||
|
leptos_meta = { version = "*" }
|
||||||
|
leptos_axum = { version = "*", optional = true }
|
||||||
|
leptos_router = { version = "*" }
|
||||||
|
log = "0.4"
|
||||||
|
simple_logger = "4"
|
||||||
|
thiserror = "1"
|
||||||
|
axum = { version = "0.6.1", optional = true }
|
||||||
|
tower = { version = "0.4.13", optional = true }
|
||||||
|
tower-http = { version = "0.3.4", features = ["fs"], optional = true }
|
||||||
|
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"], optional = true }
|
||||||
|
wasm-bindgen = "0.2"
|
||||||
|
tracing-subscriber = { version = "0.3.16", optional = true, features = [
|
||||||
|
"env-filter",
|
||||||
|
] }
|
||||||
|
tracing = { version = "0.1.37", features = ["log"], optional = true }
|
||||||
|
anyhow = { version = "1.0.71" }
|
||||||
|
|
||||||
|
serde = { workspace = true }
|
||||||
|
chrono = { workspace = true }
|
||||||
|
uuid = { workspace = true, features = ["v4", "wasm-bindgen", "js", "serde"] }
|
||||||
|
graphql_client = { version = "0.13.0", features = ["reqwest"] }
|
||||||
|
reqwasm = "0.5.0"
|
||||||
|
serde_json = "1.0.96"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]
|
||||||
|
ssr = [
|
||||||
|
"dep:axum",
|
||||||
|
"dep:tower",
|
||||||
|
"dep:tower-http",
|
||||||
|
"dep:tokio",
|
||||||
|
"leptos/ssr",
|
||||||
|
"leptos_meta/ssr",
|
||||||
|
"leptos_router/ssr",
|
||||||
|
"leptos_dom/ssr",
|
||||||
|
"dep:leptos_axum",
|
||||||
|
"dep:tracing-subscriber",
|
||||||
|
"dep:tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.metadata.cargo-all-features]
|
||||||
|
denylist = ["axum", "tower", "tower-http", "tokio", "sqlx", "leptos_axum"]
|
||||||
|
skip_feature_sets = [["ssr", "hydrate"]]
|
||||||
|
|
||||||
|
[package.metadata.leptos]
|
||||||
|
# The name used by wasm-bindgen/cargo-leptos for the JS/WASM bundle. Defaults to the crate name
|
||||||
|
output-name = "como_web"
|
||||||
|
# The site root folder is where cargo-leptos generate all output. WARNING: all content of this folder will be erased on a rebuild. Use it in your server setup.
|
||||||
|
site-root = "target/site"
|
||||||
|
# The site-root relative folder where all compiled output (JS, WASM and CSS) is written
|
||||||
|
# Defaults to pkg
|
||||||
|
site-pkg-dir = "pkg"
|
||||||
|
# [Optional] The source CSS file. If it ends with .sass or .scss then it will be compiled by dart-sass into CSS. The CSS is optimized by Lightning CSS before being written to <site-root>/<site-pkg>/app.css
|
||||||
|
style-file = "style/output.css"
|
||||||
|
# Assets source dir. All files found here will be copied and synchronized to site-root.
|
||||||
|
# The assets-dir cannot have a sub directory with the same name/path as site-pkg-dir.
|
||||||
|
#
|
||||||
|
# Optional. Env: LEPTOS_ASSETS_DIR.
|
||||||
|
assets-dir = "assets"
|
||||||
|
# The IP and port (ex: 127.0.0.1:3000) where the server serves the content. Use it in your server setup.
|
||||||
|
site-addr = "127.0.0.1:3000"
|
||||||
|
# The port to use for automatic reload monitoring
|
||||||
|
reload-port = 3002
|
||||||
|
# [Optional] Command to use when running end2end tests. It will run in the end2end dir.
|
||||||
|
# [Windows] for non-WSL use "npx.cmd playwright test"
|
||||||
|
# This binary name can be checked in Powershell with Get-Command npx
|
||||||
|
end2end-cmd = "npx playwright test"
|
||||||
|
end2end-dir = "end2end"
|
||||||
|
# The browserlist query used for optimizing the CSS.
|
||||||
|
browserquery = "defaults"
|
||||||
|
# Set by cargo-leptos watch when building with that tool. Controls whether autoreload JS will be included in the head
|
||||||
|
watch = false
|
||||||
|
# The environment Leptos will run in, usually either "DEV" or "PROD"
|
||||||
|
env = "DEV"
|
||||||
|
# The features to use when compiling the bin target
|
||||||
|
#
|
||||||
|
# Optional. Can be over-ridden with the command line parameter --bin-features
|
||||||
|
bin-features = ["ssr"]
|
||||||
|
|
||||||
|
# If the --no-default-features flag should be used when compiling the bin target
|
||||||
|
#
|
||||||
|
# Optional. Defaults to false.
|
||||||
|
bin-default-features = false
|
||||||
|
|
||||||
|
# The features to use when compiling the lib target
|
||||||
|
#
|
||||||
|
# Optional. Can be over-ridden with the command line parameter --lib-features
|
||||||
|
lib-features = ["hydrate"]
|
||||||
|
|
||||||
|
# If the --no-default-features flag should be used when compiling the lib target
|
||||||
|
#
|
||||||
|
# Optional. Defaults to false.
|
||||||
|
lib-default-features = false
|
67
crates/como_web/README.md
Normal file
67
crates/como_web/README.md
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<picture>
|
||||||
|
<source srcset="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_Solid_White.svg" media="(prefers-color-scheme: dark)">
|
||||||
|
<img src="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg" alt="Leptos Logo">
|
||||||
|
</picture>
|
||||||
|
|
||||||
|
# Leptos Starter Template
|
||||||
|
|
||||||
|
This is a template for use with the [Leptos](https://github.com/leptos-rs/leptos) web framework and the [cargo-leptos](https://github.com/akesson/cargo-leptos) tool.
|
||||||
|
|
||||||
|
## Creating your template repo
|
||||||
|
|
||||||
|
If you don't have `cargo-leptos` installed you can install it with
|
||||||
|
|
||||||
|
`cargo install cargo-leptos`
|
||||||
|
|
||||||
|
Then run
|
||||||
|
|
||||||
|
`cargo leptos new --git leptos-rs/start`
|
||||||
|
|
||||||
|
to generate a new project template.
|
||||||
|
|
||||||
|
`cd {projectname}`
|
||||||
|
|
||||||
|
to go to your newly created project.
|
||||||
|
|
||||||
|
Of course you should explore around the project structure, but the best place to start with your application code is in `src/app.rs`.
|
||||||
|
|
||||||
|
## Running your project
|
||||||
|
|
||||||
|
`cargo leptos watch`
|
||||||
|
|
||||||
|
## Installing Additional Tools
|
||||||
|
|
||||||
|
By default, `cargo-leptos` uses `nightly` Rust, `cargo-generate`, and `sass`. If you run into any trouble, you may need to install one or more of these tools.
|
||||||
|
|
||||||
|
1. `rustup toolchain install nightly --allow-downgrade` - make sure you have Rust nightly
|
||||||
|
2. `rustup target add wasm32-unknown-unknown` - add the ability to compile Rust to WebAssembly
|
||||||
|
3. `cargo install cargo-generate` - install `cargo-generate` binary (should be installed automatically in future)
|
||||||
|
4. `npm install -g sass` - install `dart-sass` (should be optional in future)
|
||||||
|
|
||||||
|
## Executing a Server on a Remote Machine Without the Toolchain
|
||||||
|
After running a `cargo leptos build --release` the minimum files needed are:
|
||||||
|
|
||||||
|
1. The server binary located in `target/server/release`
|
||||||
|
2. The `site` directory and all files within located in `target/site`
|
||||||
|
|
||||||
|
Copy these files to your remote server. The directory structure should be:
|
||||||
|
```text
|
||||||
|
como_web
|
||||||
|
site/
|
||||||
|
```
|
||||||
|
Set the following enviornment variables (updating for your project as needed):
|
||||||
|
```text
|
||||||
|
LEPTOS_OUTPUT_NAME="como_web"
|
||||||
|
LEPTOS_SITE_ROOT="site"
|
||||||
|
LEPTOS_SITE_PKG_DIR="pkg"
|
||||||
|
LEPTOS_SITE_ADDR="127.0.0.1:3000"
|
||||||
|
LEPTOS_RELOAD_PORT="3001"
|
||||||
|
```
|
||||||
|
Finally, run the server binary.
|
||||||
|
|
||||||
|
## Notes about SSG and Trunk:
|
||||||
|
Although it is not recommended, you can also run your project without server integration using the feature `csr` and `trunk serve`:
|
||||||
|
|
||||||
|
`trunk serve --open --features csr`
|
||||||
|
|
||||||
|
This may be useful for integrating external tools which require a static site, e.g. `tauri`.
|
BIN
crates/como_web/assets/favicon.ico
Normal file
BIN
crates/como_web/assets/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
27
crates/como_web/cuddle.yaml
Normal file
27
crates/como_web/cuddle.yaml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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-rust-plan.git"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
service: "como-web"
|
||||||
|
deployments: "git@git.front.kjuulh.io:como/deployments.git"
|
||||||
|
|
||||||
|
scripts:
|
||||||
|
render_como_templates:
|
||||||
|
type: shell
|
||||||
|
local_up:
|
||||||
|
type: shell
|
||||||
|
local_down:
|
||||||
|
type: shell
|
||||||
|
"tailwind:watch":
|
||||||
|
type: "shell"
|
||||||
|
"tailwind:build":
|
||||||
|
type: "shell"
|
||||||
|
"leptos:dev":
|
||||||
|
type: "shell"
|
||||||
|
"dev":
|
||||||
|
type: "shell"
|
||||||
|
"nodev":
|
||||||
|
type: "shell"
|
||||||
|
"refresh:schema":
|
||||||
|
type: "shell"
|
74
crates/como_web/end2end/package-lock.json
generated
Normal file
74
crates/como_web/end2end/package-lock.json
generated
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"name": "end2end",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "end2end",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"@playwright/test": "^1.28.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@playwright/test": {
|
||||||
|
"version": "1.28.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.28.0.tgz",
|
||||||
|
"integrity": "sha512-vrHs5DFTPwYox5SGKq/7TDn/S4q6RA1zArd7uhO6EyP9hj3XgZBBM12ktMbnDQNxh/fL1IUKsTNLxihmsU38lQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"playwright-core": "1.28.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "18.11.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
|
||||||
|
"integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
|
||||||
|
"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,
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@playwright/test": {
|
||||||
|
"version": "1.28.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.28.0.tgz",
|
||||||
|
"integrity": "sha512-vrHs5DFTPwYox5SGKq/7TDn/S4q6RA1zArd7uhO6EyP9hj3XgZBBM12ktMbnDQNxh/fL1IUKsTNLxihmsU38lQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"playwright-core": "1.28.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "18.11.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
|
||||||
|
"integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
crates/como_web/end2end/package.json
Normal file
13
crates/como_web/end2end/package.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "end2end",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"@playwright/test": "^1.28.0"
|
||||||
|
}
|
||||||
|
}
|
107
crates/como_web/end2end/playwright.config.ts
Normal file
107
crates/como_web/end2end/playwright.config.ts
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
import type { PlaywrightTestConfig } from "@playwright/test";
|
||||||
|
import { devices } from "@playwright/test";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read environment variables from file.
|
||||||
|
* https://github.com/motdotla/dotenv
|
||||||
|
*/
|
||||||
|
// require('dotenv').config();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
|
*/
|
||||||
|
const config: PlaywrightTestConfig = {
|
||||||
|
testDir: "./tests",
|
||||||
|
/* Maximum time one test can run for. */
|
||||||
|
timeout: 30 * 1000,
|
||||||
|
expect: {
|
||||||
|
/**
|
||||||
|
* Maximum time expect() should wait for the condition to be met.
|
||||||
|
* For example in `await expect(locator).toHaveText();`
|
||||||
|
*/
|
||||||
|
timeout: 5000,
|
||||||
|
},
|
||||||
|
/* Run tests in files in parallel */
|
||||||
|
fullyParallel: true,
|
||||||
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
|
forbidOnly: !!process.env.CI,
|
||||||
|
/* Retry on CI only */
|
||||||
|
retries: process.env.CI ? 2 : 0,
|
||||||
|
/* Opt out of parallel tests on CI. */
|
||||||
|
workers: process.env.CI ? 1 : undefined,
|
||||||
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
|
reporter: "html",
|
||||||
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
|
use: {
|
||||||
|
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
|
||||||
|
actionTimeout: 0,
|
||||||
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
|
// baseURL: 'http://localhost:3000',
|
||||||
|
|
||||||
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
|
trace: "on-first-retry",
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Configure projects for major browsers */
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: "chromium",
|
||||||
|
use: {
|
||||||
|
...devices["Desktop Chrome"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "firefox",
|
||||||
|
use: {
|
||||||
|
...devices["Desktop Firefox"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "webkit",
|
||||||
|
use: {
|
||||||
|
...devices["Desktop Safari"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Test against mobile viewports. */
|
||||||
|
// {
|
||||||
|
// name: 'Mobile Chrome',
|
||||||
|
// use: {
|
||||||
|
// ...devices['Pixel 5'],
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'Mobile Safari',
|
||||||
|
// use: {
|
||||||
|
// ...devices['iPhone 12'],
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
|
||||||
|
/* Test against branded browsers. */
|
||||||
|
// {
|
||||||
|
// name: 'Microsoft Edge',
|
||||||
|
// use: {
|
||||||
|
// channel: 'msedge',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'Google Chrome',
|
||||||
|
// use: {
|
||||||
|
// channel: 'chrome',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
|
||||||
|
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
|
||||||
|
// outputDir: 'test-results/',
|
||||||
|
|
||||||
|
/* Run your local dev server before starting the tests */
|
||||||
|
// webServer: {
|
||||||
|
// command: 'npm run start',
|
||||||
|
// port: 3000,
|
||||||
|
// },
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
9
crates/como_web/end2end/tests/example.spec.ts
Normal file
9
crates/como_web/end2end/tests/example.spec.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { test, expect } from "@playwright/test";
|
||||||
|
|
||||||
|
test("homepage has title and links to intro page", async ({ page }) => {
|
||||||
|
await page.goto("http://localhost:3000/");
|
||||||
|
|
||||||
|
await expect(page).toHaveTitle("Welcome to Leptos");
|
||||||
|
|
||||||
|
await expect(page.locator("h1")).toHaveText("Welcome to Leptos!");
|
||||||
|
});
|
26
crates/como_web/input.css
Normal file
26
crates/como_web/input.css
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
min-height: 100%;
|
||||||
|
|
||||||
|
@apply bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-case {
|
||||||
|
@apply m-8 border-blue-700 border-2 rounded-lg p-4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-list-item {
|
||||||
|
@apply flex flex-col justify-center hover:dark:bg-blue-900 cursor-pointer select-none px-4 py-2 border-y border-y-gray-800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-list-project {
|
||||||
|
@apply dark:bg-gray-800 hover:dark:bg-blue-900 text-gray-300;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-item {
|
||||||
|
@apply pl-6
|
||||||
|
}
|
3
crates/como_web/leptosfmt.toml
Normal file
3
crates/como_web/leptosfmt.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
max_width = 100
|
||||||
|
tab_spaces = 4
|
||||||
|
attr_value_brace_style = "WhenRequired" # "Always", "AlwaysUnlessLit", "WhenRequired" or "Preserve"
|
3
crates/como_web/rust-toolchain.toml
Normal file
3
crates/como_web/rust-toolchain.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
[toolchain]
|
||||||
|
channel = "nightly"
|
6
crates/como_web/scripts/dev.sh
Executable file
6
crates/como_web/scripts/dev.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
zellij run -- sh -c "cuddle x leptos:dev"
|
||||||
|
|
||||||
|
zellij run -- sh -c "cuddle x tailwind:watch"
|
||||||
|
|
3
crates/como_web/scripts/leptos:dev.sh
Executable file
3
crates/como_web/scripts/leptos:dev.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cargo leptos watch
|
3
crates/como_web/scripts/nodev.sh
Executable file
3
crates/como_web/scripts/nodev.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
tmux kill-window -t dev || true
|
22
crates/como_web/scripts/refresh:schema.sh
Executable file
22
crates/como_web/scripts/refresh:schema.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
graphql-client introspect-schema \
|
||||||
|
http://localhost:3001/graphql \
|
||||||
|
--header "Authorization: Basic $COMO_GATEWAY_PAT" \
|
||||||
|
--output src/api/graphql/schema/schema.json
|
||||||
|
|
||||||
|
graphql-client generate \
|
||||||
|
--schema-path src/api/graphql/schema/schema.json \
|
||||||
|
src/features/navbar_projects/graphql/queries.graphql \
|
||||||
|
--output-directory src/features/navbar_projects/gen \
|
||||||
|
--custom-scalars-module='crate::common::graphql' \
|
||||||
|
--variables-derives='Clone,Debug' \
|
||||||
|
--response-derives='Clone,Debug'
|
||||||
|
|
||||||
|
graphql-client generate \
|
||||||
|
--schema-path src/api/graphql/schema/schema.json \
|
||||||
|
src/features/dashboard_list_view/graphql/queries.graphql \
|
||||||
|
--output-directory src/features/dashboard_list_view/gen \
|
||||||
|
--custom-scalars-module='crate::common::graphql' \
|
||||||
|
--variables-derives='Clone,Debug' \
|
||||||
|
--response-derives='Clone,Debug'
|
3
crates/como_web/scripts/tailwind:build.sh
Executable file
3
crates/como_web/scripts/tailwind:build.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
npx tailwindcss -i ./input.css -o ./style/output.css
|
3
crates/como_web/scripts/tailwind:watch.sh
Executable file
3
crates/como_web/scripts/tailwind:watch.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
npx tailwindcss -i ./input.css -o ./style/output.css --watch
|
1738
crates/como_web/src/api/graphql/schema/schema.json
Normal file
1738
crates/como_web/src/api/graphql/schema/schema.json
Normal file
File diff suppressed because it is too large
Load Diff
2
crates/como_web/src/api/mod.rs
Normal file
2
crates/como_web/src/api/mod.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#[cfg(feature = "ssr")]
|
||||||
|
pub fn register() {}
|
55
crates/como_web/src/app.rs
Normal file
55
crates/como_web/src/app.rs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
use leptos::*;
|
||||||
|
use leptos_meta::*;
|
||||||
|
use leptos_router::*;
|
||||||
|
|
||||||
|
use crate::common::layout::DashboardLayout;
|
||||||
|
use crate::routes::dash::home::DashHomePage;
|
||||||
|
use crate::routes::features_view::FeaturesView;
|
||||||
|
use crate::routes::home::HomePage;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn App() -> impl IntoView {
|
||||||
|
// Provides context that manages stylesheets, titles, meta tags, etc.
|
||||||
|
provide_meta_context();
|
||||||
|
|
||||||
|
view! {
|
||||||
|
<Stylesheet id="leptos" href="/pkg/como_web.css"/>
|
||||||
|
<Router>
|
||||||
|
<main>
|
||||||
|
<Routes>
|
||||||
|
<Route
|
||||||
|
path=""
|
||||||
|
view=|| {
|
||||||
|
view! { <HomePage/> }
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/dash"
|
||||||
|
view=|| {
|
||||||
|
view! { <DashboardLayout/> }
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Route
|
||||||
|
path=""
|
||||||
|
view=|| {
|
||||||
|
view! { <DashHomePage/> }
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="home"
|
||||||
|
view=|| {
|
||||||
|
view! { <DashHomePage/> }
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Route>
|
||||||
|
<Route
|
||||||
|
path="/features"
|
||||||
|
view=|| {
|
||||||
|
view! { <FeaturesView/> }
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Routes>
|
||||||
|
</main>
|
||||||
|
</Router>
|
||||||
|
}
|
||||||
|
}
|
2
crates/como_web/src/common.rs
Normal file
2
crates/como_web/src/common.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pub mod layout;
|
||||||
|
pub mod graphql;
|
1
crates/como_web/src/common/graphql/mod.rs
Normal file
1
crates/como_web/src/common/graphql/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub type UUID = uuid::Uuid;
|
49
crates/como_web/src/common/layout.rs
Normal file
49
crates/como_web/src/common/layout.rs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
use leptos::*;
|
||||||
|
use leptos_router::*;
|
||||||
|
|
||||||
|
use crate::features::command_line::CommandLine;
|
||||||
|
use crate::features::navbar_projects::NavbarProjects;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn DashNav() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<nav class="min-w-[200px] p-4 space-y-4 h-screen sticky top-0 select-none bg-gray-800">
|
||||||
|
<div>
|
||||||
|
<a href="/dash/home" class="text-xl">
|
||||||
|
"como"
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="/dash/current" class="">
|
||||||
|
"inbox"
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p class="text-sm mb-0.5 dark:text-gray-500">"Favorites"</p>
|
||||||
|
<a href="/dash/current" class="dark:text-gray-300 pl-2">
|
||||||
|
"inbox"
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p class="text-sm mb-0.5 dark:text-gray-500">"Projects"</p>
|
||||||
|
<div class="pl-2 dark:text-gray-300">
|
||||||
|
<NavbarProjects/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn DashboardLayout() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="flex flex-row">
|
||||||
|
<DashNav/>
|
||||||
|
<div id="content" class="px-0.5 flex-grow">
|
||||||
|
<CommandLine>
|
||||||
|
<Outlet/>
|
||||||
|
</CommandLine>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
43
crates/como_web/src/fallback.rs
Normal file
43
crates/como_web/src/fallback.rs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
use cfg_if::cfg_if;
|
||||||
|
|
||||||
|
cfg_if! { if #[cfg(feature = "ssr")] {
|
||||||
|
use axum::{
|
||||||
|
body::{boxed, Body, BoxBody},
|
||||||
|
extract::State,
|
||||||
|
response::IntoResponse,
|
||||||
|
http::{Request, Response, StatusCode, Uri},
|
||||||
|
};
|
||||||
|
use axum::response::Response as AxumResponse;
|
||||||
|
use tower::ServiceExt;
|
||||||
|
use tower_http::services::ServeDir;
|
||||||
|
use leptos::{LeptosOptions, view};
|
||||||
|
use crate::app::App;
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
if res.status() == StatusCode::OK {
|
||||||
|
res.into_response()
|
||||||
|
} else{
|
||||||
|
let handler = leptos_axum::render_app_to_stream(
|
||||||
|
options.to_owned(),
|
||||||
|
move || view!{ <App/> }
|
||||||
|
);
|
||||||
|
handler(req).await.into_response()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn get_static_file(uri: Uri, root: &str) -> Result<Response<BoxBody>, (StatusCode, String)> {
|
||||||
|
let req = Request::builder().uri(uri.clone()).body(Body::empty()).unwrap();
|
||||||
|
// `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot`
|
||||||
|
// This path is relative to the cargo root
|
||||||
|
match ServeDir::new(root).oneshot(req).await {
|
||||||
|
Ok(res) => Ok(res.map(boxed)),
|
||||||
|
Err(err) => Err((
|
||||||
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
format!("Something went wrong: {err}"),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
3
crates/como_web/src/features.rs
Normal file
3
crates/como_web/src/features.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pub mod command_line;
|
||||||
|
pub mod dashboard_list_view;
|
||||||
|
pub mod navbar_projects;
|
56
crates/como_web/src/features/command_line/mod.rs
Normal file
56
crates/como_web/src/features/command_line/mod.rs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct CommandLineState {
|
||||||
|
hidden: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn CommandLineModalView() -> impl IntoView {
|
||||||
|
view! { <div>"modal"</div> }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn CommandLineModal() -> impl IntoView {
|
||||||
|
let state =
|
||||||
|
use_context::<RwSignal<CommandLineState>>().expect("command line state must be provided");
|
||||||
|
|
||||||
|
let (hidden, _) = create_slice(state, |state| state.hidden, |state, n| state.hidden = n);
|
||||||
|
|
||||||
|
view! {
|
||||||
|
{move || {
|
||||||
|
if !hidden.get() {
|
||||||
|
view! { <CommandLineModalView/> }
|
||||||
|
} else {
|
||||||
|
view! { }.into_view()
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn CommandLine(children: Children) -> impl IntoView {
|
||||||
|
let state = create_rw_signal(CommandLineState { hidden: true });
|
||||||
|
provide_context(state);
|
||||||
|
let (hidden, set_hidden) =
|
||||||
|
create_slice(state, |state| state.hidden, |state, n| state.hidden = n);
|
||||||
|
|
||||||
|
leptos_dom::helpers::window_event_listener(ev::keypress, move |event| {
|
||||||
|
if event.ctrl_key() {
|
||||||
|
match event.code().as_str() {
|
||||||
|
"KeyK" => {
|
||||||
|
set_hidden.set(!hidden.get());
|
||||||
|
//log!("toggle command")
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
view! {
|
||||||
|
<div>
|
||||||
|
<div>{children()}</div>
|
||||||
|
<CommandLineModal/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
4
crates/como_web/src/features/dashboard_list_view.rs
Normal file
4
crates/como_web/src/features/dashboard_list_view.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pub mod dashboard_list_view;
|
||||||
|
pub mod gen;
|
||||||
|
|
||||||
|
pub use dashboard_list_view::*;
|
@ -0,0 +1,93 @@
|
|||||||
|
use graphql_client::{GraphQLQuery, Response};
|
||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
use crate::features::dashboard_list_view::gen::queries::get_projects_list_view::GetProjectsListViewGetProjectsItems;
|
||||||
|
|
||||||
|
use super::gen::queries::get_projects_list_view::{
|
||||||
|
GetProjectsListViewGetProjects, ResponseData, Variables,
|
||||||
|
};
|
||||||
|
use super::gen::queries::GetProjectsListView;
|
||||||
|
|
||||||
|
pub async fn get_projects_list() -> anyhow::Result<Vec<GetProjectsListViewGetProjects>> {
|
||||||
|
let request_body = GetProjectsListView::build_query(Variables {});
|
||||||
|
let payload = serde_json::to_string(&request_body)?;
|
||||||
|
let res = reqwasm::http::Request::post("http://localhost:3001/graphql")
|
||||||
|
.credentials(reqwasm::http::RequestCredentials::Include)
|
||||||
|
.body(payload)
|
||||||
|
.send()
|
||||||
|
.await?;
|
||||||
|
let response_body: Response<ResponseData> = res.json().await?;
|
||||||
|
Ok(response_body
|
||||||
|
.data
|
||||||
|
.ok_or(anyhow::anyhow!("failed to get projects list"))?
|
||||||
|
.get_projects)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn DashboardItemView(item: GetProjectsListViewGetProjectsItems) -> impl IntoView {
|
||||||
|
view! { <div class="dashboard-list-item dashboard-item">{item.title}</div> }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn DashboardProjectItemView(project: GetProjectsListViewGetProjects) -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="dashboard-list-item dashboard-list-project">
|
||||||
|
<a href=format!("/dash/project/{}", & project.id) class="project-item flex flex-row">
|
||||||
|
<div class="space-x-2">
|
||||||
|
<span>{&project.name}</span>
|
||||||
|
<span class="text-gray-50">{project.items.len()}</span>
|
||||||
|
<span class="flex-grow"></span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn DashboardListView(
|
||||||
|
projects: Resource<(), Vec<GetProjectsListViewGetProjects>>,
|
||||||
|
) -> impl IntoView {
|
||||||
|
let projects_view = move || {
|
||||||
|
projects.with(|projects| {
|
||||||
|
if projects.is_none() {
|
||||||
|
return Vec::new();
|
||||||
|
}
|
||||||
|
let projects = projects.as_ref().unwrap();
|
||||||
|
|
||||||
|
if projects.is_empty() {
|
||||||
|
return vec![view! { <div class="project-item">"No projects"</div> }.into_any()];
|
||||||
|
}
|
||||||
|
|
||||||
|
projects
|
||||||
|
.into_iter()
|
||||||
|
.filter(|project| !project.items.is_empty())
|
||||||
|
.map(|project| {
|
||||||
|
view! {
|
||||||
|
<div>
|
||||||
|
<DashboardProjectItemView project=project.clone()/>
|
||||||
|
{&project
|
||||||
|
.items
|
||||||
|
.clone()
|
||||||
|
.into_iter()
|
||||||
|
.map(|item| {
|
||||||
|
view! { <DashboardItemView item=item/> }
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.into_view()}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
.into_any()
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
view! {<div class="project-items">{projects_view}</div> }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn DashboardList() -> impl IntoView {
|
||||||
|
let projects = create_local_resource(|| (), |_| async { get_projects_list().await.unwrap() });
|
||||||
|
|
||||||
|
view! {<DashboardListView projects=projects/> }
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
pub mod queries;
|
@ -0,0 +1,81 @@
|
|||||||
|
#![allow(clippy::all, warnings)]
|
||||||
|
pub struct GetProjectsListView;
|
||||||
|
pub mod get_projects_list_view {
|
||||||
|
#![allow(dead_code)]
|
||||||
|
use std::result::Result;
|
||||||
|
pub const OPERATION_NAME: &str = "GetProjectsListView";
|
||||||
|
pub const QUERY : & str = "query GetProjectsListView {\n getProjects {\n id\n name\n\n items {\n id\n title\n description\n state\n }\n }\n}\n" ;
|
||||||
|
use super::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
#[allow(dead_code)]
|
||||||
|
type Boolean = bool;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
type Float = f64;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
type Int = i64;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
type ID = String;
|
||||||
|
type UUID = crate::common::graphql::UUID;
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub enum ItemState {
|
||||||
|
CREATED,
|
||||||
|
DONE,
|
||||||
|
ARCHIVED,
|
||||||
|
DELETED,
|
||||||
|
Other(String),
|
||||||
|
}
|
||||||
|
impl ::serde::Serialize for ItemState {
|
||||||
|
fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
|
||||||
|
ser.serialize_str(match *self {
|
||||||
|
ItemState::CREATED => "CREATED",
|
||||||
|
ItemState::DONE => "DONE",
|
||||||
|
ItemState::ARCHIVED => "ARCHIVED",
|
||||||
|
ItemState::DELETED => "DELETED",
|
||||||
|
ItemState::Other(ref s) => &s,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<'de> ::serde::Deserialize<'de> for ItemState {
|
||||||
|
fn deserialize<D: ::serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
let s: String = ::serde::Deserialize::deserialize(deserializer)?;
|
||||||
|
match s.as_str() {
|
||||||
|
"CREATED" => Ok(ItemState::CREATED),
|
||||||
|
"DONE" => Ok(ItemState::DONE),
|
||||||
|
"ARCHIVED" => Ok(ItemState::ARCHIVED),
|
||||||
|
"DELETED" => Ok(ItemState::DELETED),
|
||||||
|
_ => Ok(ItemState::Other(s)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[derive(Serialize, Clone, Debug)]
|
||||||
|
pub struct Variables;
|
||||||
|
#[derive(Deserialize, Clone, Debug)]
|
||||||
|
pub struct ResponseData {
|
||||||
|
#[serde(rename = "getProjects")]
|
||||||
|
pub get_projects: Vec<GetProjectsListViewGetProjects>,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize, Clone, Debug)]
|
||||||
|
pub struct GetProjectsListViewGetProjects {
|
||||||
|
pub id: UUID,
|
||||||
|
pub name: String,
|
||||||
|
pub items: Vec<GetProjectsListViewGetProjectsItems>,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize, Clone, Debug)]
|
||||||
|
pub struct GetProjectsListViewGetProjectsItems {
|
||||||
|
pub id: UUID,
|
||||||
|
pub title: String,
|
||||||
|
pub description: Option<String>,
|
||||||
|
pub state: ItemState,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl graphql_client::GraphQLQuery for GetProjectsListView {
|
||||||
|
type Variables = get_projects_list_view::Variables;
|
||||||
|
type ResponseData = get_projects_list_view::ResponseData;
|
||||||
|
fn build_query(variables: Self::Variables) -> ::graphql_client::QueryBody<Self::Variables> {
|
||||||
|
graphql_client::QueryBody {
|
||||||
|
variables,
|
||||||
|
query: get_projects_list_view::QUERY,
|
||||||
|
operation_name: get_projects_list_view::OPERATION_NAME,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
query GetProjectsListView {
|
||||||
|
getProjects {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
|
||||||
|
items {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
description
|
||||||
|
state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
crates/como_web/src/features/navbar_projects.rs
Normal file
4
crates/como_web/src/features/navbar_projects.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pub mod gen;
|
||||||
|
pub mod navbar_projects;
|
||||||
|
|
||||||
|
pub use navbar_projects::*;
|
1
crates/como_web/src/features/navbar_projects/gen/mod.rs
Normal file
1
crates/como_web/src/features/navbar_projects/gen/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod queries;
|
43
crates/como_web/src/features/navbar_projects/gen/queries.rs
Normal file
43
crates/como_web/src/features/navbar_projects/gen/queries.rs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#![allow(clippy::all, warnings)]
|
||||||
|
pub struct GetProjectsListView;
|
||||||
|
pub mod get_projects_list_view {
|
||||||
|
#![allow(dead_code)]
|
||||||
|
use std::result::Result;
|
||||||
|
pub const OPERATION_NAME: &str = "GetProjectsListView";
|
||||||
|
pub const QUERY: &str =
|
||||||
|
"query GetProjectsListView {\n getProjects {\n id\n name\n }\n}\n";
|
||||||
|
use super::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
#[allow(dead_code)]
|
||||||
|
type Boolean = bool;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
type Float = f64;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
type Int = i64;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
type ID = String;
|
||||||
|
type UUID = crate::common::graphql::UUID;
|
||||||
|
#[derive(Serialize, Clone, Debug)]
|
||||||
|
pub struct Variables;
|
||||||
|
#[derive(Deserialize, Clone, Debug)]
|
||||||
|
pub struct ResponseData {
|
||||||
|
#[serde(rename = "getProjects")]
|
||||||
|
pub get_projects: Vec<GetProjectsListViewGetProjects>,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize, Clone, Debug)]
|
||||||
|
pub struct GetProjectsListViewGetProjects {
|
||||||
|
pub id: UUID,
|
||||||
|
pub name: String,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl graphql_client::GraphQLQuery for GetProjectsListView {
|
||||||
|
type Variables = get_projects_list_view::Variables;
|
||||||
|
type ResponseData = get_projects_list_view::ResponseData;
|
||||||
|
fn build_query(variables: Self::Variables) -> ::graphql_client::QueryBody<Self::Variables> {
|
||||||
|
graphql_client::QueryBody {
|
||||||
|
variables,
|
||||||
|
query: get_projects_list_view::QUERY,
|
||||||
|
operation_name: get_projects_list_view::OPERATION_NAME,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
query GetProjectsListView {
|
||||||
|
getProjects {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
use graphql_client::{GraphQLQuery, Response};
|
||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
use crate::features::navbar_projects::gen::queries::get_projects_list_view::{
|
||||||
|
ResponseData, Variables,
|
||||||
|
};
|
||||||
|
use crate::features::navbar_projects::gen::queries::GetProjectsListView;
|
||||||
|
|
||||||
|
use super::gen::queries::get_projects_list_view::GetProjectsListViewGetProjects;
|
||||||
|
|
||||||
|
pub async fn get_projects_list() -> anyhow::Result<Vec<GetProjectsListViewGetProjects>> {
|
||||||
|
let request_body = GetProjectsListView::build_query(Variables {});
|
||||||
|
let payload = serde_json::to_string(&request_body)?;
|
||||||
|
let res = reqwasm::http::Request::post("http://localhost:3001/graphql")
|
||||||
|
.credentials(reqwasm::http::RequestCredentials::Include)
|
||||||
|
.body(payload)
|
||||||
|
.send()
|
||||||
|
.await?;
|
||||||
|
let response_body: Response<ResponseData> = res.json().await?;
|
||||||
|
Ok(response_body
|
||||||
|
.data
|
||||||
|
.ok_or(anyhow::anyhow!("failed to get projects list"))?
|
||||||
|
.get_projects)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn NavbarProjectsView(
|
||||||
|
projects: Resource<(), Vec<GetProjectsListViewGetProjects>>,
|
||||||
|
) -> impl IntoView {
|
||||||
|
let projects_view = move || {
|
||||||
|
projects.with(|projects| {
|
||||||
|
if projects.is_none() {
|
||||||
|
return Vec::new()
|
||||||
|
}
|
||||||
|
let projects = projects.as_ref().unwrap();
|
||||||
|
|
||||||
|
|
||||||
|
if projects.is_empty() {
|
||||||
|
return vec![view! { <div class="project-item">"No projects"</div> }.into_any()];
|
||||||
|
}
|
||||||
|
|
||||||
|
projects
|
||||||
|
.into_iter()
|
||||||
|
.map(|project| {
|
||||||
|
view! {
|
||||||
|
<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>
|
||||||
|
</a>
|
||||||
|
}.into_any()
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
view! { <div class="project-items space-y-1">{projects_view}</div> }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn NavbarProjects() -> impl IntoView {
|
||||||
|
let projects =
|
||||||
|
create_local_resource(|| (), |_| async { get_projects_list().await.unwrap() });
|
||||||
|
|
||||||
|
view! { <NavbarProjectsView projects=projects/> }
|
||||||
|
}
|
27
crates/como_web/src/lib.rs
Normal file
27
crates/como_web/src/lib.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
pub mod api;
|
||||||
|
pub mod app;
|
||||||
|
pub mod common;
|
||||||
|
pub mod fallback;
|
||||||
|
pub mod features;
|
||||||
|
pub mod routes;
|
||||||
|
|
||||||
|
use cfg_if::cfg_if;
|
||||||
|
|
||||||
|
cfg_if! {
|
||||||
|
if #[cfg(feature = "hydrate")] {
|
||||||
|
|
||||||
|
use wasm_bindgen::prelude::wasm_bindgen;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn hydrate() {
|
||||||
|
use app::*;
|
||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
console_error_panic_hook::set_once();
|
||||||
|
|
||||||
|
leptos::mount_to_body(move || {
|
||||||
|
view! { <App/> }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
crates/como_web/src/main.rs
Normal file
45
crates/como_web/src/main.rs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#[cfg(feature = "ssr")]
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
use axum::{extract::Extension, routing::post, Router};
|
||||||
|
use como_web::app::*;
|
||||||
|
use como_web::fallback::file_and_error_handler;
|
||||||
|
use leptos::*;
|
||||||
|
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||||
|
use std::sync::Arc;
|
||||||
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
|
std::env::set_var("COMO_GATEWAY_URL", "https://api.como.i.kjuulh.io/graphql");
|
||||||
|
tracing_subscriber::fmt()
|
||||||
|
.with_env_filter(EnvFilter::from_default_env())
|
||||||
|
.init();
|
||||||
|
|
||||||
|
let conf = get_configuration(None).await.unwrap();
|
||||||
|
let addr = conf.leptos_options.site_addr;
|
||||||
|
let leptos_options = conf.leptos_options;
|
||||||
|
// Generate the list of routes in your Leptos App
|
||||||
|
let routes = generate_route_list(App);
|
||||||
|
|
||||||
|
como_web::api::register();
|
||||||
|
|
||||||
|
let app = Router::new()
|
||||||
|
.route("/api/*fn_name", post(leptos_axum::handle_server_fns))
|
||||||
|
.leptos_routes(&leptos_options.clone(), routes, || view! { <App/> })
|
||||||
|
.fallback(file_and_error_handler)
|
||||||
|
.with_state(leptos_options);
|
||||||
|
|
||||||
|
// run our app with hyper
|
||||||
|
// `axum::Server` is a re-export of `hyper::Server`
|
||||||
|
// log!("listening on http://{}", &addr);
|
||||||
|
axum::Server::bind(&addr)
|
||||||
|
.serve(app.into_make_service())
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "ssr"))]
|
||||||
|
pub fn main() {
|
||||||
|
// no client-side main function
|
||||||
|
// unless we want this to work with e.g., Trunk for pure client-side testing
|
||||||
|
// see lib.rs for hydration function instead
|
||||||
|
}
|
3
crates/como_web/src/routes.rs
Normal file
3
crates/como_web/src/routes.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pub mod dash;
|
||||||
|
pub mod features_view;
|
||||||
|
pub mod home;
|
1
crates/como_web/src/routes/dash.rs
Normal file
1
crates/como_web/src/routes/dash.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod home;
|
12
crates/como_web/src/routes/dash/home.rs
Normal file
12
crates/como_web/src/routes/dash/home.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
use crate::features::dashboard_list_view::DashboardList;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn DashHomePage() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="home-dash">
|
||||||
|
<DashboardList/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
43
crates/como_web/src/routes/features_view.rs
Normal file
43
crates/como_web/src/routes/features_view.rs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
use leptos::*;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::features::navbar_projects::gen::queries::get_projects_list_view::GetProjectsListViewGetProjects;
|
||||||
|
use crate::features::navbar_projects::NavbarProjectsView;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn FeaturesView() -> impl IntoView {
|
||||||
|
let projects = create_local_resource(
|
||||||
|
|| (),
|
||||||
|
|_| async {
|
||||||
|
vec![
|
||||||
|
GetProjectsListViewGetProjects {
|
||||||
|
id: Uuid::new_v4(),
|
||||||
|
name: "some-name".to_string(),
|
||||||
|
},
|
||||||
|
GetProjectsListViewGetProjects {
|
||||||
|
id: Uuid::new_v4(),
|
||||||
|
name: "some-other-name".to_string(),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
let emptyProjects: Resource<(), Vec<GetProjectsListViewGetProjects>> =
|
||||||
|
create_local_resource(|| (), |_| async { Vec::new() });
|
||||||
|
|
||||||
|
view! {
|
||||||
|
<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>
|
||||||
|
}
|
||||||
|
}
|
27
crates/como_web/src/routes/home.rs
Normal file
27
crates/como_web/src/routes/home.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Navbar() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="flex flex-row justify-between items-center bg-gray-800 p-4">
|
||||||
|
<div class="flex flex-row items-center">
|
||||||
|
<div class="text-2xl text-white font-bold">"Como - Todo"</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row items-center space-x-4">
|
||||||
|
<div class="text-xl text-white font-bold cursor-pointer">
|
||||||
|
<a href="http://localhost:3001/auth/zitadel?return_url=http://localhost:3000/dash/home">
|
||||||
|
"Enter"
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn HomePage() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<Navbar/>
|
||||||
|
<h1 class="text-xl text-red-50">"Welcome to Leptos!"</h1>
|
||||||
|
}
|
||||||
|
}
|
804
crates/como_web/style/output.css
Normal file
804
crates/como_web/style/output.css
Normal file
@ -0,0 +1,804 @@
|
|||||||
|
/*
|
||||||
|
! tailwindcss v3.3.3 | MIT License | https://tailwindcss.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
||||||
|
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
||||||
|
*/
|
||||||
|
|
||||||
|
*,
|
||||||
|
::before,
|
||||||
|
::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
/* 1 */
|
||||||
|
border-width: 0;
|
||||||
|
/* 2 */
|
||||||
|
border-style: solid;
|
||||||
|
/* 2 */
|
||||||
|
border-color: #e5e7eb;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
::before,
|
||||||
|
::after {
|
||||||
|
--tw-content: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Use a consistent sensible line-height in all browsers.
|
||||||
|
2. Prevent adjustments of font size after orientation changes in iOS.
|
||||||
|
3. Use a more readable tab size.
|
||||||
|
4. Use the user's configured `sans` font-family by default.
|
||||||
|
5. Use the user's configured `sans` font-feature-settings by default.
|
||||||
|
6. Use the user's configured `sans` font-variation-settings by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
html {
|
||||||
|
line-height: 1.5;
|
||||||
|
/* 1 */
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
/* 2 */
|
||||||
|
-moz-tab-size: 4;
|
||||||
|
/* 3 */
|
||||||
|
-o-tab-size: 4;
|
||||||
|
tab-size: 4;
|
||||||
|
/* 3 */
|
||||||
|
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
/* 4 */
|
||||||
|
font-feature-settings: normal;
|
||||||
|
/* 5 */
|
||||||
|
font-variation-settings: normal;
|
||||||
|
/* 6 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Remove the margin in all browsers.
|
||||||
|
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
/* 1 */
|
||||||
|
line-height: inherit;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Add the correct height in Firefox.
|
||||||
|
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
||||||
|
3. Ensure horizontal rules are visible by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
hr {
|
||||||
|
height: 0;
|
||||||
|
/* 1 */
|
||||||
|
color: inherit;
|
||||||
|
/* 2 */
|
||||||
|
border-top-width: 1px;
|
||||||
|
/* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct text decoration in Chrome, Edge, and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abbr:where([title]) {
|
||||||
|
-webkit-text-decoration: underline dotted;
|
||||||
|
text-decoration: underline dotted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the default font size and weight for headings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
font-size: inherit;
|
||||||
|
font-weight: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reset links to optimize for opt-in styling instead of opt-out.
|
||||||
|
*/
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct font weight in Edge and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Use the user's configured `mono` font family by default.
|
||||||
|
2. Correct the odd `em` font sizing in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
code,
|
||||||
|
kbd,
|
||||||
|
samp,
|
||||||
|
pre {
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
|
/* 1 */
|
||||||
|
font-size: 1em;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct font size in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sub,
|
||||||
|
sup {
|
||||||
|
font-size: 75%;
|
||||||
|
line-height: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
||||||
|
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
||||||
|
3. Remove gaps between table borders by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
table {
|
||||||
|
text-indent: 0;
|
||||||
|
/* 1 */
|
||||||
|
border-color: inherit;
|
||||||
|
/* 2 */
|
||||||
|
border-collapse: collapse;
|
||||||
|
/* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Change the font styles in all browsers.
|
||||||
|
2. Remove the margin in Firefox and Safari.
|
||||||
|
3. Remove default padding in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
input,
|
||||||
|
optgroup,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
font-family: inherit;
|
||||||
|
/* 1 */
|
||||||
|
font-feature-settings: inherit;
|
||||||
|
/* 1 */
|
||||||
|
font-variation-settings: inherit;
|
||||||
|
/* 1 */
|
||||||
|
font-size: 100%;
|
||||||
|
/* 1 */
|
||||||
|
font-weight: inherit;
|
||||||
|
/* 1 */
|
||||||
|
line-height: inherit;
|
||||||
|
/* 1 */
|
||||||
|
color: inherit;
|
||||||
|
/* 1 */
|
||||||
|
margin: 0;
|
||||||
|
/* 2 */
|
||||||
|
padding: 0;
|
||||||
|
/* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the inheritance of text transform in Edge and Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Correct the inability to style clickable types in iOS and Safari.
|
||||||
|
2. Remove default button styles.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
[type='button'],
|
||||||
|
[type='reset'],
|
||||||
|
[type='submit'] {
|
||||||
|
-webkit-appearance: button;
|
||||||
|
/* 1 */
|
||||||
|
background-color: transparent;
|
||||||
|
/* 2 */
|
||||||
|
background-image: none;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Use the modern Firefox focus style for all focusable elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
:-moz-focusring {
|
||||||
|
outline: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
|
||||||
|
*/
|
||||||
|
|
||||||
|
:-moz-ui-invalid {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct vertical alignment in Chrome and Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
progress {
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Correct the cursor style of increment and decrement buttons in Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
::-webkit-inner-spin-button,
|
||||||
|
::-webkit-outer-spin-button {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Correct the odd appearance in Chrome and Safari.
|
||||||
|
2. Correct the outline style in Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[type='search'] {
|
||||||
|
-webkit-appearance: textfield;
|
||||||
|
/* 1 */
|
||||||
|
outline-offset: -2px;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the inner padding in Chrome and Safari on macOS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Correct the inability to style clickable types in iOS and Safari.
|
||||||
|
2. Change font properties to `inherit` in Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
::-webkit-file-upload-button {
|
||||||
|
-webkit-appearance: button;
|
||||||
|
/* 1 */
|
||||||
|
font: inherit;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct display in Chrome and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
summary {
|
||||||
|
display: list-item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Removes the default spacing and border for appropriate elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
blockquote,
|
||||||
|
dl,
|
||||||
|
dd,
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6,
|
||||||
|
hr,
|
||||||
|
figure,
|
||||||
|
p,
|
||||||
|
pre {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol,
|
||||||
|
ul,
|
||||||
|
menu {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reset default styling for dialogs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
dialog {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Prevent resizing textareas horizontally by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
|
||||||
|
2. Set the default placeholder color to the user's configured gray 400 color.
|
||||||
|
*/
|
||||||
|
|
||||||
|
input::-moz-placeholder, textarea::-moz-placeholder {
|
||||||
|
opacity: 1;
|
||||||
|
/* 1 */
|
||||||
|
color: #9ca3af;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
input::placeholder,
|
||||||
|
textarea::placeholder {
|
||||||
|
opacity: 1;
|
||||||
|
/* 1 */
|
||||||
|
color: #9ca3af;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Set the default cursor for buttons.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
[role="button"] {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Make sure disabled buttons don't get the pointer cursor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
|
||||||
|
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
|
||||||
|
This can trigger a poorly considered lint error in some tools but is included by design.
|
||||||
|
*/
|
||||||
|
|
||||||
|
img,
|
||||||
|
svg,
|
||||||
|
video,
|
||||||
|
canvas,
|
||||||
|
audio,
|
||||||
|
iframe,
|
||||||
|
embed,
|
||||||
|
object {
|
||||||
|
display: block;
|
||||||
|
/* 1 */
|
||||||
|
vertical-align: middle;
|
||||||
|
/* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
|
||||||
|
*/
|
||||||
|
|
||||||
|
img,
|
||||||
|
video {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make elements with the HTML hidden attribute stay hidden by default */
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
*, ::before, ::after {
|
||||||
|
--tw-border-spacing-x: 0;
|
||||||
|
--tw-border-spacing-y: 0;
|
||||||
|
--tw-translate-x: 0;
|
||||||
|
--tw-translate-y: 0;
|
||||||
|
--tw-rotate: 0;
|
||||||
|
--tw-skew-x: 0;
|
||||||
|
--tw-skew-y: 0;
|
||||||
|
--tw-scale-x: 1;
|
||||||
|
--tw-scale-y: 1;
|
||||||
|
--tw-pan-x: ;
|
||||||
|
--tw-pan-y: ;
|
||||||
|
--tw-pinch-zoom: ;
|
||||||
|
--tw-scroll-snap-strictness: proximity;
|
||||||
|
--tw-gradient-from-position: ;
|
||||||
|
--tw-gradient-via-position: ;
|
||||||
|
--tw-gradient-to-position: ;
|
||||||
|
--tw-ordinal: ;
|
||||||
|
--tw-slashed-zero: ;
|
||||||
|
--tw-numeric-figure: ;
|
||||||
|
--tw-numeric-spacing: ;
|
||||||
|
--tw-numeric-fraction: ;
|
||||||
|
--tw-ring-inset: ;
|
||||||
|
--tw-ring-offset-width: 0px;
|
||||||
|
--tw-ring-offset-color: #fff;
|
||||||
|
--tw-ring-color: rgb(59 130 246 / 0.5);
|
||||||
|
--tw-ring-offset-shadow: 0 0 #0000;
|
||||||
|
--tw-ring-shadow: 0 0 #0000;
|
||||||
|
--tw-shadow: 0 0 #0000;
|
||||||
|
--tw-shadow-colored: 0 0 #0000;
|
||||||
|
--tw-blur: ;
|
||||||
|
--tw-brightness: ;
|
||||||
|
--tw-contrast: ;
|
||||||
|
--tw-grayscale: ;
|
||||||
|
--tw-hue-rotate: ;
|
||||||
|
--tw-invert: ;
|
||||||
|
--tw-saturate: ;
|
||||||
|
--tw-sepia: ;
|
||||||
|
--tw-drop-shadow: ;
|
||||||
|
--tw-backdrop-blur: ;
|
||||||
|
--tw-backdrop-brightness: ;
|
||||||
|
--tw-backdrop-contrast: ;
|
||||||
|
--tw-backdrop-grayscale: ;
|
||||||
|
--tw-backdrop-hue-rotate: ;
|
||||||
|
--tw-backdrop-invert: ;
|
||||||
|
--tw-backdrop-opacity: ;
|
||||||
|
--tw-backdrop-saturate: ;
|
||||||
|
--tw-backdrop-sepia: ;
|
||||||
|
}
|
||||||
|
|
||||||
|
::backdrop {
|
||||||
|
--tw-border-spacing-x: 0;
|
||||||
|
--tw-border-spacing-y: 0;
|
||||||
|
--tw-translate-x: 0;
|
||||||
|
--tw-translate-y: 0;
|
||||||
|
--tw-rotate: 0;
|
||||||
|
--tw-skew-x: 0;
|
||||||
|
--tw-skew-y: 0;
|
||||||
|
--tw-scale-x: 1;
|
||||||
|
--tw-scale-y: 1;
|
||||||
|
--tw-pan-x: ;
|
||||||
|
--tw-pan-y: ;
|
||||||
|
--tw-pinch-zoom: ;
|
||||||
|
--tw-scroll-snap-strictness: proximity;
|
||||||
|
--tw-gradient-from-position: ;
|
||||||
|
--tw-gradient-via-position: ;
|
||||||
|
--tw-gradient-to-position: ;
|
||||||
|
--tw-ordinal: ;
|
||||||
|
--tw-slashed-zero: ;
|
||||||
|
--tw-numeric-figure: ;
|
||||||
|
--tw-numeric-spacing: ;
|
||||||
|
--tw-numeric-fraction: ;
|
||||||
|
--tw-ring-inset: ;
|
||||||
|
--tw-ring-offset-width: 0px;
|
||||||
|
--tw-ring-offset-color: #fff;
|
||||||
|
--tw-ring-color: rgb(59 130 246 / 0.5);
|
||||||
|
--tw-ring-offset-shadow: 0 0 #0000;
|
||||||
|
--tw-ring-shadow: 0 0 #0000;
|
||||||
|
--tw-shadow: 0 0 #0000;
|
||||||
|
--tw-shadow-colored: 0 0 #0000;
|
||||||
|
--tw-blur: ;
|
||||||
|
--tw-brightness: ;
|
||||||
|
--tw-contrast: ;
|
||||||
|
--tw-grayscale: ;
|
||||||
|
--tw-hue-rotate: ;
|
||||||
|
--tw-invert: ;
|
||||||
|
--tw-saturate: ;
|
||||||
|
--tw-sepia: ;
|
||||||
|
--tw-drop-shadow: ;
|
||||||
|
--tw-backdrop-blur: ;
|
||||||
|
--tw-backdrop-brightness: ;
|
||||||
|
--tw-backdrop-contrast: ;
|
||||||
|
--tw-backdrop-grayscale: ;
|
||||||
|
--tw-backdrop-hue-rotate: ;
|
||||||
|
--tw-backdrop-invert: ;
|
||||||
|
--tw-backdrop-opacity: ;
|
||||||
|
--tw-backdrop-saturate: ;
|
||||||
|
--tw-backdrop-sepia: ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.relative {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticky {
|
||||||
|
position: sticky;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-0 {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb-0 {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb-0\.5 {
|
||||||
|
margin-bottom: 0.125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.\!hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.h-screen {
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.min-w-\[200px\] {
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-grow {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cursor-pointer {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-none {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-row {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items-center {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.justify-between {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.space-x-2 > :not([hidden]) ~ :not([hidden]) {
|
||||||
|
--tw-space-x-reverse: 0;
|
||||||
|
margin-right: calc(0.5rem * var(--tw-space-x-reverse));
|
||||||
|
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.space-x-4 > :not([hidden]) ~ :not([hidden]) {
|
||||||
|
--tw-space-x-reverse: 0;
|
||||||
|
margin-right: calc(1rem * var(--tw-space-x-reverse));
|
||||||
|
margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.space-y-1 > :not([hidden]) ~ :not([hidden]) {
|
||||||
|
--tw-space-y-reverse: 0;
|
||||||
|
margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));
|
||||||
|
margin-bottom: calc(0.25rem * var(--tw-space-y-reverse));
|
||||||
|
}
|
||||||
|
|
||||||
|
.space-y-4 > :not([hidden]) ~ :not([hidden]) {
|
||||||
|
--tw-space-y-reverse: 0;
|
||||||
|
margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
|
||||||
|
margin-bottom: calc(1rem * var(--tw-space-y-reverse));
|
||||||
|
}
|
||||||
|
|
||||||
|
.space-y-5 > :not([hidden]) ~ :not([hidden]) {
|
||||||
|
--tw-space-y-reverse: 0;
|
||||||
|
margin-top: calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));
|
||||||
|
margin-bottom: calc(1.25rem * var(--tw-space-y-reverse));
|
||||||
|
}
|
||||||
|
|
||||||
|
.rounded-md {
|
||||||
|
border-radius: 0.375rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-gray-800 {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-0 {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-0\.5 {
|
||||||
|
padding: 0.125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-2 {
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-4 {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.px-0 {
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.px-0\.5 {
|
||||||
|
padding-left: 0.125rem;
|
||||||
|
padding-right: 0.125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.px-2 {
|
||||||
|
padding-left: 0.5rem;
|
||||||
|
padding-right: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pl-2 {
|
||||||
|
padding-left: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-2xl {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
line-height: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-sm {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
line-height: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-xl {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
line-height: 1.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-bold {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-gray-50 {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(249 250 251 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-red-50 {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(254 242 242 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-white {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter {
|
||||||
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
min-height: 100%;
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(17 24 39 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
html, body {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(243 244 246 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-case {
|
||||||
|
margin: 2rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
border-width: 2px;
|
||||||
|
--tw-border-opacity: 1;
|
||||||
|
border-color: rgb(29 78 216 / var(--tw-border-opacity));
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-list-item {
|
||||||
|
display: flex;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
--tw-border-opacity: 1;
|
||||||
|
border-top-color: rgb(31 41 55 / var(--tw-border-opacity));
|
||||||
|
border-bottom-color: rgb(31 41 55 / var(--tw-border-opacity));
|
||||||
|
padding-left: 1rem;
|
||||||
|
padding-right: 1rem;
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.dashboard-list-item:hover {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(30 58 138 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-list-project {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(209 213 219 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.dashboard-list-project {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-list-project:hover {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(30 58 138 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-item {
|
||||||
|
padding-left: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.dark\:text-gray-300 {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(209 213 219 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark\:text-gray-500 {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
.hover\:dark\:bg-blue-700:hover {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
}
|
11
crates/como_web/tailwind.config.js
Normal file
11
crates/como_web/tailwind.config.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
darkMode: 'media',
|
||||||
|
content: {
|
||||||
|
files: ["*.html", "./src/**/*.rs"],
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
extend: {}
|
||||||
|
},
|
||||||
|
plugins: []
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user