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

Degree column #296

Merged
merged 3 commits into from
Feb 20, 2024
Merged

Degree column #296

merged 3 commits into from
Feb 20, 2024

Conversation

JakeWags
Copy link
Member

@JakeWags JakeWags commented Feb 8, 2024

Does this PR close any open issues?

Closes #288
Depends #295

Give a longer description of what this PR addresses and why it's needed

This PR adds a degree column. The column is placed after the bookmark star column. It simply shows a number representing the degree of the row.

The column's header has a # to represent the degree number. There is a tooltip which says "Degree" onhover. The context menu has the same sorting options (sort ascending, descending)

Additionally, this PR adds a left click sort ability to each column as well.

Finally, the sorting accordion is removed from the sidebar entirely.

Provide pictures/videos of the behavior before and after these changes (optional)

upset-degree-column

Are there any additional TODOs before this PR is ready to go?

TODOs:

  • ...

@JakeWags JakeWags requested a review from JackWilb February 8, 2024 21:24
Copy link

netlify bot commented Feb 8, 2024

Deploy Preview for upset2 ready!

Name Link
🔨 Latest commit ee22b46
🔍 Latest deploy log https://app.netlify.com/sites/upset2/deploys/65d512aa26bbc500085eb87c
😎 Deploy Preview https://deploy-preview-296--upset2.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@JackWilb
Copy link
Member

JackWilb commented Feb 12, 2024

Screenshot 2024-02-12 at 9 53 44 AM

This doesn't work for aggregates. Maybe we just disable for aggregates?

Copy link
Member

@JackWilb JackWilb left a comment

Choose a reason for hiding this comment

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

I'm happy with this, but will hold off on approval until we merge #295

Comment on lines +20 to +64
const sortByDegree = (order: string) => {
actions.sortBy('Degree', order);
};

const handleOnClick = () => {
if (sortBy !== 'Degree') {
sortByDegree('Ascending');
} else {
sortByDegree(sortByOrder === 'Ascending' ? 'Descending' : 'Ascending');
}
};

const handleContextMenuClose = () => {
setContextMenu(null);
};

const getMenuItems = () => [
{
label: 'Sort by Degree - Ascending',
onClick: () => {
sortByDegree('Ascending');
handleContextMenuClose();
},
disabled: sortBy === 'Degree' && sortByOrder === 'Ascending',
},
{
label: 'Sort by Degree - Descending',
onClick: () => {
sortByDegree('Descending');
handleContextMenuClose();
},
disabled: sortBy === 'Degree' && sortByOrder === 'Descending',
},
];

const openContextMenu = (e: MouseEvent) => {
setContextMenu(
{
mouseX: e.clientX,
mouseY: e.clientY,
id: 'header-menu-degree',
items: getMenuItems(),
},
);
};
Copy link
Member

Choose a reason for hiding this comment

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

Do any of these need useCallback?

@JakeWags JakeWags merged commit ad191bf into main Feb 20, 2024
7 checks passed
@JakeWags JakeWags deleted the degree-column branch February 20, 2024 21:28
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.

Add degree column
2 participants