feat: authentication #44
@ -1,11 +1,10 @@
|
||||
/.git
|
||||
/.github
|
||||
/node_modules
|
||||
/target
|
||||
|
||||
.dockerignore
|
||||
/docker-compose-dev.yaml
|
||||
/docker-compose-prod.yaml
|
||||
/docker-compose.yaml
|
||||
/docker/dev/*/Dockerfile
|
||||
/docker/prod/*/Dockerfile
|
||||
/.dioxus/
|
||||
/.git/
|
||||
/.github/
|
||||
/dist/
|
||||
/debug/
|
||||
/node_modules/
|
||||
/static/
|
||||
/target/
|
||||
/docker-compose-dev.yml
|
||||
/docker-compose-prod.yml
|
||||
|
1
.env.dev
1
.env.dev
@ -1,2 +1,3 @@
|
||||
DATABASE_URL=postgres://app:app@db/todo_baggins
|
||||
LANGUAGE_CODE=en-US
|
||||
AUTH_TOKEN=my_token
|
||||
|
@ -1 +0,0 @@
|
||||
${PullRequestTitle} (${PullRequestReference})
|
4
.github/config/markdownlint.yaml
vendored
4
.github/config/markdownlint.yaml
vendored
@ -1,4 +0,0 @@
|
||||
---
|
||||
# no-duplicate-heading
|
||||
MD024:
|
||||
siblings_only: true
|
4
.github/config/yamllint.yaml
vendored
4
.github/config/yamllint.yaml
vendored
@ -1,4 +0,0 @@
|
||||
rules:
|
||||
comments:
|
||||
# https://github.com/redhat-developer/vscode-yaml/issues/433
|
||||
min-spaces-from-content: 1
|
1670
.github/dependencies/checkov-check/requirements.txt
vendored
1670
.github/dependencies/checkov-check/requirements.txt
vendored
File diff suppressed because it is too large
Load Diff
41
.github/workflows/actionlint-check.yaml
vendored
41
.github/workflows/actionlint-check.yaml
vendored
@ -1,41 +0,0 @@
|
||||
---
|
||||
name: actionlint check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: actionlint check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: actionlint installation
|
||||
working-directory: /bin
|
||||
run: |
|
||||
set -e
|
||||
|
||||
INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/rhysd/actionlint/e11169d0656294827d65370a3c76a2325406da85/scripts/download-actionlint.bash"
|
||||
ACTIONLINT_VERSION="1.7.5"
|
||||
|
||||
INSTALL_SCRIPT_CHECKSUM="99ab9f1d97c31c9a051e6902305f7ea9f48e7e7e1b0ee41f64aa831c86655168 download-actionlint.bash"
|
||||
ACTIONLINT_CHECKSUM="3d74253aa0cf645e6224fd53f2d56776998c7c05a0d3c12307463285515898f8 actionlint"
|
||||
|
||||
wget -O download-actionlint.bash "$INSTALL_SCRIPT_URL"
|
||||
echo "$INSTALL_SCRIPT_CHECKSUM" | sha256sum --check
|
||||
|
||||
bash download-actionlint.bash "$ACTIONLINT_VERSION"
|
||||
echo "$ACTIONLINT_CHECKSUM" | sha256sum --check
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: actionlint check
|
||||
run: actionlint
|
33
.github/workflows/checkov-check.yaml
vendored
33
.github/workflows/checkov-check.yaml
vendored
@ -1,33 +0,0 @@
|
||||
---
|
||||
name: checkov check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: checkov check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: Python installation
|
||||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
|
||||
with:
|
||||
python-version: "3.13.1"
|
||||
- name: Rust toolchain installation
|
||||
uses: dtolnay/rust-toolchain@0579bb9e1907e560c2f263f705f93655a44a07e5
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: checkov installation
|
||||
run: pip install --no-cache-dir --require-hashes -r .github/dependencies/checkov-check/requirements.txt
|
||||
- name: checkov check
|
||||
run: checkov --directory .
|
@ -1,29 +0,0 @@
|
||||
---
|
||||
name: conventional commit messages check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: conventional commit messages check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: conventional commit messages check
|
||||
uses: davidglezz/action-conventional-commits-check@ea8ae44ab9c7b79c1da0bd811a6ee6c5768ce476
|
||||
with:
|
||||
target-branch: ${{ github.event.pull_request.base.ref }}
|
||||
current-branch: ${{ github.event.pull_request.head.ref }}
|
||||
pattern: "^(build|chore|ci|docs|feat|fix|hotfix|perf|refactor|revert|style|test){1}(\\([[:alnum:]._-]+\\))?(!)?: ([[:alnum:]])+([[:space:][:print:]]*)$"
|
24
.github/workflows/conventional-commits.yml
vendored
Normal file
24
.github/workflows/conventional-commits.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: conventional commits
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened, edited ]
|
||||
|
||||
permissions: { }
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: conventional commits
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: conventional commits check
|
||||
uses: webiny/action-conventional-commits@v1.3.0
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -1,24 +0,0 @@
|
||||
---
|
||||
name: conventional pull request title check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: conventional pull request title check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: conventional pull request title check
|
||||
uses: ytanikin/PRConventionalCommits@b628c5a234cc32513014b7bfdd1e47b532124d98
|
||||
with:
|
||||
task_types: '["build","chore","ci","docs","feat","fix","hotfix","perf","refactor","revert","style","test"]'
|
||||
add_label: "false"
|
23
.github/workflows/conventional-pull-requests.yml
vendored
Normal file
23
.github/workflows/conventional-pull-requests.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: conventional pull requests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened, edited ]
|
||||
|
||||
permissions: { }
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: conventional pull requests
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: conventional pull requests check
|
||||
uses: ytanikin/PRConventionalCommits@1.1.0
|
||||
with:
|
||||
task_types: '["build","chore","ci","docs","feat","fix","perf","refactor","revert","style","test"]'
|
||||
add_label: 'false'
|
41
.github/workflows/dotenv-linter-check.yaml
vendored
41
.github/workflows/dotenv-linter-check.yaml
vendored
@ -1,41 +0,0 @@
|
||||
---
|
||||
name: dotenv-linter check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: dotenv-linter check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: dotenv-linter installation
|
||||
working-directory: /bin
|
||||
run: |
|
||||
set -e
|
||||
|
||||
INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/ced5b9b28d9a1a309fe900cb992d69dba91205dc/install.sh"
|
||||
DOTENV_LINTER_VERSION="v3.3.0"
|
||||
|
||||
INSTALL_SCRIPT_CHECKSUM="3b883cbc2bc3b48b6acd794802326a50fcbfeff7d5cd61e457c54fd6072bd809 dotenv-linter-install.sh"
|
||||
DOTENV_LINTER_CHECKSUM="4bf3efb743a1e3383ab3407ff48c6147dd527dac35b736e224a26425df00a2ee dotenv-linter"
|
||||
|
||||
wget -O dotenv-linter-install.sh "$INSTALL_SCRIPT_URL"
|
||||
echo "$INSTALL_SCRIPT_CHECKSUM" | sha256sum --check
|
||||
|
||||
sh dotenv-linter-install.sh -- -b . "$DOTENV_LINTER_VERSION"
|
||||
echo "$DOTENV_LINTER_CHECKSUM" | sha256sum --check
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: dotenv-linter check
|
||||
run: dotenv-linter
|
38
.github/workflows/gitleaks-check.yaml
vendored
38
.github/workflows/gitleaks-check.yaml
vendored
@ -1,38 +0,0 @@
|
||||
---
|
||||
name: GitLeaks check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: GitLeaks check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: GitLeaks installation
|
||||
working-directory: /bin
|
||||
run: |
|
||||
set -e
|
||||
|
||||
VERSION="v8.22.0"
|
||||
CHECKSUM="3f95fef7e361adafed2b1bb9c591ba3bc6b595b4f296b346257301b7bf04be15 gitleaks.tar.gz"
|
||||
|
||||
wget -O "gitleaks.tar.gz" "https://github.com/gitleaks/gitleaks/releases/download/$VERSION/gitleaks_8.22.0_linux_arm64.tar.gz"
|
||||
echo "$CHECKSUM" | sha256sum --check
|
||||
|
||||
tar xzf gitleaks.tar.gz
|
||||
chmod +x gitleaks
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: GitLeaks check
|
||||
run: gitleaks git && gitleaks dir
|
43
.github/workflows/hadolint-check.yaml
vendored
43
.github/workflows/hadolint-check.yaml
vendored
@ -1,43 +0,0 @@
|
||||
---
|
||||
name: hadolint check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: hadolint check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: hadolint installation
|
||||
working-directory: /bin
|
||||
run: |
|
||||
set -e
|
||||
|
||||
VERSION="v2.12.0"
|
||||
CHECKSUM="5798551bf19f33951881f15eb238f90aef023f11e7ec7e9f4c37961cb87c5df6 hadolint"
|
||||
|
||||
wget -O hadolint "https://github.com/hadolint/hadolint/releases/download/$VERSION/hadolint-Linux-arm64"
|
||||
echo "$CHECKSUM" | sha256sum --check
|
||||
|
||||
chmod +x hadolint
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: hadolint check
|
||||
run: |
|
||||
STATUS=0
|
||||
while read -r file; do
|
||||
echo "Linting $file..."
|
||||
hadolint "$file" || STATUS=1
|
||||
done < <(find . -name "Dockerfile")
|
||||
exit $STATUS
|
27
.github/workflows/htmlhint-check.yaml
vendored
27
.github/workflows/htmlhint-check.yaml
vendored
@ -1,27 +0,0 @@
|
||||
---
|
||||
name: htmlhint check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: htmlhint check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: dependencies installation
|
||||
run: npm install
|
||||
- name: htmlhint check
|
||||
run: npx htmlhint "**/*.html"
|
43
.github/workflows/lint.yml
vendored
Normal file
43
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened, edited ]
|
||||
|
||||
permissions: { }
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Super-linter needs the full git history to get the list of files that changed across commits
|
||||
fetch-depth: 0
|
||||
- name: Super-linter check
|
||||
uses: super-linter/super-linter@v7.0.0 # x-release-please-version
|
||||
env:
|
||||
# to report GitHub Actions status checks
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VALIDATE_ALL_CODEBASE: false
|
||||
VALIDATE_JAVASCRIPT_PRETTIER: false
|
||||
VALIDATE_JAVASCRIPT_STANDARD: false
|
||||
VALIDATE_JSCPD: false
|
||||
VALIDATE_RUST_2015: false
|
||||
VALIDATE_RUST_2018: false
|
||||
VALIDATE_SQLFLUFF: false
|
||||
FIX_CSS_PRETTIER: true
|
||||
FIX_HTML_PRETTIER: true
|
||||
FIX_JAVASCRIPT_ES: true
|
||||
FIX_JSON_PRETTIER: true
|
||||
FIX_RUST_2021: true
|
||||
FIX_RUST_CLIPPY: true
|
||||
FIX_TYPESCRIPT_ES: true
|
||||
FIX_YAML_PRETTIER: true
|
27
.github/workflows/markdownlint-check.yaml
vendored
27
.github/workflows/markdownlint-check.yaml
vendored
@ -1,27 +0,0 @@
|
||||
---
|
||||
name: markdownlint check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: markdownlint check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: dependencies installation
|
||||
run: npm install
|
||||
- name: markdownlint check
|
||||
run: npx markdownlint --config .github/config/markdownlint.yaml "**/*.md" --ignore node_modules
|
27
.github/workflows/prettier-check.yaml
vendored
27
.github/workflows/prettier-check.yaml
vendored
@ -1,27 +0,0 @@
|
||||
---
|
||||
name: Prettier check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Prettier check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: dependencies installation
|
||||
run: npm install
|
||||
- name: Prettier check
|
||||
run: npx prettier . --check
|
43
.github/workflows/rust-check.yaml
vendored
43
.github/workflows/rust-check.yaml
vendored
@ -1,43 +0,0 @@
|
||||
---
|
||||
name: Rust check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Rust check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: dependencies installation
|
||||
run: >
|
||||
apt-get update && apt-get install -y
|
||||
libgtk-3-dev=3.24.33-1ubuntu2.2
|
||||
libjavascriptcoregtk-4.1-dev=2.46.5-0ubuntu0.22.04.1
|
||||
libsoup-3.0-dev=3.0.7-0ubuntu1
|
||||
libwebkit2gtk-4.1-dev=2.46.5-0ubuntu0.22.04.1
|
||||
libxdo-dev=1:3.20160805.1-4
|
||||
- name: Rust toolchain installation
|
||||
uses: dtolnay/rust-toolchain@0579bb9e1907e560c2f263f705f93655a44a07e5
|
||||
with:
|
||||
components: clippy, rustfmt
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: npm build
|
||||
run: npm install && npm run build
|
||||
- name: rustfmt check
|
||||
run: cargo fmt --all --check
|
||||
- name: Clippy check
|
||||
run: cargo clippy --all-targets --all-features -- --deny warnings
|
||||
- name: test check
|
||||
run: cargo test --all --all-targets --all-features
|
34
.github/workflows/shellcheck-check.yaml
vendored
34
.github/workflows/shellcheck-check.yaml
vendored
@ -1,34 +0,0 @@
|
||||
---
|
||||
name: ShellCheck check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ShellCheck check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: ShellCheck installation
|
||||
run: apt-get update && apt-get install -y shellcheck=0.8.0-2
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: ShellCheck check
|
||||
# https://www.shellcheck.net/wiki/Recursiveness
|
||||
run: |
|
||||
if find . -type f -name "*.sh" -print0 | grep -qz .; then
|
||||
find . -type f -name "*.sh" -print0 | xargs -0 shellcheck
|
||||
exit 0
|
||||
else
|
||||
echo "No shell scripts found. Skipping ShellCheck."
|
||||
fi
|
27
.github/workflows/stylelint-check.yaml
vendored
27
.github/workflows/stylelint-check.yaml
vendored
@ -1,27 +0,0 @@
|
||||
---
|
||||
name: Stylelint check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Stylelint check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: dependencies installation
|
||||
run: npm install
|
||||
- name: Stylelint check
|
||||
run: npx stylelint "**/*.css"
|
27
.github/workflows/yamllint-check.yaml
vendored
27
.github/workflows/yamllint-check.yaml
vendored
@ -1,27 +0,0 @@
|
||||
---
|
||||
name: yamllint check
|
||||
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: yamllint check
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: read
|
||||
statuses: write
|
||||
steps:
|
||||
- name: yamllint installation
|
||||
run: apt-get update && apt-get install -y yamllint=1.26.3-1
|
||||
- name: code checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: yamllint check
|
||||
run: yamllint -c .github/config/yamllint.yaml .
|
15
.gitignore
vendored
15
.gitignore
vendored
@ -1,9 +1,10 @@
|
||||
/node_modules
|
||||
/target
|
||||
/target/
|
||||
/dist/
|
||||
/static/
|
||||
/.dioxus/
|
||||
/node_modules/
|
||||
|
||||
/**/*.rs.bk
|
||||
/.DS_Store
|
||||
/.env
|
||||
/.env.prod
|
||||
**/*.rs.bk
|
||||
|
||||
/docker-compose.yaml
|
||||
.env
|
||||
.env.prod
|
||||
|
63
.idea/codeStyles/Project.xml
generated
63
.idea/codeStyles/Project.xml
generated
@ -1,63 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
</HTMLCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</JSCodeStyleSettings>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<VueCodeStyleSettings>
|
||||
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
||||
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
||||
</VueCodeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Markdown">
|
||||
<option name="RIGHT_MARGIN" value="80" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Vue">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="yaml">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
5
.idea/codeStyles/codeStyleConfig.xml
generated
@ -1,5 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
2
.idea/dataSources.local.xml
generated
2
.idea/dataSources.local.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="dataSourceStorageLocal" created-in="RR-243.23654.116">
|
||||
<component name="dataSourceStorageLocal" created-in="RR-242.21829.114">
|
||||
<data-source name="todo_baggins@localhost" uuid="1658668c-c2b8-426d-a22f-16fbad9eff0b">
|
||||
<database-info product="PostgreSQL" version="16.4 (Debian 16.4-1.pgdg120+1)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.6.0" dbms="POSTGRES" exact-version="16.4" exact-driver-version="42.6">
|
||||
<identifier-quote-string>"</identifier-quote-string>
|
||||
|
1048
.idea/dataSources/1658668c-c2b8-426d-a22f-16fbad9eff0b.xml
generated
1048
.idea/dataSources/1658668c-c2b8-426d-a22f-16fbad9eff0b.xml
generated
File diff suppressed because it is too large
Load Diff
@ -1,2 +1,2 @@
|
||||
#n:public
|
||||
!<md> [946, 0, null, null, -2147483648, -2147483648]
|
||||
!<md> [785, 0, null, null, -2147483648, -2147483648]
|
||||
|
203
.idea/icon.svg
generated
203
.idea/icon.svg
generated
@ -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 |
8
.idea/prettier.xml
generated
8
.idea/prettier.xml
generated
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PrettierConfiguration">
|
||||
<option name="myConfigurationMode" value="AUTOMATIC" />
|
||||
<option name="myRunOnSave" value="true" />
|
||||
<option name="myFilesPattern" value="**/*.{html,css,scss,js,ts,cjs,cts,mjs,mts,json,yaml}" />
|
||||
</component>
|
||||
</project>
|
2
.idea/runConfigurations/dev.xml
generated
2
.idea/runConfigurations/dev.xml
generated
@ -3,7 +3,7 @@
|
||||
<deployment type="docker-compose.yml">
|
||||
<settings>
|
||||
<option name="envFilePath" value="" />
|
||||
<option name="sourceFilePath" value="docker-compose-dev.yaml" />
|
||||
<option name="sourceFilePath" value="docker-compose-dev.yml" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
|
2
.idea/sqldialects.xml
generated
2
.idea/sqldialects.xml
generated
@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/migrations/00000000000000_diesel_initial_setup/down.sql" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/migrations/00000000000000_diesel_initial_setup/up.sql" dialect="PostgreSQL" />
|
||||
<file url="PROJECT" dialect="PostgreSQL" />
|
||||
</component>
|
||||
</project>
|
@ -1 +0,0 @@
|
||||
{}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": ["stylelint-config-standard"]
|
||||
}
|
4291
Cargo.lock
generated
4291
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
74
Cargo.toml
74
Cargo.toml
@ -1,59 +1,39 @@
|
||||
[package]
|
||||
name = "todo-baggins"
|
||||
version = "0.1.0"
|
||||
authors = ["Matouš Volf <git@matousvolf.cz>"]
|
||||
authors = ["Matouš Volf <66163112+matous-volf@users.noreply.github.com>"]
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
chrono = { version = "0.4.39", features = ["serde", "unstable-locales"] }
|
||||
dioxus = { version = "0.6.3", features = ["fullstack", "router"] }
|
||||
feruca = { version = "0.10.1" }
|
||||
serde = { version = "1.0.217" }
|
||||
serde_json = { version = "1.0.138" }
|
||||
serde_with = { version = "3.12.0", features = ["chrono_0_4"] }
|
||||
tracing = "0.1.41"
|
||||
unic-langid-impl = { version = "0.9.5", features = ["serde"] }
|
||||
validator = { version = "0.19.0", features = ["derive"] }
|
||||
chrono = { version = "0.4.38", features = ["serde", "unstable-locales"] }
|
||||
diesel = { version = "2.2.2", features = ["chrono", "postgres", "postgres_backend", "serde_json"] }
|
||||
|
||||
diesel = { version = "2.2.7", features = ["chrono", "postgres", "postgres_backend", "serde_json"], optional = true }
|
||||
diesel_migrations = { version = "2.2.0", features = ["postgres"], optional = true }
|
||||
dotenvy = { version = "0.15.7", optional = true }
|
||||
time = { version = "0.3.37", optional = true }
|
||||
dioxus = { version = "0.5", features = ["fullstack", "router"] }
|
||||
|
||||
async-std = { version = "1.13.0", optional = true }
|
||||
dioxus-i18n = { version = "0.4.2", optional = true }
|
||||
dioxus-query = { version = "0.6.0", optional = true }
|
||||
voca_rs = { version = "1.15.2", optional = true }
|
||||
# Debug
|
||||
dioxus-logger = "0.5.1"
|
||||
dotenvy = "0.15.7"
|
||||
serde = "1.0.208"
|
||||
validator = { version = "0.18.1", features = ["derive"] }
|
||||
serde_json = "1.0.125"
|
||||
tracing = "0.1.40"
|
||||
tracing-wasm = "0.2.1"
|
||||
serde_with = { version = "3.9.0", features = ["chrono_0_4"] }
|
||||
async-std = "1.12.0"
|
||||
dioxus-query = "0.5.1"
|
||||
time = "0.3.36"
|
||||
dioxus-sdk = { version = "0.5.0", features = ["i18n"] }
|
||||
unic-langid-impl = "0.9.5"
|
||||
voca_rs = "1.15.2"
|
||||
http = "1.1.0"
|
||||
pin-project-lite = "0.2.14"
|
||||
tower-layer = "0.3.3"
|
||||
tower-service = "0.3.3"
|
||||
cookie = { version = "0.18.1", features = ["percent-encode"] }
|
||||
|
||||
[features]
|
||||
default = ["web"]
|
||||
desktop = ["dioxus/desktop"]
|
||||
mobile = ["dioxus/mobile"]
|
||||
web = [
|
||||
"dioxus/web",
|
||||
"dep:async-std",
|
||||
"dep:dioxus-query",
|
||||
"dep:dioxus-i18n",
|
||||
"dep:voca_rs"
|
||||
]
|
||||
server = [
|
||||
"dioxus/server",
|
||||
"dep:diesel",
|
||||
"dep:diesel_migrations",
|
||||
"dep:dotenvy",
|
||||
"dep:time",
|
||||
]
|
||||
|
||||
[profile]
|
||||
|
||||
[profile.wasm-dev]
|
||||
inherits = "dev"
|
||||
opt-level = 1
|
||||
|
||||
[profile.server-dev]
|
||||
inherits = "dev"
|
||||
|
||||
[profile.android-dev]
|
||||
inherits = "dev"
|
||||
default = []
|
||||
server = ["dioxus/axum"]
|
||||
web = ["dioxus/web"]
|
||||
|
31
Dioxus.toml
31
Dioxus.toml
@ -3,7 +3,14 @@
|
||||
# App (Project) Name
|
||||
name = "todo-baggins"
|
||||
|
||||
# For font files to get referenced in CSS files by their original names, without the hash Dioxus appends.
|
||||
# Dioxus App Default Platform
|
||||
# web, desktop, fullstack
|
||||
default_platform = "fullstack"
|
||||
|
||||
# `build` & `serve` dist path
|
||||
out_dir = "dist"
|
||||
|
||||
# resource (assets) file folder
|
||||
asset_dir = "assets"
|
||||
|
||||
[web.app]
|
||||
@ -11,14 +18,28 @@ asset_dir = "assets"
|
||||
# HTML title tag content
|
||||
title = "Todo Baggins"
|
||||
|
||||
[web.watcher]
|
||||
|
||||
# when watcher trigger, regenerate the `index.html`
|
||||
reload_html = true
|
||||
|
||||
# which files or dirs will be watcher monitoring
|
||||
watch_path = ["src", "assets"]
|
||||
|
||||
# include `assets` in web platform
|
||||
[web.resource]
|
||||
|
||||
# Additional CSS style files
|
||||
style = []
|
||||
# CSS style file
|
||||
|
||||
# Additional JavaScript files
|
||||
script = []
|
||||
style = [
|
||||
"/styles/tailwind_output.css",
|
||||
"/styles/fonts.css",
|
||||
"/styles/input_number_arrows.css",
|
||||
"/styles/input_range.css"
|
||||
]
|
||||
|
||||
# Javascript code file
|
||||
script = ["https://kit.fontawesome.com/3c1b409f8f.js"]
|
||||
|
||||
[web.resource.dev]
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 130 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
@ -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 |
@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "Todo Baggins",
|
||||
"short_name": "Todo Baggins",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#27272a",
|
||||
"theme_color": "#27272a",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/images/icon.png",
|
||||
"sizes": "any",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
@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: normal;
|
||||
font-weight: 100 900;
|
||||
font-display: swap;
|
||||
src: url("/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");
|
||||
}
|
||||
@font-face {
|
||||
font-family: Inter;
|
||||
font-style: italic;
|
||||
font-weight: 100 900;
|
||||
font-display: swap;
|
||||
src: url("/fonts/inter_variable_italic.woff2") format("woff2");
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
input::-webkit-outer-spin-button,
|
||||
input::-webkit-inner-spin-button {
|
||||
display: none;
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
display: none;
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
appearance: textfield;
|
||||
appearance:textfield;
|
||||
}
|
||||
|
@ -1,63 +1,63 @@
|
||||
input[type="range"],
|
||||
input[type="range"]::-webkit-slider-runnable-track,
|
||||
input[type="range"]::-webkit-slider-thumb {
|
||||
appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
background: transparent;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
input[type="range"]::-moz-range-thumb {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
background: rgba(228 228 231);
|
||||
border: 0;
|
||||
border-radius: 0.5rem;
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
background: rgba(228 228 231);
|
||||
border: 0;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
input[type="range"]::-moz-range-progress {
|
||||
background: #525259;
|
||||
height: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
background: #525259;
|
||||
height: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
input[type="range"]::-moz-range-track {
|
||||
background: rgba(39 39 42 / 50%);
|
||||
height: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
background: rgba(39 39 42 / 50%);
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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 {
|
||||
background: rgba(39 39 42 / 50%);
|
||||
height: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
background: rgba(39 39 42 / 50%);
|
||||
height: 0.5rem;
|
||||
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;
|
||||
background: rgba(39 39 42 / 50%);
|
||||
height: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
---
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
@ -12,27 +11,16 @@ services:
|
||||
- ./Cargo.toml:/srv/app/Cargo.toml
|
||||
- ./diesel.toml:/srv/app/diesel.toml
|
||||
- ./Dioxus.toml:/srv/app/Dioxus.toml
|
||||
restart: always
|
||||
ports: ["8000:8000"]
|
||||
depends_on: ["db", "style-builder"]
|
||||
|
||||
style-builder:
|
||||
build:
|
||||
dockerfile: docker/dev/style-builder/Dockerfile
|
||||
volumes:
|
||||
- ./assets:/srv/app/assets
|
||||
- ./src:/srv/app/src
|
||||
- ./package.json:/srv/app/package.json
|
||||
- ./package-lock.json:/srv/app/package-lock.json
|
||||
# To prevent the container from exiting.
|
||||
# See https://github.com/rails/rails/issues/44048.
|
||||
tty: true
|
||||
restart: always
|
||||
ports: [ "8000:8000" ]
|
||||
depends_on: [ "db" ]
|
||||
|
||||
db:
|
||||
image: postgres:16.4-bookworm
|
||||
volumes: ["db_data:/var/lib/postgresql/data"]
|
||||
ports: ["5432:5432"]
|
||||
volumes: [ "db_data:/var/lib/postgresql/data" ]
|
||||
ports: [ "5432:5432" ]
|
||||
environment:
|
||||
POSTGRES_DB: todo_baggins
|
||||
POSTGRES_USER: app
|
@ -1,28 +0,0 @@
|
||||
---
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
dockerfile: docker/prod/app/Dockerfile
|
||||
networks:
|
||||
- default
|
||||
- web-server-network
|
||||
restart: always
|
||||
depends_on: ["db"]
|
||||
|
||||
db:
|
||||
image: postgres:16.4-bookworm
|
||||
volumes: ["db_data:/var/lib/postgresql/data"]
|
||||
networks:
|
||||
- default
|
||||
environment:
|
||||
POSTGRES_DB: todo_baggins
|
||||
POSTGRES_USER: app
|
||||
POSTGRES_PASSWORD: app
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
|
||||
networks:
|
||||
web-server-network:
|
||||
external: true
|
0
docker-compose-prod.yml
Executable file
0
docker-compose-prod.yml
Executable file
@ -1,17 +1,23 @@
|
||||
# 1.83.0-bookworm
|
||||
FROM rust@sha256:a45bf1f5d9af0a23b26703b3500d70af1abff7f984a7abef5a104b42c02a292b
|
||||
FROM rust:1.80-bookworm
|
||||
|
||||
RUN cargo install dioxus-cli --version 0.6.3 \
|
||||
&& cargo install diesel_cli --version 2.2.7
|
||||
RUN rustup target add wasm32-unknown-unknown && \
|
||||
cargo install dioxus-cli diesel_cli && \
|
||||
apt-get update && apt-get install -y nodejs=18.19.0+dfsg-6~deb12u2 npm=9.2.0~ds1-1 supervisor=4.2.5-1
|
||||
|
||||
COPY . /srv/app
|
||||
WORKDIR /srv/app
|
||||
|
||||
RUN mkdir -p /.local/share/dioxus \
|
||||
&& chown -R 1000:1000 /srv/app /usr/local/cargo /.local/share/dioxus
|
||||
RUN npm install
|
||||
|
||||
HEALTHCHECK CMD curl --fail -H "Accept: text/html" http://localhost:8000 || exit 1
|
||||
COPY docker/dev/app/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
RUN chown -R 1000:1000 /srv/app && \
|
||||
chown -R 1000:1000 /usr/local/cargo && \
|
||||
mkdir -p /.local/share/dioxus && \
|
||||
chown -R 1000:1000 /.local/share/dioxus
|
||||
|
||||
HEALTHCHECK CMD curl --fail http://localhost:8000 || exit 1
|
||||
|
||||
USER 1000:1000
|
||||
|
||||
CMD ["dx", "serve", "--addr", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["sh", "docker/dev/app/entrypoint.sh"]
|
||||
|
5
docker/dev/app/entrypoint.sh
Executable file
5
docker/dev/app/entrypoint.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
diesel migration run
|
||||
|
||||
supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
23
docker/dev/app/supervisord.conf
Normal file
23
docker/dev/app/supervisord.conf
Normal file
@ -0,0 +1,23 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
pidfile=/dev/null
|
||||
|
||||
[program:npm]
|
||||
command=npm run watch
|
||||
directory=/srv/app
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
|
||||
[program:dx]
|
||||
command=dx serve
|
||||
directory=/srv/app
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
@ -1,15 +0,0 @@
|
||||
# 23-alpine3.21
|
||||
FROM node@sha256:c61b6b12a3c96373673cd52d7ecee2314e82bca5d541eecf0bc6aee870c8c6f7
|
||||
|
||||
WORKDIR /srv/app
|
||||
|
||||
COPY ./package.json ./package.json
|
||||
COPY ./package-lock.json ./package-lock.json
|
||||
|
||||
RUN npm install
|
||||
|
||||
USER 1000:1000
|
||||
|
||||
#checkov:skip=CKV_DOCKER_2: No need for (or even a simple way to do) a healthcheck.
|
||||
|
||||
CMD ["npm", "run", "watch"]
|
@ -1,40 +0,0 @@
|
||||
# 1.83.0-bookworm
|
||||
FROM rust@sha256:a45bf1f5d9af0a23b26703b3500d70af1abff7f984a7abef5a104b42c02a292b AS builder
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
nodejs=18.19.0+dfsg-6~deb12u2 \
|
||||
npm=9.2.0~ds1-1 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& cargo install dioxus-cli --version 0.6.3 \
|
||||
&& cargo install diesel_cli --version 2.2.7
|
||||
|
||||
COPY . /srv/app
|
||||
WORKDIR /srv/app
|
||||
|
||||
RUN npm install \
|
||||
&& npm run build \
|
||||
&& dx bundle
|
||||
|
||||
# bookworm
|
||||
FROM debian@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a AS runner
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends libpq5=15.10-0+deb12u1 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=builder /srv/app/target/dx/todo-baggins/release/web /srv/app
|
||||
COPY .env /srv/app/.env
|
||||
|
||||
RUN chown -R 1000:1000 /srv/app
|
||||
|
||||
WORKDIR /srv/app
|
||||
|
||||
HEALTHCHECK CMD curl --fail -H "Accept: text/html" http://localhost || exit 1
|
||||
|
||||
USER 1000:1000
|
||||
|
||||
ENV IP="0.0.0.0"
|
||||
ENV PORT="80"
|
||||
CMD ["./server"]
|
1657
package-lock.json
generated
1657
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,9 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"tailwindcss": "3.4.10"
|
||||
"tailwindcss": "^3.4.10"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tailwindcss -c src/styles/tailwind.config.js -i src/styles/tailwind.css -o assets/styles/tailwind_output.css",
|
||||
"watch": "npm run build -- --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"htmlhint": "1.1.4",
|
||||
"markdownlint-cli": "0.43.0",
|
||||
"prettier": "3.4.2",
|
||||
"stylelint": "16.12.0",
|
||||
"stylelint-config-standard": "36.0.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +1,21 @@
|
||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||
use crate::route::Route;
|
||||
use crate::server::internationalization::get_language_identifier;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_i18n::prelude::*;
|
||||
use dioxus_i18n::unic_langid::langid;
|
||||
use dioxus_query::prelude::use_init_query_client;
|
||||
|
||||
const FAVICON: Asset = asset!("/assets/favicon.ico");
|
||||
const TAILWIND_CSS: Asset = asset!("/assets/styles/tailwind_output.css");
|
||||
const FONTS_CSS: Asset = asset!("/assets/styles/fonts.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");
|
||||
use dioxus_query::prelude::{use_init_query_client};
|
||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||
use dioxus_sdk::i18n::{use_init_i18n};
|
||||
use crate::internationalization::get_languages;
|
||||
use crate::server::internationalization::get_language_identifier;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn App() -> Element {
|
||||
use_init_query_client::<QueryValue, QueryErrors, QueryKey>();
|
||||
|
||||
let language_identifier = use_server_future(get_language_identifier)?
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
use_init_i18n(|| {
|
||||
I18nConfig::new(language_identifier)
|
||||
.with_locale(Locale::new_static(
|
||||
langid!("cs-CZ"),
|
||||
include_str!("../internationalization/cs_cz.ftl"),
|
||||
))
|
||||
.with_locale(Locale::new_static(
|
||||
langid!("en-US"),
|
||||
include_str!("../internationalization/en_us.ftl"),
|
||||
))
|
||||
});
|
||||
|
||||
|
||||
let language_identifier = use_server_future(get_language_identifier)?.unwrap().unwrap();
|
||||
use_init_i18n(language_identifier.clone(), language_identifier, get_languages);
|
||||
|
||||
rsx! {
|
||||
document::Link { rel: "icon", href: FAVICON }
|
||||
document::Stylesheet { href: TAILWIND_CSS }
|
||||
document::Stylesheet { href: FONTS_CSS }
|
||||
document::Stylesheet { href: INPUT_NUMBER_ARROWS_CSS }
|
||||
document::Stylesheet { href: INPUT_RANGE_CSS }
|
||||
document::Script { src: "https://kit.fontawesome.com/3c1b409f8f.js" }
|
||||
|
||||
div {
|
||||
class: "min-h-screen text-zinc-200 bg-zinc-800 pt-4 pb-36",
|
||||
Router::<Route> {}
|
||||
|
@ -25,7 +25,7 @@ pub(crate) fn BottomPanel(display_form: Signal<bool>) -> Element {
|
||||
// Necessary for a smooth – not instant – height transition.
|
||||
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. */
|
||||
it is being closed. */
|
||||
if !display_form() {
|
||||
expanded.set(false);
|
||||
}
|
||||
|
@ -4,10 +4,7 @@ use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn CategoryInput(
|
||||
selected_category: Signal<Category>,
|
||||
class: Option<&'static str>,
|
||||
) -> Element {
|
||||
pub(crate) fn CategoryInput(selected_category: Signal<Category>, class: Option<&'static str>) -> Element {
|
||||
rsx! {
|
||||
div {
|
||||
class: format!("flex flex-row gap-2 {}", class.unwrap_or("")),
|
||||
|
@ -4,5 +4,6 @@ use dioxus::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn Home() -> Element {
|
||||
rsx! {}
|
||||
rsx! {
|
||||
}
|
||||
}
|
||||
|
@ -11,14 +11,17 @@ use dioxus::prelude::*;
|
||||
#[component]
|
||||
pub(crate) fn Layout() -> 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));
|
||||
|
||||
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! {
|
||||
Outlet::<Route> {}
|
||||
StickyBottom {
|
||||
|
@ -1,16 +1,16 @@
|
||||
pub(crate) mod app;
|
||||
pub(crate) mod bottom_panel;
|
||||
pub(crate) mod category_input;
|
||||
pub(crate) mod form_open_button;
|
||||
pub(crate) mod home;
|
||||
pub(crate) mod layout;
|
||||
pub(crate) mod navigation;
|
||||
pub(crate) mod navigation_item;
|
||||
pub(crate) mod pages;
|
||||
pub(crate) mod project_form;
|
||||
pub(crate) mod reoccurrence_input;
|
||||
pub(crate) mod sticky_bottom;
|
||||
pub(crate) mod subtasks_form;
|
||||
pub(crate) mod task_form;
|
||||
pub(crate) mod task_list;
|
||||
pub(crate) mod pages;
|
||||
pub(crate) mod navigation;
|
||||
pub(crate) mod form_open_button;
|
||||
pub(crate) mod bottom_panel;
|
||||
pub(crate) mod sticky_bottom;
|
||||
pub(crate) mod category_input;
|
||||
pub(crate) mod reoccurrence_input;
|
||||
pub(crate) mod layout;
|
||||
pub(crate) mod navigation_item;
|
||||
pub(crate) mod subtasks_form;
|
||||
pub(crate) mod task_list_item;
|
||||
|
@ -75,7 +75,7 @@ pub(crate) fn Navigation(expanded: Signal<bool>) -> Element {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { VNode::empty() }}
|
||||
} else { None }}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::route::Route;
|
||||
use dioxus::prelude::*;
|
||||
use crate::route::Route;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn NavigationItem(route: Route, children: Element) -> Element {
|
||||
|
@ -8,9 +8,9 @@ use chrono::{Datelike, Local};
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_i18n::prelude::i18n;
|
||||
use dioxus_i18n::t;
|
||||
use dioxus_query::prelude::QueryResult;
|
||||
use dioxus_sdk::i18n::use_i18;
|
||||
use dioxus_sdk::translate;
|
||||
|
||||
const CALENDAR_LENGTH_DAYS: usize = 366 * 3;
|
||||
|
||||
@ -23,12 +23,14 @@ pub(crate) fn CategoryCalendarPage() -> Element {
|
||||
});
|
||||
let tasks_query_result = tasks.result();
|
||||
|
||||
let i18 = use_i18();
|
||||
|
||||
rsx! {
|
||||
match tasks_query_result.value() {
|
||||
QueryResult::Ok(QueryValue::TasksWithSubtasks(tasks))
|
||||
| QueryResult::Loading(Some(QueryValue::TasksWithSubtasks(tasks))) => {
|
||||
let today_date = Local::now().date_naive();
|
||||
|
||||
|
||||
rsx! {
|
||||
div {
|
||||
class: "pt-4 flex flex-col gap-8",
|
||||
@ -40,15 +42,16 @@ pub(crate) fn CategoryCalendarPage() -> Element {
|
||||
div {
|
||||
class: "pt-1",
|
||||
{
|
||||
date_current.format_localized(t!(
|
||||
date_current.format_localized(translate!(
|
||||
i18,
|
||||
if date_current.year() == Local::now().year() {
|
||||
"date-weekday-format"
|
||||
"formats.date_weekday_format"
|
||||
} else {
|
||||
"date-weekday-year-format"
|
||||
"formats.date_weekday_year_format"
|
||||
}
|
||||
).as_str(),
|
||||
LocaleFromLanguageIdentifier::from(
|
||||
&i18n().language()
|
||||
&(i18.selected_language)()
|
||||
).into()
|
||||
)
|
||||
.to_string()
|
||||
@ -57,7 +60,7 @@ pub(crate) fn CategoryCalendarPage() -> Element {
|
||||
}
|
||||
TaskList {
|
||||
tasks: tasks.iter().filter(|task| {
|
||||
if let Category::Calendar { date, .. }
|
||||
if let Category::Calendar { date, .. }
|
||||
= task.task().category() {
|
||||
*date == date_current
|
||||
} else {
|
||||
@ -67,7 +70,7 @@ pub(crate) fn CategoryCalendarPage() -> Element {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
QueryResult::Loading(None) => rsx! {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
use crate::models::category::Category;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn CategoryDonePage() -> Element {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
use crate::models::category::Category;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn CategoryInboxPage() -> Element {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
use crate::models::category::Category;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn CategoryLongTermPage() -> Element {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
use crate::models::category::Category;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn CategoryNextStepsPage() -> Element {
|
||||
|
@ -28,6 +28,6 @@ pub(crate) fn CategoryPage(category: Category) -> Element {
|
||||
"Errors occurred: {errors:?}"
|
||||
}
|
||||
},
|
||||
value => panic!("Unexpected query result: {value:?}"),
|
||||
value => panic!("Unexpected query result: {value:?}")
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
use crate::models::category::Category;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn CategorySomedayMaybePage() -> Element {
|
||||
|
@ -7,9 +7,9 @@ use crate::query::tasks::use_tasks_with_subtasks_in_category_query;
|
||||
use crate::query::QueryValue;
|
||||
use chrono::Local;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_i18n::t;
|
||||
use dioxus_i18n::use_i18n::i18n;
|
||||
use dioxus_query::prelude::QueryResult;
|
||||
use dioxus_sdk::i18n::use_i18;
|
||||
use dioxus_sdk::translate;
|
||||
use voca_rs::Voca;
|
||||
|
||||
#[component]
|
||||
@ -26,6 +26,8 @@ pub(crate) fn CategoryTodayPage() -> Element {
|
||||
let long_term_tasks_query = use_tasks_with_subtasks_in_category_query(Category::LongTerm);
|
||||
let long_term_tasks_query_result = long_term_tasks_query.result();
|
||||
|
||||
let i18 = use_i18();
|
||||
|
||||
rsx! {
|
||||
div {
|
||||
class: "pt-4 flex flex-col gap-8",
|
||||
@ -44,7 +46,7 @@ pub(crate) fn CategoryTodayPage() -> Element {
|
||||
}
|
||||
div {
|
||||
class: "mt-1",
|
||||
{t!("long-term")._upper_first()}
|
||||
{translate!(i18, "long_term")._upper_first()}
|
||||
}
|
||||
}
|
||||
div {
|
||||
@ -95,7 +97,7 @@ pub(crate) fn CategoryTodayPage() -> Element {
|
||||
panic!("Unexpected category.");
|
||||
}
|
||||
}).cloned().collect::<Vec<TaskWithSubtasks>>();
|
||||
|
||||
|
||||
rsx! {
|
||||
if !overdue_tasks.is_empty() {
|
||||
div {
|
||||
@ -107,7 +109,7 @@ pub(crate) fn CategoryTodayPage() -> Element {
|
||||
}
|
||||
div {
|
||||
class: "mt-1",
|
||||
{t!("overdue")._upper_first()}
|
||||
{translate!(i18, "overdue")._upper_first()}
|
||||
}
|
||||
}
|
||||
TaskList {
|
||||
@ -126,17 +128,18 @@ pub(crate) fn CategoryTodayPage() -> Element {
|
||||
div {
|
||||
class: "mt-1",
|
||||
{
|
||||
let format = t!("date-weekday-format");
|
||||
let format = translate!(i18, "formats.date_weekday_format");
|
||||
let today_date = today_date.format_localized(
|
||||
format.as_str(),
|
||||
LocaleFromLanguageIdentifier::from(
|
||||
&i18n().language()
|
||||
&(i18.selected_language)()
|
||||
).into()
|
||||
).to_string();
|
||||
format!(
|
||||
"{} – {}",
|
||||
t!("today")._upper_first(),
|
||||
if t!("weekday-lowercase-first").parse().unwrap() {
|
||||
translate!(i18, "today")._upper_first(),
|
||||
if translate!(i18, "formats.weekday_lowercase_first")
|
||||
.parse().unwrap() {
|
||||
today_date._lower_first()
|
||||
} else {
|
||||
today_date
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
use crate::models::category::Category;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn CategoryTrashPage() -> Element {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
use crate::models::category::Category;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use crate::components::pages::category_page::CategoryPage;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn CategoryWaitingForPage() -> Element {
|
||||
|
@ -1,12 +1,12 @@
|
||||
pub(crate) mod category_calendar_page;
|
||||
pub(crate) mod category_done_page;
|
||||
pub(crate) mod category_inbox_page;
|
||||
pub(crate) mod category_calendar_page;
|
||||
pub(crate) mod category_today_page;
|
||||
pub(crate) mod category_waiting_for_page;
|
||||
pub(crate) mod category_long_term_page;
|
||||
pub(crate) mod category_next_steps_page;
|
||||
pub(crate) mod category_page;
|
||||
pub(crate) mod category_someday_maybe_page;
|
||||
pub(crate) mod category_today_page;
|
||||
pub(crate) mod category_done_page;
|
||||
pub(crate) mod category_trash_page;
|
||||
pub(crate) mod category_waiting_for_page;
|
||||
pub(crate) mod not_found_page;
|
||||
pub(crate) mod projects_page;
|
||||
pub(crate) mod category_page;
|
||||
|
@ -1,8 +1,8 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_query::prelude::QueryResult;
|
||||
use crate::models::project::Project;
|
||||
use crate::query::projects::use_projects_query;
|
||||
use crate::query::QueryValue;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_query::prelude::QueryResult;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn ProjectsPage() -> Element {
|
||||
|
@ -7,10 +7,8 @@ use dioxus::prelude::*;
|
||||
use dioxus_query::prelude::use_query_client;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn ProjectForm(
|
||||
project: Option<Project>,
|
||||
on_successful_submit: EventHandler<()>,
|
||||
) -> Element {
|
||||
pub(crate) fn ProjectForm(project: Option<Project>, on_successful_submit: EventHandler<()>)
|
||||
-> Element {
|
||||
let query_client = use_query_client::<QueryValue, QueryErrors, QueryKey>();
|
||||
let project_for_submit = project.clone();
|
||||
|
||||
|
@ -6,7 +6,7 @@ use dioxus::prelude::*;
|
||||
#[component]
|
||||
pub(crate) fn ReoccurrenceIntervalInput(
|
||||
reoccurrence_interval: Signal<Option<ReoccurrenceInterval>>,
|
||||
class_buttons: Option<&'static str>,
|
||||
class_buttons: Option<&'static str>
|
||||
) -> Element {
|
||||
rsx! {
|
||||
button {
|
||||
|
@ -116,7 +116,7 @@ pub(crate) fn SubtasksForm(task: Task) -> Element {
|
||||
onchange: {
|
||||
let subtask = subtask.clone();
|
||||
let task = task.clone();
|
||||
move |event: Event<FormData>| {
|
||||
move |event| {
|
||||
let subtask = subtask.clone();
|
||||
let task = task.clone();
|
||||
async move {
|
||||
|
@ -4,16 +4,18 @@ use crate::components::subtasks_form::SubtasksForm;
|
||||
use crate::models::category::{CalendarTime, Category, Reoccurrence};
|
||||
use crate::models::task::NewTask;
|
||||
use crate::models::task::Task;
|
||||
use crate::query::projects::use_projects_query;
|
||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||
use crate::route::Route;
|
||||
use crate::server::projects::get_projects;
|
||||
use crate::server::tasks::{create_task, delete_task, edit_task};
|
||||
use chrono::Duration;
|
||||
use dioxus::core_macro::{component, rsx};
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_i18n::t;
|
||||
use dioxus_query::prelude::{use_query_client, QueryResult};
|
||||
use dioxus_query::prelude::use_query_client;
|
||||
use dioxus_sdk::i18n::use_i18;
|
||||
use dioxus_sdk::translate;
|
||||
use voca_rs::Voca;
|
||||
|
||||
const REMINDER_OFFSETS: [Option<Duration>; 17] = [
|
||||
None,
|
||||
@ -37,65 +39,51 @@ const REMINDER_OFFSETS: [Option<Duration>; 17] = [
|
||||
|
||||
#[component]
|
||||
pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()>) -> Element {
|
||||
let projects_query = use_projects_query();
|
||||
let projects = use_server_future(get_projects)?.unwrap().unwrap();
|
||||
|
||||
let route = use_route::<Route>();
|
||||
let selected_category = use_signal(|| {
|
||||
if let Some(task) = &task {
|
||||
task.category().clone()
|
||||
} else {
|
||||
match 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,
|
||||
},
|
||||
Route::CategoryLongTermPage => Category::LongTerm,
|
||||
_ => Category::Inbox,
|
||||
}
|
||||
let selected_category = use_signal(|| if let Some(task) = &task {
|
||||
task.category().clone()
|
||||
} else {
|
||||
match 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,
|
||||
},
|
||||
Route::CategoryLongTermPage => Category::LongTerm,
|
||||
_ => Category::Inbox,
|
||||
}
|
||||
});
|
||||
let category_calendar_reoccurrence_interval = use_signal(|| {
|
||||
task.as_ref().and_then(|task| {
|
||||
if let Category::Calendar {
|
||||
reoccurrence: Some(reoccurrence),
|
||||
..
|
||||
} = task.category()
|
||||
{
|
||||
Some(reoccurrence.interval().clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
});
|
||||
let mut category_calendar_has_time = use_signal(|| {
|
||||
task.as_ref().is_some_and(|task| {
|
||||
matches!(*task.category(), Category::Calendar { time: Some(_), .. })
|
||||
})
|
||||
});
|
||||
let mut category_calendar_reminder_offset_index = use_signal(|| {
|
||||
task.as_ref()
|
||||
.and_then(|task| {
|
||||
if let Category::Calendar {
|
||||
time: Some(time), ..
|
||||
} = task.category()
|
||||
{
|
||||
REMINDER_OFFSETS
|
||||
.iter()
|
||||
.position(|&reminder_offset| reminder_offset == time.reminder_offset())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap_or(REMINDER_OFFSETS.len() - 1)
|
||||
});
|
||||
}
|
||||
);
|
||||
let category_calendar_reoccurrence_interval = use_signal(|| task.as_ref().and_then(|task|
|
||||
if let Category::Calendar { reoccurrence: Some(reoccurrence), .. } = task.category() {
|
||||
Some(reoccurrence.interval().clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
));
|
||||
let mut category_calendar_has_time = use_signal(|| task.as_ref().is_some_and(
|
||||
|task| matches!(*task.category(), Category::Calendar { time: Some(_), .. }))
|
||||
);
|
||||
let mut category_calendar_reminder_offset_index = use_signal(|| task.as_ref().and_then(|task|
|
||||
if let Category::Calendar { time: Some(time), .. } = task.category() {
|
||||
REMINDER_OFFSETS.iter().position(|&reminder_offset|
|
||||
reminder_offset == time.reminder_offset()
|
||||
)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
).unwrap_or(REMINDER_OFFSETS.len() - 1));
|
||||
|
||||
let query_client = use_query_client::<QueryValue, QueryErrors, QueryKey>();
|
||||
let task_for_submit = task.clone();
|
||||
|
||||
let i18 = use_i18();
|
||||
|
||||
rsx! {
|
||||
div {
|
||||
class: "p-4 flex flex-col gap-4",
|
||||
@ -189,34 +177,16 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
|
||||
id: "input_project",
|
||||
option {
|
||||
value: 0,
|
||||
{t!("none")}
|
||||
{translate!(i18, "none")}
|
||||
},
|
||||
match projects_query.result().value() {
|
||||
QueryResult::Ok(QueryValue::Projects(projects))
|
||||
| QueryResult::Loading(Some(QueryValue::Projects(projects))) => {
|
||||
let mut projects = projects.clone();
|
||||
projects.sort();
|
||||
rsx! {
|
||||
for project in projects {
|
||||
option {
|
||||
value: project.id().to_string(),
|
||||
initial_selected: task.as_ref().is_some_and(
|
||||
|task| task.project_id() == Some(project.id())
|
||||
),
|
||||
{project.title()}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
QueryResult::Loading(None) => rsx! {
|
||||
// TODO: Add a loading indicator.
|
||||
},
|
||||
QueryResult::Err(errors) => rsx! {
|
||||
div {
|
||||
"Errors occurred: {errors:?}"
|
||||
}
|
||||
},
|
||||
value => panic!("Unexpected query result: {value:?}")
|
||||
for project in projects {
|
||||
option {
|
||||
value: project.id().to_string(),
|
||||
selected: task.as_ref().is_some_and(
|
||||
|task| task.project_id() == Some(project.id())
|
||||
),
|
||||
{project.title()}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -372,12 +342,12 @@ pub(crate) fn TaskForm(task: Option<Task>, on_successful_submit: EventHandler<()
|
||||
} else {
|
||||
format!("{} h", offset.num_hours())
|
||||
}
|
||||
).unwrap_or_else(|| t!("none"))}
|
||||
).unwrap_or_else(|| translate!(i18, "none"))}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => VNode::empty()
|
||||
_ => None
|
||||
}
|
||||
},
|
||||
if let Some(task) = task.as_ref() {
|
||||
|
@ -1,12 +1,12 @@
|
||||
use crate::components::task_list_item::TaskListItem;
|
||||
use crate::models::category::Category;
|
||||
use crate::models::task::{Task, TaskWithSubtasks};
|
||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||
use crate::server::tasks::complete_task;
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_query::prelude::use_query_client;
|
||||
use crate::components::task_list_item::TaskListItem;
|
||||
use crate::query::{QueryErrors, QueryKey, QueryValue};
|
||||
use crate::server::tasks::complete_task;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>) -> Element {
|
||||
@ -14,7 +14,7 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
|
||||
let mut task_being_edited = use_context::<Signal<Option<Task>>>();
|
||||
|
||||
tasks.sort();
|
||||
|
||||
|
||||
rsx! {
|
||||
div {
|
||||
class: format!("flex flex-col {}", class.unwrap_or("")),
|
||||
@ -22,17 +22,17 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
|
||||
div {
|
||||
key: "{task.task().id()}",
|
||||
class: format!(
|
||||
"px-8 pt-4 {} flex flex-row gap-4 select-none {}",
|
||||
"px-8 pt-5 {} flex flex-row gap-4 select-none {}",
|
||||
if task.task().deadline().is_some() || !task.subtasks().is_empty() {
|
||||
"pb-0.5"
|
||||
} else if let Category::Calendar { time, .. } = task.task().category() {
|
||||
if time.is_some() {
|
||||
"pb-0.5"
|
||||
} else {
|
||||
"pb-4"
|
||||
"pb-5"
|
||||
}
|
||||
} else {
|
||||
"pb-4"
|
||||
"pb-5"
|
||||
},
|
||||
if task_being_edited().is_some_and(|t| t.id() == task.task().id()) {
|
||||
"bg-zinc-700"
|
||||
@ -44,7 +44,7 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
|
||||
},
|
||||
i {
|
||||
class: format!(
|
||||
"{} text-3xl align-middle h-9 text-zinc-500",
|
||||
"{} text-3xl text-zinc-500",
|
||||
if *(task.task().category()) == Category::Done {
|
||||
"fa solid fa-square-check"
|
||||
} else {
|
||||
@ -53,13 +53,12 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
|
||||
),
|
||||
onclick: {
|
||||
let task = task.clone();
|
||||
move |event: Event<MouseData>| {
|
||||
move |event| {
|
||||
// To prevent editing the task.
|
||||
event.stop_propagation();
|
||||
let task = task.clone();
|
||||
async move {
|
||||
let completed_task = complete_task(task.task().id()).await
|
||||
.unwrap();
|
||||
let completed_task = complete_task(task.task().id()).await.unwrap();
|
||||
let mut query_keys = vec![
|
||||
QueryKey::Tasks,
|
||||
QueryKey::TasksInCategory(
|
||||
|
@ -5,12 +5,14 @@ use chrono::{Datelike, Local};
|
||||
use dioxus::core_macro::rsx;
|
||||
use dioxus::dioxus_core::Element;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_i18n::prelude::i18n;
|
||||
use dioxus_i18n::t;
|
||||
use dioxus_sdk::i18n::use_i18;
|
||||
use dioxus_sdk::translate;
|
||||
use voca_rs::Voca;
|
||||
|
||||
#[component]
|
||||
pub(crate) fn TaskListItem(task: TaskWithSubtasks) -> Element {
|
||||
let i18 = use_i18();
|
||||
|
||||
rsx! {
|
||||
div {
|
||||
class: "flex flex-col",
|
||||
@ -31,37 +33,37 @@ pub(crate) fn TaskListItem(task: TaskWithSubtasks) -> Element {
|
||||
format!(
|
||||
" {}",
|
||||
if deadline == today_date - chrono::Days::new(1) {
|
||||
t!("yesterday")
|
||||
translate!(i18, "yesterday")
|
||||
} else if deadline == today_date {
|
||||
t!("today")
|
||||
translate!(i18, "today")
|
||||
} else if deadline == today_date + chrono::Days::new(1) {
|
||||
t!("tomorrow")
|
||||
translate!(i18, "tomorrow")
|
||||
} else if deadline > today_date
|
||||
&& deadline <= today_date + chrono::Days::new(7) {
|
||||
let deadline = deadline.format_localized(
|
||||
"%A",
|
||||
LocaleFromLanguageIdentifier::from(
|
||||
&i18n().language()
|
||||
&(i18.selected_language)()
|
||||
).into()
|
||||
).to_string();
|
||||
if t!("weekday-lowercase-first")
|
||||
if translate!(i18, "formats.weekday_lowercase_first")
|
||||
.parse().unwrap() {
|
||||
deadline._lower_first()
|
||||
} else {
|
||||
deadline
|
||||
}
|
||||
} else {
|
||||
let format = t!(
|
||||
let format = translate!(i18,
|
||||
if deadline.year() == today_date.year() {
|
||||
"date-format"
|
||||
"formats.date_format"
|
||||
} else {
|
||||
"date-year-format"
|
||||
"formats.date_year_format"
|
||||
}
|
||||
);
|
||||
deadline.format_localized(
|
||||
format.as_str(),
|
||||
LocaleFromLanguageIdentifier::from(
|
||||
&i18n().language()
|
||||
&(i18.selected_language)()
|
||||
).into()
|
||||
).to_string()
|
||||
}
|
||||
@ -77,8 +79,8 @@ pub(crate) fn TaskListItem(task: TaskWithSubtasks) -> Element {
|
||||
class: "fa-solid fa-clock"
|
||||
},
|
||||
{
|
||||
let format = t!("time-format");
|
||||
format!(" {}", calendar_time.time().format(format.as_str()))
|
||||
let format = translate!(i18, "formats.time_format");
|
||||
format!(" {}",calendar_time.time().format(format.as_str()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,9 @@ pub enum Error {
|
||||
ServerInternal,
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl From<diesel::result::Error> for Error {
|
||||
fn from(_: diesel::result::Error) -> Self {
|
||||
Self::ServerInternal
|
||||
fn from(_: diesel::result::Error) -> Self {
|
||||
Self::ServerInternal
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use serde::Deserialize;
|
||||
use serde_with::serde_derive::Serialize;
|
||||
use std::fmt::Display;
|
||||
use std::str::FromStr;
|
||||
use serde::Deserialize;
|
||||
use serde_with::serde_derive::Serialize;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ErrorVec<T> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
pub(crate) mod error;
|
||||
pub(crate) mod error_vec;
|
||||
pub(crate) mod project_error;
|
||||
pub(crate) mod subtask_error;
|
||||
pub(crate) mod task_error;
|
||||
pub(crate) mod subtask_error;
|
||||
|
@ -13,8 +13,7 @@ pub enum ProjectError {
|
||||
|
||||
impl From<ValidationErrors> for ErrorVec<ProjectError> {
|
||||
fn from(validation_errors: ValidationErrors) -> Self {
|
||||
validation_errors
|
||||
.errors()
|
||||
validation_errors.errors()
|
||||
.iter()
|
||||
.flat_map(|(&field, error_kind)| match field {
|
||||
"title" => match error_kind {
|
||||
@ -35,7 +34,6 @@ impl From<ValidationErrors> for ErrorVec<ProjectError> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl From<diesel::result::Error> for ProjectError {
|
||||
fn from(_: diesel::result::Error) -> Self {
|
||||
Self::Error(Error::ServerInternal)
|
||||
|
@ -14,8 +14,7 @@ pub enum SubtaskError {
|
||||
|
||||
impl From<ValidationErrors> for ErrorVec<SubtaskError> {
|
||||
fn from(validation_errors: ValidationErrors) -> Self {
|
||||
validation_errors
|
||||
.errors()
|
||||
validation_errors.errors()
|
||||
.iter()
|
||||
.flat_map(|(&field, error_kind)| match field {
|
||||
"title" => match error_kind {
|
||||
@ -36,29 +35,28 @@ impl From<ValidationErrors> for ErrorVec<SubtaskError> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl From<diesel::result::Error> for SubtaskError {
|
||||
fn from(diesel_error: diesel::result::Error) -> Self {
|
||||
match diesel_error {
|
||||
diesel::result::Error::DatabaseError(
|
||||
diesel::result::DatabaseErrorKind::ForeignKeyViolation,
|
||||
info,
|
||||
) => match info.constraint_name() {
|
||||
Some("subtasks_task_id_fkey") => Self::TaskNotFound,
|
||||
_ => Self::Error(Error::ServerInternal),
|
||||
},
|
||||
_ => Self::Error(Error::ServerInternal),
|
||||
diesel::result::DatabaseErrorKind::ForeignKeyViolation, info
|
||||
) => {
|
||||
match info.constraint_name() {
|
||||
Some("subtasks_task_id_fkey") => Self::TaskNotFound,
|
||||
_ => Self::Error(Error::ServerInternal)
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
Self::Error(Error::ServerInternal)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ErrorVec<Error>> for ErrorVec<SubtaskError> {
|
||||
fn from(error_vec: ErrorVec<Error>) -> Self {
|
||||
Vec::from(error_vec)
|
||||
.into_iter()
|
||||
.map(SubtaskError::Error)
|
||||
.collect::<Vec<SubtaskError>>()
|
||||
.into()
|
||||
Vec::from(error_vec).into_iter()
|
||||
.map(SubtaskError::Error).collect::<Vec<SubtaskError>>().into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,7 @@ pub enum TaskError {
|
||||
|
||||
impl From<ValidationErrors> for ErrorVec<TaskError> {
|
||||
fn from(validation_errors: ValidationErrors) -> Self {
|
||||
validation_errors
|
||||
.errors()
|
||||
validation_errors.errors()
|
||||
.iter()
|
||||
.flat_map(|(&field, error_kind)| match field {
|
||||
"title" => match error_kind {
|
||||
@ -36,18 +35,20 @@ impl From<ValidationErrors> for ErrorVec<TaskError> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl From<diesel::result::Error> for TaskError {
|
||||
fn from(diesel_error: diesel::result::Error) -> Self {
|
||||
match diesel_error {
|
||||
diesel::result::Error::DatabaseError(
|
||||
diesel::result::DatabaseErrorKind::ForeignKeyViolation,
|
||||
info,
|
||||
) => match info.constraint_name() {
|
||||
Some("tasks_project_id_fkey") => Self::ProjectNotFound,
|
||||
_ => Self::Error(Error::ServerInternal),
|
||||
},
|
||||
_ => Self::Error(Error::ServerInternal),
|
||||
diesel::result::DatabaseErrorKind::ForeignKeyViolation, info
|
||||
) => {
|
||||
match info.constraint_name() {
|
||||
Some("tasks_project_id_fkey") => Self::ProjectNotFound,
|
||||
_ => Self::Error(Error::ServerInternal)
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
Self::Error(Error::ServerInternal)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
none = žádný
|
||||
long-term = dlouhodobé
|
||||
yesterday = včera
|
||||
today = dnes
|
||||
tomorrow = zítra
|
||||
overdue = zpožděné
|
||||
|
||||
## Date and time formats
|
||||
date-format = %-d. %B
|
||||
date-year-format = %-d. %B %Y
|
||||
date-weekday-format = %A %-d. %B
|
||||
date-weekday-year-format = %A %-d. %B %Y
|
||||
weekday-lowercase-first = true
|
||||
time-format = %-H:%M
|
19
src/internationalization/cs_cz.json
Normal file
19
src/internationalization/cs_cz.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "cs-CZ",
|
||||
"texts": {
|
||||
"none": "žádný",
|
||||
"long_term": "dlouhodobé",
|
||||
"yesterday": "včera",
|
||||
"today": "dnes",
|
||||
"tomorrow": "zítra",
|
||||
"overdue": "zpožděné",
|
||||
"formats": {
|
||||
"date_format": "%-d. %B",
|
||||
"date_year_format": "%-d. %B %Y",
|
||||
"date_weekday_format": "%A %-d. %B",
|
||||
"date_weekday_year_format": "%A %-d. %B %Y",
|
||||
"weekday_lowercase_first": "true",
|
||||
"time_format": "%-H:%M"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
none = none
|
||||
long-term = long-term
|
||||
yesterday = yesterday
|
||||
today = today
|
||||
tomorrow = tomorrow
|
||||
overdue = overdue
|
||||
|
||||
## Date and time formats
|
||||
date-format = %B %-d
|
||||
date-year-format = %B %-d, %Y
|
||||
date-weekday-format = %A, %B %-d
|
||||
date-weekday-year-format = %A, %B %-d, %Y
|
||||
weekday-lowercase-first = false
|
||||
time-format = %-I:%M %P
|
19
src/internationalization/en_us.json
Normal file
19
src/internationalization/en_us.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "en-US",
|
||||
"texts": {
|
||||
"none": "none",
|
||||
"long_term": "long-term",
|
||||
"yesterday": "yesterday",
|
||||
"today": "today",
|
||||
"tomorrow": "tomorrow",
|
||||
"overdue": "overdue",
|
||||
"formats": {
|
||||
"date_format": "%B %-d",
|
||||
"date_year_format": "%B %-d, %Y",
|
||||
"date_weekday_format": "%A, %B %-d",
|
||||
"date_weekday_year_format": "%A, %B %-d, %Y",
|
||||
"weekday_lowercase_first": "false",
|
||||
"time_format": "%-I:%M %P"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,19 @@
|
||||
use chrono::Locale;
|
||||
use dioxus::fullstack::once_cell::sync::Lazy;
|
||||
use feruca::Collator;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Mutex;
|
||||
use std::str::FromStr;
|
||||
use chrono::Locale;
|
||||
use dioxus_sdk::i18n::Language;
|
||||
use unic_langid_impl::LanguageIdentifier;
|
||||
|
||||
pub(crate) static COLLATOR: Lazy<Mutex<Collator>> = Lazy::new(|| Mutex::new(Collator::default()));
|
||||
const EN_US: &str = include_str!("en_us.json");
|
||||
const CS_CZ: &str = include_str!("cs_cz.json");
|
||||
|
||||
pub(crate) fn get_languages() -> Vec<Language> {
|
||||
Vec::from([EN_US, CS_CZ]).into_iter().map(|texts| Language::from_str(texts).unwrap()).collect()
|
||||
}
|
||||
|
||||
pub(crate) struct LocaleFromLanguageIdentifier<'a>(&'a LanguageIdentifier);
|
||||
|
||||
impl Deref for LocaleFromLanguageIdentifier<'_> {
|
||||
impl<'a> Deref for LocaleFromLanguageIdentifier<'a> {
|
||||
type Target = LanguageIdentifier;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@ -17,13 +21,9 @@ impl Deref for LocaleFromLanguageIdentifier<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LocaleFromLanguageIdentifier<'_>> for Locale {
|
||||
impl<'a> From<LocaleFromLanguageIdentifier<'a>> for Locale {
|
||||
fn from(language_identifier: LocaleFromLanguageIdentifier) -> Self {
|
||||
language_identifier
|
||||
.to_string()
|
||||
.replace("-", "_")
|
||||
.parse()
|
||||
.unwrap()
|
||||
language_identifier.to_string().replace("-", "_").parse().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
20
src/main.rs
20
src/main.rs
@ -1,26 +1,24 @@
|
||||
mod components;
|
||||
mod errors;
|
||||
mod internationalization;
|
||||
#[cfg(feature = "server")]
|
||||
mod migrations;
|
||||
mod models;
|
||||
mod query;
|
||||
mod route;
|
||||
#[cfg(feature = "server")]
|
||||
mod schema;
|
||||
mod server;
|
||||
mod query;
|
||||
mod utils;
|
||||
mod internationalization;
|
||||
|
||||
use components::app::App;
|
||||
use dioxus::prelude::*;
|
||||
use tracing::info;
|
||||
use dioxus_logger::tracing::{info, Level};
|
||||
|
||||
fn main() {
|
||||
info!("Running migrations.");
|
||||
server_only!(
|
||||
migrations::run_migrations().expect("Failed to run migrations.");
|
||||
dioxus_logger::init(Level::INFO).expect("failed to initialize logger");
|
||||
info!("starting app");
|
||||
|
||||
let cfg = server_only!(
|
||||
dioxus::fullstack::Config::new().addr(std::net::SocketAddr::from(([0, 0, 0, 0], 8000)))
|
||||
);
|
||||
|
||||
info!("Starting app.");
|
||||
launch(App);
|
||||
LaunchBuilder::fullstack().with_cfg(cfg).launch(App);
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
||||
use std::error::Error;
|
||||
|
||||
const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");
|
||||
|
||||
pub(crate) fn run_migrations() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
||||
let mut connection = crate::server::database_connection::establish_database_connection()?;
|
||||
|
||||
connection.run_pending_migrations(MIGRATIONS)?;
|
||||
|
||||
Ok(())
|
||||
}
|
@ -1,28 +1,19 @@
|
||||
#[cfg(feature = "server")]
|
||||
use std::hash::Hash;
|
||||
use crate::schema::tasks;
|
||||
use chrono::{Duration, NaiveDate, NaiveTime};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::deserialize::FromSql;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::pg::{Pg, PgValue};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::serialize::{Output, ToSql};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::sql_types::{Bool, Jsonb};
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::{AsExpression, BoxableExpression, FromSqlRow, PgJsonbExpressionMethods};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "server")]
|
||||
use serde_json::json;
|
||||
use serde_with::DurationSeconds;
|
||||
use std::hash::Hash;
|
||||
#[cfg(feature = "server")]
|
||||
use std::io::Write;
|
||||
|
||||
#[serde_with::serde_as]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(AsExpression, FromSqlRow))]
|
||||
#[cfg_attr(feature = "server", diesel(sql_type = Jsonb))]
|
||||
#[derive(AsExpression, FromSqlRow, Serialize, Deserialize, Clone, Debug)]
|
||||
#[diesel(sql_type = Jsonb)]
|
||||
pub enum Category {
|
||||
Inbox,
|
||||
SomedayMaybe,
|
||||
@ -38,9 +29,8 @@ pub enum Category {
|
||||
Trash,
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl Category {
|
||||
pub fn eq_sql_predicate(&self) -> Box<dyn BoxableExpression<tasks::table, Pg, SqlType = Bool>> {
|
||||
pub fn eq_sql_predicate(&self) -> Box<dyn BoxableExpression<tasks::table, Pg, SqlType=Bool>> {
|
||||
use crate::schema::tasks::dsl::*;
|
||||
|
||||
match self {
|
||||
@ -70,7 +60,6 @@ impl PartialEq for Category {
|
||||
|
||||
impl Eq for Category {}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl ToSql<Jsonb, Pg> for Category {
|
||||
fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Pg>) -> diesel::serialize::Result {
|
||||
let json = serde_json::to_string(self)?;
|
||||
@ -83,7 +72,6 @@ impl ToSql<Jsonb, Pg> for Category {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl FromSql<Jsonb, Pg> for Category {
|
||||
fn from_sql(bytes: PgValue) -> diesel::deserialize::Result<Self> {
|
||||
let bytes = bytes.as_bytes();
|
||||
@ -111,17 +99,13 @@ pub struct Reoccurrence {
|
||||
|
||||
impl Reoccurrence {
|
||||
pub fn new(start_date: NaiveDate, interval: ReoccurrenceInterval, length: u32) -> Self {
|
||||
Self {
|
||||
start_date,
|
||||
interval,
|
||||
length,
|
||||
}
|
||||
Self { start_date, interval, length }
|
||||
}
|
||||
|
||||
|
||||
pub fn start_date(&self) -> NaiveDate {
|
||||
self.start_date
|
||||
}
|
||||
|
||||
|
||||
pub fn interval(&self) -> &ReoccurrenceInterval {
|
||||
&self.interval
|
||||
}
|
||||
@ -141,12 +125,9 @@ pub struct CalendarTime {
|
||||
|
||||
impl CalendarTime {
|
||||
pub fn new(time: NaiveTime, reminder_offset: Option<Duration>) -> Self {
|
||||
Self {
|
||||
time,
|
||||
reminder_offset,
|
||||
}
|
||||
Self { time, reminder_offset }
|
||||
}
|
||||
|
||||
|
||||
pub fn time(&self) -> NaiveTime {
|
||||
self.time
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
pub(crate) mod category;
|
||||
pub(crate) mod project;
|
||||
pub(crate) mod subtask;
|
||||
pub(crate) mod category;
|
||||
pub(crate) mod task;
|
||||
pub(crate) mod subtask;
|
||||
|
@ -1,22 +1,16 @@
|
||||
use crate::internationalization::COLLATOR;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::schema::projects;
|
||||
use std::cmp::Ordering;
|
||||
use chrono::NaiveDateTime;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::schema::projects;
|
||||
use diesel::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
use validator::Validate;
|
||||
|
||||
const TITLE_LENGTH_MIN: u64 = 1;
|
||||
const TITLE_LENGTH_MAX: u64 = 255;
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(
|
||||
feature = "server",
|
||||
diesel(table_name = crate::schema::projects, check_for_backend(diesel::pg::Pg))
|
||||
)]
|
||||
#[derive(Queryable, Selectable, Identifiable, Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[diesel(table_name = crate::schema::projects)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
pub struct Project {
|
||||
id: i32,
|
||||
title: String,
|
||||
@ -24,7 +18,6 @@ pub struct Project {
|
||||
updated_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl Project {
|
||||
pub fn id(&self) -> i32 {
|
||||
self.id
|
||||
@ -33,11 +26,11 @@ impl Project {
|
||||
pub fn title(&self) -> &str {
|
||||
&self.title
|
||||
}
|
||||
|
||||
|
||||
pub fn created_at(&self) -> NaiveDateTime {
|
||||
self.created_at
|
||||
}
|
||||
|
||||
|
||||
pub fn updated_at(&self) -> NaiveDateTime {
|
||||
self.updated_at
|
||||
}
|
||||
@ -53,22 +46,14 @@ impl PartialOrd<Self> for Project {
|
||||
|
||||
impl Ord for Project {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
COLLATOR
|
||||
.lock()
|
||||
.unwrap()
|
||||
.collate(self.title(), other.title())
|
||||
self.title().cmp(other.title())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Insertable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = projects))]
|
||||
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[diesel(table_name = projects)]
|
||||
pub struct NewProject {
|
||||
#[validate(length(
|
||||
min = "TITLE_LENGTH_MIN",
|
||||
max = "TITLE_LENGTH_MAX",
|
||||
code = "title_length"
|
||||
))]
|
||||
#[validate(length(min = "TITLE_LENGTH_MIN", max = "TITLE_LENGTH_MAX", code = "title_length"))]
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
|
@ -1,30 +1,19 @@
|
||||
#[cfg(feature = "server")]
|
||||
use std::cmp::Ordering;
|
||||
use crate::models::task::Task;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::schema::subtasks;
|
||||
use chrono::NaiveDateTime;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
use validator::Validate;
|
||||
|
||||
const TITLE_LENGTH_MIN: u64 = 1;
|
||||
const TITLE_LENGTH_MAX: u64 = 255;
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "server",
|
||||
derive(Queryable, Selectable, Identifiable, Associations)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "server",
|
||||
diesel(
|
||||
table_name = subtasks,
|
||||
belongs_to(Task, foreign_key = task_id),
|
||||
check_for_backend(diesel::pg::Pg)
|
||||
)
|
||||
)]
|
||||
#[derive(Queryable, Selectable, Identifiable, Associations, Serialize, Deserialize, PartialEq,
|
||||
Clone, Debug)]
|
||||
#[diesel(belongs_to(Task, foreign_key = task_id))]
|
||||
#[diesel(table_name = subtasks)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
pub struct Subtask {
|
||||
id: i32,
|
||||
task_id: i32,
|
||||
@ -70,33 +59,23 @@ impl PartialOrd<Self> for Subtask {
|
||||
|
||||
impl Ord for Subtask {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.is_completed()
|
||||
.cmp(&other.is_completed())
|
||||
self.is_completed().cmp(&other.is_completed())
|
||||
.then(self.created_at().cmp(&other.created_at()))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Insertable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = subtasks))]
|
||||
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[diesel(table_name = subtasks)]
|
||||
pub struct NewSubtask {
|
||||
pub task_id: i32,
|
||||
#[validate(length(
|
||||
min = "TITLE_LENGTH_MIN",
|
||||
max = "TITLE_LENGTH_MAX",
|
||||
code = "title_length"
|
||||
))]
|
||||
#[validate(length(min = "TITLE_LENGTH_MIN", max = "TITLE_LENGTH_MAX", code = "title_length"))]
|
||||
pub title: String,
|
||||
pub is_completed: bool,
|
||||
}
|
||||
|
||||
impl NewSubtask {
|
||||
pub fn new(task_id: i32, title: String, is_completed: bool) -> Self {
|
||||
Self {
|
||||
task_id,
|
||||
title,
|
||||
is_completed,
|
||||
}
|
||||
Self { task_id, title, is_completed }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
use crate::models::category::Category;
|
||||
use crate::models::subtask::Subtask;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::schema::tasks;
|
||||
use crate::utils::reverse_ord_option::ReverseOrdOption;
|
||||
use chrono::NaiveDateTime;
|
||||
#[cfg(feature = "server")]
|
||||
use diesel::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
@ -13,9 +11,9 @@ use validator::Validate;
|
||||
const TITLE_LENGTH_MIN: u64 = 1;
|
||||
const TITLE_LENGTH_MAX: u64 = 255;
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = tasks, check_for_backend(diesel::pg::Pg)))]
|
||||
#[derive(Queryable, Selectable, Identifiable, Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[diesel(table_name = tasks)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
pub struct Task {
|
||||
id: i32,
|
||||
title: String,
|
||||
@ -69,39 +67,23 @@ impl Ord for Task {
|
||||
match (&self.category, &other.category) {
|
||||
(Category::Inbox, Category::Inbox) => self.created_at.cmp(&other.created_at),
|
||||
(
|
||||
Category::Calendar {
|
||||
date: self_date,
|
||||
time: self_time,
|
||||
..
|
||||
},
|
||||
Category::Calendar {
|
||||
date: other_date,
|
||||
time: other_time,
|
||||
..
|
||||
},
|
||||
) => self_date
|
||||
.cmp(other_date)
|
||||
.then(
|
||||
ReverseOrdOption::from(
|
||||
&self_time.as_ref().map(|calendar_time| calendar_time.time()),
|
||||
)
|
||||
.cmp(&ReverseOrdOption::from(
|
||||
&other_time
|
||||
.as_ref()
|
||||
.map(|calendar_time| calendar_time.time()),
|
||||
)),
|
||||
)
|
||||
.then(
|
||||
ReverseOrdOption::from(&self.deadline())
|
||||
.cmp(&ReverseOrdOption::from(&other.deadline())),
|
||||
)
|
||||
.then(self.created_at.cmp(&other.created_at)),
|
||||
(Category::Done, Category::Done) | (Category::Trash, Category::Trash) => {
|
||||
self.updated_at.cmp(&other.updated_at).reverse()
|
||||
}
|
||||
(_, _) => ReverseOrdOption::from(&self.deadline())
|
||||
.cmp(&ReverseOrdOption::from(&other.deadline()))
|
||||
Category::Calendar { date: self_date, time: self_time, .. },
|
||||
Category::Calendar { date: other_date, time: other_time, .. }
|
||||
) => self_date.cmp(other_date)
|
||||
.then(ReverseOrdOption::from(
|
||||
&self_time.as_ref().map(|calendar_time| calendar_time.time())
|
||||
).cmp(&ReverseOrdOption::from(
|
||||
&other_time.as_ref().map(|calendar_time| calendar_time.time())
|
||||
)))
|
||||
.then(ReverseOrdOption::from(&self.deadline()).cmp(
|
||||
&ReverseOrdOption::from(&other.deadline())
|
||||
))
|
||||
.then(self.created_at.cmp(&other.created_at)),
|
||||
(Category::Done, Category::Done) | (Category::Trash, Category::Trash)
|
||||
=> self.updated_at.cmp(&other.updated_at).reverse(),
|
||||
(_, _) => ReverseOrdOption::from(&self.deadline()).cmp(
|
||||
&ReverseOrdOption::from(&other.deadline())
|
||||
).then(self.created_at.cmp(&other.created_at)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -140,15 +122,10 @@ impl Ord for TaskWithSubtasks {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[cfg_attr(feature = "server", derive(Insertable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = tasks))]
|
||||
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[diesel(table_name = tasks)]
|
||||
pub struct NewTask {
|
||||
#[validate(length(
|
||||
min = "TITLE_LENGTH_MIN",
|
||||
max = "TITLE_LENGTH_MAX",
|
||||
code = "title_length"
|
||||
))]
|
||||
#[validate(length(min = "TITLE_LENGTH_MIN", max = "TITLE_LENGTH_MAX", code = "title_length"))]
|
||||
pub title: String,
|
||||
pub deadline: Option<chrono::NaiveDate>,
|
||||
pub category: Category,
|
||||
@ -162,12 +139,7 @@ impl NewTask {
|
||||
category: Category,
|
||||
project_id: Option<i32>,
|
||||
) -> Self {
|
||||
Self {
|
||||
title,
|
||||
deadline,
|
||||
category,
|
||||
project_id,
|
||||
}
|
||||
Self { title, deadline, category, project_id }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,10 @@ use crate::models::project::Project;
|
||||
use crate::models::subtask::Subtask;
|
||||
use crate::models::task::{Task, TaskWithSubtasks};
|
||||
|
||||
pub(crate) mod tasks;
|
||||
pub(crate) mod projects;
|
||||
pub(crate) mod subtasks;
|
||||
pub(crate) mod tasks;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub(crate) enum QueryValue {
|
||||
Projects(Vec<Project>),
|
||||
@ -18,7 +17,6 @@ pub(crate) enum QueryValue {
|
||||
Subtasks(Vec<Subtask>),
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum QueryErrors {
|
||||
Error(ErrorVec<Error>),
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user