Skip to content

Commit

Permalink
Merge branch 'feature/#2533-example-proposal-templates' into feature/#…
Browse files Browse the repository at this point in the history
…2533-sablier-and-transfer-template
  • Loading branch information
mudrila committed Jan 10, 2025
2 parents 7c72f99 + fd0f3e1 commit bbbb82a
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "decent-interface",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"dependencies": {
"@amplitude/analytics-browser": "^2.11.1",
Expand Down
Binary file modified public/images/hero_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/css/Toast.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
margin-right: 0;
}

.sonner-toast[data-type='loading'] [data-icon] {
margin-top: 8px;
}

.sonner-toast [data-icon] svg {
width: 24px;
height: 24px;
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProposalBuilder/ProposalMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FormikProps } from 'formik';
import { useTranslation } from 'react-i18next';
import { CreateProposalForm, ProposalBuilderMode } from '../../types/proposalBuilder';
import { InputComponent, TextareaComponent } from '../ui/forms/InputComponent';
import { builderInProposalMode } from './constants';

export interface ProposalMetadataProps extends FormikProps<CreateProposalForm> {
mode: ProposalBuilderMode;
Expand All @@ -14,8 +15,7 @@ export default function ProposalMetadata({
mode,
}: ProposalMetadataProps) {
const { t } = useTranslation(['proposalTemplate', 'proposal', 'common']);
const isProposalMode =
mode === ProposalBuilderMode.PROPOSAL || mode === ProposalBuilderMode.PROPOSAL_WITH_ACTIONS;
const isProposalMode = builderInProposalMode(mode);

return (
<VStack
Expand Down
22 changes: 11 additions & 11 deletions src/components/ProposalBuilder/ProposalTransaction.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
VStack,
HStack,
Text,
Accordion,
AccordionButton,
AccordionItem,
AccordionPanel,
Box,
Flex,
HStack,
IconButton,
Accordion,
AccordionPanel,
AccordionItem,
AccordionButton,
Radio,
Text,
VStack,
} from '@chakra-ui/react';
import { Plus, MinusCircle, CaretDown, CaretRight } from '@phosphor-icons/react';
import { CaretDown, CaretRight, MinusCircle, Plus } from '@phosphor-icons/react';
import { useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { CreateProposalTransaction, ProposalBuilderMode } from '../../types/proposalBuilder';
Expand All @@ -21,7 +21,7 @@ import ExampleLabel from '../ui/forms/ExampleLabel';
import { BigIntComponent, InputComponent } from '../ui/forms/InputComponent';
import CeleryButtonWithIcon from '../ui/utils/CeleryButtonWithIcon';
import Divider from '../ui/utils/Divider';
import { DEFAULT_PROPOSAL_TRANSACTION } from './constants';
import { builderInProposalMode, DEFAULT_PROPOSAL_TRANSACTION } from './constants';

interface ProposalTransactionProps {
transaction: CreateProposalTransaction;
Expand All @@ -42,7 +42,7 @@ export default function ProposalTransaction({
setFieldValue,
mode,
}: ProposalTransactionProps) {
const isProposalMode = mode === ProposalBuilderMode.PROPOSAL;
const isProposalMode = builderInProposalMode(mode);
const { t } = useTranslation(['proposal', 'proposalTemplate', 'common']);
const [expandedIndecies, setExpandedIndecies] = useState<number[]>([0]);

Expand Down Expand Up @@ -193,7 +193,7 @@ export default function ProposalTransaction({
setFieldValue(
`transactions.${transactionIndex}.parameters`,
transaction.parameters.filter(
(parameterToRemove, parameterToRemoveIndex) =>
(_parameterToRemove, parameterToRemoveIndex) =>
parameterToRemoveIndex !== i,
),
)
Expand Down
13 changes: 12 additions & 1 deletion src/components/ProposalBuilder/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { CreateProposalTransaction, Stream, Tranche } from '../../types/proposalBuilder';
import {
CreateProposalTransaction,
ProposalBuilderMode,
Stream,
Tranche,
} from '../../types/proposalBuilder';

export const builderInProposalMode = (mode: ProposalBuilderMode) =>
mode === ProposalBuilderMode.PROPOSAL ||
mode === ProposalBuilderMode.PROPOSAL_WITH_ACTIONS ||
mode === ProposalBuilderMode.SABLIER ||
mode === ProposalBuilderMode.PROPOSAL_FROM_TEMPLATE;

export const DEFAULT_PROPOSAL_TRANSACTION: CreateProposalTransaction = {
targetAddress: '',
Expand Down
9 changes: 5 additions & 4 deletions src/components/ProposalBuilder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import ProposalMetadata from './ProposalMetadata';
import { ProposalStreams } from './ProposalStreams';
import ProposalTransactionsForm from './ProposalTransactionsForm';
import StepButtons from './StepButtons';
import { builderInProposalMode } from './constants';

interface ProposalBuilderProps {
mode: ProposalBuilderMode;
Expand All @@ -53,8 +54,8 @@ export function ProposalBuilder({
const step = (paths[paths.length - 1] || paths[paths.length - 2]) as
| CreateProposalSteps
| undefined;
const isProposalMode =
mode === ProposalBuilderMode.PROPOSAL || mode === ProposalBuilderMode.PROPOSAL_WITH_ACTIONS;
const isProposalMode = builderInProposalMode(mode);
const isSablierMode = mode === ProposalBuilderMode.SABLIER;

const {
governance: { isAzorius },
Expand Down Expand Up @@ -218,13 +219,13 @@ export function ProposalBuilder({
/>
<Route
path={
mode === ProposalBuilderMode.SABLIER
isSablierMode
? CreateProposalSteps.STREAMS
: CreateProposalSteps.TRANSACTIONS
}
element={
<>
{mode === ProposalBuilderMode.SABLIER ? (
{isSablierMode ? (
<ProposalStreams
pendingTransaction={pendingCreateTx}
{...formikProps}
Expand Down
2 changes: 0 additions & 2 deletions src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export const MAX_CONTENT_WIDTH = '80rem';

const features = {
developmentMode: 'DEVELOPMENT_MODE',
termedRoles: 'TERMED_ROLES',
demoMode: 'DEMO_MODE',
} as const;

Expand All @@ -72,7 +71,6 @@ export const isFeatureEnabled = (feature: FeatureFlag) => {
};

export const isDevMode = () => isFeatureEnabled(features.developmentMode);
export const isTermedRolesEnabled = () => isFeatureEnabled(features.termedRoles);
export const isDemoMode = () => isFeatureEnabled(features.demoMode);

/**
Expand Down
14 changes: 7 additions & 7 deletions src/hooks/DAO/loaders/governance/useAzoriusProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ export const useAzoriusProposals = () => {

let proposalData;

if (
proposalCreatedEvent.args.proposer === undefined ||
proposalCreatedEvent.args.strategy === undefined
) {
continue;
}

if (proposalCreatedEvent.args.metadata && proposalCreatedEvent.args.transactions) {
const metadataEvent = parseProposalMetadata(proposalCreatedEvent.args.metadata);

Expand Down Expand Up @@ -273,13 +280,6 @@ export const useAzoriusProposals = () => {
}
}

if (
proposalCreatedEvent.args.proposer === undefined ||
proposalCreatedEvent.args.strategy === undefined
) {
continue;
}

let strategyType: VotingStrategyType | undefined;
const strategyAddress = proposalCreatedEvent.args.strategy;
const {
Expand Down
4 changes: 1 addition & 3 deletions src/pages/create/SafeCreatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ export function SafeCreatePage() {
if (daoFound) {
navigate(DAO_ROUTES.dao.relative(addressPrefix, safeAddress));
} else {
toast.loading(t('failedIndexSafe'), {
duration: Infinity,
});
toast.loading(t('failedIndexSafe'));
navigate(BASE_ROUTES.landing);
}
},
Expand Down
19 changes: 14 additions & 5 deletions src/utils/azorius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,20 @@ export const mapProposalCreatedEventToProposal = async (
abstainVotes: 0n,
};

const strategyContract = getContract({
address: strategyAddress,
abi: abis.LinearERC20Voting,
client: publicClient,
});
const strategyContract =
strategyType === VotingStrategyType.LINEAR_ERC20 ||
strategyType === VotingStrategyType.LINEAR_ERC20_HATS_WHITELISTING
? getContract({
address: strategyAddress,
abi: abis.LinearERC20Voting,
client: publicClient,
})
: getContract({
address: strategyAddress,
abi: abis.LinearERC721Voting,
client: publicClient,
});

const stratProposalVotes = await strategyContract.read.getProposalVotes([proposalId]);
proposalVotes.noVotes = stratProposalVotes[0];
proposalVotes.yesVotes = stratProposalVotes[1];
Expand Down

0 comments on commit bbbb82a

Please sign in to comment.