-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add ability to sort team tables in either desc or asc order for each column #48
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
base: main
Are you sure you want to change the base?
Conversation
|
This is great, I would love to be able to sort by ways other than kills. Thanks for adding this functionality :) I agree with mega that default by kills should be changed, as it doesn't accurately reflect the in-game scoreboard which uses additional information to get the actual score. I'm personally in favour of time, as then all the bots and cheaters that newly join a game will consistently hang around one end of the board instead of flying through it as they go and kill everything in sight. Being able to sort by kills would certainly still be useful to have though, hence I greatly appreciate this feature. |
In regards to this: what do you mean? Do you mean that when sorting by clicking the header that the user should be able to have multiple sorted? For example: sort by desc on both user and time instead of only being able to have time or user?
I think with this I'll set it to sort by time for now, with the most recent appearing at the bottom since I think this makes a bit more sense practically but either way the default is designed to be changed easily so this can just be how it is for now and if later it needs to be changed it can be done very easily.
I think this is a great idea but I figure to ask: should there also be a preference to have the current user always display at the top regardless of sorting? Currently this is just how it is but wondering if this should be an option that is default enabled and can be turned off otherwise
I have been unable to replicate this so far. The only thing that I think should/would be causing this is if somehow the |
Scratch this. Found a way to kind of replicate it with sorting by time as default, I will update in the next commit and hopefully this should fix it |
…ult sort to time, refactor sorting to be in a separate utils file
SammCheese
left a comment
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.
It seems like the sorting does not apply to the BLU player list, no matter which sort option is used?



Changelog:
const localVerdictwithinsrc/components/TF2/Player/playerutils.tsxwithconst LOCAL_VERDICT_OPTIONSfrom new fileplayerConstants.tsxsrc/constants/playerConstants.tsxcontaining the following:export type VERDICT_TYPESwhich can be one of 6 strings (based on what I could find this value can be)interface VERDICT_OPTIONwith structure{ label: string, value: VERDICT_TYPES | string T}export const LOCAL_VERDICT_OPTIONS: VERDICT_OPTION[](this is effectively justconst localVerdicthence why it replaces it but using types)src/components/TF2/ScoreboardTable/SortableTableHeader.tsxthat renders header as a button with a sort icon that reflects current sorting statesrc/constants/tableConstants.tsxcontaining the following:export enum SORT_TYPESwith values:UNSORTEDSORT_ASCSORT_DESCexport enum SORT_OPTIONSwith values:SORT_BY_USERSORT_BY_TIMESORT_BY_RATINGexport interface TableHeaderSortingwith structure{ sortValue: SORT_OPTIONS, sortType: SORT_TYPES }export interface SortableHeaderwith structure{ sortValue: SORT_OPTIONS, nameKey: string, hideWhenSmall?: boolean }where name key is what is passed for translation purposesexport const DEFAULT_HEADER_SORT: TableHeaderSortingset to unsorted and sort by userexport const SORTABLE_SCOREBOARD_HEADERS: SortableHeader[]containing the 3 possible sorting optionsexport const RATING_SORT_ORDERwhich usesVERDICT_TYPESto make a simple way to define the "Rating" column is sorted via numberssrc/components/TF2/ScoreboardTable/ScoreboardTable.tsxto use new<SortableTableHeader />and constants fromtableConstants.tsxto define sorting functionality. In all sorting cases, the current user is displayed at the top of the team's listtailwind.config.jsgridTemplateColumnsso the new<SortableHeader />won't be weirdly squished or have the sorting icon off screen