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

added new features to setting page #408

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

melpsh
Copy link
Contributor

@melpsh melpsh commented Jan 4, 2025

Describe your changes

1- removed the redundant save button
2- removed the organization name for now
3- removed the select outlined
5- added the modal for deleting each member on the table

Issue 401

Please ensure all items are checked off before requesting a review:

  • I deployed the code locally.
  • I have performed a self-review of my code.
  • I have included the issue # in the PR.
  • I have labelled the PR correctly.
  • The issue I am working on is assigned to me.
  • I didn't use any hardcoded values (otherwise it will not scale, and will make it difficult to maintain consistency across the application).
  • I made sure font sizes, color choices etc are all referenced from the theme.
  • My PR is granular and targeted to one specific feature.
  • I took a screenshot or a video and attached to this PR if there is a UI change.
    image

Summary by CodeRabbit

  • New Features

    • Added a confirmation dialog for deleting team members
    • Enhanced team management interface with a deletion confirmation step
  • Style

    • Updated modal width to 440px
    • Refined Select component styling for role selection
  • Bug Fixes

    • Prevented accidental team member deletions by adding a confirmation step

@melpsh melpsh added the frontend Frontend related tasks/issues label Jan 4, 2025
@melpsh melpsh self-assigned this Jan 4, 2025
Copy link

coderabbitai bot commented Jan 4, 2025

Walkthrough

The pull request introduces enhancements to the team management interface in the TeamManagement component. A new confirmation dialog has been added for deleting team members, improving user experience by preventing accidental deletions. The changes include adding state variables to manage dialog visibility and the member selected for deletion, along with new methods to handle the deletion confirmation process. Additionally, a minor styling adjustment was made to the DualButtonModal component, setting a maximum width of 440 pixels.

Changes

File Change Summary
Clients/src/presentation/pages/SettingsPage/Team/index.tsx - Added dialog confirmation for team member deletion
- Introduced new state variables open and memberToDelete
- Added handleDeleteClick, confirmDelete, and handleClose methods
- Modified delete action to use confirmation dialog
Clients/src/presentation/vw-v2-components/Dialogs/DualButtonModal/index.tsx - Added maxWidth property of 440px to Stack component

Suggested labels

enhancement

Suggested reviewers

  • gorkem-bwl
  • MuhammadKhalilzadeh

Possibly related PRs

Poem

🐰 A rabbit's tale of team control,
Deletion now needs a gentle poll,
Confirm before you click and sweep,
No members lost in hasty leap,
With dialog's grace, we keep things neat! 🗑️


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:

  • 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. (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

  • 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: 1

🧹 Nitpick comments (4)
Clients/src/presentation/pages/SettingsPage/Team/index.tsx (4)

60-61: Explain usage rationale or rename for clarity
While the state variables open and memberToDelete are self-explanatory, consider renaming open to something more descriptive like isDeleteDialogOpen for improved clarity and maintainability.


150-153: Separation of concerns
handleDeleteClick sets dialog visibility and the selected member state, but consider aligning naming conventions: openDeleteDialog(memberId) might better convey the intent.


328-380: Dialog styling
Using inline styling within Material-UI’s Dialog is acceptable. However, this might become unwieldy if additional dialogs share styling. Consider extracting to a shared theme or custom theme override for consistency.


440-446: Revisit “Save All” logic
This block is commented out, which may be intentional. If the save logic is needed later, consider creating another PR or referencing a TODO to track revisiting this code.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c2f0d0b and c3d9115.

📒 Files selected for processing (2)
  • Clients/src/presentation/pages/SettingsPage/Team/index.tsx (8 hunks)
  • Clients/src/presentation/vw-v2-components/Dialogs/DualButtonModal/index.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Clients/src/presentation/vw-v2-components/Dialogs/DualButtonModal/index.tsx
🔇 Additional comments (5)
Clients/src/presentation/pages/SettingsPage/Team/index.tsx (5)

94-97: Potential side effect handling
In handleClose, resetting both open and memberToDelete is straightforward. However, if future logic depends on partial cleanup (e.g., partial resets if certain conditions fail), factor out the reset logic. Otherwise, this is good for now.


99-106: Confirm success/failure within confirmDelete
Currently, if an API call or server request is needed for deletion, there's no error handling or success/failure feedback. Ensure that the local state changes reflect a successful operation. Consider implementing an async call to the backend and showing notifications on success or failure.


296-301: Styling border
Removing the border from the notched outline is consistent with the design. Verify default focus states for accessibility; lacking a visual focus indicator could harm usability for keyboard navigation.


304-306: Validation check
Ensure roles are restricted to known constants. If the roles array changes or user input is untrusted, consider an additional check on the assigned value.


311-319: Icon alignment
The trashbin icon usage is straightforward. If the icon were to change or scale for different screen sizes, ensure consistent alignment with text or neighboring elements.

Comment on lines +382 to +437
count={dashboardValues.vendors.length}
page={page}
onPageChange={handleChangePage}
rowsPerPage={rowsPerPage}
rowsPerPageOptions={[5, 10, 15, 25]}
onRowsPerPageChange={handleChangeRowsPerPage}
ActionsComponent={(props) => <TablePaginationActions {...props} />}
labelRowsPerPage="Rows per page"
labelDisplayedRows={({ page, count }) =>
`Page ${page + 1} of ${Math.max(
0,
Math.ceil(count / rowsPerPage)
)}`
}
slotProps={{
select: {
MenuProps: {
keepMounted: true,
PaperProps: {
className: "pagination-dropdown",
sx: {
mt: 0,
mb: theme.spacing(2),
},
},
transformOrigin: { vertical: "bottom", horizontal: "left" },
anchorOrigin: { vertical: "top", horizontal: "left" },
sx: { mt: theme.spacing(-2) },
},
transformOrigin: { vertical: "bottom", horizontal: "left" },
anchorOrigin: { vertical: "top", horizontal: "left" },
sx: { mt: theme.spacing(-2) },
},
inputProps: { id: "pagination-dropdown" },
IconComponent: SelectorVertical,
sx: {
ml: theme.spacing(4),
mr: theme.spacing(12),
minWidth: theme.spacing(20),
textAlign: "left",
"&.Mui-focused > div": {
backgroundColor: theme.palette.background.main,
inputProps: { id: "pagination-dropdown" },
IconComponent: SelectorVertical,
sx: {
ml: theme.spacing(4),
mr: theme.spacing(12),
minWidth: theme.spacing(20),
textAlign: "left",
"&.Mui-focused > div": {
backgroundColor: theme.palette.background.main,
},
},
},
},
}}
sx={{
mt: theme.spacing(6),
color: theme.palette.text.secondary,
"& .MuiSelect-icon": {
width: "24px",
height: "fit-content",
},
"& .MuiSelect-select": {
width: theme.spacing(10),
borderRadius: theme.shape.borderRadius,
border: `1px solid ${theme.palette.border.light}`,
padding: theme.spacing(4),
},
}}
/>
}}
sx={{
mt: theme.spacing(6),
color: theme.palette.text.secondary,
"& .MuiSelect-icon": {
width: "24px",
height: "fit-content",
},
"& .MuiSelect-select": {
width: theme.spacing(10),
border: `1px solid ${theme.palette.border.light}`,
padding: theme.spacing(4),
},
}}
/>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Pagination count mismatch
Line 382 references count={dashboardValues.vendors.length}, while the table data is local (filteredMembers). Verify that the pagination logic (page count & displayed rows) aligns with the team member data rather than vendor data.

