build: migrate to Dioxus 0.6 #61
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "build/dioxus-0.6-migration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary by CodeRabbit
New Features
desktop
andmobile
in the application.Bug Fixes
Documentation
Chores
/dist/
directory during builds.index.html
in development configuration.Walkthrough
This pull request includes a series of updates across multiple files, primarily focusing on dependency updates, internationalization enhancements, and modifications to configuration files. Key changes involve updating the
.idea/dataSources.local.xml
for versioning, modifyingCargo.toml
to include new dependencies and features, and altering Dockerfiles for updated base images and health check commands. Additionally, several components have been refined to improve localization support, including the introduction of new localization files and the removal of outdated configurations.Changes
.idea/dataSources.local.xml
created-in
attribute fromRR-242.21829.114
toRR-243.21565.245
.Cargo.toml
dioxus
to0.6.0
,dioxus-query
to0.6.0
, addeddioxus-i18n
at0.3.0
,async-std
at1.12.0
,diesel_migrations
at2.2.0
,feruca
at0.10.0
. Updatedvalidator
andunic-langid-impl
with new features. Expanded features section and added new profiles.Dioxus.toml
style
array in[web.resource]
.assets/styles/fonts.css
src
paths for@font-face
declarations to reflect new directory structure.docker-compose-dev.yml
index.html
in theapp
service.docker/dev/app/Dockerfile
rust:1.83-bookworm
, addedwasm32-unknown-unknown
target, updatedHEALTHCHECK
command to include an additional header.docker/dev/app/supervisord.conf
dx
program to specify address and port.docker/prod/app/Dockerfile
rust:1.83-bookworm
, modifiedCOPY
command for build output, updated health check command, added environment variablesIP
andPORT
, changed startup command.index.html
src/components/app.rs
src/components/navigation.rs
VNode::empty()
instead ofNone
whenexpanded
state is false.src/components/pages/category_calendar_page.rs
i18n
andt
fromdioxus_i18n
, modified date format retrieval.src/components/pages/category_today_page.rs
translate!
macro witht!
fromdioxus_i18n
, updated date formatting logic.src/components/subtasks_form.rs
onchange
event handler to specify event type asEvent<FormData>
.src/components/task_form.rs
use_i18
witht
for internationalization, refined category handling logic.src/components/task_list.rs
Event<MouseData>
.src/components/task_list_item.rs
use_i18
withi18n
for localization, updated translation calls.src/internationalization/cs_cz.ftl
src/internationalization/cs_cz.json
src/internationalization/en_us.ftl
src/internationalization/en_us.json
src/internationalization/mod.rs
get_languages
function.src/main.rs
dioxus_logger
crate usage, simplified logging setup, and streamlined application launch process.src/server/internationalization.rs
get_language_identifier
function..dockerignore
/dist/
directory, allowing its contents to be included in the Docker image.Possibly related PRs
TaskForm
component, which includes the addition of a delete functionality for tasks. This is related to the main PR as both involve updates to configuration files that may affect how tasks and their associated data are managed.SubtasksForm
component for managing subtasks, which is directly related to the main PR's focus on task management and configuration updates..idea/dataSources.local.xml
file are utilized in a production environment.Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
❤️ Share
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
I pushed a fix in commit <commit_id>, please review it.
Generate unit testing code for this file.
Open a follow-up GitHub issue for this discussion.
@coderabbitai
in a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.
@coderabbitai modularize this function.
@coderabbitai
in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
@coderabbitai read src/utils.ts and generate unit testing code.
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pause
to pause the reviews on a PR.@coderabbitai resume
to resume the paused reviews.@coderabbitai review
to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full review
to do a full review from scratch and review all the files again.@coderabbitai summary
to regenerate the summary of the PR.@coderabbitai generate docstrings
to generate docstrings for this PR. (Beta)@coderabbitai resolve
resolve all the CodeRabbit review comments.@coderabbitai configuration
to show the current CodeRabbit configuration for the repository.@coderabbitai help
to get help.Other keywords and placeholders
@coderabbitai ignore
anywhere in the PR description to prevent this PR from being reviewed.@coderabbitai summary
to generate the high-level summary at a specific location in the PR description.@coderabbitai
anywhere in the PR title to generate the title automatically.CodeRabbit Configuration File (
.coderabbit.yaml
).coderabbit.yaml
file to the root of your repository.# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
Actionable comments posted: 6
🧹 Outside diff range comments (2)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between
7f4990ef82
and8d3f858f0b
.⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (24)
.idea/dataSources.local.xml
(1 hunks)Cargo.toml
(1 hunks)Dioxus.toml
(1 hunks)assets/styles/fonts.css
(1 hunks)docker-compose-dev.yml
(0 hunks)docker/dev/app/Dockerfile
(2 hunks)docker/dev/app/supervisord.conf
(1 hunks)docker/prod/app/Dockerfile
(2 hunks)index.html
(0 hunks)src/components/app.rs
(1 hunks)src/components/navigation.rs
(1 hunks)src/components/pages/category_calendar_page.rs
(5 hunks)src/components/pages/category_today_page.rs
(6 hunks)src/components/subtasks_form.rs
(1 hunks)src/components/task_form.rs
(3 hunks)src/components/task_list.rs
(4 hunks)src/components/task_list_item.rs
(3 hunks)src/internationalization/cs_cz.ftl
(1 hunks)src/internationalization/cs_cz.json
(0 hunks)src/internationalization/en_us.ftl
(1 hunks)src/internationalization/en_us.json
(0 hunks)src/internationalization/mod.rs
(0 hunks)src/main.rs
(1 hunks)src/server/internationalization.rs
(1 hunks)💤 Files with no reviewable changes (5)
🔇 Additional comments (31)
src/internationalization/cs_cz.ftl (1)
9-12
: LGTM! Date formats follow Czech conventions correctly.The date formats properly use:
src/internationalization/en_us.ftl (2)
9-12
: LGTM! Date formats follow US conventions correctly.The date formats properly use:
14-14
: Verify AM/PM format across platforms.The
%P
format (lowercase am/pm) is used, but some systems might handle it differently. Consider testing on various platforms or using%p
(uppercase AM/PM) for consistency.docker/dev/app/supervisord.conf (1)
17-17
: LGTM! Explicit host and port binding is good practice.The updated command explicitly binds to all interfaces (0.0.0.0) and port 8000, which is necessary for proper container accessibility.
Let's verify the port configuration is consistent across Docker files:
✅ Verification successful
Port configuration is consistent across Docker files
The port 8000 is consistently configured in both files:
supervisord.conf
: Used in the dx serve command with--port 8000
Dockerfile
: Referenced in the health check URLhttp://localhost:8000
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 78
Script:
Length of output: 505
assets/styles/fonts.css (1)
7-7
: Verify font assets location and accessibility.The font paths have been updated to include the
/assets/
prefix. This change might be related to Dioxus 0.6's asset handling.Let's verify the font files exist and are properly configured:
Also applies to: 15-15
✅ Verification successful
Font assets are present at the new location
The verification confirms that the font files (
inter_variable.woff2
andinter_variable_italic.woff2
) exist in the new/assets/fonts/
directory, matching the updated path in the CSS. No references to the old path were found in CSS or HTML files.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 211
docker/dev/app/Dockerfile (2)
Line range hint
1-5
: LGTM: Appropriate toolchain setup for Dioxus 0.6The Rust version and required tools (wasm32 target, dioxus-cli) are correctly configured for Dioxus 0.6 migration.
🧰 Tools
🪛 Hadolint (2.12.0)
[info] 3-3: Delete the apt-get lists after installing something
(DL3009)
[info] 3-3: Avoid additional packages by specifying
--no-install-recommends
(DL3015)
19-19
: Verify the Accept header requirementThe addition of the
Accept: text/html
header suggests a change in the server's response handling.✅ Verification successful
Health check header appears to be a standard configuration
The
Accept: text/html
header in the health check appears to be a standard configuration that exists in both development and production Dockerfiles. Since we couldn't find any specific route handlers or server configurations that explicitly check for this header, and the header is consistently used across environments, this seems to be a reasonable default health check configuration.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 24
Script:
Length of output: 581
Script:
Length of output: 259
Dioxus.toml (1)
33-33
: Verify the removal of CSS stylesThe removal of all CSS style entries suggests a change in the styling approach. This change needs verification to ensure styles are handled appropriately in the new Dioxus 0.6 implementation.
✅ Verification successful
Let me check the content of the style-related files to understand how styles are being handled now.
CSS styles are properly managed, removal from Dioxus.toml is correct
The removal of style entries from Dioxus.toml is valid as the styles are now being handled directly in the application code:
assets/styles/
andsrc/styles/
src/styles/tailwind.css
src/components/app.rs
using theasset!
macro🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 355
Script:
Length of output: 1775
docker/prod/app/Dockerfile (3)
Line range hint
1-31
: Security considerations look good✅ Multi-stage build reduces attack surface
✅ Specific package versions
✅ Non-root user
✅ Minimal runtime dependencies
🧰 Tools
🪛 Hadolint (2.12.0)
[info] 16-16: Delete the apt-get lists after installing something
(DL3009)
[info] 16-16: Avoid additional packages by specifying
--no-install-recommends
(DL3015)
29-31
: Verify server configuration changesThe addition of IP and PORT environment variables and the change to
./server
entry point suggest significant changes in the server implementation.✅ Verification successful
Let me try a different search strategy to verify the server configuration changes.
Let me check the main server configuration in the main.rs and server module files.
Based on the codebase analysis, I can now provide the final response:
Environment variables appear to be safe to add
The codebase appears to be a Dioxus-based application (a Rust web framework) that doesn't explicitly handle server binding configuration in the main application code. The IP and PORT environment variables in the Dockerfile are likely handled by the framework's default server configuration or build artifacts, making these additions safe and non-breaking.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 228
Script:
Length of output: 2014
Script:
Length of output: 727
18-18
: Verify the new build output pathThe path
/srv/app/target/dx/todo-baggins/release/web
reflects Dioxus 0.6's new build output structure..idea/dataSources.local.xml (1)
3-3
: LGTM - IDE configuration updateThis is an auto-generated IDE configuration change, not directly related to the Dioxus migration.
Cargo.toml (3)
37-45
: LGTM: Profile configurationsThe profile configurations for different platforms look good and follow Rust conventions.
14-14
: Verify new dependencies are necessaryNew dependencies added:
Also applies to: 17-17, 19-19
✅ Verification successful
Let me verify the usage of
async-std
since it wasn't found in the initial search.Dependencies are appropriately used in the codebase
async-std
is used for task sleeping in bottom panel componentdiesel_migrations
is actively used in migrations module for embedding and handling database migrationsferuca
is utilized in internationalization module for collation🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 673
Script:
Length of output: 594
10-13
: Verify Dioxus 0.6.0 migration compatibilityThe update to Dioxus 0.6.0 and related dependencies looks good. However, let's verify there are no breaking changes that need attention.
✅ Verification successful
Let's verify the actual usage of Dioxus APIs to check for potential breaking changes in 0.6.0.
Let's check the component syntax and imports to ensure they match Dioxus 0.6.0's patterns.
Migration to Dioxus 0.6.0 appears compatible with current codebase
The codebase is already following Dioxus 0.6.0 patterns:
use_signal
hook syntax correctly#[component]
attribute syntaxdioxus::prelude
and related modules🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1280
Script:
Length of output: 2376
Script:
Length of output: 19997
src/components/app.rs (3)
11-15
: LGTM: Asset managementGood use of const assets for styles and favicon. The separation of styles into distinct files improves maintainability.
37-41
: LGTM: Asset linkingProper linking of all required stylesheets in the document head.
21-34
: Verify internationalization setupThe i18n setup looks good with proper language identifier handling. Let's verify the FTL files exist and are properly formatted.
✅ Verification successful
Let me check the actual content of those hardcoded strings to determine if they should be localized.
Based on the verification results, I can now provide a final response:
FTL files are properly formatted and complete
The internationalization setup is correctly implemented with:
cs_cz.ftl
anden_us.ftl
files exist and contain proper translationsWhile there are many hardcoded strings in the components, they are primarily CSS classes, HTML attributes, and Font Awesome icon classes, which should not be localized.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1363
Script:
Length of output: 45444
src/components/navigation.rs (1)
78-78
: LGTM: Correct migration fromNone
toVNode::empty()
The change aligns with Dioxus 0.6's preferred way of handling empty nodes in the virtual DOM.
Let's check if there are any remaining
None
returns in RSX blocks that should be migrated:✅ Verification successful
LGTM: All
None
usages in RSX blocks have been properly migratedBased on the search results, all remaining
None
usages in the codebase are legitimate RustOption
values (in pattern matching, struct fields, etc.) and not related to RSX/virtual DOM nodes. The only instances ofVNode::empty()
found are correct migrations, and there are no remaining cases whereNone
is being used as an empty node in RSX blocks.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 30
Script:
Length of output: 8172
Script:
Length of output: 548
Script:
Length of output: 17265
src/components/pages/category_calendar_page.rs (2)
11-12
: LGTM: Updated i18n imports for Dioxus 0.6Correct migration to the new
dioxus-i18n
prelude imports.43-51
: Verify i18n key migrationsThe migration from dot notation (
formats.date-weekday-format
) to kebab-case (date-weekday-format
) looks correct, but we should verify all i18n keys have been updated consistently.✅ Verification successful
Let me search specifically for translation keys in the codebase to verify the migration.
Let me check the translation files to verify the format of all keys.
Let me search specifically for translation files and their content to verify the i18n key formats.
Migration to kebab-case format is consistent
The translation files show that all date and time format keys are consistently using kebab-case format (
date-weekday-format
,date-weekday-year-format
, etc.) with no instances of dot notation. The migration appears to be complete and correct.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1741
Script:
Length of output: 7886
Script:
Length of output: 51972
Script:
Length of output: 650
src/components/task_list.rs (1)
57-57
: LGTM: Added type annotation for Event handlerThe explicit type annotation
Event<MouseData>
aligns with Dioxus 0.6's type system requirements.src/components/task_list_item.rs (3)
1-1
: LGTM: Proper migration of i18n importsThe imports have been correctly updated to use the new
dioxus_i18n
crate instead of the deprecateddioxus_sdk
i18n module.Also applies to: 9-9
34-34
: LGTM: Translation calls properly migratedAll translation calls have been correctly migrated from
translate!
tot!
macro, maintaining consistent behavior while adopting the new Dioxus 0.6 i18n system.Also applies to: 36-36, 38-38, 47-47, 54-58, 80-81
44-45
: LGTM: Locale handling updatedThe locale handling has been properly updated to use
i18n().language()
instead of the previous i18n implementation.Also applies to: 64-65
src/components/pages/category_today_page.rs (2)
10-11
: LGTM: Clean i18n import structureThe imports have been properly organized, separating the
t
macro andi18n
function imports fromdioxus_i18n
.47-47
: LGTM: Consistent translation migrationAll translation calls have been properly migrated to use the new
t!
macro while maintaining the existing date formatting and case handling logic.Also applies to: 110-110, 129-139
src/components/subtasks_form.rs (1)
119-119
: LGTM: Proper event type annotation for Dioxus 0.6The event handler has been correctly updated with explicit
Event<FormData>
type annotation, which is required for type safety in Dioxus 0.6.src/components/task_form.rs (3)
14-14
: LGTM: Import change aligns with Dioxus migrationThe addition of
dioxus_i18n::t
import is consistent with the migration to Dioxus 0.6 and the new internationalization approach.364-364
: LGTM: Improved empty node handlingThe change to
VNode::empty()
follows Dioxus 0.6 best practices for representing no content, providing better type safety than returningNone
.176-176
: Verify translation key existsThe migration to
t!
macro looks good, but let's verify the "none" translation key exists in all locale files.Also applies to: 359-359
✅ Verification successful
Translation key "none" is properly defined in all locale files
The "none" translation key is correctly defined in both locale files:
none = žádný
none = none
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 263
Script:
Length of output: 232
🧹 Nitpick (assertive)
Review cross-platform feature flags
Good addition of platform-specific features. Consider documenting the build requirements for each platform in the README.
🧹 Nitpick (assertive)
Consider extracting padding logic to a function
The padding class determination logic is becoming complex. Consider extracting it to a separate function for better maintainability.
📝 Committable suggestion
🛠️ Refactor suggestion
Consider using the
?
operator for error propagationInstead of using
unwrap()
, consider proper error handling with the?
operator and propagating the error up.📝 Committable suggestion
@ -0,0 +11,4 @@
date-weekday-format = %A %-d. %B
date-weekday-year-format = %A %-d. %B %Y
weekday-lowercase-first = true
time-format = %-H:%M
🧹 Nitpick (assertive)
Consider adding seconds format for consistency.
While the current time format is correct for basic display, consider adding a separate key for cases where seconds precision is needed (e.g., logs, timestamps).
📝 Committable suggestion
@ -13,3 +13,3 @@
use dioxus::prelude::*;
use dioxus_logger::tracing::{info, Level};
use tracing::info;
🧹 Nitpick (assertive)
Consider enhancing error handling and logging setup.
While the changes align with Dioxus 0.6, consider these improvements:
Also applies to: 23-23
@ -26,3 +23,1 @@
dioxus::fullstack::Config::new().addr(std::net::SocketAddr::from(([0, 0, 0, 0], 8000)))
);
LaunchBuilder::fullstack().with_cfg(cfg).launch(App);
launch(App);
🧹 Nitpick (assertive)
Add error context to migration failure message.
The current error message could be more descriptive to help with troubleshooting.
📝 Committable suggestion
Waiting for Super-linter to support rustc >1.79.0.
Actionable comments posted: 1
♻️ Duplicate comments (2)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between
e1ee31c0c4
and8c9eae39a6
.📒 Files selected for processing (2)
src/components/task_list.rs
(4 hunks)src/components/task_list_item.rs
(3 hunks)🔇 Additional comments (4)
src/components/task_list.rs (1)
57-57
: LGTM! Type annotation improves clarityThe explicit type annotation for the MouseData event improves type safety and readability.
src/components/task_list_item.rs (3)
1-1
: LGTM! Proper i18n importsThe imports correctly support the migration to Dioxus 0.6's internationalization system.
Also applies to: 9-9
80-81
: LGTM! Proper time format handlingThe time format is correctly retrieved from i18n and properly applied to the calendar time.
34-34
: Verify translation keys and formatsThe migration to Dioxus 0.6's i18n system looks good. Please ensure all translation keys exist in the localization files and the date/time formats are appropriate for all supported locales.
Also applies to: 36-36, 38-38, 47-47, 54-58
✅ Verification successful
All translation keys are present and properly formatted
The verification shows that:
yesterday
,today
,tomorrow
,weekday-lowercase-first
,date-format
,date-year-format
,time-format
) exist in both English (en_us) and Czech (cs_cz) localization files%-I:%M %P
)%-H:%M
)weekday-lowercase-first
flag is correctly set (false
for English,true
for Czech)🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 195
Script:
Length of output: 844
@ -4,6 +4,7 @@ use dioxus::core_macro::rsx;
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
use dioxus_query::prelude::use_query_client;
use tracing::info;
🧹 Nitpick (assertive)
Remove unused import
The
info
import fromtracing
is not used in this file.