Skip to content

Commit

Permalink
tweaks in module for feature flagging
Browse files Browse the repository at this point in the history
  • Loading branch information
albinagu committed Aug 20, 2024
1 parent 9b21d89 commit ebccfee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions libs/service-portal/signature-collection/src/lib/paths.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum SignatureCollectionPaths {
RootPath = '/min-gogn/listar',
GeneralPetitions = '/min-gogn/listar/undirskriftalistar',

// Parliamentary
SignatureCollectionParliamentaryLists = '/min-gogn/listar/althingis-medmaelasofnun',
Expand Down
12 changes: 6 additions & 6 deletions libs/service-portal/signature-collection/src/module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { lazy } from 'react'
import { m } from '@island.is/service-portal/core'
import { PortalModule, PortalRoute } from '@island.is/portals/core'
import { SignatureCollectionPaths } from './lib/paths'
import { Features } from '@island.is/feature-flags'
import { ApiScope } from '@island.is/auth/scopes'
import { Navigate } from 'react-router-dom'

Expand All @@ -19,41 +18,42 @@ const ViewListParliamentary = lazy(() =>

export const signatureCollectionModule: PortalModule = {
name: m.signatureCollectionLists,
featureFlag: Features.servicePortalSignatureCollection,
routes: ({ userInfo }) => {
const applicationRoutes: PortalRoute[] = [
{
name: m.signatureCollectionParliamentaryLists,
path: SignatureCollectionPaths.RootPath,
enabled: userInfo.scopes.includes(ApiScope.signatureCollection),
element: (
<Navigate
to={SignatureCollectionPaths.SignatureCollectionParliamentaryLists}
replace
/>
/* Default path to general petitions since these are always ongoing */
<Navigate to={SignatureCollectionPaths.GeneralPetitions} replace />
),
},
{
name: m.signatureCollectionParliamentaryLists,
enabled: userInfo.scopes.includes(ApiScope.signatureCollection),
path: SignatureCollectionPaths.SignatureCollectionParliamentaryLists,
key: 'ParliamentaryLists',
element: <SignatureListsParliamentary />,
},
{
name: m.signatureCollectionPresidentialLists,
path: SignatureCollectionPaths.ViewParliamentaryList,
enabled: userInfo.scopes.includes(ApiScope.signatureCollection),
key: 'ParliamentaryLists',
element: <ViewListParliamentary />,
},
{
name: m.signatureCollectionPresidentialLists,
enabled: userInfo.scopes.includes(ApiScope.signatureCollection),
path: SignatureCollectionPaths.SignatureCollectionLists,
key: 'PresidentialLists',
element: <SignatureListsPresidential />,
},
{
name: m.signatureCollectionPresidentialLists,
path: SignatureCollectionPaths.ViewList,
key: 'PresidentialLists',
enabled: userInfo.scopes.includes(ApiScope.signatureCollection),
element: <ViewListPresidential />,
},
Expand Down

0 comments on commit ebccfee

Please sign in to comment.