Skip to content

#316: Add helper func to get activity titles from ids in Opp-List#384

Merged
nadavosa merged 4 commits intodevelopfrom
add-opp-list-activities-function
Apr 24, 2026
Merged

#316: Add helper func to get activity titles from ids in Opp-List#384
nadavosa merged 4 commits intodevelopfrom
add-opp-list-activities-function

Conversation

@DarrellRoberts
Copy link
Copy Markdown
Collaborator

@DarrellRoberts DarrellRoberts commented Apr 23, 2026

Description

  • Adds helper func to get activity titles from ids in the options array. This was neccessary to display activities in the opportunity cards

  • Adds Activity filter

Related Issues

Closes #316

Changes

  • Bullet list of meaningful changes (optional)

Screenshots / Demos

image

Checklist

  • WITHIN THE SCOPE OF AN ISSUE; No unnecessary files included
  • Tests added/updated
  • Documentation updated
  • CI passes

@DarrellRoberts DarrellRoberts self-assigned this Apr 23, 2026
Comment thread src/components/Dashboard/Opportunities/helpers.ts Outdated
@@ -16,4 +16,5 @@ export const defaultOpportunityCardsFilter: OpportunityCardsFilter = {
[OpportunityType.EVENTS]: false,
[OpportunityType.REGULAR]: false,
},
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACTIVITY is not part of QueryParamsKeys hence why I went for EntityTableName. But I can update the sdk if needed

@need4deed need4deed requested review from Cy-fox April 23, 2026 16:12
Copy link
Copy Markdown
Collaborator

@nadavosa nadavosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Issue 1 — Activity filters won't restore from URL

In src/components/Dashboard/Opportunities/Filters/helpers.ts, the deserialization loop:

```ts
queryActivities.forEach((l) => {
if (newFilter.activity[l] !== undefined) newFilter.activity[l] = true;
});
```

defaultOpportunityCardsFilter initializes activity as {}, so every key is undefined — the condition is always false and activity filters are never restored from the URL when navigating back.

Fix:
```ts
queryActivities.forEach((l) => {
newFilter.activity[l] = true;
});
```

Issue 2 — Type consistency in getActivityTitles

In src/components/Dashboard/Opportunities/helpers.ts:
```ts
const activityMap = new Map(activityList.map((item) => [item.id, item.title])); // key: number
return activities.map((act) => activityMap.get(Number(act.id))) // lookup: Number(string)?
```

act.idanditem.idare the same type at runtime.? Ifact.idis a string, the map lookup will always miss (different types as Map keys). Safest fix is to key everything withString(id)` consistentl

@DarrellRoberts
Copy link
Copy Markdown
Collaborator Author

thanks for the review @nadavosa ! I've committed those changes now

@DarrellRoberts
Copy link
Copy Markdown
Collaborator Author

DarrellRoberts commented Apr 23, 2026

FYI I've noticed we're not actually importing/using the deserializeOpportunityFilters function (the function that will automatically add filters when the URL is pasted/refreshed). I did start to implement it in /Opportunities.tsx but realise I should probably do it in a seperate issue/PR

@need4deed
Copy link
Copy Markdown
Contributor

need4deed commented Apr 24, 2026

FYI I've noticed we're not actually importing/using the deserializeOpportunityFilters function (the function that will automatically add filters when the URL is pasted/refreshed). I did start to implement it in /Opportunities.tsx but realise I should probably do it in a seperate issue/PR

Yes this is important, we alwasy need to refilter because oft that - can you open an issue?

@need4deed need4deed requested a review from nadavosa April 24, 2026 08:47
@nadavosa nadavosa merged commit 3fa7ccb into develop Apr 24, 2026
1 check passed
@nadavosa nadavosa deleted the add-opp-list-activities-function branch April 24, 2026 08:48
@DarrellRoberts
Copy link
Copy Markdown
Collaborator Author

sure thing

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.

Activities of opportunity missing in search screen

3 participants