From 321734061033c9dbb4d1b98939da7a420d7478bd Mon Sep 17 00:00:00 2001 From: iandebruin98 Date: Wed, 15 Jan 2025 10:21:51 +0100 Subject: [PATCH 1/3] fix: Update values for tag groups --- .../projects/[project]/widgets/begrootmodule/[id]/display.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/admin-server/src/pages/projects/[project]/widgets/begrootmodule/[id]/display.tsx b/apps/admin-server/src/pages/projects/[project]/widgets/begrootmodule/[id]/display.tsx index 91fdba461..8ae3bc91b 100644 --- a/apps/admin-server/src/pages/projects/[project]/widgets/begrootmodule/[id]/display.tsx +++ b/apps/admin-server/src/pages/projects/[project]/widgets/begrootmodule/[id]/display.tsx @@ -312,6 +312,8 @@ export default function BegrootmoduleDisplay( values = values.filter(value => value !== item); } + values = values.filter(value => tagGroupNames.includes(value)); + form.setValue('tagTypeTagGroup', values); props.onFieldChanged('tagTypeTagGroup', values); }} From d3e9f3a7cacb496e572ec7998408ebe51a24c471 Mon Sep 17 00:00:00 2001 From: iandebruin98 Date: Wed, 15 Jan 2025 11:27:51 +0100 Subject: [PATCH 2/3] fix: Replace session with localstorage --- packages/stem-begroot/src/stem-begroot.tsx | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/stem-begroot/src/stem-begroot.tsx b/packages/stem-begroot/src/stem-begroot.tsx index 617d44602..367a18060 100644 --- a/packages/stem-begroot/src/stem-begroot.tsx +++ b/packages/stem-begroot/src/stem-begroot.tsx @@ -212,7 +212,7 @@ function StemBegroot({ // Check the pending state and if there are any resources, hint to update the selected items useEffect(() => { if (props.votes.voteType === "countPerTag" || props.votes.voteType === "budgetingPerTag") { - const pendingPerTag = session.get('osc-resource-vote-pending-per-tag'); + const pendingPerTag = JSON.parse(localStorage.getItem('oscResourceVotePendingPerTag') || 'null'); if (pendingPerTag) { setTagCounter((prevTagCounter) => @@ -241,7 +241,7 @@ function StemBegroot({ ); } } else { - let pending = session.get('osc-resource-vote-pending'); + let pending = JSON.parse(localStorage.getItem('oscResourceVotePending') || 'null'); if ( pending && resources?.records?.length > 0 && @@ -257,9 +257,9 @@ function StemBegroot({ let pending; if (props.votes.voteType === "countPerTag" || props.votes.voteType === "budgetingPerTag") { - pending = session.get('osc-resource-vote-pending-per-tag'); + pending = JSON.parse(localStorage.getItem('oscResourceVotePendingPerTag') || 'null'); } else { - pending = session.get('osc-resource-vote-pending'); + pending = JSON.parse(localStorage.getItem('oscResourceVotePending') || 'null'); } if ( @@ -282,7 +282,8 @@ function StemBegroot({ resourcesToVoteFor[resource.id] = 'yes'; } ); - session.set('osc-resource-vote-pending', resourcesToVoteFor); + + localStorage.setItem('oscResourceVotePending', JSON.stringify(resourcesToVoteFor)); } else { const resourcesToVoteForPerTag: { [tag: string]: { [key: string]: any } } = {}; @@ -296,7 +297,7 @@ function StemBegroot({ }); }); - session.set('osc-resource-vote-pending-per-tag', resourcesToVoteForPerTag); + localStorage.setItem('oscResourceVotePendingPerTag', JSON.stringify(resourcesToVoteForPerTag)); } } @@ -455,7 +456,7 @@ function StemBegroot({ isSimpleView={Boolean(props.isSimpleView)} onPrimaryButtonClick={(resource) => { if (props.votes.voteType === "countPerTag" || props.votes.voteType === "budgetingPerTag") { - session.remove('osc-resource-vote-pending-per-tag'); + localStorage.removeItem('oscResourceVotePendingPerTag'); if (activeTagTab) { const activeTag = tagCounter.find(tagObj => tagObj[activeTagTab]); @@ -475,7 +476,7 @@ function StemBegroot({ } } } else { - session.remove('osc-resource-vote-pending'); + localStorage.removeItem('oscResourceVotePending'); const resourceInBudgetList = selectedResources.find( (r) => r.id === resource.id @@ -550,8 +551,8 @@ function StemBegroot({ setActiveTagTab={setActiveTagTab} typeIsPerTag={props?.votes?.voteType === "countPerTag" || props?.votes?.voteType === "budgetingPerTag"} onSelectedResourceRemove={(resource: {id: number, budget: number}) => { - session.remove('osc-resource-vote-pending'); - session.remove('osc-resource-vote-pending-per-tag'); + localStorage.removeItem('oscResourceVotePending'); + localStorage.removeItem('oscResourceVotePendingPerTag'); if (props?.votes?.voteType === "countPerTag" || props?.votes?.voteType === "budgetingPerTag") { setTagCounter(prevTagCounter => { @@ -732,12 +733,11 @@ function StemBegroot({ if (uniqueResourcesToVote.length > 0) { await doVote(uniqueResourcesToVote); + localStorage.removeItem('oscResourceVotePendingPerTag'); } - - session.remove('osc-resource-vote-pending-per-tag'); } else { await doVote(selectedResources); - session.remove('osc-resource-vote-pending'); + localStorage.removeItem('oscResourceVotePending'); } setCurrentStep(currentStep + 1); } catch (err: any) { @@ -849,8 +849,8 @@ function StemBegroot({ originalResourceUrl={props.originalResourceUrl} resourceListColumns={resourceListColumns || 3} onResourcePrimaryClicked={(resource) => { - session.remove('osc-resource-vote-pending'); - session.remove('osc-resource-vote-pending-per-tag'); + localStorage.removeItem('oscResourceVotePending'); + localStorage.removeItem('oscResourceVotePendingPerTag'); let newTagCounter = [...tagCounter]; From 323062003f6878a9722d006b9a31b07bd7aa58bd Mon Sep 17 00:00:00 2001 From: iandebruin98 Date: Wed, 15 Jan 2025 11:39:30 +0100 Subject: [PATCH 3/3] fix: Change placement for the re-login button --- packages/stem-begroot/src/stem-begroot.tsx | 13 ++++++++++-- .../stem-begroot/src/step-3-success/index.tsx | 21 +++++-------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/packages/stem-begroot/src/stem-begroot.tsx b/packages/stem-begroot/src/stem-begroot.tsx index 367a18060..6d9d28a19 100644 --- a/packages/stem-begroot/src/stem-begroot.tsx +++ b/packages/stem-begroot/src/stem-begroot.tsx @@ -654,9 +654,7 @@ function StemBegroot({ {currentStep === 3 ? ( ) : null} @@ -688,6 +686,17 @@ function StemBegroot({ ) : null} + {currentStep === 3 ? ( + + ) : null} + {/* Dont show on voting step if you are on step 2 your not logged in*/} {(currentStep !== 2 && currentStep !== -1) ? ( + ); };