- count={dashboardValues.vendors.length}
+ count={filteredMembers.length}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
count={dashboardValues.vendors.length}
page={page}
onPageChange={handleChangePage}
rowsPerPage={rowsPerPage}
rowsPerPageOptions={[5, 10, 15, 25]}
onRowsPerPageChange={handleChangeRowsPerPage}
ActionsComponent={(props) => <TablePaginationActions {...props} />}
labelRowsPerPage="Rows per page"
labelDisplayedRows={({ page, count }) =>
`Page ${page + 1} of ${Math.max(
0,
Math.ceil(count / rowsPerPage)
)}`
}
slotProps={{
select: {
MenuProps: {
keepMounted: true,
PaperProps: {
className: "pagination-dropdown",
sx: {
mt: 0,
mb: theme.spacing(2),
},
},
transformOrigin: { vertical: "bottom", horizontal: "left" },
anchorOrigin: { vertical: "top", horizontal: "left" },
sx: { mt: theme.spacing(-2) },
},
transformOrigin: { vertical: "bottom", horizontal: "left" },
anchorOrigin: { vertical: "top", horizontal: "left" },
sx: { mt: theme.spacing(-2) },
},
inputProps: { id: "pagination-dropdown" },
IconComponent: SelectorVertical,
sx: {
ml: theme.spacing(4),
mr: theme.spacing(12),
minWidth: theme.spacing(20),
textAlign: "left",
"&.Mui-focused > div": {
backgroundColor: theme.palette.background.main,
inputProps: { id: "pagination-dropdown" },
IconComponent: SelectorVertical,
sx: {
ml: theme.spacing(4),
mr: theme.spacing(12),
minWidth: theme.spacing(20),
textAlign: "left",
"&.Mui-focused > div": {
backgroundColor: theme.palette.background.main,
},
},
},
},
}}
sx={{
mt: theme.spacing(6),
color: theme.palette.text.secondary,
"& .MuiSelect-icon": {
width: "24px",
height: "fit-content",
},
"& .MuiSelect-select": {
width: theme.spacing(10),
borderRadius: theme.shape.borderRadius,
border: `1px solid ${theme.palette.border.light}`,
padding: theme.spacing(4),
},
}}
/>
}}
sx={{
mt: theme.spacing(6),
color: theme.palette.text.secondary,
"& .MuiSelect-icon": {
width: "24px",
height: "fit-content",
},
"& .MuiSelect-select": {
width: theme.spacing(10),
border: `1px solid ${theme.palette.border.light}`,
padding: theme.spacing(4),
},
}}
/>
count={filteredMembers.length}
page={page}
onPageChange={handleChangePage}
rowsPerPage={rowsPerPage}
rowsPerPageOptions={[5, 10, 15, 25]}
onRowsPerPageChange={handleChangeRowsPerPage}
ActionsComponent={(props) => <TablePaginationActions {...props} />}
labelRowsPerPage="Rows per page"
labelDisplayedRows={({ page, count }) =>
`Page ${page + 1} of ${Math.max(
0,
Math.ceil(count / rowsPerPage)
)}`
}
slotProps={{
select: {
MenuProps: {
keepMounted: true,
PaperProps: {
className: "pagination-dropdown",
sx: {
mt: 0,
mb: theme.spacing(2),
},
},
transformOrigin: { vertical: "bottom", horizontal: "left" },
anchorOrigin: { vertical: "top", horizontal: "left" },
sx: { mt: theme.spacing(-2) },
},
inputProps: { id: "pagination-dropdown" },
IconComponent: SelectorVertical,
sx: {
ml: theme.spacing(4),
mr: theme.spacing(12),
minWidth: theme.spacing(20),
textAlign: "left",
"&.Mui-focused > div": {
backgroundColor: theme.palette.background.main,
},
},
},
}}
sx={{
mt: theme.spacing(6),
color: theme.palette.text.secondary,
"& .MuiSelect-icon": {
width: "24px",
height: "fit-content",
},
"& .MuiSelect-select": {
width: theme.spacing(10),
border: `1px solid ${theme.palette.border.light}`,
padding: theme.spacing(4),
},
}}
/>

@MuhammadKhalilzadeh MuhammadKhalilzadeh self-requested a review January 4, 2025 16:58
@MuhammadKhalilzadeh
Copy link
Collaborator

Hi @gorkemcetin,
Are we good we the looks of it?
Any modifications you want?

@MuhammadKhalilzadeh
Copy link
Collaborator

@melpsh @gorkemcetin
I feel the padding is a bit large? what do you think?
Also, we have a customizable modal already btw!

@gorkem-bwl
Copy link
Contributor

gorkem-bwl commented Jan 6, 2025

@melpsh you can use the modal we have for this and we're good to go!

@melpsh
Copy link
Contributor Author

melpsh commented Jan 6, 2025

Please clarify what modal do you want me to use exactly?

@gorkem-bwl
Copy link
Contributor

@melpsh you can use the modal we have for this and we're good to go!

Can you please check this one? I "think" it was this popup Mo added recently.

  • Clients/src/presentation/components/Popup

@MuhammadKhalilzadeh
Copy link
Collaborator

MuhammadKhalilzadeh commented Jan 6, 2025

@gorkem-bwl Let's not import that component for now.

Thank you for the code @melpsh.
Please decrease your paddings.
By paying attention to details and considering how other components look, its recognizable that your paddings on left and top are not matching to the right and bottom padding.

What do you think @gorkem-bwl ?
what are our standard values here?

@MuhammadKhalilzadeh
Copy link
Collaborator

This is an example that we have:
When you create a component, please make sure its eye comforting
Thanks 🙏🏻

Screenshot 2025-01-06 140502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Frontend related tasks/issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants