-
Notifications
You must be signed in to change notification settings - Fork 1
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
OPHJOD-1211: Implement "Päämääräni" feature #348
Conversation
* @param element HTML element | ||
* @returns True if the element is part of a headlessui dialog, false otherwise | ||
*/ | ||
const isPartOfHeadlessUIDialog = React.useCallback((element: HTMLElement) => { |
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.
This hook is being used in OpportunityCard
to close the actions menu on outside click. I ran into an issue when using ConfirmationDialog
inside the menu: Clicking on the dialog buttons would trigger closing the menu and nothing would happen. I think this is quite a sketchy solution but I couldn't figure out a better one.
5141a7b
to
dcfda5d
Compare
@@ -80,17 +95,6 @@ const Favorites = () => { | |||
} | |||
}, [selectedFilter, pageData]); | |||
|
|||
const favoriteCount = React.useMemo(() => { |
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.
While working with favoritesStore, I realized that it would be easier to do the total counting there, otherwise I'd have to duplicate this counting code in Päämääräni section as well
@@ -148,8 +180,7 @@ export const useSuosikitStore = create<FavoritesState>()((set, get) => ({ | |||
suosikit.findIndex((item) => item.suosionKohdeId === a.id), | |||
) as TypedMahdollisuus[]; | |||
|
|||
set({ pageData: sortedResultBySuosikkiOrder }); | |||
set({ pageNr: page }); | |||
set({ pageData: sortedResultBySuosikkiOrder, pageNr: safePageNr, totalItems: filteredSuosikit.length }); | |||
window.scrollTo({ top: 0, behavior: 'smooth' }); |
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.
Should make a JIRA ticket about this, scrolling should be called from within the component. Now the page scrolls to the top in Päämääräni
page everytime a new page of favorites are fetched.
|
Description
Related JIRA ticket
https://jira.eduuni.fi/browse/OPHJOD-1211