Compare commits

28 Commits

Author SHA1 Message Date
ac2fafeb91 feat: UI overhaul (#131) 2026-01-29 19:24:59 +00:00
30fdeae3b2 feat: UI overhaul
All checks were successful
conventional pull request title check / conventional pull request title check (pull_request) Successful in 6s
actionlint check / actionlint check (pull_request) Successful in 20s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 10s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 32s
GitLeaks check / GitLeaks check (pull_request) Successful in 28s
hadolint check / hadolint check (pull_request) Successful in 42s
htmlhint check / htmlhint check (pull_request) Successful in 1m16s
markdownlint check / markdownlint check (pull_request) Successful in 53s
Prettier check / Prettier check (pull_request) Successful in 50s
ShellCheck check / ShellCheck check (pull_request) Successful in 39s
yamllint check / yamllint check (pull_request) Successful in 42s
Stylelint check / Stylelint check (pull_request) Successful in 44s
checkov check / checkov check (pull_request) Successful in 6m52s
Rust check / Rust check (pull_request) Successful in 33m33s
2026-01-29 16:22:45 +01:00
be1a21b746 fix: text wrapping (#128) 2026-01-25 10:21:12 +00:00
fa749b652f fix: text wrapping
Some checks failed
actionlint check / actionlint check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 3s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 6s
GitLeaks check / GitLeaks check (pull_request) Successful in 9s
conventional commit messages check / conventional commit messages check (pull_request) Failing after 5s
hadolint check / hadolint check (pull_request) Successful in 19s
markdownlint check / markdownlint check (pull_request) Successful in 37s
htmlhint check / htmlhint check (pull_request) Successful in 43s
Prettier check / Prettier check (pull_request) Successful in 40s
ShellCheck check / ShellCheck check (pull_request) Successful in 48s
Stylelint check / Stylelint check (pull_request) Successful in 37s
checkov check / checkov check (pull_request) Successful in 1m46s
yamllint check / yamllint check (pull_request) Successful in 31s
Rust check / Rust check (pull_request) Successful in 16m41s
2026-01-25 10:35:54 +01:00
d9efaaae6e fix: ability to access the someday maybe category list (#127) 2026-01-25 09:27:23 +00:00
428e52ba3d fix: ability to access the someday maybe category list
Some checks failed
actionlint check / actionlint check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 4s
conventional commit messages check / conventional commit messages check (pull_request) Failing after 6s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 7s
GitLeaks check / GitLeaks check (pull_request) Successful in 15s
hadolint check / hadolint check (pull_request) Successful in 15s
htmlhint check / htmlhint check (pull_request) Successful in 36s
Prettier check / Prettier check (pull_request) Successful in 54s
checkov check / checkov check (pull_request) Successful in 1m20s
markdownlint check / markdownlint check (pull_request) Successful in 57s
ShellCheck check / ShellCheck check (pull_request) Successful in 28s
Stylelint check / Stylelint check (pull_request) Successful in 27s
yamllint check / yamllint check (pull_request) Successful in 30s
Rust check / Rust check (pull_request) Successful in 23m59s
2026-01-25 09:41:46 +01:00
8dbb1dc48e feat: make the cursor of subtask buttons pointer (#124) 2026-01-24 20:53:48 +00:00
ee950aa4a9 feat: make the cursor of subtask buttons pointer
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 7s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 6s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 3s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 8s
GitLeaks check / GitLeaks check (pull_request) Successful in 12s
hadolint check / hadolint check (pull_request) Successful in 41s
htmlhint check / htmlhint check (pull_request) Successful in 1m1s
checkov check / checkov check (pull_request) Successful in 1m18s
markdownlint check / markdownlint check (pull_request) Successful in 59s
Prettier check / Prettier check (pull_request) Successful in 27s
ShellCheck check / ShellCheck check (pull_request) Successful in 34s
Stylelint check / Stylelint check (pull_request) Successful in 32s
yamllint check / yamllint check (pull_request) Successful in 34s
Rust check / Rust check (pull_request) Successful in 16m14s
2026-01-24 21:34:30 +01:00
439cc012f0 chore: make the Rust builds locked (#123) 2026-01-24 20:08:34 +00:00
803fe36ed1 feat: update Font Awesome to 7.1.0 (#122) 2026-01-24 20:08:26 +00:00
80918b98d9 chore: make the Rust builds locked
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 4s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 7s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 10s
GitLeaks check / GitLeaks check (pull_request) Successful in 13s
hadolint check / hadolint check (pull_request) Successful in 39s
checkov check / checkov check (pull_request) Successful in 1m36s
htmlhint check / htmlhint check (pull_request) Successful in 1m19s
markdownlint check / markdownlint check (pull_request) Successful in 1m14s
Prettier check / Prettier check (pull_request) Successful in 50s
ShellCheck check / ShellCheck check (pull_request) Successful in 2m1s
Stylelint check / Stylelint check (pull_request) Successful in 2m4s
yamllint check / yamllint check (pull_request) Successful in 2m20s
Rust check / Rust check (pull_request) Successful in 21m31s
2026-01-24 20:00:16 +01:00
d4235ef2ab feat: update Font Awesome to 7.1.0
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 39s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 8s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 10s
GitLeaks check / GitLeaks check (pull_request) Successful in 46s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 48s
hadolint check / hadolint check (pull_request) Successful in 51s
checkov check / checkov check (pull_request) Successful in 2m37s
htmlhint check / htmlhint check (pull_request) Successful in 1m9s
markdownlint check / markdownlint check (pull_request) Successful in 50s
Prettier check / Prettier check (pull_request) Successful in 30s
ShellCheck check / ShellCheck check (pull_request) Successful in 55s
Stylelint check / Stylelint check (pull_request) Successful in 54s
yamllint check / yamllint check (pull_request) Successful in 1m6s
Rust check / Rust check (pull_request) Successful in 24m52s
2026-01-24 17:52:43 +01:00
d0a124ee75 fix: font displaying (#120) 2026-01-24 11:30:45 +00:00
67a8a3fae6 fix: font displaying
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 6s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 6s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 3s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 6s
GitLeaks check / GitLeaks check (pull_request) Successful in 13s
hadolint check / hadolint check (pull_request) Successful in 33s
htmlhint check / htmlhint check (pull_request) Successful in 40s
checkov check / checkov check (pull_request) Successful in 1m18s
markdownlint check / markdownlint check (pull_request) Successful in 57s
Prettier check / Prettier check (pull_request) Successful in 34s
ShellCheck check / ShellCheck check (pull_request) Successful in 32s
Stylelint check / Stylelint check (pull_request) Successful in 30s
yamllint check / yamllint check (pull_request) Successful in 34s
Rust check / Rust check (pull_request) Successful in 11m1s
2026-01-24 12:16:16 +01:00
baef08475f chore: bump the Dioxus and Diesel CLI (#117) 2026-01-24 09:44:33 +00:00
265516c1a6 chore: bump the Dioxus and Diesel CLI
All checks were successful
conventional pull request title check / conventional pull request title check (pull_request) Successful in 10s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 26s
GitLeaks check / GitLeaks check (pull_request) Successful in 23s
hadolint check / hadolint check (pull_request) Successful in 52s
htmlhint check / htmlhint check (pull_request) Successful in 1m3s
markdownlint check / markdownlint check (pull_request) Successful in 1m1s
Prettier check / Prettier check (pull_request) Successful in 52s
yamllint check / yamllint check (pull_request) Successful in 27s
Stylelint check / Stylelint check (pull_request) Successful in 33s
ShellCheck check / ShellCheck check (pull_request) Successful in 9m9s
Rust check / Rust check (pull_request) Successful in 29m35s
actionlint check / actionlint check (pull_request) Successful in 18s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 13s
checkov check / checkov check (pull_request) Successful in 1m37s
2026-01-24 00:44:51 +01:00
01c9b2d0fb fix: automatically reconnect after losing a WebSocket connection (#112) 2026-01-23 19:32:12 +00:00
4ad96fe92f fix: Android bundle Docker compose build (#114) 2026-01-23 19:32:05 +00:00
df1d23c0e3 chore: bump dependencies (#116) 2026-01-23 19:31:59 +00:00
ce73256133 fix: automatically reconnect after losing a WebSocket connection
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 12s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 22s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 4s
checkov check / checkov check (pull_request) Successful in 1m19s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 10s
GitLeaks check / GitLeaks check (pull_request) Successful in 13s
hadolint check / hadolint check (pull_request) Successful in 11s
htmlhint check / htmlhint check (pull_request) Successful in 41s
markdownlint check / markdownlint check (pull_request) Successful in 34s
Prettier check / Prettier check (pull_request) Successful in 37s
ShellCheck check / ShellCheck check (pull_request) Successful in 25s
Stylelint check / Stylelint check (pull_request) Successful in 40s
yamllint check / yamllint check (pull_request) Successful in 29s
Rust check / Rust check (pull_request) Successful in 1h1m8s
2026-01-23 18:01:39 +01:00
fd661ba7e4 fix: Android bundle Docker compose build
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 12s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 6s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 12s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 14s
GitLeaks check / GitLeaks check (pull_request) Successful in 20s
hadolint check / hadolint check (pull_request) Successful in 17s
markdownlint check / markdownlint check (pull_request) Successful in 39s
checkov check / checkov check (pull_request) Successful in 1m23s
htmlhint check / htmlhint check (pull_request) Successful in 49s
ShellCheck check / ShellCheck check (pull_request) Successful in 28s
Prettier check / Prettier check (pull_request) Successful in 33s
Stylelint check / Stylelint check (pull_request) Successful in 30s
yamllint check / yamllint check (pull_request) Successful in 36s
Rust check / Rust check (pull_request) Successful in 1h58m0s
2026-01-23 18:01:23 +01:00
316d45fe0c chore: bump dependencies
All checks were successful
conventional pull request title check / conventional pull request title check (pull_request) Successful in 8s
actionlint check / actionlint check (pull_request) Successful in 15s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 16s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 23s
GitLeaks check / GitLeaks check (pull_request) Successful in 23s
hadolint check / hadolint check (pull_request) Successful in 24s
Prettier check / Prettier check (pull_request) Successful in 53s
markdownlint check / markdownlint check (pull_request) Successful in 56s
htmlhint check / htmlhint check (pull_request) Successful in 1m0s
checkov check / checkov check (pull_request) Successful in 1m47s
ShellCheck check / ShellCheck check (pull_request) Successful in 35s
yamllint check / yamllint check (pull_request) Successful in 37s
Stylelint check / Stylelint check (pull_request) Successful in 43s
Rust check / Rust check (pull_request) Successful in 1h12m38s
2026-01-23 18:00:32 +01:00
00bb8d7951 ci: update the Rust check dependencies (#115) 2026-01-23 16:59:59 +00:00
393173f218 ci: update the Rust check dependencies
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 6s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 6s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 10s
GitLeaks check / GitLeaks check (pull_request) Successful in 10s
hadolint check / hadolint check (pull_request) Successful in 30s
htmlhint check / htmlhint check (pull_request) Successful in 44s
checkov check / checkov check (pull_request) Successful in 1m6s
markdownlint check / markdownlint check (pull_request) Successful in 48s
Prettier check / Prettier check (pull_request) Successful in 27s
ShellCheck check / ShellCheck check (pull_request) Successful in 25s
yamllint check / yamllint check (pull_request) Successful in 25s
Stylelint check / Stylelint check (pull_request) Successful in 27s
Rust check / Rust check (pull_request) Successful in 14m21s
2026-01-23 17:28:58 +01:00
8fd5fe2d4e chore: remove unused CSS configuration (#110) 2026-01-11 08:53:33 +00:00
d165e58443 chore: remove unused CSS configuration
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 6s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 3s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 5s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 9s
GitLeaks check / GitLeaks check (pull_request) Successful in 11s
hadolint check / hadolint check (pull_request) Successful in 18s
htmlhint check / htmlhint check (pull_request) Successful in 46s
markdownlint check / markdownlint check (pull_request) Successful in 42s
Prettier check / Prettier check (pull_request) Successful in 33s
checkov check / checkov check (pull_request) Successful in 1m30s
ShellCheck check / ShellCheck check (pull_request) Successful in 32s
Stylelint check / Stylelint check (pull_request) Successful in 34s
yamllint check / yamllint check (pull_request) Successful in 32s
Rust check / Rust check (pull_request) Successful in 23m25s
2026-01-10 13:00:51 +01:00
c23397a941 ci: update the Rust and chechkov Rust toolchain (#111) 2026-01-10 11:50:40 +00:00
4f8abe60da ci: update the Rust and chechkov checks
All checks were successful
conventional pull request title check / conventional pull request title check (pull_request) Successful in 8s
actionlint check / actionlint check (pull_request) Successful in 15s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 17s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 13s
GitLeaks check / GitLeaks check (pull_request) Successful in 15s
hadolint check / hadolint check (pull_request) Successful in 27s
htmlhint check / htmlhint check (pull_request) Successful in 50s
markdownlint check / markdownlint check (pull_request) Successful in 47s
checkov check / checkov check (pull_request) Successful in 1m49s
Prettier check / Prettier check (pull_request) Successful in 1m3s
ShellCheck check / ShellCheck check (pull_request) Successful in 39s
yamllint check / yamllint check (pull_request) Successful in 39s
Stylelint check / Stylelint check (pull_request) Successful in 51s
Rust check / Rust check (pull_request) Successful in 17m17s
2026-01-10 12:09:26 +01:00
53 changed files with 1149 additions and 1424 deletions

View File

@@ -22,7 +22,7 @@ jobs:
with: with:
python-version: "3.13.1" python-version: "3.13.1"
- name: Rust toolchain installation - name: Rust toolchain installation
uses: dtolnay/rust-toolchain@8a40291d6a0a08b8fb98b13bad5a0305b42d5f9c # 1.92.0 uses: dtolnay/rust-toolchain@9bc92bc5598b4f3bec5d910d352094982cb0c3b9 # 1.92.0
- name: code checkout - name: code checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: with:

View File

@@ -21,12 +21,12 @@ jobs:
run: > run: >
apt-get update && apt-get install -y apt-get update && apt-get install -y
libgtk-3-dev=3.24.33-1ubuntu2.2 libgtk-3-dev=3.24.33-1ubuntu2.2
libjavascriptcoregtk-4.1-dev=2.50.2-0ubuntu0.22.04.2 libjavascriptcoregtk-4.1-dev=2.50.4-0ubuntu0.22.04.1
libsoup-3.0-dev=3.0.7-0ubuntu1 libsoup-3.0-dev=3.0.7-0ubuntu1
libwebkit2gtk-4.1-dev=2.50.2-0ubuntu0.22.04.2 libwebkit2gtk-4.1-dev=2.50.4-0ubuntu0.22.04.1
libxdo-dev=1:3.20160805.1-4 libxdo-dev=1:3.20160805.1-4
- name: Rust toolchain installation - name: Rust toolchain installation
uses: dtolnay/rust-toolchain@8a40291d6a0a08b8fb98b13bad5a0305b42d5f9c # 1.92.0 uses: dtolnay/rust-toolchain@9bc92bc5598b4f3bec5d910d352094982cb0c3b9 # 1.92.0
with: with:
components: clippy, rustfmt components: clippy, rustfmt
- name: code checkout - name: code checkout
@@ -40,6 +40,6 @@ jobs:
- name: rustfmt check - name: rustfmt check
run: cargo fmt --all --check run: cargo fmt --all --check
- name: Clippy check - name: Clippy check
run: cargo clippy --all-targets --all-features -- --deny warnings run: cargo clippy --locked --all-targets --all-features -- --deny warnings
- name: test check - name: test check
run: cargo test --all --all-targets --all-features run: cargo --locked test --all --all-targets --all-features

554
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,19 +7,21 @@ edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
chrono = { version = "0.4.42", features = ["serde", "unstable-locales"] } chrono = { version = "0.4.43", features = ["serde", "unstable-locales"] }
dioxus = { version = "0.7.2", features = ["fullstack", "router"] } # Remember to update the CLI as well.
dioxus = { version = "0.7.3", features = ["fullstack", "router"] }
# TODO: Remove this once https://github.com/DioxusLabs/dioxus/issues/4765 is resolved. # TODO: Remove this once https://github.com/DioxusLabs/dioxus/issues/4765 is resolved.
dioxus-html = { version = "0.7.2", features = ["serialize"] } dioxus-html = { version = "0.7.3", features = ["serialize"] }
feruca = { version = "0.11.5" } feruca = { version = "0.11.5" }
serde = { version = "1.0.228" } serde = { version = "1.0.228" }
serde_json = { version = "1.0.145" } serde_json = { version = "1.0.149" }
serde_with = { version = "3.16.1", features = ["chrono_0_4"] } serde_with = { version = "3.16.1", features = ["chrono_0_4"] }
tracing = "0.1.43" tracing = "0.1.44"
unic-langid-impl = { version = "0.9.6", features = ["serde"] } unic-langid-impl = { version = "0.9.6", features = ["serde"] }
validator = { version = "0.20.0", features = ["derive"] } validator = { version = "0.20.0", features = ["derive"] }
diesel = { version = "2.3.4", features = [ # Remember to update the CLI as well.
diesel = { version = "2.3.6", features = [
"chrono", "chrono",
"postgres", "postgres",
"postgres_backend", "postgres_backend",
@@ -29,13 +31,18 @@ diesel_migrations = { version = "2.3.1", features = [
"postgres", "postgres",
], optional = true } ], optional = true }
rand = { version = "0.9.2", optional = true } rand = { version = "0.9.2", optional = true }
time = { version = "0.3.44", optional = true } time = { version = "0.3.45", optional = true }
tokio = { version = "1.48.0", optional = true } tokio = { version = "1.49.0", optional = true }
async-std = { version = "1.13.2", optional = true } async-std = { version = "1.13.2", optional = true }
dioxus-i18n = "0.5.0" dioxus-i18n = "0.5.1"
voca_rs = "1.15.2" voca_rs = "1.15.2"
load-dotenv = "0.1.2" load-dotenv = "0.1.2"
# TODO: Switch to upstream once it merges the changes.
dioxus-free-icons = { git = "https://github.com/matous-volf/dioxus-free-icons", rev = "6488400003a3d6829e771a84a565c5c5f08a9aa0", features = [
"font-awesome-regular",
"font-awesome-solid",
] }
[features] [features]
default = ["web"] default = ["web"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,203 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="512"
height="512"
viewBox="0 0 512 512"
version="1.1"
id="svg1"
sodipodi:docname="icon.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:document-units="px"
inkscape:zoom="1.1020922"
inkscape:cx="188.27826"
inkscape:cy="204.15715"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1">
<inkscape:path-effect
effect="fillet_chamfer"
id="path-effect2"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1"
radius="0"
unit="px"
method="auto"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" />
<inkscape:path-effect
effect="fillet_chamfer"
id="path-effect1"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1"
radius="0"
unit="px"
method="auto"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="display:inline;fill:#27272a;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="rect1"
width="512"
height="512"
x="0"
y="0"
sodipodi:insensitive="true"
inkscape:label="background"
ry="128.00018"
sodipodi:type="rect"
rx="129.98714" />
<g
id="g17"
inkscape:label="logo"
transform="translate(8)">
<g
id="g8"
inkscape:label="ring">
<g
id="g7"
inkscape:label="back">
<circle
style="fill:#d97706;fill-opacity:1;stroke:#d97706;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="path1"
cx="224"
cy="256"
r="128"
inkscape:label="ring back" />
<rect
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:21.8936;stroke-dasharray:none;stroke-opacity:1"
id="rect2"
width="48"
height="288"
x="224"
y="112"
inkscape:label="rect2" />
</g>
<g
id="g1"
transform="translate(-4.163147,-0.69235229)"
inkscape:label="front">
<circle
style="fill:#27272a;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="path1-5-2"
cx="276.16315"
cy="256.69235"
r="128" />
<circle
style="fill:none;fill-opacity:1;stroke:#fbbf24;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="path1-5"
cx="276.16315"
cy="256.69235"
r="128" />
</g>
</g>
<g
id="g16"
inkscape:label="tick"
transform="translate(16.000231,-8.3918418e-5)">
<g
id="g6"
transform="rotate(45,-57.96574,415.4208)"
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-opacity:1"
inkscape:label="back">
<rect
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="rect9"
width="32.000458"
height="32"
x="273.94067"
y="210.74516"
transform="rotate(-45,-57.96574,415.4208)" />
<rect
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="rect8"
width="32.000458"
height="32"
x="206.05841"
y="233.37257"
transform="rotate(-45,-57.96574,415.4208)" />
<rect
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="rect7"
height="16"
x="228.686"
y="285.255"
width="32"
transform="rotate(-45,-57.96574,415.4208)" />
<rect
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="rect5"
width="64"
height="32"
x="0"
y="100" />
<rect
style="fill:#d97706;fill-opacity:1;stroke:none;stroke-width:39.1918;stroke-dasharray:none;stroke-opacity:1"
id="rect6"
width="32"
height="96"
x="32"
y="36" />
</g>
<g
id="g4"
transform="rotate(45,-41.965512,454.04877)"
style="fill:#fbbf24;fill-opacity:1;stroke:none;stroke-opacity:1"
inkscape:label="front">
<rect
style="fill:#fbbf24;fill-opacity:1;stroke:none;stroke-width:32;stroke-dasharray:none;stroke-opacity:1"
id="rect3"
width="64"
height="32"
x="0"
y="100" />
<rect
style="fill:#fbbf24;fill-opacity:1;stroke:none;stroke-width:39.1918;stroke-dasharray:none;stroke-opacity:1"
id="rect4"
width="32"
height="96"
x="32"
y="36" />
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -3,8 +3,8 @@
"short_name": "Todo Baggins", "short_name": "Todo Baggins",
"start_url": "/", "start_url": "/",
"display": "standalone", "display": "standalone",
"background_color": "#27272a", "background_color": "#101828",
"theme_color": "#27272a", "theme_color": "#b89a2e",
"icons": [ "icons": [
{ {
"src": "/assets/images/icon.png", "src": "/assets/images/icon.png",

View File

@@ -1,17 +0,0 @@
@layer base {
@font-face {
font-family: Inter;
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("/assets/fonts/inter_variable.woff2") format("woff2");
}
@font-face {
font-family: Inter;
font-style: italic;
font-weight: 100 900;
font-display: swap;
src: url("/assets/fonts/inter_variable_italic.woff2") format("woff2");
}
}

View File

@@ -8,56 +8,37 @@ input[type="range"] {
background: transparent; background: transparent;
} }
input[type="range"]::-moz-range-thumb { input[type="range"]::-moz-range-thumb,
input[type="range"]::-webkit-slider-thumb {
width: 1.25rem; width: 1.25rem;
height: 1.25rem; height: 1.25rem;
background: rgba(228 228 231); background: var(--color-gray-400);
filter: drop-shadow(0 var(--spacing) 0 var(--color-gray-500));
border: 0; border: 0;
border-radius: 0.5rem; border-radius: 0.5rem;
cursor: pointer;
} }
input[type="range"]::-moz-range-progress { input[type="range"]::-webkit-slider-thumb {
background: #525259; position: relative;
top: -9px;
}
input[type="range"]::-moz-range-track,
input[type="range"]::-webkit-slider-runnable-track {
background: var(--color-gray-800-muted);
height: 0.5rem; height: 0.5rem;
filter: drop-shadow(
0 calc(0px - var(--spacing)) 0 var(--color-gray-900-muted)
);
border-radius: 0.25rem; border-radius: 0.25rem;
} }
input[type="range"]::-moz-range-track { input[type="range"]::-moz-range-track {
background: rgba(39 39 42 / 50%); transform: translateY(3px);
height: 0.5rem;
border-radius: 0.25rem;
}
input[type="range"].input-range-reverse::-moz-range-progress {
background: #2d2d31;
height: 0.5rem;
border-radius: 0.25rem;
}
input[type="range"].input-range-reverse::-moz-range-track {
background: rgba(113 113 122 / 50%);
height: 0.5rem;
border-radius: 0.25rem;
}
input[type="range"]::-webkit-slider-thumb {
width: 1.25rem;
height: 1.25rem;
background: rgba(228 228 231);
border: 0;
border-radius: 0.5rem;
position: relative;
top: -0.4rem;
} }
input[type="range"]::-webkit-slider-runnable-track { input[type="range"]::-webkit-slider-runnable-track {
background: rgba(39 39 42 / 50%); position: relative;
height: 0.5rem; top: 3px;
border-radius: 0.25rem;
}
input[type="range"].input-range-reverse::-webkit-slider-runnable-track {
background: rgba(39 39 42 / 50%);
height: 0.5rem;
border-radius: 0.25rem;
} }

View File

@@ -0,0 +1,7 @@
select {
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath fill='%239ca3af' d='M300.3 440.8C312.9 451 331.4 450.3 343.1 438.6L471.1 310.6C480.3 301.4 483 287.7 478 275.7C473 263.7 461.4 256 448.5 256L192.5 256C179.6 256 167.9 263.8 162.9 275.8C157.9 287.8 160.7 301.5 169.9 310.6L297.9 438.6L300.3 440.8z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-size: 2rem;
background-position: right 0.5rem center;
}

View File

@@ -2,4 +2,5 @@
services: services:
app: app:
build: build:
dockerfile: docker/prod/app/Dockerfile
target: builder_android target: builder_android

View File

@@ -12,6 +12,7 @@ services:
- ./Cargo.toml:/srv/app/Cargo.toml - ./Cargo.toml:/srv/app/Cargo.toml
- ./diesel.toml:/srv/app/diesel.toml - ./diesel.toml:/srv/app/diesel.toml
- ./Dioxus.toml:/srv/app/Dioxus.toml - ./Dioxus.toml:/srv/app/Dioxus.toml
- ./tailwind.css:/srv/app/tailwind.css
restart: always restart: always
ports: ["8000:8000"] ports: ["8000:8000"]
depends_on: ["db"] depends_on: ["db"]

View File

@@ -6,6 +6,7 @@ services:
networks: networks:
- default - default
- web-server-network - web-server-network
ports: ["8000:80"]
restart: always restart: always
depends_on: ["db"] depends_on: ["db"]

View File

@@ -5,8 +5,8 @@ RUN useradd -m -u 1000 -s /bin/bash app_user \
USER app_user USER app_user
RUN cargo install --git https://github.com/diesel-rs/diesel --rev 2e85ba060d3d70ea605ea58a79b8a435749a7adc --locked diesel_cli \ RUN cargo install --git https://github.com/diesel-rs/diesel --rev 207604888d28a490061698f07a25090438be42fe --locked diesel_cli \
&& cargo install --git https://github.com/DioxusLabs/dioxus --rev 8f8b58ea80ba0ec8057807bcd58fb609f7a5f2b1 --locked dioxus-cli && cargo install --git https://github.com/DioxusLabs/dioxus --rev 22b06badde44ba1af0fcf339c91b66483175b660 --locked dioxus-cli
COPY --chown=app_user . /srv/app COPY --chown=app_user . /srv/app
WORKDIR /srv/app WORKDIR /srv/app

View File

@@ -1,7 +1,7 @@
FROM rust:1.92.0-bookworm@sha256:9676d0547a259997add8f5924eb6b959c589ed39055338e23b99aba7958d6d31 AS builder_base FROM rust:1.92.0-bookworm@sha256:9676d0547a259997add8f5924eb6b959c589ed39055338e23b99aba7958d6d31 AS builder_base
RUN cargo install --git https://github.com/diesel-rs/diesel --rev 2e85ba060d3d70ea605ea58a79b8a435749a7adc --locked diesel_cli \ RUN cargo install --git https://github.com/diesel-rs/diesel --rev 207604888d28a490061698f07a25090438be42fe --locked diesel_cli \
&& cargo install --git https://github.com/DioxusLabs/dioxus --rev 8f8b58ea80ba0ec8057807bcd58fb609f7a5f2b1 --locked dioxus-cli --features disable-telemetry && cargo install --git https://github.com/DioxusLabs/dioxus --rev 22b06badde44ba1af0fcf339c91b66483175b660 --locked dioxus-cli --features disable-telemetry
COPY . /srv/app COPY . /srv/app
WORKDIR /srv/app WORKDIR /srv/app
@@ -39,7 +39,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& keytool -genkeypair -noprompt -keystore /tmp/android_keystore.jks -alias key -keyalg RSA -keysize 2048 -validity 3660 -dname "CN=" -storepass 123456 -keypass 123456 \ && keytool -genkeypair -noprompt -keystore /tmp/android_keystore.jks -alias key -keyalg RSA -keysize 2048 -validity 3660 -dname "CN=" -storepass 123456 -keypass 123456 \
&& export ANDROID_HOME="$ANDROID_SDK_ROOT" \ && export ANDROID_HOME="$ANDROID_SDK_ROOT" \
&& export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION" \ && export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION" \
&& dx bundle --platform android --target aarch64-linux-android --release \ && dx bundle --locked --platform android --target aarch64-linux-android --release \
&& java -jar /tmp/bundletool-all.jar build-apks --bundle=/srv/app/target/dx/todo_baggins/release/android/app/app/build/outputs/bundle/release/TodoBaggins-aarch64-linux-android.aab --output=/tmp/todo_baggins.apks --mode=universal --ks=/tmp/android_keystore.jks --ks-key-alias=key --ks-pass=pass:123456 \ && java -jar /tmp/bundletool-all.jar build-apks --bundle=/srv/app/target/dx/todo_baggins/release/android/app/app/build/outputs/bundle/release/TodoBaggins-aarch64-linux-android.aab --output=/tmp/todo_baggins.apks --mode=universal --ks=/tmp/android_keystore.jks --ks-key-alias=key --ks-pass=pass:123456 \
&& mkdir -p /srv/app/bundle \ && mkdir -p /srv/app/bundle \
&& unzip -qp /tmp/todo_baggins.apks universal.apk > /srv/app/bundle/todo_baggins.apk && unzip -qp /tmp/todo_baggins.apks universal.apk > /srv/app/bundle/todo_baggins.apk
@@ -47,7 +47,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
FROM builder_base AS builder_web FROM builder_base AS builder_web
RUN dx bundle --release RUN dx bundle --locked --release
FROM debian:bookworm@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a AS runner_web FROM debian:bookworm@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a AS runner_web

View File

@@ -7,15 +7,22 @@ use dioxus_i18n::prelude::*;
use dioxus_i18n::unic_langid::langid; use dioxus_i18n::unic_langid::langid;
const FAVICON: Asset = asset!("/assets/favicon.ico"); const FAVICON: Asset = asset!("/assets/favicon.ico");
const TAILWIND_CSS: Asset = asset!("/assets/tailwind.css"); /* Once https://github.com/DioxusLabs/dioxus/issues/4490 is resolved, hopefully it will be
sufficient to just include the single icon.png. */
#[used]
static IMAGES_DIRECTORY: Asset = asset!(
"/assets/images",
AssetOptions::builder().with_hash_suffix(false)
);
#[used] #[used]
static FONTS_DIRECTORY: Asset = asset!( static FONTS_DIRECTORY: Asset = asset!(
"/assets/fonts", "/assets/fonts",
AssetOptions::builder().with_hash_suffix(false) AssetOptions::builder().with_hash_suffix(false)
); );
const FONTS_CSS: Asset = asset!("/assets/styles/fonts.css"); const TAILWIND_CSS: Asset = asset!("/assets/tailwind.css");
const INPUT_NUMBER_ARROWS_CSS: Asset = asset!("/assets/styles/input_number_arrows.css"); const INPUT_NUMBER_ARROWS_CSS: Asset = asset!("/assets/styles/input_number_arrows.css");
const INPUT_RANGE_CSS: Asset = asset!("/assets/styles/input_range.css"); const INPUT_RANGE_CSS: Asset = asset!("/assets/styles/input_range.css");
const SELECT_ARROW_CSS: Asset = asset!("/assets/styles/select_arrow.css");
const MANIFEST: Asset = asset!("/assets/manifest.json"); const MANIFEST: Asset = asset!("/assets/manifest.json");
#[component] #[component]
@@ -35,14 +42,13 @@ pub(crate) fn App() -> Element {
rsx! { rsx! {
document::Link { rel: "icon", href: FAVICON } document::Link { rel: "icon", href: FAVICON }
document::Stylesheet { href: TAILWIND_CSS } document::Stylesheet { href: TAILWIND_CSS }
document::Stylesheet { href: FONTS_CSS }
document::Stylesheet { href: INPUT_NUMBER_ARROWS_CSS } document::Stylesheet { href: INPUT_NUMBER_ARROWS_CSS }
document::Stylesheet { href: INPUT_RANGE_CSS } document::Stylesheet { href: INPUT_RANGE_CSS }
document::Stylesheet { href: SELECT_ARROW_CSS }
document::Link { rel: "manifest", href: MANIFEST, crossorigin: "use-credentials" } document::Link { rel: "manifest", href: MANIFEST, crossorigin: "use-credentials" }
document::Script { src: "https://kit.fontawesome.com/3c1b409f8f.js" }
div { div {
class: "min-h-screen pt-4 pb-36 flex flex-col text-zinc-200 bg-zinc-800", class: "min-h-screen py-4 flex flex-col text-gray-300 bg-gray-900",
Router::<Route> {} Router::<Route> {}
} }
} }

View File

@@ -1,78 +1,22 @@
use crate::components::error_boundary_message::ErrorBoundaryMessage;
use crate::components::navigation::Navigation; use crate::components::navigation::Navigation;
use crate::components::project_form::ProjectForm;
use crate::components::task_form::TaskForm;
use crate::models::project::Project;
use crate::models::task::Task;
use crate::route::Route;
use dioxus::prelude::*; use dioxus::prelude::*;
#[component] #[component]
pub(crate) fn BottomPanel(display_form: Signal<bool>) -> Element { pub(crate) fn BottomPanel() -> Element {
// A signal for delaying the application of styles.
#[allow(clippy::redundant_closure)]
let mut expanded = use_signal(|| display_form());
let navigation_expanded = use_signal(|| false); let navigation_expanded = use_signal(|| false);
let current_route = use_route();
let mut project_being_edited = use_context::<Signal<Option<Project>>>();
let mut task_being_edited = use_context::<Signal<Option<Task>>>();
use_effect(use_reactive(&display_form, move |display_form| {
if display_form() {
expanded.set(true);
} else {
spawn(async move {
// Necessary for a smooth not instant height transition.
#[cfg(not(feature = "server"))]
async_std::task::sleep(std::time::Duration::from_millis(500)).await;
/* The check is necessary for the situation when the user expands the panel while
it is being closed. */
if !display_form() {
expanded.set(false);
}
});
}
}));
rsx! { rsx! {
div { div {
class: format!( class: format!(
"flex flex-col pointer-events-auto bg-zinc-700/50 rounded-t-xl border-t-zinc-600 border-t backdrop-blur drop-shadow-[0_-5px_10px_rgba(0,0,0,0.2)] transition-[height] duration-[500ms] ease-[cubic-bezier(0.79,0.14,0.15,0.86)] overflow-y-scroll {}", "flex flex-col pointer-events-auto bg-gray-800 transition-[height] duration-[500ms] ease-[cubic-bezier(0.79,0.14,0.15,0.86)] overflow-y-scroll {}",
match (display_form(), current_route, navigation_expanded()) { if navigation_expanded() {
(false, _, false) => "h-[66px]", "h-[130px]"
(false, _, true) => "h-[130px]", } else {
(true, Route::ProjectsPage, _) => "h-[130px]", "h-[66px]"
(true, _, _) => "h-[506px]",
} }
), ),
if expanded() {
ErrorBoundaryMessage {
match current_route {
Route::ProjectsPage => rsx! {
ProjectForm {
project: project_being_edited(),
on_successful_submit: move |_| {
display_form.set(false);
project_being_edited.set(None);
}
}
},
_ => rsx! {
TaskForm {
task: task_being_edited(),
on_successful_submit: move |_| {
display_form.set(false);
task_being_edited.set(None);
}
}
}
}
}
} else {
Navigation { Navigation {
expanded: navigation_expanded, is_expanded: navigation_expanded,
}
} }
} }
} }

View File

@@ -0,0 +1,29 @@
use dioxus::prelude::*;
#[component]
pub(crate) fn ButtonPrimary(
class: Option<String>,
children: Element,
#[props(extends = GlobalAttributes, extends = button)] attributes: Vec<Attribute>,
// TODO: Remove this once https://github.com/DioxusLabs/dioxus/issues/4019 gets resolved.
onclick: Option<Callback<Event<MouseData>>>,
) -> Element {
rsx! {
button {
class: format!(
"cursor-pointer pb-[6px] hover:pb-[7px] active:pb-[2px] mt-[1px] hover:mt-0 active:mt-[5px] hover:*:drop-shadow-[0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted)] active:*:drop-shadow-[0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted)] transition-all duration-150 {}",
class.unwrap_or("".to_owned())
),
onclick: move |event| {
if let Some(onclick) = onclick {
onclick.call(event);
}
},
..attributes,
div {
class: "py-3.5 px-4 flex flex-row justify-center items-center bg-amber-300-muted drop-shadow-[0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted)] text-amber-700-muted rounded-xl transition-all duration-150",
{children}
}
}
}
}

View File

@@ -0,0 +1,29 @@
use dioxus::prelude::*;
#[component]
pub(crate) fn ButtonSecondary(
class: Option<String>,
children: Element,
#[props(extends = GlobalAttributes, extends = button)] attributes: Vec<Attribute>,
// TODO: Remove this once https://github.com/DioxusLabs/dioxus/issues/4019 gets resolved.
onclick: Option<Callback<Event<MouseData>>>,
) -> Element {
rsx! {
button {
class: format!(
"cursor-pointer pb-[6px] hover:pb-[7px] active:pb-[2px] mt-[1px] hover:mt-0 active:mt-[5px] hover:*:drop-shadow-[0_7px_0_var(--color-gray-800)] active:*:drop-shadow-[0_2px_0_var(--color-gray-800)] transition-all duration-150 {}",
class.unwrap_or("".to_owned())
),
onclick: move |event| {
if let Some(onclick) = onclick {
onclick.call(event);
}
},
..attributes,
div {
class: "py-3.5 px-4 flex flex-row justify-center items-center bg-gray-600 drop-shadow-[0_6px_0_var(--color-gray-800)] rounded-xl transition-all duration-150",
{children}
}
}
}
}

View File

@@ -28,11 +28,12 @@ pub(crate) fn CategoryCalendarTaskList() -> Element {
div { div {
class: "flex flex-col gap-4", class: "flex flex-col gap-4",
div { div {
class: "px-8 flex flex-row items-center gap-2 font-bold", class: "px-7 flex flex-row items-center gap-2 text-gray-500 font-bold",
div { div {
class: "pt-1", class: "pt-1",
{ {
date_current.format_localized(t!( date_current.format_localized(
t!(
if date_current.year() == Local::now().year() { if date_current.year() == Local::now().year() {
"date-weekday-format" "date-weekday-format"
} else { } else {

View File

@@ -1,7 +1,12 @@
use crate::components::select_button::SelectButton;
use crate::models::category::Category; use crate::models::category::Category;
use dioxus::core_macro::rsx; use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element; use dioxus::dioxus_core::Element;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::icons::fa_regular_icons::FaLightbulb;
use dioxus_free_icons::icons::fa_solid_icons::{
FaCalendarDays, FaHourglassHalf, FaInbox, FaSignsPost, FaWater,
};
#[component] #[component]
pub(crate) fn CategoryInput( pub(crate) fn CategoryInput(
@@ -10,93 +15,51 @@ pub(crate) fn CategoryInput(
) -> Element { ) -> Element {
rsx! { rsx! {
div { div {
class: format!("flex flex-row gap-2 {}", class.unwrap_or("")), class: format!("grid grid-cols-3 gap-3 {}", class.unwrap_or("")),
button { SelectButton {
r#type: "button", icon: FaLightbulb,
class: format!( is_selected: matches!(selected_category(), Category::SomedayMaybe),
"py-2 rounded-lg grow basis-0 {} cursor-pointer", on_select: move |_| {
if selected_category() == Category::SomedayMaybe { "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
selected_category.set(Category::SomedayMaybe); selected_category.set(Category::SomedayMaybe);
},
i {
class: "fa-solid fa-question"
} }
}, }
button { SelectButton {
r#type: "button", icon: FaWater,
class: format!( is_selected: matches!(selected_category(), Category::LongTerm),
"py-2 rounded-lg grow basis-0 {} cursor-pointer", on_select: move |_| {
if selected_category() == Category::LongTerm { "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
selected_category.set(Category::LongTerm); selected_category.set(Category::LongTerm);
},
i {
class: "fa-solid fa-water"
} }
}, }
button { SelectButton {
r#type: "button", icon: FaHourglassHalf,
class: format!( is_selected: matches!(selected_category(), Category::WaitingFor(_)),
"py-2 rounded-lg grow basis-0 {} cursor-pointer", on_select: move |_| {
if let Category::WaitingFor(_) = selected_category() { "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
selected_category.set(Category::WaitingFor(String::new())); selected_category.set(Category::WaitingFor(String::new()));
},
i {
class: "fa-solid fa-hourglass-half"
} }
}, }
button { SelectButton {
r#type: "button", icon: FaSignsPost,
class: format!( is_selected: matches!(selected_category(), Category::NextSteps),
"py-2 rounded-lg grow basis-0 {} cursor-pointer", on_select: move |_| {
if selected_category() == Category::NextSteps { "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
selected_category.set(Category::NextSteps); selected_category.set(Category::NextSteps);
},
i {
class: "fa-solid fa-forward"
} }
}, }
button { SelectButton {
r#type: "button", icon: FaCalendarDays,
class: format!( is_selected: matches!(selected_category(), Category::Calendar { .. }),
"py-2 rounded-lg grow basis-0 {} cursor-pointer", on_select: move |_| {
if let Category::Calendar { .. } = selected_category() { "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
selected_category.set(Category::Calendar { selected_category.set(Category::Calendar {
date: chrono::Local::now().date_naive(), date: chrono::Local::now().date_naive(),
reoccurrence: None, reoccurrence: None,
time: None, time: None,
}); });
},
i {
class: "fa-solid fa-calendar-days"
} }
}, }
button { SelectButton {
r#type: "button", icon: FaInbox,
class: format!( is_selected: matches!(selected_category(), Category::Inbox),
"py-2 rounded-lg grow basis-0 {} cursor-pointer", on_select: move |_| {
if selected_category() == Category::Inbox { "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
selected_category.set(Category::Inbox); selected_category.set(Category::Inbox);
},
i {
class: "fa-solid fa-inbox"
} }
} }
} }

View File

@@ -1,11 +1,12 @@
use crate::components::task_list::TaskList; use crate::components::task_list::TaskList;
use crate::components::task_list_item::TaskListItem;
use crate::hooks::use_tasks_with_subtasks_in_category; use crate::hooks::use_tasks_with_subtasks_in_category;
use crate::internationalization::LocaleFromLanguageIdentifier; use crate::internationalization::LocaleFromLanguageIdentifier;
use crate::models::category::Category; use crate::models::category::Category;
use crate::models::task::TaskWithSubtasks; use crate::models::task::TaskWithSubtasks;
use chrono::Local; use chrono::Local;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::Icon;
use dioxus_free_icons::icons::fa_solid_icons::{FaCalendarCheck, FaCalendarXmark, FaWater};
use dioxus_i18n::t; use dioxus_i18n::t;
use dioxus_i18n::use_i18n::i18n; use dioxus_i18n::use_i18n::i18n;
use voca_rs::Voca; use voca_rs::Voca;
@@ -45,34 +46,21 @@ pub(crate) fn CategoryTodayTaskList() -> Element {
rsx! { rsx! {
div { div {
class: "pt-4 flex flex-col gap-8", class: "pt-4 flex flex-col gap-8",
if !long_term_tasks.is_empty() {
div { div {
class: "flex flex-col gap-4", class: "flex flex-col gap-4",
div { div {
class: "px-8 flex flex-row items-center gap-2 font-bold", class: "px-7 flex flex-row items-center gap-2 text-gray-500 font-bold",
i { Icon {
class: "fa-solid fa-water text-xl w-6 text-center" class: "mx-1.5",
icon: FaWater
} }
div { div {
class: "mt-1",
{t!("long-term")._upper_first()} {t!("long-term")._upper_first()}
} }
} }
div { TaskList {
for task in long_term_tasks { tasks: long_term_tasks
div {
key: "{task.task.id}",
class: format!(
"px-8 pt-5 {} flex flex-row gap-4",
if task.task.deadline.is_some() {
"pb-0.5"
} else {
"pb-5"
}
),
TaskListItem {
task: task.clone()
}
}
} }
} }
} }
@@ -80,12 +68,14 @@ pub(crate) fn CategoryTodayTaskList() -> Element {
div { div {
class: "flex flex-col gap-4", class: "flex flex-col gap-4",
div { div {
class: "px-8 flex flex-row items-center gap-2 font-bold", class: "px-7 flex flex-row items-center gap-2 text-gray-500 font-bold",
i { Icon {
class: "fa-solid fa-calendar-xmark text-xl w-6 text-center" class: "mx-1.25",
height: 22,
width: 22,
icon: FaCalendarXmark
} }
div { div {
class: "mt-1",
{t!("overdue")._upper_first()} {t!("overdue")._upper_first()}
} }
} }
@@ -98,12 +88,14 @@ pub(crate) fn CategoryTodayTaskList() -> Element {
div { div {
class: "flex flex-col gap-4", class: "flex flex-col gap-4",
div { div {
class: "px-8 flex flex-row items-center gap-2 font-bold", class: "px-7 flex flex-row items-center gap-2 text-gray-500 font-bold",
i { Icon {
class: "fa-solid fa-calendar-check text-xl w-6 text-center" class: "mx-1.25",
height: 22,
width: 22,
icon: FaCalendarCheck
} }
div { div {
class: "mt-1",
{ {
let format = t!("date-weekday-format"); let format = t!("date-weekday-format");
let today_date = today_date.format_localized( let today_date = today_date.format_localized(

View File

@@ -0,0 +1,31 @@
use crate::components::project_form::PROJECT_BEING_EDITED;
use crate::components::{button_primary::ButtonPrimary, task_form::TASK_BEING_EDITED};
use crate::route::Route;
use dioxus::prelude::*;
use dioxus_free_icons::{Icon, icons::fa_solid_icons::FaGavel};
#[component]
pub(crate) fn CreateButton() -> Element {
let navigator = use_navigator();
let current_route = use_route();
rsx! {
ButtonPrimary {
class: "pointer-events-auto m-4 self-end *:rounded-full! *:p-4",
onclick: move |_| {
*TASK_BEING_EDITED.write() = None;
*PROJECT_BEING_EDITED.write() = None;
navigator.push(
match current_route {
Route::ProjectsPage => Route::ProjectFormPage,
_ => Route::TaskFormPage,
}
);
},
Icon {
icon: FaGavel,
height: 24,
width: 24
}
}
}
}

View File

@@ -1,6 +1,8 @@
use dioxus::core_macro::rsx; use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element; use dioxus::dioxus_core::Element;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::Icon;
use dioxus_free_icons::icons::fa_solid_icons::FaTriangleExclamation;
#[component] #[component]
pub(crate) fn ErrorBoundaryMessage(children: Element, class: Option<String>) -> Element { pub(crate) fn ErrorBoundaryMessage(children: Element, class: Option<String>) -> Element {
@@ -11,8 +13,11 @@ pub(crate) fn ErrorBoundaryMessage(children: Element, class: Option<String>) ->
div { div {
class: "grow flex flex-col justify-center items-center", class: "grow flex flex-col justify-center items-center",
div { div {
i { Icon {
class: "text-3xl fa-solid fa-triangle-exclamation" class: "text-gray-500",
icon: FaTriangleExclamation,
height: 32,
width: 32
} }
} }
} }

View File

@@ -1,25 +0,0 @@
use crate::models::project::Project;
use crate::models::task::Task;
use dioxus::prelude::*;
#[component]
pub(crate) fn FormOpenButton(opened: Signal<bool>) -> Element {
let mut project_being_edited = use_context::<Signal<Option<Project>>>();
let mut task_being_edited = use_context::<Signal<Option<Task>>>();
rsx! {
button {
class: "pointer-events-auto m-4 py-3 px-5 self-end text-center bg-zinc-300/50 rounded-xl border-t-zinc-200 border-t backdrop-blur drop-shadow-[0_-5px_10px_rgba(0,0,0,0.2)] text-2xl text-zinc-200 cursor-pointer",
onclick: move |_| {
if opened() {
project_being_edited.set(None);
task_being_edited.set(None);
}
opened.set(!opened());
},
i {
class: format!("min-w-6 fa-solid {}", if opened() { "fa-xmark" } else { "fa-plus" }),
}
}
}
}

53
src/components/input.rs Normal file
View File

@@ -0,0 +1,53 @@
use dioxus::prelude::*;
#[component]
pub(crate) fn Input(
class: Option<String>,
name: String,
r#type: String,
id: Option<String>,
#[props(extends = GlobalAttributes, extends = input)] attributes: Vec<Attribute>,
// TODO: Remove this once https://github.com/DioxusLabs/dioxus/issues/5271 gets resolved.
autofocus: Option<bool>,
// TODO: Remove this once https://github.com/DioxusLabs/dioxus/issues/4019 gets resolved.
oninput: Option<Callback<Event<FormData>>>,
onchange: Option<Callback<Event<FormData>>>,
) -> Element {
rsx! {
input {
class: format!(
/* `w-full` is required for the Chromium renderer to allow the input to shrink
properly. */
"pt-3 pb-2.25 w-full {} bg-gray-800-muted enabled:hover:bg-gray-800 enabled:focus:bg-gray-800 drop-shadow-[0_calc(0px_-_var(--spacing))_0_var(--color-gray-900-muted)] rounded-xl outline-0 {} transition-all duration-150 {}",
match r#type.as_str() {
"date" => "ps-3.25 pe-3",
_ => "px-4"
},
match r#type.as_str() {
"text" | "number" => "",
_ => "enabled:cursor-pointer"
},
class.unwrap_or("".to_owned())
),
name: name.clone(),
r#type,
id: id.unwrap_or(format!("input_{}", name)),
oninput: move |event| {
if let Some(oninput) = oninput {
oninput.call(event);
}
},
onchange: move |event| {
if let Some(onchange) = oninput {
onchange.call(event);
}
},
onmounted: move |element| async move {
if let Some(true) = autofocus {
let _ = element.set_focus(true).await;
}
},
..attributes
}
}
}

View File

@@ -0,0 +1,21 @@
use dioxus::prelude::*;
use dioxus_free_icons::{Icon, IconShape};
#[component]
pub(crate) fn InputLabel<I: IconShape + Clone + PartialEq + 'static>(
icon: I,
r#for: Option<String>,
) -> Element {
rsx! {
label {
r#for,
class: "mt-0.5 min-w-7 flex flex-row justify-center items-center",
Icon {
class: "text-gray-600",
icon,
height: 16,
width: 16
}
}
}
}

View File

@@ -1,16 +1,21 @@
pub(crate) mod app; pub(crate) mod app;
pub(crate) mod bottom_panel; pub(crate) mod bottom_panel;
pub(crate) mod button_primary;
pub(crate) mod button_secondary;
pub(crate) mod category_calendar_task_list; pub(crate) mod category_calendar_task_list;
pub(crate) mod category_input; pub(crate) mod category_input;
pub(crate) mod category_today_task_list; pub(crate) mod category_today_task_list;
pub(crate) mod create_button;
pub(crate) mod error_boundary_message; pub(crate) mod error_boundary_message;
pub(crate) mod form_open_button; pub(crate) mod input;
pub(crate) mod input_label;
pub(crate) mod navigation; pub(crate) mod navigation;
pub(crate) mod navigation_item; pub(crate) mod navigation_item;
pub(crate) mod project_form; pub(crate) mod project_form;
pub(crate) mod project_list; pub(crate) mod project_list;
pub(crate) mod project_select; pub(crate) mod project_select;
pub(crate) mod reoccurrence_input; pub(crate) mod reoccurrence_interval_input;
pub(crate) mod select_button;
pub(crate) mod sticky_bottom; pub(crate) mod sticky_bottom;
pub(crate) mod subtasks_form; pub(crate) mod subtasks_form;
pub(crate) mod task_form; pub(crate) mod task_form;

View File

@@ -1,78 +1,72 @@
use crate::components::navigation_item::NavigationItem; use crate::components::navigation_item::NavigationItem;
use crate::route::Route; use crate::route::Route;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::Icon;
use dioxus_free_icons::icons::fa_regular_icons::FaLightbulb;
use dioxus_free_icons::icons::fa_solid_icons::{
FaBars, FaCalendarDay, FaCalendarDays, FaHourglassHalf, FaInbox, FaList, FaSignsPost,
FaTrashCan, FaVolcano,
};
#[component] #[component]
pub(crate) fn Navigation(expanded: Signal<bool>) -> Element { pub(crate) fn Navigation(is_expanded: Signal<bool>) -> Element {
rsx! { rsx! {
div { div {
class: "grid grid-cols-5 justify-stretch", class: "grid grid-cols-5 justify-stretch",
button { button {
class: format!( class: format!(
"py-4 text-center text-2xl {} cursor-pointer", "py-2 flex flex-row justify-center items-center cursor-pointer",
if expanded() { "text-zinc-200" }
else { "text-zinc-500" }
), ),
onclick: move |_| expanded.set(!expanded()), onclick: move |_| is_expanded.set(!is_expanded()),
i { div {
class: "fa-solid fa-bars" class: format!("pt-2.5 px-4 {} transition-all duration-150",
if is_expanded() { "pb-2 mt-1 bg-gray-900 text-gray-400 rounded-xl drop-shadow-[0_calc(0px_-_var(--spacing))_0_var(--color-gray-950)]" }
else { "pb-3 bg-gray-800 rounded-xl drop-shadow-[0_0_0_var(--color-gray-950)] text-gray-600" }
),
Icon {
icon: FaBars,
height: 24,
width: 24
}
} }
}, },
NavigationItem { NavigationItem {
route: Route::CategoryNextStepsPage, route: Route::CategoryNextStepsPage,
i { icon: FaSignsPost
class: "fa-solid fa-forward"
}
}, },
NavigationItem { NavigationItem {
route: Route::CategoryCalendarPage, route: Route::CategoryCalendarPage,
i { icon: FaCalendarDays
class: "fa-solid fa-calendar-days"
}
}, },
NavigationItem { NavigationItem {
route: Route::CategoryTodayPage, route: Route::CategoryTodayPage,
i { icon: FaCalendarDay
class: "fa-solid fa-calendar-day"
}
}, },
NavigationItem { NavigationItem {
route: Route::CategoryInboxPage, route: Route::CategoryInboxPage,
i { icon: FaInbox
class: "fa-solid fa-inbox"
}
}, },
{if expanded() { {if is_expanded() {
rsx! { rsx! {
NavigationItem { NavigationItem {
route: Route::ProjectsPage, route: Route::ProjectsPage,
i { icon: FaList
class: "fa-solid fa-list"
}
}, },
NavigationItem { NavigationItem {
route: Route::CategoryTrashPage, route: Route::CategoryTrashPage,
i { icon: FaTrashCan
class: "fa-solid fa-trash-can"
}
}, },
NavigationItem { NavigationItem {
route: Route::CategoryDonePage, route: Route::CategoryDonePage,
i { icon: FaVolcano
class: "fa-solid fa-check"
}
}, },
NavigationItem { NavigationItem {
route: Route::CategoryLongTermPage, route: Route::CategorySomedayMaybePage,
i { icon: FaLightbulb
class: "fa-solid fa-water"
}
}, },
NavigationItem { NavigationItem {
route: Route::CategoryWaitingForPage, route: Route::CategoryWaitingForPage,
i { icon: FaHourglassHalf
class: "fa-solid fa-hourglass-half"
}
} }
} }
} else { VNode::empty() }} } else { VNode::empty() }}

View File

@@ -1,19 +1,31 @@
use crate::route::Route; use crate::route::Route;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::{Icon, IconShape};
#[component] #[component]
pub(crate) fn NavigationItem(route: Route, children: Element) -> Element { pub(crate) fn NavigationItem<I: IconShape + Clone + PartialEq + 'static>(
route: Route,
icon: I,
) -> Element {
let current_route = use_route::<Route>(); let current_route = use_route::<Route>();
rsx! { rsx! {
Link { Link {
to: route.clone(), to: route.clone(),
class: format!( class: format!(
"py-4 text-center text-2xl {}", "py-2.5 flex flex-row justify-center items-center hover:*:bg-gray-900 active:*:text-gray-400",
if current_route == route { "text-zinc-200" }
else { "text-zinc-500" }
), ),
children div {
class: format!("pt-2.5 px-4 {} transition-all duration-150",
if current_route == route { "pb-2 mt-1 bg-gray-900 text-gray-400 rounded-xl drop-shadow-[0_calc(0px_-_var(--spacing))_0_var(--color-gray-950)]" }
else { "pb-3 bg-gray-800 rounded-xl drop-shadow-[0_0_0_var(--color-gray-950)] text-gray-600" }
),
Icon {
icon,
height: 24,
width: 24
}
}
} }
} }
} }

View File

@@ -1,73 +1,110 @@
use crate::components::button_primary::ButtonPrimary;
use crate::components::button_secondary::ButtonSecondary;
use crate::components::input::Input;
use crate::components::input_label::InputLabel;
use crate::models::project::Project; use crate::models::project::Project;
use crate::server::projects::{create_project, delete_project, edit_project}; use crate::server::projects::{create_project, delete_project, edit_project};
use dioxus::core_macro::{component, rsx}; use dioxus::core_macro::{component, rsx};
use dioxus::dioxus_core::Element; use dioxus::dioxus_core::Element;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::Icon;
use dioxus_free_icons::icons::fa_solid_icons::{FaFeatherPointed, FaStamp, FaTrashCan, FaXmark};
pub(crate) static PROJECT_BEING_EDITED: GlobalSignal<Option<Project>> = Signal::global(|| None);
#[component] #[component]
pub(crate) fn ProjectForm( pub(crate) fn ProjectForm() -> Element {
project: Option<Project>, let navigator = use_navigator();
on_successful_submit: EventHandler<()>, let project = PROJECT_BEING_EDITED();
) -> Element {
let project_for_submit = project.clone(); let project_for_submit = project.clone();
rsx! { rsx! {
form { form {
class: "px-4 flex flex-col gap-4",
onsubmit: move |event| { onsubmit: move |event| {
event.prevent_default(); event.prevent_default();
let project = project_for_submit.clone(); let project = project_for_submit.clone();
async move { async move {
let new_project = event.parsed_values().unwrap(); let new_project = event.parsed_values().unwrap();
if let Some(project) = project { let result = if let Some(project) = project {
let _ = edit_project(project.id, new_project).await; edit_project(project.id, new_project).await
} else { } else {
let _ = create_project(new_project).await; create_project(new_project).await
};
if result.is_ok() {
navigator.go_back();
} }
on_successful_submit.call(());
} }
}, },
class: "p-4 flex flex-col gap-4", id: "form_project",
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
r#for: "input_title", icon: FaFeatherPointed,
class: "min-w-6 text-center", r#for: "input_title"
i {
class: "fa-solid fa-pen-clip text-zinc-400/50"
} }
} Input {
input { class: "grow",
name: "title", name: "title",
required: true, required: true,
initial_value: project.as_ref().map(|project| project.title.to_owned()),
r#type: "text", r#type: "text",
class: "py-2 px-3 grow bg-zinc-800/50 rounded-lg", initial_value: project.as_ref().map(|project| project.title.to_owned()),
id: "input_title" }
} }
} }
div { div {
class: "flex flex-row justify-between mt-auto", class: "px-4 grid grid-cols-3 gap-3 mt-auto",
button { ButtonSecondary {
r#type: "button", r#type: "button",
class: "py-2 px-4 bg-zinc-300/50 rounded-lg cursor-pointer", class: "grow",
onclick: move |_| { onclick: {
let project = project.clone();
move |_| {
let project = project.clone(); let project = project.clone();
async move { async move {
if let Some(project) = project { if let Some(project) = project {
let _ = delete_project(project.id).await; let result = delete_project(project.id).await;
if result.is_ok() {
navigator.go_back();
}
} else {
navigator.go_back();
}
} }
on_successful_submit.call(());
} }
}, },
i { Icon {
class: "fa-solid fa-trash-can" icon: FaTrashCan,
height: 16,
width: 16
} }
} }
button { if project.is_some() {
div {
class: "grow flex flex-col items-stretch",
GoBackButton {
ButtonSecondary {
/* TODO: Replace w-full` with proper flexbox styling once
https://github.com/DioxusLabs/dioxus/issues/5269 is solved. */
class: "w-full",
r#type: "button",
Icon {
icon: FaXmark,
height: 16,
width: 16
}
}
}
}
} else {
div {}
}
ButtonPrimary {
form: "form_project",
r#type: "submit", r#type: "submit",
class: "py-2 px-4 bg-zinc-300/50 rounded-lg cursor-pointer", Icon {
i { icon: FaStamp,
class: "fa-solid fa-floppy-disk" height: 16,
} width: 16
} }
} }
} }

View File

@@ -1,24 +1,22 @@
use crate::{hooks::use_projects, models::project::Project}; use crate::route::Route;
use crate::{components::project_form::PROJECT_BEING_EDITED, hooks::use_projects};
use dioxus::prelude::*; use dioxus::prelude::*;
#[component] #[component]
pub(crate) fn ProjectList() -> Element { pub(crate) fn ProjectList() -> Element {
let navigator = use_navigator();
let projects = use_projects()?; let projects = use_projects()?;
let mut project_being_edited = use_context::<Signal<Option<Project>>>();
rsx! { rsx! {
div { div {
class: "flex flex-col", class: "flex flex-col",
for project in projects { for project in projects {
div { div {
class: "px-7 py-4 hover:bg-gray-800 font-medium text-pretty wrap-anywhere select-none transition-all duration-150 cursor-pointer",
key: "{project.id}", key: "{project.id}",
class: format!( onclick: move |_| {
"px-8 py-4 select-none {}", *PROJECT_BEING_EDITED.write() = Some(project.clone());
if project_being_edited().is_some_and(|p| p.id == project.id) { navigator.push(Route::ProjectFormPage);
"bg-zinc-700" },
} else { "" }
),
onclick: move |_| project_being_edited.set(Some(project.clone())),
{project.title.clone()} {project.title.clone()}
} }
} }

View File

@@ -10,8 +10,8 @@ pub(crate) fn ProjectSelect(initial_selected_id: Option<i32>) -> Element {
rsx! { rsx! {
select { select {
name: "project_id", name: "project_id",
class: "px-3.5 py-2.5 bg-zinc-800/50 rounded-lg grow cursor-pointer", class: "px-4 pt-3 pb-2.25 bg-gray-800-muted enabled:hover:bg-gray-800 enabled:active:bg-gray-800 drop-shadow-[0_calc(0px_-_var(--spacing))_0_var(--color-gray-900-muted)] rounded-xl grow cursor-pointer transition-all duration-150",
id: "input_project", id: "input_project_id",
option { option {
value: 0, value: 0,
{t!("none")} {t!("none")}

View File

@@ -1,76 +0,0 @@
use crate::models::category::ReoccurrenceInterval;
use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
#[component]
pub(crate) fn ReoccurrenceIntervalInput(
reoccurrence_interval: Signal<Option<ReoccurrenceInterval>>,
class_buttons: Option<&'static str>,
) -> Element {
rsx! {
button {
r#type: "button",
class: format!(
"py-2 rounded-lg {} {} cursor-pointer",
class_buttons.unwrap_or(""),
if reoccurrence_interval().is_none() { "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
reoccurrence_interval.set(None);
},
i {
class: "fa-solid fa-ban"
}
},
button {
r#type: "button",
class: format!(
"py-2 rounded-lg {} {} cursor-pointer",
class_buttons.unwrap_or(""),
if let Some(ReoccurrenceInterval::Day) = reoccurrence_interval()
{ "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
reoccurrence_interval.set(Some(ReoccurrenceInterval::Day))
},
i {
class: "fa-solid fa-sun"
}
},
button {
r#type: "button",
class: format!(
"py-2 rounded-lg {} {} cursor-pointer",
class_buttons.unwrap_or(""),
if let Some(ReoccurrenceInterval::Month) = reoccurrence_interval()
{ "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
reoccurrence_interval.set(Some(ReoccurrenceInterval::Month))
},
i {
class: "fa-solid fa-moon"
}
},
button {
r#type: "button",
class: format!(
"py-2 rounded-lg {} {} cursor-pointer",
class_buttons.unwrap_or(""),
if let Some(ReoccurrenceInterval::Year) = reoccurrence_interval()
{ "bg-zinc-500/50" }
else { "bg-zinc-800/50" }
),
onclick: move |_| {
reoccurrence_interval.set(Some(ReoccurrenceInterval::Year))
},
i {
class: "fa-solid fa-earth-europe"
}
}
}
}

View File

@@ -0,0 +1,43 @@
use crate::components::select_button::SelectButton;
use crate::models::category::ReoccurrenceInterval;
use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
use dioxus_free_icons::icons::fa_solid_icons::{FaBan, FaEarthEurope, FaMoon, FaSun};
#[component]
pub(crate) fn ReoccurrenceIntervalInput(
reoccurrence_interval: Signal<Option<ReoccurrenceInterval>>,
class_buttons: Option<&'static str>,
) -> Element {
rsx! {
SelectButton {
icon: FaBan,
is_selected: reoccurrence_interval().is_none(),
on_select: move |_| {
reoccurrence_interval.set(None);
}
}
SelectButton {
icon: FaSun,
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Day)),
on_select: move |_| {
reoccurrence_interval.set(Some(ReoccurrenceInterval::Day))
}
}
SelectButton {
icon: FaMoon,
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Month)),
on_select: move |_| {
reoccurrence_interval.set(Some(ReoccurrenceInterval::Month));
}
}
SelectButton {
icon: FaEarthEurope,
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Year)),
on_select: move |_| {
reoccurrence_interval.set(Some(ReoccurrenceInterval::Year));
}
}
}
}

View File

@@ -0,0 +1,28 @@
use dioxus::prelude::*;
use dioxus_free_icons::{Icon, IconShape};
#[component]
pub(crate) fn SelectButton<I: IconShape + Clone + PartialEq + 'static>(
icon: I,
is_selected: bool,
on_select: Callback,
) -> Element {
rsx! {
button {
r#type: "button",
class: format!(
"pt-4.5 flex flex-row justify-center items-center {} rounded-xl transition-all duration-150",
if is_selected { "pb-3.75 bg-gray-900 drop-shadow-[0_0_0_var(--color-gray-900-muted)]" }
else { "pb-2.75 mt-1 bg-gray-800-muted hover:bg-gray-800 drop-shadow-[0_calc(0px_-_var(--spacing))_0_var(--color-gray-900-muted)] text-gray-400 cursor-pointer" }
),
onclick: move |_| {
on_select.call(());
},
Icon {
icon,
height: 16,
width: 16
}
},
}
}

View File

@@ -1,3 +1,6 @@
use crate::components::button_secondary::ButtonSecondary;
use crate::components::input::Input;
use crate::components::input_label::InputLabel;
use crate::hooks::use_subtasks_of_task; use crate::hooks::use_subtasks_of_task;
use crate::models::subtask::NewSubtask; use crate::models::subtask::NewSubtask;
use crate::models::task::Task; use crate::models::task::Task;
@@ -5,12 +8,16 @@ use crate::server::subtasks::{create_subtask, delete_subtask, edit_subtask};
use dioxus::core_macro::{component, rsx}; use dioxus::core_macro::{component, rsx};
use dioxus::dioxus_core::Element; use dioxus::dioxus_core::Element;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::Icon;
use dioxus_free_icons::icons::fa_solid_icons::{FaGavel, FaListCheck, FaTrashCan};
#[component] #[component]
pub(crate) fn SubtasksForm(task: Task) -> Element { pub(crate) fn SubtasksForm(task: Task) -> Element {
let subtasks = use_subtasks_of_task(task.id)?; let subtasks = use_subtasks_of_task(task.id)?;
let mut new_title = use_signal(String::new); let mut new_title = use_signal(String::new);
rsx! { rsx! {
div {
class: "flex flex-col gap-3",
form { form {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
onsubmit: move |event| { onsubmit: move |event| {
@@ -19,7 +26,7 @@ pub(crate) fn SubtasksForm(task: Task) -> Element {
async move { async move {
let new_subtask = NewSubtask { let new_subtask = NewSubtask {
task_id: task.id, task_id: task.id,
title: event.get("title").first().cloned().and_then(|value| match value { title: event.get("new_title").first().cloned().and_then(|value| match value {
FormValue::Text(value) => Some(value), FormValue::Text(value) => Some(value),
FormValue::File(_) => None FormValue::File(_) => None
}).unwrap(), }).unwrap(),
@@ -29,29 +36,26 @@ pub(crate) fn SubtasksForm(task: Task) -> Element {
new_title.set(String::new()); new_title.set(String::new());
} }
}, },
label { InputLabel {
r#for: "input_new_title", icon: FaListCheck,
class: "min-w-6 text-center", r#for: "input_new_title"
i {
class: "fa-solid fa-list-check text-zinc-400/50"
}
} }
div { div {
class: "grow grid grid-cols-6 gap-2", class: "grow flex flex-row items-end gap-3",
input { Input {
name: "title", class: "grow",
name: "new_title",
r#type: "text",
required: true, required: true,
value: new_title, value: new_title,
r#type: "text", onchange: move |event: Event<FormData>| new_title.set(event.value())
class: "grow py-2 px-3 col-span-5 bg-zinc-800/50 rounded-lg",
id: "input_new_title",
onchange: move |event| new_title.set(event.value())
} }
button { ButtonSecondary {
r#type: "submit", r#type: "submit",
class: "py-2 col-span-1 bg-zinc-800/50 rounded-lg", Icon {
i { icon: FaGavel,
class: "fa-solid fa-plus" height: 16,
width: 16
} }
} }
} }
@@ -60,15 +64,8 @@ pub(crate) fn SubtasksForm(task: Task) -> Element {
div { div {
key: "{subtask.id}", key: "{subtask.id}",
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
i { button {
class: format!( class: "mt-1.5 hover:mt-1 hover:pb-0.5 min-w-7 cursor-pointer transition-all duration-150",
"{} min-w-6 text-center text-2xl text-zinc-400/50",
if subtask.is_completed {
"fa solid fa-square-check"
} else {
"fa-regular fa-square"
}
),
onclick: { onclick: {
let subtask = subtask.clone(); let subtask = subtask.clone();
move |_| { move |_| {
@@ -85,14 +82,19 @@ pub(crate) fn SubtasksForm(task: Task) -> Element {
).await; ).await;
} }
} }
},
div {
class: format!("grow h-7 w-7 mb-[4px] drop-shadow-[0_1px_0_var(--color-gray-800),0_1px_0_var(--color-gray-800),0_1px_0_var(--color-gray-800),0_1px_0_var(--color-gray-800)] rounded-full {}",
if subtask.is_completed {"bg-gray-600"} else {"border-3 border-gray-600"}
)
} }
} }
div { div {
class: "grow grid grid-cols-6 gap-2", class: "grow flex flex-row items-end gap-3",
input { Input {
class: "grow",
name: "title_edit_{subtask.id}",
r#type: "text", r#type: "text",
class: "grow py-2 px-3 col-span-5 bg-zinc-800/50 rounded-lg",
id: "input_title_{subtask.id}",
initial_value: subtask.title.clone(), initial_value: subtask.title.clone(),
onchange: { onchange: {
let subtask = subtask.clone(); let subtask = subtask.clone();
@@ -116,9 +118,8 @@ pub(crate) fn SubtasksForm(task: Task) -> Element {
} }
} }
} }
button { ButtonSecondary {
r#type: "button", r#type: "button",
class: "py-2 col-span-1 bg-zinc-800/50 rounded-lg",
onclick: { onclick: {
let subtask = subtask.clone(); let subtask = subtask.clone();
move |_| { move |_| {
@@ -128,8 +129,11 @@ pub(crate) fn SubtasksForm(task: Task) -> Element {
} }
} }
}, },
i { Icon {
class: "fa-solid fa-trash-can" icon: FaTrashCan,
height: 16,
width: 16
}
} }
} }
} }

View File

@@ -1,16 +1,24 @@
use crate::components::button_primary::ButtonPrimary;
use crate::components::button_secondary::ButtonSecondary;
use crate::components::category_input::CategoryInput; use crate::components::category_input::CategoryInput;
use crate::components::input::Input;
use crate::components::input_label::InputLabel;
use crate::components::project_select::ProjectSelect; use crate::components::project_select::ProjectSelect;
use crate::components::reoccurrence_input::ReoccurrenceIntervalInput; use crate::components::reoccurrence_interval_input::ReoccurrenceIntervalInput;
use crate::components::subtasks_form::SubtasksForm; use crate::components::subtasks_form::SubtasksForm;
use crate::models::category::{CalendarTime, Category, Reoccurrence}; use crate::models::category::{CalendarTime, Category, Reoccurrence};
use crate::models::task::NewTask; use crate::models::task::NewTask;
use crate::models::task::Task; use crate::models::task::Task;
use crate::route::Route;
use crate::server::tasks::{create_task, delete_task, edit_task}; use crate::server::tasks::{create_task, delete_task, edit_task};
use chrono::Duration; use chrono::Duration;
use dioxus::core_macro::{component, rsx}; use dioxus::core_macro::{component, rsx};
use dioxus::dioxus_core::Element; use dioxus::dioxus_core::Element;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::Icon;
use dioxus_free_icons::icons::fa_solid_icons::{
FaBell, FaBomb, FaClock, FaFeatherPointed, FaHourglassEnd, FaList, FaRepeat, FaScroll, FaStamp,
FaTrashCan, FaXmark,
};
use dioxus_i18n::t; use dioxus_i18n::t;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@@ -46,25 +54,19 @@ struct InputData {
project_id: Option<String>, project_id: Option<String>,
} }
pub(crate) static TASK_BEING_EDITED: GlobalSignal<Option<Task>> = Signal::global(|| None);
pub(crate) static LATEST_VISITED_CATEGORY: GlobalSignal<Category> =
Signal::global(|| Category::Inbox);
#[component] #[component]
pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()>) -> Element { pub(crate) fn TaskForm() -> Element {
let route = use_route::<Route>(); let navigator = use_navigator();
let task = TASK_BEING_EDITED();
let selected_category = use_signal(|| { let selected_category = use_signal(|| {
if let Some(task) = &task { if let Some(task) = &task {
task.category.clone() task.category.clone()
} else { } else {
match route { LATEST_VISITED_CATEGORY()
Route::CategorySomedayMaybePage => Category::SomedayMaybe,
Route::CategoryWaitingForPage => Category::WaitingFor(String::new()),
Route::CategoryNextStepsPage => Category::NextSteps,
Route::CategoryCalendarPage | Route::CategoryTodayPage => Category::Calendar {
date: chrono::Local::now().date_naive(),
reoccurrence: None,
time: None,
},
Route::CategoryLongTermPage => Category::LongTerm,
_ => Category::Inbox,
}
} }
}); });
let category_calendar_reoccurrence_interval = use_signal(|| { let category_calendar_reoccurrence_interval = use_signal(|| {
@@ -104,9 +106,9 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
rsx! { rsx! {
div { div {
class: "p-4 flex flex-col gap-4", class: "grow px-4 flex flex-col gap-6.5",
form { form {
class: "flex flex-col gap-4", class: "flex flex-col gap-8",
id: "form_task", id: "form_task",
onsubmit: move |event| { onsubmit: move |event| {
event.prevent_default(); event.prevent_default();
@@ -148,50 +150,45 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
project_id: input_data.project_id project_id: input_data.project_id
.and_then(|deadline| deadline.parse().ok()).filter(|&id| id > 0), .and_then(|deadline| deadline.parse().ok()).filter(|&id| id > 0),
}; };
if let Some(task) = task { let result = if let Some(task) = task {
let _ = edit_task(task.id, new_task).await; edit_task(task.id, new_task).await
} else { } else {
let _ = create_task(new_task).await; create_task(new_task).await
};
if result.is_ok() {
navigator.go_back();
} }
on_successful_submit.call(());
} }
}, },
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
r#for: "input_title", r#for: "input_title",
class: "min-w-6 text-center", icon: FaFeatherPointed
i {
class: "fa-solid fa-pen-clip text-zinc-400/50"
}, },
}, Input {
input { class: "grow",
name: "title", name: "title",
required: true, required: true,
initial_value: task.as_ref().map(|task| task.title.clone()), initial_value: task.as_ref().map(|task| task.title.clone()),
r#type: "text", r#type: "text",
class: "py-2 px-3 grow bg-zinc-800/50 rounded-lg", autofocus: task.is_none()
id: "input_title" }
},
}, },
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
r#for: "input_project", r#for: "input_project_id",
class: "min-w-6 text-center", icon: FaList
i {
class: "fa-solid fa-list text-zinc-400/50"
}
}, },
SuspenseBoundary { SuspenseBoundary {
fallback: |_| { fallback: |_| {
rsx ! { rsx ! {
select { select {
class: "px-3.5 py-2.5 bg-zinc-800/50 rounded-lg grow cursor-pointer", class: "px-4 pt-3 pb-2.25 bg-gray-800-muted drop-shadow-[0_calc(0px_-_var(--spacing))_0_var(--color-gray-900-muted)] rounded-xl grow cursor-pointer",
option { option {
value: 0, value: 0
{t!("none")} }
},
} }
} }
}, },
@@ -202,86 +199,69 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
}, },
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
r#for: "input_deadline", icon: FaBomb,
class: "min-w-6 text-center", r#for: "input_deadline"
i {
class: "fa-solid fa-bomb text-zinc-400/50"
}
}, },
input { Input {
name: "deadline", name: "deadline",
initial_value: task.as_ref().and_then(|task| task.deadline) initial_value: task.as_ref().and_then(|task| task.deadline)
.map(|deadline| deadline.format("%Y-%m-%d").to_string()), .map(|deadline| deadline.format("%Y-%m-%d").to_string()),
r#type: "date", r#type: "date",
class: "py-2 px-3 bg-zinc-800/50 rounded-lg grow basis-0 cursor-pointer", class: "grow basis-0"
id: "input_deadline"
} }
}, },
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
class: "min-w-6 text-center", icon: FaScroll
i {
class: "fa-solid fa-layer-group text-zinc-400/50"
}
}, },
CategoryInput { CategoryInput {
selected_category: selected_category, class: "grow",
class: "grow" selected_category: selected_category
} }
} }
match selected_category() { match selected_category() {
Category::WaitingFor(waiting_for) => rsx! { Category::WaitingFor(waiting_for) => rsx! {
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
r#for: "input_deadline", icon: FaHourglassEnd,
class: "min-w-6 text-center", r#for: "input_category_waiting_for",
i {
class: "fa-solid fa-hourglass-end text-zinc-400/50"
}
}, },
input { Input {
class: "grow",
name: "category_waiting_for", name: "category_waiting_for",
required: true, required: true,
initial_value: waiting_for, initial_value: waiting_for,
r#type: "text", r#type: "text",
class: "py-2 px-3 bg-zinc-800/50 rounded-lg grow", }
id: "input_category_waiting_for"
},
} }
}, },
Category::Calendar { date, reoccurrence, time } => rsx! { Category::Calendar { date, reoccurrence, time } => rsx! {
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
r#for: "input_category_calendar_date", icon: FaClock,
class: "min-w-6 text-center", r#for: "input_category_calendar_date"
i {
class: "fa-solid fa-clock text-zinc-400/50"
}
}, },
div { div {
class: "grow flex flex-row gap-2", class: "grow grid grid-cols-7 gap-3",
input { Input {
r#type: "date", class: "grow col-span-4",
name: "category_calendar_date", name: "category_calendar_date",
r#type: "date",
required: true, required: true,
initial_value: date.format("%Y-%m-%d").to_string(), initial_value: date.format("%Y-%m-%d").to_string(),
class:
"py-2 px-3 bg-zinc-800/50 rounded-lg grow cursor-pointer",
id: "input_category_calendar_date"
}, },
input { Input {
r#type: "time", class: "grow col-span-3",
name: "category_calendar_time", name: "category_calendar_time",
r#type: "time",
initial_value: time.map(|calendar_time| initial_value: time.map(|calendar_time|
calendar_time.time.format("%H:%M").to_string() calendar_time.time.format("%H:%M").to_string()
), ),
class: "py-2 px-3 bg-zinc-800/50 rounded-lg grow cursor-pointer", oninput: move |event: Event<FormData>| {
id: "input_category_calendar_time",
oninput: move |event| {
category_calendar_has_time.set(!event.value().is_empty()); category_calendar_has_time.set(!event.value().is_empty());
} }
} }
@@ -289,54 +269,46 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
}, },
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
r#for: "category_calendar_reoccurrence_length", icon: FaRepeat,
class: "min-w-6 text-center", r#for: "category_calendar_reoccurrence_length"
i {
class: "fa-solid fa-repeat text-zinc-400/50"
}
}, },
div { div {
class: "grow grid grid-cols-6 gap-2", class: "grow grid grid-cols-5 items-end gap-3",
ReoccurrenceIntervalInput { ReoccurrenceIntervalInput {
reoccurrence_interval: category_calendar_reoccurrence_interval reoccurrence_interval: category_calendar_reoccurrence_interval
}, },
input { Input {
class: "text-right",
r#type: "number", r#type: "number",
inputmode: "numeric", inputmode: "numeric",
name: "category_calendar_reoccurrence_length", name: "category_calendar_reoccurrence_length",
disabled: category_calendar_reoccurrence_interval().is_none(), disabled: category_calendar_reoccurrence_interval().is_none(),
required: true, required: true,
min: 1, min: "1",
initial_value: category_calendar_reoccurrence_interval().map_or( initial_value: category_calendar_reoccurrence_interval().map_or(
String::new(), String::new(),
|_| reoccurrence.map_or(1, |reoccurrence| |_| reoccurrence.map_or(1, |reoccurrence|
reoccurrence.length).to_string() reoccurrence.length).to_string()
), )
class: "py-2 px-3 bg-zinc-800/50 rounded-lg col-span-2 text-right",
id: "category_calendar_reoccurrence_length"
} }
} }
}, },
if category_calendar_has_time() { if category_calendar_has_time() {
div { div {
class: "flex flex-row items-center gap-3", class: "flex flex-row items-center gap-3",
label { InputLabel {
r#for: "category_calendar_reminder_offset_index", r#for: "input_category_calendar_reminder_offset_index",
class: "min-w-6 text-center", icon: FaBell
i {
class: "fa-solid fa-bell text-zinc-400/50"
}
}, },
input { input {
r#type: "range", class: "grow",
name: "category_calendar_reminder_offset_index", name: "category_calendar_reminder_offset_index",
r#type: "range",
min: 0, min: 0,
max: REMINDER_OFFSETS.len() as i64 - 1, max: REMINDER_OFFSETS.len() as i64 - 1,
initial_value: category_calendar_reminder_offset_index() initial_value: category_calendar_reminder_offset_index()
.to_string(), .to_string(),
class: "grow input-range-reverse cursor-pointer",
id: "category_calendar_has_reminder",
oninput: move |event| { oninput: move |event| {
category_calendar_reminder_offset_index.set( category_calendar_reminder_offset_index.set(
event.value().parse().unwrap() event.value().parse().unwrap()
@@ -344,8 +316,8 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
} }
}, },
label { label {
r#for: "category_calendar_reminder_offset_index",
class: "pr-3 min-w-16 text-right", class: "pr-3 min-w-16 text-right",
r#for: "category_calendar_reminder_offset_index",
{REMINDER_OFFSETS[category_calendar_reminder_offset_index()] {REMINDER_OFFSETS[category_calendar_reminder_offset_index()]
.map( .map(
|offset| if offset.num_hours() < 1 { |offset| if offset.num_hours() < 1 {
@@ -371,17 +343,20 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
} }
} }
} }
}
div { div {
class: "flex flex-row justify-between mt-auto", class: "px-4 grid grid-cols-3 gap-3 mt-auto",
button { ButtonSecondary {
r#type: "button", r#type: "button",
class: "py-2 px-4 bg-zinc-300/50 rounded-lg cursor-pointer", class: "grow",
onclick: move |_| { onclick: {
let task = task.clone();
move |_| {
let task = task.clone(); let task = task.clone();
async move { async move {
if let Some(task) = task { if let Some(task) = task {
if let Category::Trash = task.category { let result = if let Category::Trash = task.category {
let _ = delete_task(task.id).await; delete_task(task.id).await
} else { } else {
let new_task = NewTask { let new_task = NewTask {
title: task.title.to_owned(), title: task.title.to_owned(),
@@ -389,23 +364,50 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
category: Category::Trash, category: Category::Trash,
project_id: task.project_id project_id: task.project_id
}; };
let _ = edit_task(task.id, new_task).await; edit_task(task.id, new_task).await.map(|_| ())
};
if result.is_ok() {
navigator.go_back();
}
} else {
navigator.go_back();
} }
} }
on_successful_submit.call(());
} }
}, },
i { Icon {
class: "fa-solid fa-trash-can" icon: FaTrashCan,
height: 16,
width: 16
} }
} }
button { if task.is_some() {
div {
class: "grow flex flex-col items-stretch",
GoBackButton {
ButtonSecondary {
/* TODO: Replace w-full` with proper flexbox styling once
https://github.com/DioxusLabs/dioxus/issues/5269 is solved. */
class: "w-full",
r#type: "button",
Icon {
icon: FaXmark,
height: 16,
width: 16
}
}
}
}
} else {
div {}
}
ButtonPrimary {
form: "form_task", form: "form_task",
r#type: "submit", r#type: "submit",
class: "py-2 px-4 bg-zinc-300/50 rounded-lg cursor-pointer", Icon {
i { icon: FaStamp,
class: "fa-solid fa-floppy-disk" height: 16,
} width: 16
} }
} }
} }

View File

@@ -1,6 +1,8 @@
use crate::components::task_form::TASK_BEING_EDITED;
use crate::components::task_list_item::TaskListItem; use crate::components::task_list_item::TaskListItem;
use crate::models::category::Category; use crate::models::category::Category;
use crate::models::task::{Task, TaskWithSubtasks}; use crate::models::task::TaskWithSubtasks;
use crate::route::Route;
use crate::server::tasks::complete_task; use crate::server::tasks::complete_task;
use dioxus::core_macro::rsx; use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element; use dioxus::dioxus_core::Element;
@@ -8,7 +10,7 @@ use dioxus::prelude::*;
#[component] #[component]
pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>) -> Element { pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>) -> Element {
let mut task_being_edited = use_context::<Signal<Option<Task>>>(); let navigator = use_navigator();
rsx! { rsx! {
div { div {
class: format!("flex flex-col {}", class.unwrap_or("")), class: format!("flex flex-col {}", class.unwrap_or("")),
@@ -16,34 +18,31 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
div { div {
key: "{task.task.id}", key: "{task.task.id}",
class: format!( class: format!(
"px-8 pt-4 {} flex flex-row gap-4 select-none {}", "px-7 pt-3.75 {} flex flex-row items-start gap-4 hover:bg-gray-800 cursor-pointer select-none transition-all duration-150",
if task.task.deadline.is_some() || !task.subtasks.is_empty() { if task.task.deadline.is_some() || !task.subtasks.is_empty() {
"pb-0.5" "pb-0.25"
} else if let Category::Calendar { time, .. } = &task.task.category { } else if let Category::Calendar { time, .. } = &task.task.category {
if time.is_some() { if time.is_some() {
"pb-0.5" "pb-0.25"
} else { } else {
"pb-4" "pb-3.75"
} }
} else { } else {
"pb-4" "pb-3.75"
}, },
if task_being_edited().is_some_and(|t| t.id == task.task.id) {
"bg-zinc-700"
} else { "" }
), ),
onclick: { onclick: {
let task = task.clone(); let task = task.clone();
move |_| task_being_edited.set(Some(task.task.clone())) move |_| {
}, *TASK_BEING_EDITED.write() = Some(task.task.clone());
i { navigator.push(Route::TaskFormPage);
class: format!(
"{} text-3xl align-middle h-9 text-zinc-500",
if let Category::Done = task.task.category {
"fa solid fa-square-check"
} else {
"fa-regular fa-square cursor-pointer"
} }
},
button {
class: format!(
"mt-0.5 hover:mt-0 hover:pb-0.5 transition-all duration-150 cursor-pointer {}",
if let Category::Done = task.task.category { "pointer-events-none" }
else { "" }
), ),
onclick: { onclick: {
move |event: Event<MouseData>| { move |event: Event<MouseData>| {
@@ -53,8 +52,19 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
let _ = complete_task(task.task.id).await; let _ = complete_task(task.task.id).await;
} }
} }
},
div {
class: format!("h-8 w-8 rounded-full {}",
if let Category::Done = task.task.category {
"mt-[3px] mb-[2px] bg-amber-300-muted"
} else {
"mb-[5px] border-3 border-amber-300-muted drop-shadow-[0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted)]"
}
)
} }
}, },
div {
class: "mt-1.5",
TaskListItem { TaskListItem {
task: task.clone() task: task.clone()
} }
@@ -63,3 +73,4 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
} }
} }
} }
}

View File

@@ -5,6 +5,8 @@ use chrono::{Datelike, Local};
use dioxus::core_macro::rsx; use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element; use dioxus::dioxus_core::Element;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::Icon;
use dioxus_free_icons::icons::fa_solid_icons::{FaBomb, FaClock, FaListCheck};
use dioxus_i18n::prelude::i18n; use dioxus_i18n::prelude::i18n;
use dioxus_i18n::t; use dioxus_i18n::t;
use voca_rs::Voca; use voca_rs::Voca;
@@ -14,19 +16,21 @@ pub(crate) fn TaskListItem(task: TaskWithSubtasks) -> Element {
let today_date = Local::now().date_naive(); let today_date = Local::now().date_naive();
rsx! { rsx! {
div { div {
class: "flex flex-col", class: "pt-0.75 flex flex-col",
div { div {
class: "mt-1 grow font-medium", class: "grow font-medium text-pretty wrap-anywhere",
{task.task.title} {task.task.title}
}, },
div { div {
class: "flex flex-row gap-4", class: "flex flex-row gap-4",
if let Some(deadline) = task.task.deadline { if let Some(deadline) = task.task.deadline {
div { div {
class: "text-sm text-zinc-400", class: "flex flex-row items-center gap-1 text-sm text-gray-500",
i { Icon {
class: "fa-solid fa-bomb" icon: FaBomb,
}, height: 14,
width: 14
}
{ {
format!( format!(
" {}", " {}",
@@ -72,10 +76,12 @@ pub(crate) fn TaskListItem(task: TaskWithSubtasks) -> Element {
if let Category::Calendar { time, .. } = task.task.category { if let Category::Calendar { time, .. } = task.task.category {
if let Some(calendar_time) = time { if let Some(calendar_time) = time {
div { div {
class: "text-sm text-zinc-400", class: "flex flex-row items-center gap-1 text-sm text-gray-500",
i { Icon {
class: "fa-solid fa-clock" icon: FaClock,
}, height: 14,
width: 14
}
{ {
let format = t!("time-format"); let format = t!("time-format");
format!(" {}", calendar_time.time.format(format.as_str())) format!(" {}", calendar_time.time.format(format.as_str()))
@@ -85,10 +91,12 @@ pub(crate) fn TaskListItem(task: TaskWithSubtasks) -> Element {
} }
if !task.subtasks.is_empty() { if !task.subtasks.is_empty() {
div { div {
class: "text-sm text-zinc-400", class: "flex flex-row items-center gap-1 text-sm text-gray-500",
i { Icon {
class: "fa-solid fa-list-check" icon: FaListCheck,
}, height: 14,
width: 14
}
{format!( {format!(
" {}/{}", " {}/{}",
task.subtasks.iter() task.subtasks.iter()

View File

@@ -1,6 +1,6 @@
use dioxus::{ use dioxus::{
CapturedError, CapturedError,
fullstack::{Loader, Loading, WebSocketOptions, use_websocket}, fullstack::{Loader, Loading, WebSocketOptions},
prelude::*, prelude::*,
}; };
use serde::{Serialize, de::DeserializeOwned}; use serde::{Serialize, de::DeserializeOwned};
@@ -13,6 +13,29 @@ use crate::{
}, },
}; };
fn use_on_document_become_visible(mut callback: impl FnMut() + 'static) {
let callback = use_callback(move |_| callback());
use_effect(move || {
spawn(async move {
let mut eval = document::eval(
r#"
document.addEventListener("visibilitychange", () => {
if (!document.hidden) {
dioxus.send(0);
}
});
"#,
);
loop {
eval.recv::<u8>()
.await
.expect("The JS code returned a value not parsable to `u8`.");
callback.call(());
}
});
});
}
#[allow(clippy::result_large_err)] #[allow(clippy::result_large_err)]
fn sort_loader_result<T: Ord + Clone>( fn sort_loader_result<T: Ord + Clone>(
result: Result<Loader<Vec<T>>, Loading>, result: Result<Loader<Vec<T>>, Loading>,
@@ -34,18 +57,38 @@ where
E: Into<CapturedError> + 'static, E: Into<CapturedError> + 'static,
{ {
let mut refresh_tick = use_signal(|| 0u64); let mut refresh_tick = use_signal(|| 0u64);
let mut websocket_reset_tick = use_signal(|| 0u64);
let loader = use_loader(move || { let loader = use_loader(move || {
let _ = refresh_tick(); // Read => dependency. let _ = refresh_tick(); // Read => dependency.
future() future()
}); });
let mut socket = use_websocket(|| subscribe_to_updates(WebSocketOptions::default())); use_effect(move || {
use_future(move || async move { let initial_websocket_reset_tick = websocket_reset_tick();
spawn(async move {
let Ok(socket) =
subscribe_to_updates(WebSocketOptions::new().with_automatic_reconnect()).await
else {
return;
};
while socket.recv().await.is_ok() { while socket.recv().await.is_ok() {
if websocket_reset_tick() != initial_websocket_reset_tick {
// A new WebSocket has been created (a new task spawned), cleaning this one up.
break;
}
refresh_tick += 1; refresh_tick += 1;
} }
}); });
});
/* So that when the device goes to sleep or suspends the app, the WebSocket gets recreated on
waking up. It is important to do this only on becoming visible (document.hidden == false),
because becoming hidden is the part when network may not work and thus cause errors. */
use_on_document_become_visible(move || {
websocket_reset_tick += 1;
refresh_tick += 1;
});
loader loader
} }

View File

@@ -1,47 +0,0 @@
use crate::components::bottom_panel::BottomPanel;
use crate::components::form_open_button::FormOpenButton;
use crate::components::sticky_bottom::StickyBottom;
use crate::models::project::Project;
use crate::models::task::Task;
use crate::route::Route;
use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
#[component]
pub(crate) fn Main() -> Element {
let mut display_form = use_signal(|| false);
let project_being_edited =
use_context_provider::<Signal<Option<Project>>>(|| Signal::new(None));
let task_being_edited = use_context_provider::<Signal<Option<Task>>>(|| Signal::new(None));
use_effect(move || {
display_form.set(project_being_edited().is_some() || task_being_edited().is_some());
});
rsx! {
SuspenseBoundary {
fallback: |_| {
rsx! {
div {
class: "grow flex flex-col justify-center items-center",
div {
i {
class: "text-3xl fa-solid fa-cog fa-spin"
}
}
}
}
},
Outlet::<Route> {}
}
StickyBottom {
FormOpenButton {
opened: display_form,
}
BottomPanel {
display_form: display_form,
}
}
}
}

View File

@@ -1,2 +1,2 @@
mod main; pub(crate) mod navigation;
pub(crate) use main::Main; pub(crate) mod suspense;

38
src/layouts/navigation.rs Normal file
View File

@@ -0,0 +1,38 @@
use crate::components::bottom_panel::BottomPanel;
use crate::components::create_button::CreateButton;
use crate::components::sticky_bottom::StickyBottom;
use crate::components::task_form::LATEST_VISITED_CATEGORY;
use crate::models::category::Category;
use crate::route::Route;
use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
#[component]
pub(crate) fn Navigation() -> Element {
let current_route = use_route();
use_effect(use_reactive(&current_route, move |current_route| {
*LATEST_VISITED_CATEGORY.write() = match current_route {
Route::CategorySomedayMaybePage => Category::SomedayMaybe,
Route::CategoryWaitingForPage => Category::WaitingFor(String::new()),
Route::CategoryNextStepsPage => Category::NextSteps,
Route::CategoryCalendarPage | Route::CategoryTodayPage => Category::Calendar {
date: chrono::Local::now().date_naive(),
reoccurrence: None,
time: None,
},
_ => Category::Inbox,
};
}));
rsx! {
div {
class: "grow flex flex-col pb-36",
Outlet::<Route> {}
}
StickyBottom {
CreateButton {},
BottomPanel {}
}
}
}

28
src/layouts/suspense.rs Normal file
View File

@@ -0,0 +1,28 @@
use crate::route::Route;
use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
use dioxus_free_icons::Icon;
use dioxus_free_icons::icons::fa_solid_icons::FaCog;
#[component]
pub(crate) fn Suspense() -> Element {
rsx! {
SuspenseBoundary {
fallback: |_| {
rsx! {
div {
class: "grow flex flex-col justify-center items-center",
Icon {
class: "text-gray-500 animate-[spin_3000ms_linear_infinite]",
icon: FaCog,
height: 32,
width: 32
}
}
}
},
Outlet::<Route> {}
}
}
}

View File

@@ -2,14 +2,15 @@ use crate::layouts;
use crate::views::category_calendar_page::CategoryCalendarPage; use crate::views::category_calendar_page::CategoryCalendarPage;
use crate::views::category_done_page::CategoryDonePage; use crate::views::category_done_page::CategoryDonePage;
use crate::views::category_inbox_page::CategoryInboxPage; use crate::views::category_inbox_page::CategoryInboxPage;
use crate::views::category_long_term_page::CategoryLongTermPage;
use crate::views::category_next_steps_page::CategoryNextStepsPage; use crate::views::category_next_steps_page::CategoryNextStepsPage;
use crate::views::category_someday_maybe_page::CategorySomedayMaybePage; use crate::views::category_someday_maybe_page::CategorySomedayMaybePage;
use crate::views::category_today_page::CategoryTodayPage; use crate::views::category_today_page::CategoryTodayPage;
use crate::views::category_trash_page::CategoryTrashPage; use crate::views::category_trash_page::CategoryTrashPage;
use crate::views::category_waiting_for_page::CategoryWaitingForPage; use crate::views::category_waiting_for_page::CategoryWaitingForPage;
use crate::views::not_found_page::NotFoundPage; use crate::views::not_found_page::NotFoundPage;
use crate::views::project_form_page::ProjectFormPage;
use crate::views::projects_page::ProjectsPage; use crate::views::projects_page::ProjectsPage;
use crate::views::task_form_page::TaskFormPage;
use dioxus::prelude::*; use dioxus::prelude::*;
// All variants have the same postfix because they have to match the component names. // All variants have the same postfix because they have to match the component names.
@@ -17,8 +18,8 @@ use dioxus::prelude::*;
#[derive(Clone, Routable, Debug, PartialEq)] #[derive(Clone, Routable, Debug, PartialEq)]
#[rustfmt::skip] #[rustfmt::skip]
pub(crate) enum Route { pub(crate) enum Route {
#[layout(layouts::Main)] #[layout(layouts::navigation::Navigation)]
#[redirect("/", || Route::CategoryTodayPage {})] #[layout(layouts::suspense::Suspense)]
#[route("/today")] #[route("/today")]
CategoryTodayPage, CategoryTodayPage,
#[route("/inbox")] #[route("/inbox")]
@@ -31,8 +32,6 @@ pub(crate) enum Route {
CategoryNextStepsPage, CategoryNextStepsPage,
#[route("/calendar")] #[route("/calendar")]
CategoryCalendarPage, CategoryCalendarPage,
#[route("/long-term")]
CategoryLongTermPage,
#[route("/done")] #[route("/done")]
CategoryDonePage, CategoryDonePage,
#[route("/trash")] #[route("/trash")]
@@ -40,6 +39,13 @@ pub(crate) enum Route {
#[route("/projects")] #[route("/projects")]
ProjectsPage, ProjectsPage,
#[end_layout] #[end_layout]
#[end_layout]
#[layout(layouts::suspense::Suspense)]
#[route("/task")]
TaskFormPage,
#[route("/project")]
ProjectFormPage,
#[end_layout]
#[redirect("/", || Route::CategoryTodayPage)] #[redirect("/", || Route::CategoryTodayPage)]
#[route("/:..route")] #[route("/:..route")]
NotFoundPage { NotFoundPage {

View File

@@ -1,17 +0,0 @@
use crate::components::error_boundary_message::ErrorBoundaryMessage;
use crate::models::category::Category;
use crate::views::category_page::CategoryPage;
use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
#[component]
pub(crate) fn CategoryLongTermPage() -> Element {
rsx! {
ErrorBoundaryMessage {
CategoryPage {
category: Category::LongTerm,
}
}
}
}

View File

@@ -11,8 +11,7 @@ pub(crate) fn CategoryPage(category: Category) -> Element {
rsx! { rsx! {
TaskList { TaskList {
tasks: tasks.clone(), tasks: tasks.clone()
class: "pb-36"
} }
} }
} }

View File

@@ -1,7 +1,6 @@
pub(crate) mod category_calendar_page; pub(crate) mod category_calendar_page;
pub(crate) mod category_done_page; pub(crate) mod category_done_page;
pub(crate) mod category_inbox_page; pub(crate) mod category_inbox_page;
pub(crate) mod category_long_term_page;
pub(crate) mod category_next_steps_page; pub(crate) mod category_next_steps_page;
pub(crate) mod category_page; pub(crate) mod category_page;
pub(crate) mod category_someday_maybe_page; pub(crate) mod category_someday_maybe_page;
@@ -9,4 +8,6 @@ pub(crate) mod category_today_page;
pub(crate) mod category_trash_page; pub(crate) mod category_trash_page;
pub(crate) mod category_waiting_for_page; pub(crate) mod category_waiting_for_page;
pub(crate) mod not_found_page; pub(crate) mod not_found_page;
pub(crate) mod project_form_page;
pub(crate) mod projects_page; pub(crate) mod projects_page;
pub(crate) mod task_form_page;

View File

@@ -0,0 +1,12 @@
use crate::components::{error_boundary_message::ErrorBoundaryMessage, project_form::ProjectForm};
use dioxus::prelude::*;
#[component]
pub(crate) fn ProjectFormPage() -> Element {
rsx! {
ErrorBoundaryMessage {
class: "grow py-4 flex flex-col gap-12",
ProjectForm {}
}
}
}

View File

@@ -0,0 +1,12 @@
use crate::components::{error_boundary_message::ErrorBoundaryMessage, task_form::TaskForm};
use dioxus::prelude::*;
#[component]
pub(crate) fn TaskFormPage() -> Element {
rsx! {
ErrorBoundaryMessage {
class: "grow py-4 flex flex-col gap-12",
TaskForm {}
}
}
}

View File

@@ -1,2 +1,27 @@
/* stylelint-disable-next-line import-notation */ /* stylelint-disable-next-line import-notation */
@import "tailwindcss"; @import "tailwindcss";
@font-face {
font-family: Inter;
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("/assets/fonts/inter_variable.woff2") format("woff2");
}
@font-face {
font-family: Inter;
font-style: italic;
font-weight: 100 900;
font-display: swap;
src: url("/assets/fonts/inter_variable_italic.woff2") format("woff2");
}
/* stylelint-disable-next-line */
@theme {
--font-sans: "Inter", "sans";
--color-amber-300-muted: #b89a2e;
--color-amber-700-muted: #80390b;
--color-gray-800-muted: #141d2d;
--color-gray-900-muted: #0b111f;
}