diff --git a/package-lock.json b/package-lock.json index 710bb6f..bc45aa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "rln-js", "version": "0.1.0", "dependencies": { - "@waku/rln": "0.1.1-7e8cb89", + "@waku/rln": "0.1.1-60a5070", "@waku/utils": "^0.0.12", "ethers": "^5.7.2", "next": "13.5.6", @@ -1424,13 +1424,13 @@ "dev": true }, "node_modules/@waku/rln": { - "version": "0.1.1-7e8cb89", - "resolved": "https://registry.npmjs.org/@waku/rln/-/rln-0.1.1-7e8cb89.tgz", - "integrity": "sha512-ToHwjodXoc1BrllRkIqC8/D73LqMlL4AHRdaSk4ttXjzdlqELdZYaJEwMtEBlupydNPf813RZ6V6hVuE6ttbTg==", + "version": "0.1.1-60a5070", + "resolved": "https://registry.npmjs.org/@waku/rln/-/rln-0.1.1-60a5070.tgz", + "integrity": "sha512-c3rXqzuTTQVIn2l4gZKDG+/2UY2yb0XbumyrsuvX9fQhQxopCAsSi16CYePdG5HCpImXPNJEC3C3JakuiA3v9A==", "dependencies": { "@chainsafe/bls-keystore": "^3.0.0", - "@waku/utils": "^0.0.12", - "@waku/zerokit-rln-wasm": "^0.0.10", + "@waku/utils": "^0.0.13", + "@waku/zerokit-rln-wasm": "^0.0.13", "ethereum-cryptography": "^2.1.2", "ethers": "^5.7.2", "lodash": "^4.17.21", @@ -1441,6 +1441,19 @@ "node": ">=18" } }, + "node_modules/@waku/rln/node_modules/@waku/utils": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.13.tgz", + "integrity": "sha512-sGZRJyYr7+QZpV2tlGJF48gKmwNdFha6rPKPgXiKDsz2YMhPlg70ffbGcND3bEfOwWmX4g/x5i3Oqwwl+HzwJw==", + "dependencies": { + "chai": "^4.3.8", + "debug": "^4.3.4", + "uint8arrays": "^4.0.4" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@waku/utils": { "version": "0.0.12", "resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.12.tgz", @@ -1455,9 +1468,9 @@ } }, "node_modules/@waku/zerokit-rln-wasm": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/@waku/zerokit-rln-wasm/-/zerokit-rln-wasm-0.0.10.tgz", - "integrity": "sha512-qegIK1P54mxEp59uTa8C0/zidUffLc2Iee61yiKRIuGJDui2mQ+0V+KzPSPImKpIoqfVLT192EqgZkqPmj8VEw==" + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/@waku/zerokit-rln-wasm/-/zerokit-rln-wasm-0.0.13.tgz", + "integrity": "sha512-x7CRIIslmfCmTZc7yVp3dhLlKeLUs8ILIm9kv7+wVJ23H4pPw0Z+uH0ueLIYYfwODI6fDiwJj3S1vdFzM8D1zA==" }, "node_modules/@zeit/schemas": { "version": "2.29.0", @@ -7796,18 +7809,30 @@ "dev": true }, "@waku/rln": { - "version": "0.1.1-7e8cb89", - "resolved": "https://registry.npmjs.org/@waku/rln/-/rln-0.1.1-7e8cb89.tgz", - "integrity": "sha512-ToHwjodXoc1BrllRkIqC8/D73LqMlL4AHRdaSk4ttXjzdlqELdZYaJEwMtEBlupydNPf813RZ6V6hVuE6ttbTg==", + "version": "0.1.1-60a5070", + "resolved": "https://registry.npmjs.org/@waku/rln/-/rln-0.1.1-60a5070.tgz", + "integrity": "sha512-c3rXqzuTTQVIn2l4gZKDG+/2UY2yb0XbumyrsuvX9fQhQxopCAsSi16CYePdG5HCpImXPNJEC3C3JakuiA3v9A==", "requires": { "@chainsafe/bls-keystore": "^3.0.0", - "@waku/utils": "^0.0.12", - "@waku/zerokit-rln-wasm": "^0.0.10", + "@waku/utils": "^0.0.13", + "@waku/zerokit-rln-wasm": "^0.0.13", "ethereum-cryptography": "^2.1.2", "ethers": "^5.7.2", "lodash": "^4.17.21", "rlnjs": "^3.2.3", "uuid": "^9.0.1" + }, + "dependencies": { + "@waku/utils": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.13.tgz", + "integrity": "sha512-sGZRJyYr7+QZpV2tlGJF48gKmwNdFha6rPKPgXiKDsz2YMhPlg70ffbGcND3bEfOwWmX4g/x5i3Oqwwl+HzwJw==", + "requires": { + "chai": "^4.3.8", + "debug": "^4.3.4", + "uint8arrays": "^4.0.4" + } + } } }, "@waku/utils": { @@ -7821,9 +7846,9 @@ } }, "@waku/zerokit-rln-wasm": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/@waku/zerokit-rln-wasm/-/zerokit-rln-wasm-0.0.10.tgz", - "integrity": "sha512-qegIK1P54mxEp59uTa8C0/zidUffLc2Iee61yiKRIuGJDui2mQ+0V+KzPSPImKpIoqfVLT192EqgZkqPmj8VEw==" + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/@waku/zerokit-rln-wasm/-/zerokit-rln-wasm-0.0.13.tgz", + "integrity": "sha512-x7CRIIslmfCmTZc7yVp3dhLlKeLUs8ILIm9kv7+wVJ23H4pPw0Z+uH0ueLIYYfwODI6fDiwJj3S1vdFzM8D1zA==" }, "@zeit/schemas": { "version": "2.29.0", diff --git a/package.json b/package.json index b3996ce..9ad987e 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "@waku/rln": "0.1.1-7e8cb89", + "@waku/rln": "0.1.1-60a5070", "@waku/utils": "^0.0.12", "ethers": "^5.7.2", "next": "13.5.6", diff --git a/src/app/home/components/Blockchain.tsx b/src/app/components/Blockchain.tsx similarity index 100% rename from src/app/home/components/Blockchain.tsx rename to src/app/components/Blockchain.tsx diff --git a/src/app/components/Header.tsx b/src/app/components/Header.tsx new file mode 100644 index 0000000..374c13e --- /dev/null +++ b/src/app/components/Header.tsx @@ -0,0 +1,24 @@ +import { Block, BlockTypes } from "@/components/Block"; +import { Title } from "@/components/Title"; +import { Button } from "@/components/Button"; + +type HeaderProps = { + children?: React.ReactNode; + onWalletConnect?: () => void; +} + +export const Header: React.FunctionComponent = (props) => { + return ( + <> + + Waku + {props.onWalletConnect && ( + + )} + + {props.children} + + ); +}; diff --git a/src/app/home/components/Keystore.tsx b/src/app/components/Keystore.tsx similarity index 100% rename from src/app/home/components/Keystore.tsx rename to src/app/components/Keystore.tsx diff --git a/src/app/home/components/KeystoreDetails.tsx b/src/app/components/KeystoreDetails.tsx similarity index 100% rename from src/app/home/components/KeystoreDetails.tsx rename to src/app/components/KeystoreDetails.tsx diff --git a/src/app/components/Menu.tsx b/src/app/components/Menu.tsx new file mode 100644 index 0000000..ea06295 --- /dev/null +++ b/src/app/components/Menu.tsx @@ -0,0 +1,12 @@ +import Link from "next/link"; +import { Block } from "@/components/Block"; + +export const Menu: React.FunctionComponent<{}> = () => { + return ( + +

{">"}

+

Chat

+

Keystore

+
+ ); +}; diff --git a/src/app/components/Waku.tsx b/src/app/components/Waku.tsx new file mode 100644 index 0000000..3364ca0 --- /dev/null +++ b/src/app/components/Waku.tsx @@ -0,0 +1,162 @@ +import React from "react"; +import { Block } from "@/components/Block"; +import { Subtitle } from "@/components/Subtitle"; +import { Button } from "@/components/Button"; +import { MessageContent } from "@/hooks"; + +type WakuProps = { + onSend: (nick: string, text: string) => Promise; + activeContentTopic: string; + messages: MessageContent[]; + onActiveContentTopicChange: (contentTopic: string) => void; +} + +export const Waku: React.FunctionComponent = (props) => { + const { + nick, + text, + onNickChange, + onMessageChange, + resetText, + } = useMessage(); + const { + contentTopic, + onContentTopicChange, + } = useContentTopic(props.activeContentTopic); + + const onSendClick = async () => { + await props.onSend(nick, text); + resetText(); + }; + + const renderedMessages = React.useMemo( + () => props.messages.map(renderMessage), + [props.messages] + ); + + return ( + + + + + Waku + + + + + + + + + + + + + + +