Skip to content

Conversation

@JatsuAkaYashvant
Copy link
Member

@JatsuAkaYashvant JatsuAkaYashvant commented Apr 2, 2025

Fixes #

I have introduced an icon to open circuit link in the browser in one click, resolving the issue : #261

Describe the changes you have made in this PR -

Changes Made

  1. Added Browser Button:

    • Implemented direct web browser opening functionality
    • Added new browser icon button in AppBar actions
    • Used url_launcher package for URL handling
  2. Fixed AppBar Title Truncation:

    • Wrapped AppBar title in SizedBox with constrained width
    • Added proper overflow handling with TextOverflow.ellipsis
    • Adjusted font size and weight for better visibility
  3. Code Quality Improvements:

    • Fixed all undefined method errors
    • Removed unused imports
    • Fixed syntax and formatting issues
  4. Maintained Existing Functionality:

    • Preserved all original features
    • Ensured backward compatibility

Screenshots of the changes (If any) -

WhatsApp Image 2025-04-02 at 20 15 35_7b5872e3

Note: Please check Allow edits from maintainers. if you would like us to assist in the PR.

Summary by CodeRabbit

  • New Features

    • Introduced a centralized method for generating project URLs, enhancing the sharing functionality.
  • Style

    • Improved the app bar title layout to gracefully truncate lengthy titles.
  • Bug Fixes

    • Introduced user notifications when the external project link fails to launch.

@coderabbitai
Copy link

coderabbitai bot commented Apr 2, 2025

Walkthrough

The changes introduce a new method _getProjectUrl in the _ProjectDetailsViewState class within the project details view. This method centralizes the construction of a project URL using the author's ID and project ID from the _recievedProject variable, which is consistently used to access project attributes. The inline URL construction in the onShareButtonPressed method is replaced by this new method. Additionally, comments in the code have been removed, but the overall structure of the class remains unchanged.

Changes

File Change Summary
lib/ui/views/.../project_details_view.dart - Added _getProjectUrl method to construct a project URL.
- Replaced inline URL construction in onShareButtonPressed with the new method.
- Removed comments from the code.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f6f518 and 4214ef3.

📒 Files selected for processing (1)
  • lib/ui/views/projects/project_details_view.dart (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/ui/views/projects/project_details_view.dart
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • 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.
  • Files and specific lines of code (under the "Files changed" tab): Tag @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.
  • PR comments: Tag @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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
lib/ui/views/projects/project_details_view.dart (2)

49-59: URL launching implementation looks good, but there's duplicate URL construction logic

The URL launching implementation correctly handles errors and displays appropriate messages to the user.

There's duplicate URL construction logic between this method and onShareButtonPressed(). Consider extracting this into a helper method:

+  String _getProjectUrl() {
+    return 'https://circuitverse.org/users/${_receivedProject.relationships.author.data.id}/projects/${_receivedProject.id}';
+  }

  Future<void> _launchProjectUrl() async {
-    final url =
-        'https://circuitverse.org/users/${_receivedProject.relationships.author.data.id}/projects/${_receivedProject.id}';
+    final url = _getProjectUrl();
    final Uri uri = Uri.parse(url);

    if (!await launchUrl(uri, mode: LaunchMode.externalApplication)) {
      ScaffoldMessenger.of(
        context,
      ).showSnackBar(const SnackBar(content: Text('Could not launch URL')));
    }
  }

Then update onShareButtonPressed() as well:

  void onShareButtonPressed() {
    final RenderBox? box = context.findRenderObject() as RenderBox?;
-    var URL =
-        'https://circuitverse.org/users/${widget.project.relationships.author.data.id}/projects/${widget.project.id}';
+    var URL = _getProjectUrl();
    Share.share(
      URL,
      sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
    );
  }

61-69: Inconsistent variable usage in onShareButtonPressed method

This method still uses widget.project directly while the rest of the code has been updated to use _receivedProject.

Update to use the renamed variable for consistency:

  void onShareButtonPressed() {
    final RenderBox? box = context.findRenderObject() as RenderBox?;
    var URL =
-        'https://circuitverse.org/users/${widget.project.relationships.author.data.id}/projects/${widget.project.id}';
+        'https://circuitverse.org/users/${_receivedProject.relationships.author.data.id}/projects/${_receivedProject.id}';
    Share.share(
      URL,
      sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
    );
  }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 822e93a and 171e795.

📒 Files selected for processing (1)
  • lib/ui/views/projects/project_details_view.dart (18 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
🔇 Additional comments (5)
lib/ui/views/projects/project_details_view.dart (5)

22-22: Import added correctly for URL launching functionality

The url_launcher package is appropriately imported to enable the new feature for opening project links in a browser.


39-39: Variable naming correction

Good fix for the spelling error by renaming _recievedProject to _receivedProject throughout the code.

Also applies to: 46-47


82-91: Browser button implementation is clean and consistent

The browser button follows the same design pattern as the share button, maintaining UI consistency.


622-629: AppBar title truncation fix is appropriate

Using a SizedBox with a constrained width and TextOverflow.ellipsis effectively handles long titles.


630-633: Action buttons are well-organized

The browser button and share button are appropriately placed in the app bar actions.

@coveralls
Copy link

coveralls commented Apr 2, 2025

Pull Request Test Coverage Report for Build 14274148299

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 3 (0.0%) changed or added relevant lines in 1 file are covered.
  • 120 unchanged lines in 7 files lost coverage.
  • Overall coverage decreased (-0.5%) to 64.11%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/ui/views/projects/project_details_view.dart 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
lib/ui/views/projects/project_details_view.dart 1 44.37%
lib/ui/components/cv_social_card.dart 5 82.35%
lib/ui/views/home/home_view.dart 6 85.71%
lib/ui/views/projects/components/featured_project_card.dart 14 70.21%
lib/ui/views/profile/user_favourites_view.dart 22 46.81%
lib/ui/views/profile/user_projects_view.dart 22 47.83%
lib/ui/views/notifications/notifications_view.dart 50 1.49%
Totals Coverage Status
Change from base Build 14205381133: -0.5%
Covered Lines: 4037
Relevant Lines: 6297

💛 - Coveralls

@hardik17771
Copy link
Member

Hey @JatsuAkaYashvant , just check once the comment by codeRabbit above, this is an important improvement by using a helper method for storing url. Will merge once you make these changes.

@JatsuAkaYashvant
Copy link
Member Author

@hardik17771 I have resolved all the issues, please review.

@hardik17771 hardik17771 merged commit d6d368c into CircuitVerse:master Apr 5, 2025
5 checks passed
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants