Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.5.4 #535

Merged
merged 7 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions apps/summon-safe/src/components/Toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import styled from 'styled-components';
import { Control, Controller } from 'react-hook-form';
import { Switch, Text } from '@gnosis.pm/safe-react-components';

Expand All @@ -8,11 +9,18 @@ interface ToggleProps {
required?: boolean;
disabled?: boolean;
shouldUnregister: boolean;
switchLabel?: string;
control: Control;
}

const Container = styled.div`
display: flex;
flex-direction: row;
align-items: center;
`;

const Toggle: React.FC<ToggleProps> = (props: ToggleProps) => {
const { id, label, required, control, shouldUnregister } = props;
const { id, label, required, control, shouldUnregister, switchLabel } = props;

return (
<Controller
Expand All @@ -26,7 +34,14 @@ const Toggle: React.FC<ToggleProps> = (props: ToggleProps) => {
render={({ field }) => (
<>
<Text size="md">{`${label}${required ? ' (*)' : ''}`}</Text>
<Switch key={id} checked={field.value} onChange={field.onChange} />
<Container>
<Switch key={id} checked={field.value} onChange={field.onChange} />
{switchLabel && (
<Text size="md">{`${
field.value === false ? 'Not ' : ''
}${switchLabel}`}</Text>
)}
</Container>
</>
)}
/>
Expand Down
50 changes: 26 additions & 24 deletions apps/summon-safe/src/views/SummonForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ const SummonForm: React.FC<SummonFormProps> = (props: SummonFormProps) => {
required
control={methods.control}
shouldUnregister={false}
switchLabel="Transferrable"
/>
</Grid>
<Grid item xs={5}>
Expand All @@ -269,6 +270,7 @@ const SummonForm: React.FC<SummonFormProps> = (props: SummonFormProps) => {
required
control={methods.control}
shouldUnregister={false}
switchLabel="Transferrable"
/>
</Grid>
</StyledPairInputContainer>
Expand Down Expand Up @@ -382,55 +384,55 @@ const SummonForm: React.FC<SummonFormProps> = (props: SummonFormProps) => {
<Divider />

<Title size="sm" withoutMargin>
Starting Shamans
Starting Members
</Title>
<Text size="md">
Shamans are powerful and have control over key components of the
DAO. Use caution in the spirit world.
You must have at least one member to summon. Add other summoning
members as desired. Members can be added later through a proposal.
</Text>
<RecordsDataTable
id="shamans"
label="Shamans"
description="Addresses & Permissions"
placeholder="0xbeef 3"
tooltip="Input Shaman list with contract address and permission level per row using spaces. E.g. 0xbeef 3"
columns={SHAMAN_PROPS}
required={false}
id="members"
label="Members"
description="Addresses & Stake Amounts"
placeholder="0xbeef 10 10"
tooltip="Input member list with member address, voting stake amount, and no-voting stake amount per row using spaces. E.g. 0xdeed 10 10 \n0xbeef 0 10"
columns={MEMBER_PROPS}
required
disabled={formDisabled}
control={methods.control}
shouldUnregister={false}
register={methods.register}
registerOptions={{
transform: transformShamans,
validate: validateShamanData,
transform: transformMemberData,
validate: validateMemberData,
}}
setValue={methods.setValue}
getValues={methods.getValues}
/>
<Divider />

<Title size="sm" withoutMargin>
Starting Members
Starting Shamans
</Title>
<Text size="md">
You must have at least one member to summon. Add other summoning
members as desired. Members can be added later through a proposal.
Shamans are powerful and have control over key components of the
DAO. Use caution in the spirit world.
</Text>
<RecordsDataTable
id="members"
label="Members"
description="Addresses & Stake Amounts"
placeholder="0xbeef 10 10"
tooltip="Input member list with member address, voting stake amount, and no-voting stake amount per row using spaces. E.g. 0xdeed 10 10 \n0xbeef 0 10"
columns={MEMBER_PROPS}
required
id="shamans"
label="Shamans"
description="Addresses & Permissions"
placeholder="0xbeef 3"
tooltip="Input Shaman list with contract address and permission level per row using spaces. E.g. 0xbeef 3"
columns={SHAMAN_PROPS}
required={false}
disabled={formDisabled}
control={methods.control}
shouldUnregister={false}
register={methods.register}
registerOptions={{
transform: transformMemberData,
validate: validateMemberData,
transform: transformShamans,
validate: validateShamanData,
}}
setValue={methods.setValue}
getValues={methods.getValues}
Expand Down
2 changes: 1 addition & 1 deletion libs/abis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/abis",
"version": "0.5.3",
"version": "0.5.4",
"type": "commonjs",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion libs/connect-context/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/connect-context",
"version": "0.5.3",
"version": "0.5.4",
"repository": {
"type": "git",
"url": "https://github.com/HausDAO/monorepo"
Expand Down
2 changes: 1 addition & 1 deletion libs/connect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/connect",
"version": "0.5.3",
"version": "0.5.4",
"peerDependencies": {
"react-router-dom": "^6.4.3"
},
Expand Down
2 changes: 1 addition & 1 deletion libs/contract-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/contract-utils",
"version": "0.5.3",
"version": "0.5.4",
"type": "commonjs",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion libs/data-fetch-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/data-fetch-utils",
"version": "0.5.3",
"version": "0.5.4",
"type": "commonjs",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion libs/form-builder-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/form-builder-base",
"version": "0.5.3",
"version": "0.5.4",
"repository": {
"type": "git",
"url": "https://github.com/HausDAO/monorepo"
Expand Down
2 changes: 1 addition & 1 deletion libs/form-builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/form-builder",
"version": "0.5.3",
"version": "0.5.4",
"repository": {
"type": "git",
"url": "https://github.com/HausDAO/monorepo"
Expand Down
2 changes: 1 addition & 1 deletion libs/keychain-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/keychain-utils",
"version": "0.5.3",
"version": "0.5.4",
"repository": {
"type": "git",
"url": "https://github.com/HausDAO/monorepo"
Expand Down
2 changes: 1 addition & 1 deletion libs/moloch-v3-data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/moloch-v3-data",
"version": "0.5.3",
"version": "0.5.4",
"type": "commonjs",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion libs/moloch-v3-data/src/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const listTokenBalances = async ({

try {
const res = await fetch.get<TokenBalance[]>(
`${url}/safes/${getAddress(safeAddress)}/balances/`
`${url}/safes/${getAddress(safeAddress)}/balances/?exclude_spam=true`
);

return { data: transformTokenBalances(res, safeAddress) };
Expand Down
2 changes: 1 addition & 1 deletion libs/moloch-v3-fields/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/moloch-v3-fields",
"version": "0.5.3",
"version": "0.5.4",
"repository": {
"type": "git",
"url": "https://github.com/HausDAO/monorepo"
Expand Down
2 changes: 1 addition & 1 deletion libs/moloch-v3-hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/moloch-v3-hooks",
"version": "0.5.3",
"version": "0.5.4",
"peerDependencies": {
"react-query": "^3.39.3"
},
Expand Down
2 changes: 1 addition & 1 deletion libs/moloch-v3-legos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/moloch-v3-legos",
"version": "0.5.3",
"version": "0.5.4",
"type": "commonjs",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion libs/moloch-v3-macro-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daohaus/moloch-v3-macro-ui",
"version": "0.5.3",
"version": "0.5.4",
"peerDependencies": {
"react-router-dom": "^6.4.3"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { useMemo } from 'react';
import { Column, Row } from 'react-table';

import { DaoTable } from '../DaohausTable';
import { Avatar } from '@daohaus/ui';
import { SafeToken } from './SafeCard.styles';

type TokenBalanceType = {
tokenLogo?: string | null;
tokenName: string;
tokenSymbol: string;
balance: number;
};

type SafeBalancesTableProps = {
balances: Array<TokenBalanceType>;
};

export const SafeBalancesTable = ({ balances }: SafeBalancesTableProps) => {
const columns = useMemo<Column<TokenBalanceType>[]>(
() => [
{
Header: 'Asset',
accessor: 'tokenName',
Cell: ({
value,
row,
}: {
value: string;
row: Row<TokenBalanceType>;
}) => {
return (
<SafeToken>
<div style={{ fontSize: '1rem' }}>
<Avatar
alt={value}
size="md"
src={row.original.tokenLogo || ''}
fallback={row.original.tokenSymbol}
/>
</div>
<span>{value}</span>
</SafeToken>
);
},
},
{
Header: 'Balance',
accessor: 'balance',
Cell: ({
value,
row,
}: {
value: number;
row: Row<TokenBalanceType>;
}) => {
return <div>{`${value} ${row.original.tokenSymbol}`}</div>;
},
},
],
[balances]

Check warning on line 61 in libs/moloch-v3-macro-ui/src/components/SafeCard/SafeBalancesTable.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useMemo has an unnecessary dependency: 'balances'. Either exclude it or remove the dependency array

Check warning on line 61 in libs/moloch-v3-macro-ui/src/components/SafeCard/SafeBalancesTable.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useMemo has an unnecessary dependency: 'balances'. Either exclude it or remove the dependency array
);

return (
<DaoTable<TokenBalanceType>
tableData={balances}
columns={columns}
sortableColumns={[]}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ export const SafeActionMenuLink = styled(RouterLink)`
${DropdownLinkStyles}
font-weight: ${font.weight.bold};
`;

export const SafeToken = styled.div`
display: flex;
align-items: center;
gap: 1rem;
`;
Loading
Loading