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

Icon order #79

Open
superjai opened this issue Jan 14, 2025 · 3 comments
Open

Icon order #79

superjai opened this issue Jan 14, 2025 · 3 comments
Assignees

Comments

@superjai
Copy link
Contributor

superjai commented Jan 14, 2025

Hey @skanda-vasishta. A new issue for you concerning icons in the table of contents and in mobile view.

Currently, in the table of contents, such as below, the entries are displayed alphabetically. The same holds true in mobile view.
Screenshot 2025-01-13 at 4 04 02 PM

We want to add the feature of allowing users to have icons show up in a different order in the table of contents, other than alphabetically. In the modal content type, there is a new custom content field called modal_icon_order, which only accepts integers between 1 and 20 and with a default value of 1. What we want is to sort items by the icon order. When there are ties in the icon order, then let's go back to alphabetical sorting. This new ordering should also be used for the icons in mobile view. modal_icon_order should be available via the REST API.

As a second thing, it would be good to add section headers to the mobile view, when - for a given scene - the table of contents style is either "sectioned list" or "accordion". Something like below, but I'm sure that you can style it better. If the table of contents style is "list", then we wouldn't have section headers, obviously. If section headers are there, let's be sure to keep ordering by the field modal_icon_order.
Screenshot 2025-01-13 at 3 32 02 PM

@skanda-vasishta
Copy link
Contributor

@superjai -- maybe consider changing icon order to drop down which is dynamically updated with possible orderings

@skanda-vasishta
Copy link
Contributor

skanda-vasishta commented Jan 16, 2025

added for desktop/tablet:
const sorted_child_objs = Object.values(child_obj).sort((a, b) => a.modal_icon_order - b.modal_icon_order);
iterate through this in table_of_contents and list_toc functions instead of child_obj

@skanda-vasishta
Copy link
Contributor

mobile view requires more complicated changes as sections must be accounted for; first, sort by provided order if icon exists, maintain list of icons that don't exist separately. separate by section for existing icons, include extra section for existing icons without provided section. then, add another "pseudo" section including all icons that don't yet exist in wp (only include this section if there are any such icons)

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

No branches or pull requests

2 participants