0.5.0 • Published 6 days ago

@daohaus/moloch-v3-macro-ui v0.5.0

Weekly downloads
-
License
-
Repository
github
Last release
6 days ago

@daohaus/moloch-v3-macro-ui

A set of fully functional DAO user interface React components that allow you to rapidly develop complex DAO apps.

  • DAO Overview ans settings
  • Proposal cards, lists, details and votes
  • Member cards, lists and profiles
  • Safe/vault cards and lists

View on NPM

Usage

Installation

yarn add @daohaus/moloch-v3-macro-ui

Requirements

If your are targeting a DAO on the Etheruem Mainnet or Gnosis Chain (and more to come) you will need to provide an API key from TheGraph. Learn to get those here and here.

You will need to wrap the tree of your app with macro components in the from @daohaus/ui and the from @daohaus/tx-builder and the CurrentDaoProvider from @daohaus/moloch-v3-hooks

// main.tsx
const queryClient = new QueryClient();

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
  <React.StrictMode>
    <HashRouter>
      <QueryClientProvider client={queryClient}>
        <DHConnectProvider daoChainId={"0x1"}>
          <HausThemeProvider>
            <Routes />
          </HausThemeProvider>
        </DHConnectProvider>
      </QueryClientProvider>
    </HashRouter>
  </React.StrictMode>
);

//somePage.tsx
import { useDHConnect } from "@daohaus/connect";
import { TXBuilder } from "@daohaus/tx-builder";
import { CurrentDaoProvider } from "@daohaus/moloch-v3-hooks";

export const LayoutContainer = () => {
  const { publicClient, address } = useDHConnect();

  return (
    <TXBuilder
      publicClient={publicClient}
      chainId={"0x1"}
      daoId={"0x0daoaddress"}
      safeId={'0x0safeaddress'}
    >
      <CurrentDaoProvider
        targetDao={{
          daoChain: "0x1",
          daoId: "0x0daoaddress",
        }}
      >
        <SomeComponentWithMacroUI />
      </CurrentDaoProvider>
    </TXBuilder>
  );
};

Examples

There are examples of all macro components in our dao-app-starter repo

How to display a DAO overview

import { DaoOverview } from '@daohaus/moloch-v3-macro-ui';

export const Dao = () => {
  return <DaoOverview daoChain={'0x0'} daoId={'0x0daoaddress'} />;
};

How to display a proposal list

import { ProposalList } from '@daohaus/moloch-v3-macro-ui';
import { SingleColumnLayout } from '@daohaus/ui';

export const Proposals = () => {
  return (
    <SingleColumnLayout>
      <ProposalList header="Proposals" allowLinks={true} />
    </SingleColumnLayout>
  );
};

How to display a members list

import { MemberList } from '@daohaus/moloch-v3-macro-ui';
import { SingleColumnLayout } from '@daohaus/ui';

export const Members = () => {
  return (
    <SingleColumnLayout title="Members">
      <MemberList daoChain={'0x1'} daoId={'0x0daoaddress'} />
    </SingleColumnLayout>
  );
};

Building

Run nx run moloch-v3-macro-ui:build to build the library.

0.4.5

7 days ago

0.5.0

6 days ago

0.4.4

1 month ago

0.4.3

2 months ago

0.4.2

3 months ago

0.4.1

4 months ago

0.4.0

4 months ago

0.3.3

5 months ago

0.2.0-alpha.0

10 months ago

0.2.0-alpha.4

9 months ago

0.2.0-alpha.3

9 months ago

0.2.0-alpha.6

9 months ago

0.2.0-alpha.5

9 months ago

0.0.17

10 months ago

0.3.0

7 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.3.2

6 months ago

0.2.3

8 months ago

0.3.1

7 months ago

0.2.2

8 months ago

0.0.16

11 months ago

0.0.10

12 months ago

0.0.11

12 months ago

0.0.12

12 months ago

0.0.13

12 months ago

0.0.14

11 months ago

0.0.15

11 months ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.5

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago