[MathPow] Added Favorite Templates#93
Conversation
| const [template, setTemplates] = useState<ITemplate[]>([]) | ||
| const [pageType, setPageType] = useState<IPageType>(IPageType.NONE) | ||
|
|
||
| function getTemplateId(template: ITemplate): string { |
There was a problem hiding this comment.
16-64, This code can most likely be split up into a helper function, so it's easier to refactor and not as tightly coupled within the application. getSortedTemplatesByFavorite makes sense to stay here though if you want. unless you make a functional map component.
I would move this to /frontend/utils
There was a problem hiding this comment.
Also for me to test later: What happens if the key isn't valid i.e. template with key no longer exists
There was a problem hiding this comment.
Good idea. I will move it there later this week thanks
There was a problem hiding this comment.
Hey just following up on this PR, branches have diverged quite a bit.
I'm happy to do the cleanup here if you don't have the time, or would you have time available to do the above changes?
#77
I chose to add a heart icon that is full if the tempalte is in favorite. All of the informations for this is stored in local storage. The card on sorted by favorite for now. We could change this when we have a favorite tag in the search system. If nothing is liked, nothing changes.
@ShaanCoding, Write me if you thought of a specific style or placement that you wanted for the icon. Maybe you like white more so it blends in more, I wasn't sure about this.