Skip to content

Commit

Permalink
Overhauled docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Nov 8, 2022
1 parent bbc9d55 commit 122eab9
Show file tree
Hide file tree
Showing 79 changed files with 265 additions and 100 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ yarn
If you're here to work on UI components in isolation, you will likely want to
run the [Storybook](https://storybook.js.org/) server to mock up components and
iterate quickly without having to access live chain data. Check out the
[storybook package README](./packages/storybook/README.md) for usage
[storybook package README](./packages/storybook) for usage
instructions.

To start the Storybook server, run this command from the root of this monorepo:
Expand All @@ -49,24 +49,24 @@ If something is misconfigured, check out the docs for

## Packages

#### `apps/`
#### `/apps`

| App | Summary |
| ------------------------------- | ----------- |
| [`dapp`](./apps/dapp/README.md) | DAO DAO UI. |
| App | Summary |
| --------------------- | ---------------------------------------------------------------- |
| [`dapp`](./apps/dapp) | DAO DAO UI hosted at [https://daodao.zone](https://daodao.zone). |

#### `packages/`
#### `/packages`

| Package | Summary |
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| [`config`](./packages/config/README.md) | Configurations for various dev tools. |
| [`i18n`](./packages/i18n/README.md) | Translation system. |
| [`state`](./packages/state/README.md) | State retrieval and management for the DAO DAO UI. |
| [`stateful`](./packages/stateful/README.md) | Stateful components, hooks, and systems that access and manipulate live data. |
| [`stateless`](./packages/stateless/README.md) | React components, React hooks, and other stateless rendering utilities which do not access live data. |
| [`storybook`](./packages/storybook/README.md) | [Storybook](https://storybook.js.org/) server configuration. |
| [`types`](./packages/types/README.md) | Types used across packages. |
| [`utils`](./packages/utils/README.md) | Utility functions used across packages. |
| Package | Summary |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------- |
| [`config`](./packages/config) | Configurations for various dev tools. |
| [`i18n`](./packages/i18n) | Internationalization/translation system. |
| [`state`](./packages/state) | State retrieval and management for the DAO DAO UI. |
| [`stateful`](./packages/stateful) | Stateful components, hooks, and systems that access and manipulate live data. |
| [`stateless`](./packages/stateless) | React components, React hooks, and other stateless rendering utilities which do not access live data. |
| [`storybook`](./packages/storybook) | [Storybook](https://storybook.js.org/) server configuration and story decorators. |
| [`types`](./packages/types) | Types used across packages. |
| [`utils`](./packages/utils) | Utility functions used across packages. |

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion apps/dapp/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# dao-dao-dapp
# @dao-dao/dapp

Web application for creating and managing multiple DAOs. Live in production at
[daodao.zone](https://daodao.zone).
Expand Down
9 changes: 9 additions & 0 deletions packages/config/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# @dao-dao/config

Configuration package for various dev tools (e.g. ESLint, Prettier, TSC, etc.)

## Layout

| Location | Summary |
| --------------------------------- | ----------------------------------------------------- |
| [`eslint`](./eslint/index.js) | [ESLint](https://eslint.org/) config. |
| [`prettier`](./prettier/index.js) | [Prettier](https://prettier.io/) config. |
| [`tailwind`](./tailwind) | [Tailwind CSS](https://tailwindcss.com/) config. |
| [`ts`](./ts) | [TypeScript](https://www.typescriptlang.org/) config. |
3 changes: 2 additions & 1 deletion packages/i18n/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# @dao-dao/i18n

Translations for the DAO DAO UI.
[Internationalization](https://www.w3.org/standards/webdesign/i18n) (i.e.
translation) system for the DAO DAO UI.

## Contributing a translation

Expand Down
4 changes: 2 additions & 2 deletions packages/state/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

State retrieval and management for the DAO DAO UI.

## Folders
## Layout

| Folder | Summary |
| Location | Summary |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`contracts`](./contracts) | Smart contract query and execute clients auto-generated with [@cosmwasm/ts-codegen](https://www.npmjs.com/package/@cosmwasm/ts-codegen). |
| [`recoil`](./recoil) | [Recoil](https://recoiljs.org/) atoms and selectors for loading and caching state. |
Expand Down
20 changes: 13 additions & 7 deletions packages/stateful/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ This package combines the `@dao-dao/stateless` and `@dao-dao/state` packages
into stateful components, hooks, and other systems. These are the live,
intelligent components that do fun stuff with data.

## Systems
## Layout

| System | Summary |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [`actions`](./actions/README.md) | UI components that allow for the creation and viewing of Cosmos messages in a proposal. |
| [`command`](./command/README.md) | Interface that allows customizing command modal actions and contexts. |
| [`proposal-module-adapter`](./proposal-module-adapter/README.md) | Proposal module adapter system that allows dynamic support for proposal modules in the UI. |
| [`voting-module-adapter`](./voting-module-adapter/README.md) | Voting module adapter system that allows dynamic support for voting modules in the UI. |
| Location | Summary |
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`actions`](./actions) | UI components that allow for the creation and viewing of Cosmos messages in a proposal. |
| [`command`](./command) | Interface that allows customizing command modal actions and contexts. |
| [`components`](./components) | Stateful React components that combine elements from the [`state` package](../state) and [`stateless` package](../stateless). |
| [`hooks`](./hooks) | Stateful React hooks that combine elements from the [`state` package](../state) and [`stateless` package](../stateless). Notably, contains hooks for interacting with on-chain smart contracts. |
| [`proposal-module-adapter`](./proposal-module-adapter) | Proposal module adapter system that allows dynamic support for proposal modules in the UI. |
| [`recoil`](./recoil) | [Recoil](https://recoiljs.org) atoms and selectors that require [`state`](../state) or other stateful information. |
| [`server`](./server) | Isolated functions only to be run on the server. Notably, contains main [Static Site Generation](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) code. |
| [`utils`](./utils) | Stateful utility functions. |
| [`voting-module-adapter`](./voting-module-adapter) | Voting module adapter system that allows dynamic support for voting modules in the UI. |
| [`featured_daos.json`](./featured_daos.json) | The list of featured DAOs on [Juno](https://junonetwork.io) mainnet (`juno-1`). |
2 changes: 1 addition & 1 deletion packages/stateful/components/SuspenseLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useRecoilValue } from 'recoil'

import { mountedInBrowserAtom } from '@dao-dao/state'
import { ErrorBoundary } from '@dao-dao/stateless'
import { SuspenseLoaderProps } from '@dao-dao/types/components/SuspenseLoader'
import { SuspenseLoaderProps } from '@dao-dao/types/stateless/SuspenseLoader'

export const SuspenseLoader = ({
ErrorBoundaryComponent = ErrorBoundary,
Expand Down
2 changes: 1 addition & 1 deletion packages/stateful/components/dao/DaoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
DaoCard as StatelessDaoCard,
useCachedLoadable,
} from '@dao-dao/stateless'
import { DaoCardInfo } from '@dao-dao/types/components/DaoCard'
import { DaoCardInfo } from '@dao-dao/types/stateless/DaoCard'
import { CHAIN_ID, loadableToLoadingData } from '@dao-dao/utils'

import { usePinnedDaos } from '../../hooks'
Expand Down
2 changes: 1 addition & 1 deletion packages/stateful/components/dao/DaoMemberCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DaoMemberCard as StatelessDaoMemberCard } from '@dao-dao/stateless'
import { DaoMemberCardProps } from '@dao-dao/types/components/DaoMemberCard'
import { DaoMemberCardProps } from '@dao-dao/types/stateless/DaoMemberCard'

import { useProfile } from '../../hooks'

Expand Down
2 changes: 1 addition & 1 deletion packages/stateful/components/dao/SplashDaoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaoCard as StatelessDaoCard,
useCachedLoadable,
} from '@dao-dao/stateless'
import { DaoCardInfo } from '@dao-dao/types/components/DaoCard'
import { DaoCardInfo } from '@dao-dao/types/stateless/DaoCard'
import { loadableToLoadingData } from '@dao-dao/utils'

import { daoCardInfoLazyDataSelector } from '../../recoil'
Expand Down
4 changes: 4 additions & 0 deletions packages/stateful/hooks/contracts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# @dao-dao/stateful/hooks/contracts

React hook wrappers around smart contract clients to make it easy to execute
smart contracts.
15 changes: 15 additions & 0 deletions packages/stateful/proposal-module-adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

Author: [@NoahSaso](https://github.com/NoahSaso)

## Adapters

| Adapter | Summary |
| ------------------------------------------------- | ----------------------- |
| [CwdProposalSingle](./adapters/CwdProposalSingle) | Single choice proposals |

## Layout

| Location | Summary |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [adapters](./adapters) | Proposal module adapters. |
| [react](./react) | The external React interface used by apps and packages when using this proposal module adapter system. This uses the core logic under the hood. |
| [recoil](./recoil) | The external [Recoil](https://recoiljs.org) interface used by apps and packages when using this proposal module adapter system. This uses the core logic under the hood. |
| [core.ts](./core.ts) | The core logic that matches and loads an adapter from the available adapters. |

## What is it?

This is a proposal module adapter package. It creates a common interface for
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CwdProposalSingle

This is the proposal module adapter for the
[`cwd-proposal-single`](https://github.com/DA0-DA0/dao-contracts/tree/main/contracts/proposal/cwd-proposal-single)
contract, which powers single choice proposals. It supports `Yes`, `No`, and
`Abstain` votes, and a passing proposal may execute a set of actions on behalf
of the DAO.

## Layout

| Location | Summary |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [common](./common) | Actions, components, and hooks for the common part of the adapter. |
| [components](./components) | React components. |
| [contracts](./contracts) | Smart contract clients generated by [`@cosmwasm/ts-codegen`](https://github.com/CosmWasm/ts-codegen), React hooks, and [Recoil](https://recoiljs.org/) selectors. |
| [daoCreation](./daoCreation) | Components and functions relating to the DAO creation flow adapter configuration. |
| [functions](./functions) | Functions. |
| [hooks](./hooks) | React hooks. |
| [index.tsx](./index.tsx) | Adapter definition. |
| [types.ts](./types.ts) | Types local to this adapter. |
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Buffer } from 'buffer'

import { DaoCreationGetInstantiateInfo } from '@dao-dao/types'
import { InstantiateMsg as CwPreProposeSingleInstantiateMsg } from '@dao-dao/types/contracts/CwdPreProposeSingle'
import { PercentageThreshold } from '@dao-dao/types/contracts/CwdProposalSingle.common'
import { InstantiateMsg as CwProposalSingleInstantiateMsg } from '@dao-dao/types/contracts/CwdProposalSingle.v2'
import {
CODE_ID_CONFIG,
Expand All @@ -19,8 +20,7 @@ import {
GovernanceTokenType,
} from '../../../../voting-module-adapter/adapters/CwdVotingCw20Staked/types'
import { CwdProposalSingleAdapter } from '../../index'
import { DaoCreationConfig } from '../types'
import { convertThresholdValueToPercentageThreshold } from '../utils'
import { DaoCreationConfig, ThresholdValue } from '../types'
import instantiateSchema from './instantiate_schema.json'
import preProposeInstantiateSchema from './pre_propose_instantiate_schema.json'

Expand Down Expand Up @@ -139,3 +139,9 @@ export const getInstantiateInfo: DaoCreationGetInstantiateInfo<
msg: Buffer.from(JSON.stringify(msg), 'utf8').toString('base64'),
}
}

const convertThresholdValueToPercentageThreshold = ({
majority,
value,
}: ThresholdValue): PercentageThreshold =>
majority ? { majority: {} } : { percent: (value / 100).toFixed(2) }

This file was deleted.

18 changes: 18 additions & 0 deletions packages/stateful/voting-module-adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

Author: [@NoahSaso](https://github.com/NoahSaso)

## Adapters

| Adapter | Summary |
| --------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [CwdVotingCw20Staked](./adapters/CwdVotingCw20Staked) | [CW20](https://docs.cosmwasm.com/cw-plus/0.9.0/cw20/spec) token staked balance voting. |
| [CwdVotingCw4](./adapters/CwdVotingCw4) | [CW4](https://docs.cosmwasm.com/cw-plus/0.9.0/cw4/cw4-group-spec) group voting, multisig style. |
| [CwdVotingNativeStaked](./adapters/CwdVotingNativeStaked) | Native token staked balance voting. |
| [Fallback](./adapters/Fallback) | Fallback to allow for DAO page rendering even with an unsupported voting module. |

## Layout

| Location | Summary |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| [adapters](./adapters) | Voting module adapters. |
| [components](./components) | Components shared between adapters. |
| [react](./react) | The external React interface used by apps and packages when using this voting module adapter system. This uses the core logic under the hood. |
| [core.ts](./core.ts) | The core logic that matches and loads an adapter from the available adapters. |

## What is it?

This is a voting module adapter package. It creates a common interface for
Expand Down
Loading

0 comments on commit 122eab9

Please sign in to comment.