uwu / shelter

an attempt to prepare for the worst
https://shelter.uwu.network/
Creative Commons Zero v1.0 Universal
365 stars 12 forks source link

[settings] Add ability to add optional properties to `section` settings components #16

Closed SpikeHD closed 10 months ago

SpikeHD commented 10 months ago

Through a little bit of investigation, I found that one can add a badgeCount property to any predicate sections. For example:

image

Which can (now) be done with the following code:

registerSection('section', 'test', 'Badge Test', testComponent, {
  badgeCount: 99
})

This can be seen officially via the gift inventory tab, if you have unseen gifts.

The reason I added this as a generic object is because I did not do a thorough check of all properties a section may be able to have. I also did not investigate whether other parts (such as headers) may have such properties. If you would like me to take a more in-depth look, or happen to take a look and notice more things, feel free to let me know!

SpikeHD commented 10 months ago

Oops, dunno why those 5 extra commits are there, if you want me to cherry pick the right ones let me know, or you can just squash the commits when/if merging if you'd like!

yellowsink commented 10 months ago

Looks fine to me Thanks for the contribution :)