diff --git a/packages/app/src/utils/url.ts b/packages/app/src/utils/url.ts index cdb2b67..c6da59c 100644 --- a/packages/app/src/utils/url.ts +++ b/packages/app/src/utils/url.ts @@ -18,7 +18,7 @@ export function rolesV1AppUrl(safeInfo: SafeInfo, rolesAddress: string) { } export function rolesV2AppUrl(safeInfo: SafeInfo, rolesAddress: string) { - const base = "http://localhost:3000" //"https://roles.gnosisguild.org" + const base = "https://roles.gnosisguild.org" const prefix = chainPrefix(safeInfo) return new URL(`${base}/${prefix}:${rolesAddress}`).href diff --git a/packages/app/src/views/AddModule/ModuleButton.tsx b/packages/app/src/views/AddModule/ModuleButton.tsx index d6d2918..7be9432 100644 --- a/packages/app/src/views/AddModule/ModuleButton.tsx +++ b/packages/app/src/views/AddModule/ModuleButton.tsx @@ -8,9 +8,9 @@ import { Tag } from "components/text/Tag" interface ModuleButtonProps extends BadgeIconProps { title: string description: string + available: boolean deprecated?: boolean className?: string - onClick(): void } @@ -19,9 +19,9 @@ const useStyles = makeStyles((theme) => ({ display: "flex", flexDirection: "column", alignItems: "center", - cursor: "pointer", userSelect: "none", padding: theme.spacing(2), + cursor: "pointer", transition: "0.2s ease all", "&:hover": { background: "rgba(217, 212, 173, 0.15)", @@ -34,27 +34,25 @@ const useStyles = makeStyles((theme) => ({ title: { marginBottom: theme.spacing(0.5), }, - deprecated: { - opacity: 0.7, - }, })) export const ModuleButton = ({ title, description, icon, + available, deprecated, className, onClick, }: ModuleButtonProps) => { const classes = useStyles() + if (!available) return null + return ( diff --git a/packages/app/src/views/AddModule/index.tsx b/packages/app/src/views/AddModule/index.tsx index ecc2158..df8f066 100644 --- a/packages/app/src/views/AddModule/index.tsx +++ b/packages/app/src/views/AddModule/index.tsx @@ -15,6 +15,11 @@ import { import { useSafeAppsSDK } from "@gnosis.pm/safe-apps-react-sdk" import { NETWORK } from "utils/networks" import { klerosAvailability } from "components/input/ArbitratorSelect" +import { + ContractAddresses as AllContractAddresses, + KnownContracts, + SupportedNetworks, +} from "@gnosis.pm/zodiac" const useStyles = makeStyles((theme) => ({ root: { @@ -57,6 +62,8 @@ export const AddModulesView = () => { dispatch(setModuleAdded(true)) } + const ContractAddresses = AllContractAddresses[safe.chainId as SupportedNetworks] + const title = hasModules ? "Add another mod" : "Start by adding a mod" return ( @@ -99,6 +106,7 @@ export const AddModulesView = () => { icon="bridge" onClick={() => setModule(ModuleType.BRIDGE)} className={classes.firstModule} + available={!!ContractAddresses[KnownContracts.BRIDGE]} /> { description="Enables a time delay between when a module initiates a transaction and when it can be executed" icon="delay" onClick={() => setModule(ModuleType.DELAY)} + available={!!ContractAddresses[KnownContracts.DELAY]} /> { description="Enables participants to redeem a designated token for a proportional share of this account’digital assets" icon="exit" onClick={() => setModule(ModuleType.EXIT)} + available={!!ContractAddresses[KnownContracts.EXIT_ERC20]} /> { description="Allows avatars to enforce granular, role-based, permissions for attached modules" icon="roles" onClick={() => setModule(ModuleType.ROLES_V2)} + available={!!ContractAddresses[KnownContracts.ROLES_V2]} + /> + + dispatch(setRealityModuleScreen(true))} + available={[NETWORK.MAINNET, NETWORK.GOERLI].includes(safe.chainId)} /> - {[NETWORK.MAINNET, NETWORK.GOERLI].includes(safe.chainId) ? ( - dispatch(setRealityModuleScreen(true))} - /> - ) : ( - setModule(ModuleType.REALITY_ETH)} - /> - )} - - {klerosAvailability.includes(safe.chainId) && ( - setModule(ModuleType.KLEROS_REALITY)} - /> - )} + setModule(ModuleType.REALITY_ETH)} + available={[NETWORK.MAINNET, NETWORK.GOERLI].includes(safe.chainId)} + /> + + setModule(ModuleType.KLEROS_REALITY)} + available={klerosAvailability.includes(safe.chainId)} + /> setModule(ModuleType.TELLOR)} + available={!!ContractAddresses[KnownContracts.TELLOR]} /> { description="Enables on-chain execution of successful Snapshot proposals utilizing UMA's optimistic oracle." icon="optimisticGov" onClick={() => setModule(ModuleType.OPTIMISTIC_GOVERNOR)} + available // TODO /> { description="Enables an Open Zeppelin Governor contract as a module." icon="ozGov" onClick={() => dispatch(setOzGovernorModuleScreen(true))} + available={!!ContractAddresses[KnownContracts.OZ_GOVERNOR]} /> { description="Enables an address on one chain to control an avatar on another chain using Connext as the messaging layer." icon="connext" onClick={() => setModule(ModuleType.CONNEXT)} + available={!!ContractAddresses[KnownContracts.CONNEXT]} /> { icon="roles" deprecated onClick={() => setModule(ModuleType.ROLES_V1)} + available={!!ContractAddresses[KnownContracts.ROLES_V1]} /> { description="Enable a custom contract as a module" icon="custom" onClick={() => setModule(ModuleType.UNKNOWN)} + available />