Skip to content
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

KLO-117 : Add domain names in router details and listing screen #94

Merged
merged 3 commits into from
Feb 20, 2024

Conversation

nxtCoder19
Copy link
Contributor

Resolves kloudlite/kloudlite/issues/38

Attachment

Screenshot 2024-02-19 at 4 21 06 PM Screenshot 2024-02-19 at 4 20 42 PM

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

PR Type: Enhancement

PR Summary: This pull request introduces the functionality to display domain names in the router details and listing screens within the console application. It enhances the user interface by adding a new component, ListDomainItem, which not only displays the domain names but also provides a copy-to-clipboard feature for each domain. This feature is implemented across both grid and list views, ensuring consistency in user experience. The changes include modifications to existing components to accommodate the new feature, as well as the introduction of new utilities for clipboard management and icon state handling.

Decision: Comment

📝 Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
📝 Complexity: the changes are too large or complex for Sourcery to approve.
  • Unsupported files: the diff contains files that Sourcery does not currently support during reviews.
  • Big diff: the diff is too large to approve with confidence.

General suggestions:

  • Consider using more descriptive names for state variables that are actively used within the component. This can improve code readability and maintainability.
  • Review and remove any commented-out code that is no longer needed before finalizing the pull request. Keeping the codebase clean helps in long-term maintenance.
  • Ensure that the new feature integrates seamlessly with the existing UI/UX patterns in the application. Consistency in user experience is key to a professional and intuitive interface.
  • Given the introduction of new functionality, it might be beneficial to review and update any related documentation or user guides to include information about the domain name display and copy-to-clipboard feature.
src/apps/console/routes/_main+/$account+/$project+/$environment+/routers/router-resources.tsx: Refactor to reduce repetition and complexity by abstracting domain rendering into a separate component.

The recent changes introduce additional complexity and repetition, particularly with the rendering of ListDomainItem within a map function, which is done twice for both list and grid views. This not only increases the cognitive load for developers trying to understand the code but also violates the DRY (Don't Repeat Yourself) principle, potentially making future maintenance more challenging.

To simplify, consider abstracting the domain rendering logic into a separate component or function. This approach reduces repetition and makes the main component's code more readable and maintainable. Here's a suggested refactor:

const DomainList = ({ domains, keyPrefix, id }) => {
  return (
    <>
      {domains.map((domain) => (
        <ListDomainItem
          key={generateKey(keyPrefix, id + domain)}
          data={domain}
          value={domain}
        />
      ))}
    </>
  );
};

And then use this DomainList component in the places where you're currently mapping over item.spec.domains. This encapsulates the domain rendering logic, making the overall code cleaner and easier to follow.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

data: ReactNode;
value: string;
}) => {
const [_, setCopyIcon] = useState(<CopySimple/>);
Copy link

Choose a reason for hiding this comment

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

suggestion (llm): Using an underscore as a variable name for the state variable returned from useState is unconventional when the variable is actually used. Consider using a more descriptive name for the state variable that holds the current icon.

setCopyIcon(<CopyrightFill/>);
toast.success(`${titleCase("domain name")} copied successfully`);
}, 1000);
// toast.success('Copied to clipboard');
Copy link

Choose a reason for hiding this comment

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

nitpick (llm): It appears there's a commented-out line of code left in the changes. If this line is no longer needed, it's best to remove it to keep the codebase clean and maintainable.

@nxtCoder19 nxtCoder19 changed the base branch from main to release-v1.0.3 February 20, 2024 04:57
@nxtCoder19 nxtCoder19 changed the base branch from release-v1.0.3 to main February 20, 2024 05:04
@nxtCoder19 nxtCoder19 changed the base branch from main to release-v1.0.3 February 20, 2024 05:31
@nxtcoder17 nxtcoder17 merged commit 53d4754 into release-v1.0.3 Feb 20, 2024
4 checks passed
@nxtcoder17 nxtcoder17 deleted the fix/update-router-listing branch February 20, 2024 05:38
abdheshnayak pushed a commit that referenced this pull request Oct 28, 2024
KLO-117 : Add domain names in router details and listing screen
tulsiojha pushed a commit that referenced this pull request Nov 1, 2024
KLO-117 : Add domain names in router details and listing screen
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
KLO-117 : Add domain names in router details and listing screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[KLO-117] Add domain names in router details and listing screen
2 participants