-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Desktop Application for Vue Simulator [Tauri] #374
Conversation
WalkthroughThe changes encompass updates to several configuration files and components within the project. Key modifications include the introduction of Tauri support, adjustments to build commands, and enhancements to file handling methods. The Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant Tauri
participant Server
User->>App: Initiate file download
App->>App: Determine environment (Tauri or Web)
alt Tauri
App->>Tauri: Call downloadImageDesktop()
Tauri->>Tauri: Fetch image data
Tauri->>User: Save image to downloads directory
else Web
App->>App: Call downloadFileWeb()
App->>User: Trigger browser download
end
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
src/simulator/src/node.js
Outdated
@@ -255,7 +255,7 @@ | |||
* function for saving a node | |||
*/ | |||
saveObject() { | |||
if (this.type == NODE_INTERMEDIATE2) { | |||
if (this.type == NODE_INTERMEDIATE) { |
Check failure
Code scanning / ESLint
disallow the use of undeclared variables unless mentioned in `/*global */` comments Error
✅ Deploy Preview for circuitverse ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (18)
package-lock.json
is excluded by!**/package-lock.json
src-tauri/Cargo.lock
is excluded by!**/*.lock
src-tauri/icons/128x128.png
is excluded by!**/*.png
src-tauri/icons/[email protected]
is excluded by!**/*.png
src-tauri/icons/32x32.png
is excluded by!**/*.png
src-tauri/icons/Square107x107Logo.png
is excluded by!**/*.png
src-tauri/icons/Square142x142Logo.png
is excluded by!**/*.png
src-tauri/icons/Square150x150Logo.png
is excluded by!**/*.png
src-tauri/icons/Square284x284Logo.png
is excluded by!**/*.png
src-tauri/icons/Square30x30Logo.png
is excluded by!**/*.png
src-tauri/icons/Square310x310Logo.png
is excluded by!**/*.png
src-tauri/icons/Square44x44Logo.png
is excluded by!**/*.png
src-tauri/icons/Square71x71Logo.png
is excluded by!**/*.png
src-tauri/icons/Square89x89Logo.png
is excluded by!**/*.png
src-tauri/icons/StoreLogo.png
is excluded by!**/*.png
src-tauri/icons/cvlogo.png
is excluded by!**/*.png
src-tauri/icons/icon.ico
is excluded by!**/*.ico
src-tauri/icons/icon.png
is excluded by!**/*.png
Files selected for processing (16)
- .gitignore (1 hunks)
- netlify.toml (1 hunks)
- package.json (3 hunks)
- src-tauri/.gitignore (1 hunks)
- src-tauri/Cargo.toml (1 hunks)
- src-tauri/build.rs (1 hunks)
- src-tauri/src/main.rs (1 hunks)
- src-tauri/tauri.conf.json (1 hunks)
- src/components/DialogBox/ExportProject.vue (2 hunks)
- src/components/DialogBox/ExportVerilog.vue (2 hunks)
- src/components/DialogBox/OpenOffline.vue (1 hunks)
- src/simulator/src/data/project.ts (1 hunks)
- src/simulator/src/node.js (1 hunks)
- src/simulator/src/plotArea.js (2 hunks)
- src/simulator/src/utils.ts (4 hunks)
- vite.config.ts (2 hunks)
Files skipped from review due to trivial changes (4)
- .gitignore
- src-tauri/.gitignore
- src-tauri/build.rs
- src/components/DialogBox/ExportVerilog.vue
Additional context used
GitHub Check: ESLint
src/simulator/src/node.js
[failure] 258-258: disallow the use of undeclared variables unless mentioned in
/*global */
comments
'NODE_INTERMEDIATE' is not defined.
Additional comments not posted (32)
netlify.toml (2)
2-2
: LGTM!The change to use a direct reference to the
public
directory simplifies the path and reduces potential errors.
7-7
: LGTM! But verify the path usage in the codebase.The change to the destination path for
index.html
suggests a restructuring of the output directory layout. Ensure that this change is reflected in other parts of the codebase that reference this path.Run the following script to verify the path usage:
Verification successful
Path change is correctly implemented.
The change to the destination path for
index.html
is properly handled within thenetlify.toml
file. The command ensures thatindex.html
is moved to the correct location for deployment, and there are no other references to this path that need adjustment.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the new path for `index.html`. # Test: Search for the path usage. Expect: Only occurrences of the new path. rg --type toml -A 5 $'./dist/output/index.html'Length of output: 316
src-tauri/src/main.rs (3)
1-1
: LGTM!The comment is informative and should not be removed.
2-2
: LGTM!The
cfg_attr
attribute is correctly used to prevent an additional console window on Windows in release mode.
4-8
: LGTM!The main function is correctly implemented to initialize and run the Tauri application.
src-tauri/Cargo.toml (5)
1-10
: LGTM!The
[package]
section is correctly configured with metadata about the package.
12-12
: LGTM!The comment is informative and should not be removed.
14-16
: LGTM!The
[build-dependencies]
section is correctly configured with a dependency ontauri-build
.
17-20
: LGTM!The
[dependencies]
section is correctly configured with dependencies onserde_json
,serde
, andtauri
.
22-26
: LGTM!The
[features]
section is correctly configured with a custom protocol feature.src-tauri/tauri.conf.json (5)
3-7
: LGTM!The build section is correctly configured for the Tauri application.
8-11
: LGTM!The package section is correctly configured.
12-22
: LGTM! But consider narrowing the scope for file system access.The allowlist section is correctly configured, but the scope for file system access is very broad. Consider narrowing it down to specific directories if possible.
23-54
: LGTM!The bundle section is correctly configured for the Tauri application.
62-70
: LGTM!The windows section is correctly configured for the Tauri application.
vite.config.ts (3)
32-32
: LGTM!Using an environment variable for the base URL enhances flexibility for different deployment environments.
34-45
: LGTM!The build section is correctly configured for the Vite build tool.
57-60
: LGTM!The server section is correctly configured for the Vite build tool.
package.json (3)
6-9
: LGTM!The scripts section is correctly configured for the project.
18-18
: LGTM!The dependencies section is correctly configured for the project.
48-48
: LGTM!The devDependencies section is correctly configured for the project.
src/components/DialogBox/ExportProject.vue (2)
44-44
: LGTM!The import statement change from
download
todownloadFile
is approved.
76-76
: LGTM!The function call change from
download
todownloadFile
is approved.src/components/DialogBox/OpenOffline.vue (1)
70-70
: LGTM!The change from
reactive
toref
for theprojectList
variable is approved.src/simulator/src/data/project.ts (1)
96-96
: Verify the data format before storing.The
saveOffline
function no longer serializes thedata
object before saving it to local storage. Ensure thatdata
is already in a suitable format for storage.Run the following script to verify the data format:
src/simulator/src/utils.ts (5)
13-14
: LGTM!The new imports from
@tauri-apps/api/fs
and@tauri-apps/api/path
are necessary for the Tauri-specific functions.
121-127
: LGTM!The
downloadFile
function correctly determines the environment and calls the appropriate download function.
Line range hint
130-142
: LGTM!The
downloadFileWeb
function correctly handles web-based file downloads.
148-157
: LGTM!The
downloadFileDesktop
function correctly handles desktop-based file downloads using the Tauri API.
292-294
: LGTM!The
isTauri
function correctly checks if the application is running in a Tauri environment.src/simulator/src/plotArea.js (2)
112-116
: LGTM!The
download
function correctly integrates the new Tauri-specific download logic.
124-148
: LGTM!The
downloadImageDesktop
function correctly handles desktop-based image downloads using the Tauri API.
could you explore adding native menu? |
You can also add github action for release https://github.com/tauri-apps/tauri-action |
@niladrix719 Could you fix the git conflict ? |
…into desktop-app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
Files selected for processing (6)
- package.json (3 hunks)
- src/simulator/src/data.js (1 hunks)
- src/simulator/src/listeners.js (3 hunks)
- src/simulator/src/plotArea.js (2 hunks)
- src/simulator/src/utils.ts (4 hunks)
- vite.config.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/simulator/src/data.js
Additional context used
GitHub Check: ESLint
src/simulator/src/listeners.js
[failure] 27-27: disallow unused variables
'lineTo' is defined but never used.
Additional comments not posted (33)
vite.config.ts (5)
33-33
: LGTM!Using an environment variable for the
base
property is a good practice for flexible deployments.
35-35
: LGTM!The change in the output directory structure is noted and looks good.
37-37
: LGTM!Increasing the
chunkSizeWarningLimit
to accommodate larger chunks without triggering warnings is a reasonable change.
38-46
: LGTM!The addition of
rollupOptions
with themanualChunks
function is a good approach for optimizing the chunking behavior and improving performance.
71-71
: LGTM!Enabling external access to the server by setting the
host
property totrue
is a helpful change for enhancing the development experience.package.json (5)
6-6
: LGTM!The
serve
script has been updated to usecross-env
for setting theVITE_BASE_URL
environment variable, which is a good practice for cross-platform compatibility.
7-7
: LGTM!The
build
script has been enhanced with the following changes:
- Using
cross-env
for setting theVITE_BASE_URL
environment variable to./
, indicating that the built application will be served from the current directory.- Adding the
--mode build
flag to specify the build mode, which could be used to apply specific configurations or optimizations.- Including the
--emptyOutDir
flag to ensure that the output directory is emptied before the build, preventing stale files.These changes improve the build process and provide more control over the build output.
8-8
: LGTM!The
dev
script has been updated to usecross-env
for setting theVITE_BASE_URL
environment variable, aligning with the changes made to theserve
script. This ensures consistency in the base URL during development.
9-9
: LGTM!The new
tauri
script has been added to integrate with the Tauri framework for building desktop applications. It usescross-env
to set theVITE_BASE_URL
environment variable to/simulatorvue/
, ensuring that the application is served from the correct base URL when running with Tauri.
19-19
: LGTM!The following dependencies have been added to the project:
@tauri-apps/api
and@tauri-apps/cli
: These dependencies are related to the Tauri framework, indicating that the project is integrating with Tauri for building desktop applications.cross-env
: This dependency is used in the scripts to set environment variables in a cross-platform manner.dotenv
: This dependency is commonly used for loading environment variables from a.env
file.The versions of the dependencies are properly specified, and the additions align with the changes made to the scripts and the integration with Tauri.
Also applies to: 49-49, 54-55
src/simulator/src/utils.ts (4)
121-127
: LGTM!The
downloadFile
function provides a clean and modular approach to handle file downloads across different environments. It abstracts away the platform-specific details and offers a unified interface, enhancing code maintainability and readability.
Line range hint
130-145
: LGTM!The
downloadFileWeb
function follows a standard approach for triggering file downloads in web applications. It creates a temporary anchor element, sets the necessary attributes, and simulates a click event to initiate the download. The code is self-contained and does not introduce any external dependencies.
148-157
: LGTM!The
downloadFileDesktop
function utilizes the Tauri API to handle file downloads in a desktop environment. It retrieves the downloads directory, constructs the appropriate file path, and writes the provided text content to the specified file. The code leverages the capabilities of the Tauri framework to provide a seamless file download experience for desktop users.
346-348
: LGTM!The
isTauri
function provides a simple and effective way to check if the application is running in a Tauri environment. By checking for the presence of thewindow.__TAURI__
property, it allows the codebase to conditionally execute Tauri-specific code or fallback to alternative implementations. This enhances code flexibility and adaptability to different environments.src/simulator/src/plotArea.js (2)
113-124
: LGTM!The changes to the
download
function look good. It correctly checks for the Tauri environment and calls the appropriate download method based on the environment.
126-150
: Excellent implementation!The
downloadImageDesktop
function is well-implemented and follows the necessary steps to download the canvas image as a file in a desktop environment using the Tauri API. It handles the image data conversion, file path construction, and binary data writing correctly. The inclusion of error handling ensures that any issues during the download process are caught and logged appropriately.src/simulator/src/listeners.js (17)
37-38
: LGTM!The imports are valid and used appropriately in the file.
789-790
: LGTM!The
zoomSliderListeners
function is implemented correctly and sets up the necessary event listeners for the zoom slider.
791-792
: LGTM!The comment is informative and helps in understanding the purpose of the subsequent code.
793-795
: LGTM!The event listener for the
new-project
event is set up correctly and calls the appropriate method oflogixFunction
.
797-799
: LGTM!The event listener for the
save_online
event is set up correctly and calls the appropriate method oflogixFunction
.
801-803
: LGTM!The event listener for the
save_offline
event is set up correctly and calls the appropriate method oflogixFunction
.
805-807
: LGTM!The event listener for the
open_offline
event is set up correctly and calls the appropriate method oflogixFunction
.
809-811
: LGTM!The event listener for the
export
event is set up correctly and calls the appropriate method oflogixFunction
.
813-815
: LGTM!The event listener for the
import
event is set up correctly and calls the appropriate method oflogixFunction
.
817-819
: LGTM!The event listener for the
recover
event is set up correctly and calls the appropriate method oflogixFunction
.
821-823
: LGTM!The event listener for the
clear
event is set up correctly and calls the appropriate method oflogixFunction
.
825-827
: LGTM!The event listener for the
preview_circuit
event is set up correctly and calls the appropriate method oflogixFunction
.
829-831
: LGTM!The event listener for the
new-circuit
event is set up correctly and calls the appropriate method oflogixFunction
.
833-835
: LGTM!The event listener for the
new-verilog-module
event is set up correctly and calls the appropriate method oflogixFunction
.
837-839
: LGTM!The event listener for the
insert-sub-circuit
event is set up correctly and calls the appropriate method oflogixFunction
.
841-843
: LGTM!The event listener for the
combinational-analysis
event is set up correctly and calls the appropriate method oflogixFunction
.
845-879
: LGTM!The event listeners for various events are set up correctly and call the appropriate methods of
logixFunction
.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Desktop Application for Vue Simulator using Tauri
Screen.Recording.2024-08-26.at.11.02.34.PM.mov
Summary by CodeRabbit
New Features
Bug Fixes
Chores
.gitignore
files to streamline version control.