Skip to content

Commit

Permalink
chore: more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras committed Nov 5, 2020
1 parent 955683b commit 3a02314
Show file tree
Hide file tree
Showing 13 changed files with 575 additions and 9 deletions.
11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ module.exports = {
// Prettier Plugin
"plugin:prettier/recommended",
"prettier/react",

// MDX Plugin
"plugin:mdx/recommended",
],
plugins: ["regex", "graphql"],

Expand Down Expand Up @@ -114,7 +117,7 @@ module.exports = {
"scripts",
"subgraph",
"components/.storybook",
"components/*.stories.js",
"components/*.stories.{js,mdx}",
],
},
],
Expand All @@ -128,6 +131,7 @@ module.exports = {
"assets/**",
"subgraph/**",
"react-player/lazy",
"@storybook/addon-docs/blocks",
],
},
],
Expand Down Expand Up @@ -342,6 +346,11 @@ module.exports = {
},
],

// MDX Plugin
"mdx/no-jsx-html-comments": "error",
"mdx/no-unescaped-entities": "error",
"mdx/no-unused-expressions": "error",

// Regex Plugin
"regex/invalid": [
"error",
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## (2020-11-04)
## (2020-11-05)

- chore: add button on click documentation ([fb493c5](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/fb493c5))
- chore: add code of conduct ([6859555](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/6859555))
Expand All @@ -12,6 +12,7 @@
- chore: auto-detect Web3 call type ([15ae304](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/15ae304))
- chore: begin work on profile details page ([e4283ef](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/e4283ef))
- chore: document accordion ([2c0cd55](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/2c0cd55))
- chore: document account settings popup ([955683b](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/955683b))
- chore: expand subgraph ([31e87b2](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/31e87b2))
- chore: expand subgraph ([788c53f](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/788c53f))
- chore: expand subgraph more ([4aca747](https://github.com/Proof-Of-Humanity/proof-of-humanity-web/commit/4aca747))
Expand Down
1 change: 1 addition & 0 deletions components/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
"core-js/modules": "@storybook/core/node_modules/core-js/modules",
"@kleros/components": path.resolve(__dirname, ".."),
"@kleros/icons": path.resolve(__dirname, "../../icons"),
subgraph: path.resolve(__dirname, "../../subgraph"),
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion components/account-settings-popup.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import AccountSettingsPopup from "./account-settings-popup";
import Web3Provider from "./web3-provider";

const metadata = {
title: "Components/AccountSettingsPopup",
title: "Web3/AccountSettingsPopup",
component: AccountSettingsPopup,
argTypes: {
name: {
Expand Down
7 changes: 5 additions & 2 deletions components/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import Text from "./text";
export default function Alert({ type = "info", title, children }) {
const Icon = { info: Info }[type];
return (
<Flex variant={`alert.${type}`} sx={{ alignItems: "center" }}>
<Icon size={24} />
<Flex
variant={`alert.${type}`}
sx={{ alignItems: "center", backgroundColor: "background" }}
>
<Icon variant={`alert.${type}.icon`} size={24} />
<Box sx={{ marginLeft: 2 }}>
<Text variant={`alert.${type}.title`}>{title}</Text>
<Text>{children}</Text>
Expand Down
55 changes: 55 additions & 0 deletions components/alert.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import Alert from "./alert";

const metadata = {
title: "Components/Alert",
component: Alert,
argTypes: {
type: {
type: "string",
description: "The alert's type.",
table: {
type: {
summary: "string",
},
},
defaultValue: "info",
control: {
type: "radio",
options: ["info"],
},
},
title: {
type: "object",
description: "The alert's title.",
table: {
type: {
summary: "react-renderable",
},
},
},
children: {
type: "object",
description: "The alert's content.",
table: {
type: {
summary: "react-renderable",
},
},
},
},
};
export default metadata;

function Template(args) {
return <Alert {...args} />;
}

export const Info = Template.bind();
Info.args = {
title: "For Contributors",
children:
"If this side wins, you get back your contribution and a 10% reward.",
};

export const InfoLoading = Template.bind();
InfoLoading.args = { title: "For Contributors" };
3 changes: 2 additions & 1 deletion components/appeal.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function AppealTabPanelCard({
const totalContribution = web3.utils.toBN(paidFees);
const card = (
<Card
sx={{ minWidth: 480 }}
header={
<>
<Identicon address={address} />
Expand Down Expand Up @@ -197,7 +198,7 @@ function AppealTabPanel({
when your side ultimately wins. If only one side manages to fund their
fees, it automatically wins.
</Text>
<Grid sx={{ marginBottom: 3 }} gap={2} columns={2}>
<Grid sx={{ marginBottom: 3 }} gap={2} columns={[1, 1, 1, 2]}>
<AppealTabPanelCard
address={party1}
{...[undecided, winner, loser][currentRuling]}
Expand Down
132 changes: 132 additions & 0 deletions components/appeal.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import Appeal from "./appeal";
import Web3Provider from "./web3-provider";

import KlerosLiquid from "subgraph/abis/kleros-liquid";
import ProofOfHumanity from "subgraph/abis/proof-of-humanity";
import { address, klerosLiquidAddress } from "subgraph/config/kovan";

const metadata = {
title: "Arbitration/Appeal",
component: Appeal,
argTypes: {
challenges: {
type: { name: "array", required: true },
description: "The list of challenge objects.",
table: {
type: {
summary: "array",
},
},
},
sharedStakeMultiplier: {
type: { name: "number", required: true },
description: "The shared stake multiplier.",
table: {
type: {
summary: "number",
},
},
},
loserStakeMultiplier: {
type: { name: "number", required: true },
description: "The loser stake multiplier.",
table: {
type: {
summary: "number",
},
},
},
winnerStakeMultiplier: {
type: { name: "number", required: true },
description: "The winner stake multiplier.",
table: {
type: {
summary: "number",
},
},
},
arbitrator: {
type: { name: "string", required: true },
description: "The arbitrator's address.",
table: {
type: {
summary: "string",
},
},
},
arbitratorExtraData: {
type: { name: "string", required: true },
description: "The extra data passed to the arbitrator.",
table: {
type: {
summary: "string",
},
},
},
contract: {
type: { name: "string", required: true },
description: "The arbitrable contract name in the Web3 Provider.",
table: {
type: {
summary: "string",
},
},
},
args: {
type: { name: "array", required: true },
description: "Arguments to pass to the fundAppeal function.",
table: {
type: {
summary: "array",
},
},
},
},
};
export default metadata;

const contracts = [
{
name: "proofOfHumanity",
abi: ProofOfHumanity,
address: { kovan: address },
},
{
name: "klerosLiquid",
abi: KlerosLiquid,
address: { kovan: klerosLiquidAddress },
},
];
function Template(args) {
return (
<Web3Provider
infuraURL="wss://kovan.infura.io/ws/v3/dd555294ec53482f952f78d2d955c34d"
contracts={contracts}
>
<Appeal {...args} />
</Web3Provider>
);
}

export const Default = Template.bind();
Default.args = {
challenges: [
{
id: 1,
reason: { startCase: "Duplicate" },
disputeID: 10,
parties: [
"0xDb3ea8CbFd37D558eAcF8d0352bE3701352C1D9B",
"0x77AAbcA64973590C56D121510753b3324823d75E",
],
rounds: [{ paidFees: [1e18, 0], hasPaid: [false, false] }],
},
],
sharedStakeMultiplier: 2,
loserStakeMultiplier: 3,
winnerStakeMultiplier: 3,
arbitrator: "0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80",
arbitratorExtraData: "0x",
contract: "proofOfHumanity",
args: ["0xDb3ea8CbFd37D558eAcF8d0352bE3701352C1D9B"],
};
Loading

0 comments on commit 3a02314

Please sign in to comment.