-
Notifications
You must be signed in to change notification settings - Fork 7
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
Degree column #296
Conversation
✅ Deploy Preview for upset2 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.
I'm happy with this, but will hold off on approval until we merge #295
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(), | ||
}, | ||
); | ||
}; |
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.
Do any of these need useCallback?
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)
Are there any additional TODOs before this PR is ready to go?
TODOs: