-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
[MathPow] Added Favorite Templates #93
base: develop
Are you sure you want to change the base?
[MathPow] Added Favorite Templates #93
Conversation
|
||
export default function IndexPage() { | ||
const [template, setTemplates] = useState<ITemplate[]>([]) | ||
const [pageType, setPageType] = useState<IPageType>(IPageType.NONE) | ||
|
||
function getTemplateId(template: ITemplate): string { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I will move it there later this week thanks
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.
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.