Skip to content

Commit

Permalink
Remove feature flags gating and flags itself from .env for termed rol…
Browse files Browse the repository at this point in the history
…es and whitelisting
  • Loading branch information
mudrila committed Nov 14, 2024
1 parent 2f4d473 commit c4524ca
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 72 deletions.
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,4 @@ VITE_APP_WALLET_CONNECT_PROJECT_ID=""

# FEATURE FLAGS (Must equal "ON")
VITE_APP_FLAG_DEVELOPMENT_MODE=""
VITE_APP_FLAG_WHITELISTING=""
VITE_APP_FLAG_TERMED_ROLES=""
VITE_APP_FLAG_DEMO_MODE=""
5 changes: 2 additions & 3 deletions src/components/Roles/RoleDetailsTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Divider, Tab, TabList, TabPanel, TabPanels, Tabs, Text } from '@chakra-
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { Address, Hex } from 'viem';
import { isFeatureEnabled } from '../../constants/common';
import {
paymentSorterByActiveStatus,
paymentSorterByStartDate,
Expand Down Expand Up @@ -115,11 +114,11 @@ export default function RoleDetailsTabs({
mt={4}
>
<TabList>
{isFeatureEnabled('TERMED_ROLES') && isTermed && <Tab>{t('terms')}</Tab>}
{isTermed && <Tab>{t('terms')}</Tab>}
<Tab>{t('payments')}</Tab>
</TabList>
<TabPanels mt={4}>
{isFeatureEnabled('TERMED_ROLES') && isTermed && (
{isTermed && (
<TabPanel>
<RoleTermDetails
hatId={hatId}
Expand Down
63 changes: 30 additions & 33 deletions src/components/Roles/forms/RoleFormInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,39 +103,36 @@ export default function RoleFormInfo() {
</FormControl>
</Box>
{/* @dev - deploying whitelisting voting strategy is feasible from UI/UX standpoint only when Safe has Azorius module AND hatsTree been created already */}
{type !== GovernanceType.MULTISIG &&
!!hatsTree &&
!!hatsTreeId &&
import.meta.env.VITE_APP_FLAG_WHITELISTING === 'ON' && (
<FormControl>
<Field name="roleEditing.canCreateProposals">
{() => (
<Flex
justifyContent="space-between"
alignItems="center"
padding={4}
borderRadius={8}
border="1px solid"
borderColor="neutral-3"
>
<Text>{t('canCreateProposals')}</Text>
<Switch
size="md"
variant="secondary"
onChange={() =>
setFieldValue(
'roleEditing.canCreateProposals',
!values.roleEditing?.canCreateProposals,
)
}
isChecked={values.roleEditing?.canCreateProposals}
isDisabled={!values.roleEditing}
/>
</Flex>
)}
</Field>
</FormControl>
)}
{type !== GovernanceType.MULTISIG && !!hatsTree && !!hatsTreeId && (
<FormControl>
<Field name="roleEditing.canCreateProposals">
{() => (
<Flex
justifyContent="space-between"
alignItems="center"
padding={4}
borderRadius={8}
border="1px solid"
borderColor="neutral-3"
>
<Text>{t('canCreateProposals')}</Text>
<Switch
size="md"
variant="secondary"
onChange={() =>
setFieldValue(
'roleEditing.canCreateProposals',
!values.roleEditing?.canCreateProposals,
)
}
isChecked={values.roleEditing?.canCreateProposals}
isDisabled={!values.roleEditing}
/>
</Flex>
)}
</Field>
</FormControl>
)}
</>
);
}
8 changes: 2 additions & 6 deletions src/components/Roles/forms/RoleFormMember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Field, FieldInputProps, FieldMetaProps, FormikProps, useFormikContext }
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { DecentHourGlass } from '../../../assets/theme/custom/icons/DecentHourGlass';
import { DETAILS_BOX_SHADOW, isFeatureEnabled } from '../../../constants/common';
import { DETAILS_BOX_SHADOW } from '../../../constants/common';
import useAddress from '../../../hooks/utils/useAddress';
import { useGetAccountName } from '../../../hooks/utils/useGetAccountName';
import { RoleFormValues } from '../../../types/roles';
Expand Down Expand Up @@ -333,10 +333,6 @@ export function RoleFormMember() {
const { values } = useFormikContext<RoleFormValues>();

if (!!values.roleEditing?.isTermed) {
if (!isFeatureEnabled('TERMED_ROLES')) {
// @prevent any sheningans on different environments
return null;
}
return <RoleFormTerms />;
}
return (
Expand All @@ -356,7 +352,7 @@ export function RoleFormMember() {
>
<RoleMemberWearerInput />
</Box>
{isFeatureEnabled('TERMED_ROLES') && <RoleFormMemberTermToggle />}
<RoleFormMemberTermToggle />
</Box>
);
}
26 changes: 12 additions & 14 deletions src/components/SafeSettings/SettingsNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,19 @@ export default function SettingsNavigation() {
{fractalModules.length + safe.guard ? 1 : 0}
</Text>
</SettingsLink>
{import.meta.env.VITE_APP_FLAG_WHITELISTING === 'ON' && (
<SettingsLink
path={DAO_ROUTES.settingsPermissions.relative(addressPrefix, safe.address)}
leftIcon={<CheckSquare fontSize="1.5rem" />}
title={t('permissionsTitle')}
showDivider={false}
<SettingsLink
path={DAO_ROUTES.settingsPermissions.relative(addressPrefix, safe.address)}
leftIcon={<CheckSquare fontSize="1.5rem" />}
title={t('permissionsTitle')}
showDivider={false}
>
<Text
textStyle="body-base"
color="neutral-7"
>
<Text
textStyle="body-base"
color="neutral-7"
>
{azoriusGovernance.votingStrategy ? 1 : 0}
</Text>
</SettingsLink>
)}
{azoriusGovernance.votingStrategy ? 1 : 0}
</Text>
</SettingsLink>
</>
)}
</Flex>
Expand Down
24 changes: 10 additions & 14 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,20 +214,16 @@ export const router = (addressPrefix: string, daoAddress: string | undefined) =>
path: DAO_ROUTES.settingsModulesAndGuard.path,
element: <SafeModulesSettingsPage />,
},
...(import.meta.env.VITE_APP_FLAG_WHITELISTING === 'ON'
? [
{
path: DAO_ROUTES.settingsPermissions.path,
element: <SafePermissionsSettingsPage />,
children: [
{
path: DAO_ROUTES.settingsPermissionsCreateProposal.path,
element: <SafePermissionsCreateProposal />,
},
],
},
]
: []),
{
path: DAO_ROUTES.settingsPermissions.path,
element: <SafePermissionsSettingsPage />,
children: [
{
path: DAO_ROUTES.settingsPermissionsCreateProposal.path,
element: <SafePermissionsCreateProposal />,
},
],
},
],
},
{
Expand Down

0 comments on commit c4524ca

Please sign in to comment.