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

[MathPow] Added Favorite Templates #93

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

MathPow
Copy link
Contributor

@MathPow MathPow commented May 5, 2024

#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.

image
image

@MathPow MathPow changed the base branch from main to develop May 5, 2024 18:45

export default function IndexPage() {
const [template, setTemplates] = useState<ITemplate[]>([])
const [pageType, setPageType] = useState<IPageType>(IPageType.NONE)

function getTemplateId(template: ITemplate): string {
Copy link
Owner

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

Copy link
Owner

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

Copy link
Contributor Author

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

@ShaanCoding ShaanCoding changed the title Feature/i77 favorite templates [MathPow] Added Favorite Templates May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pull Request
Development

Successfully merging this pull request may close these issues.

None yet

2 participants