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

OPHJOD-1211: Implement "Päämääräni" feature #348

Merged
merged 1 commit into from
Feb 7, 2025
Merged

Conversation

juhaniko
Copy link
Contributor

Description

  • Implemented "Päämääräni" feature under profile

Related JIRA ticket

https://jira.eduuni.fi/browse/OPHJOD-1211

* @param element HTML element
* @returns True if the element is part of a headlessui dialog, false otherwise
*/
const isPartOfHeadlessUIDialog = React.useCallback((element: HTMLElement) => {
Copy link
Contributor Author

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.

@juhaniko juhaniko force-pushed the OPHJOD-1211 branch 4 times, most recently from 5141a7b to dcfda5d Compare February 6, 2025 08:48
@@ -80,17 +95,6 @@ const Favorites = () => {
}
}, [selectedFilter, pageData]);

const favoriteCount = React.useMemo(() => {
Copy link
Contributor Author

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' });
Copy link
Contributor Author

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.

Copy link

sonarqubecloud bot commented Feb 7, 2025

@juhaniko juhaniko merged commit 085aa90 into main Feb 7, 2025
6 checks passed
@juhaniko juhaniko deleted the OPHJOD-1211 branch February 7, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants