Skip to content

Commit 4cc70ee

Browse files
author
Manuel Bichler
committed
another day with another update
1 parent 2924bb0 commit 4cc70ee

File tree

18 files changed

+3390
-150
lines changed

18 files changed

+3390
-150
lines changed

src/components/dao/forms/addDaoForm.tsx

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function AddDaoForm() {
3535
}
3636

3737
return (
38-
<div className="px-4 py-8 mx-auto max-w-7xl sm:px-6 lg:px-8">
38+
<div className="px-4 py-8 mx-auto max-w-4xl sm:px-6 lg:px-8">
3939
<div className="flex flex-col">
4040
<form onSubmit={onSubmit} className="space-y-8 ">
4141
<div className="space-y-8 ">
@@ -45,11 +45,11 @@ export function AddDaoForm() {
4545
Create a new DAO
4646
</h3>
4747
<p className="mt-1 text-sm text-gray-500">
48-
This creates a new data DAO contract which will be deployed to
49-
Filecon Hyperspace.
48+
This creates a new data DAO which will be saved on the Filecon
49+
Hyperspace network.
5050
</p>
5151
</div>
52-
<div className="grid grid-cols-1 mt-6 gap-y-6 gap-x-4 sm:grid-cols-6">
52+
<div className="grid grid-cols-1 mt-6 gap-y-6 gap-x-4 ">
5353
<div className="sm:col-span-4">
5454
<label
5555
htmlFor="name"
@@ -73,7 +73,7 @@ export function AddDaoForm() {
7373
htmlFor="owners"
7474
className="block text-sm font-medium text-gray-700"
7575
>
76-
DAO owner addresses
76+
DAO owner address
7777
</label>
7878
<div className="flex mt-1 rounded-md shadow-sm">
7979
<input
@@ -102,36 +102,47 @@ export function AddDaoForm() {
102102
</div>
103103
</div>
104104
</div>
105-
<ul role="list" className="grid max-w-md grid-cols-1 gap-5 mt-3">
106-
<li
107-
key={owner}
108-
className="flex col-span-1 rounded-md shadow-sm"
105+
<div className="sm:col-span-4">
106+
<label
107+
htmlFor="owners"
108+
className="block text-sm font-medium text-gray-700 mt-3"
109+
>
110+
DAO owners
111+
</label>
112+
<ul
113+
role="list"
114+
className="grid max-w-md grid-cols-1 gap-5 mt-1"
109115
>
110-
<div className="flex items-center justify-center flex-shrink-0 w-16 text-sm font-medium text-white bg-indigo-600 rounded-l-md">
111-
{";-)"}
112-
</div>
113-
<div className="flex items-center justify-between flex-1 truncate bg-white border-t border-b border-r border-gray-200 rounded-r-md">
114-
<div className="flex-1 px-4 py-2 text-sm truncate">
115-
<p className="text-gray-500"> {address}</p>
116-
</div>
117-
</div>
118-
</li>
119-
{owners.map((owner) => (
120116
<li
121117
key={owner}
122118
className="flex col-span-1 rounded-md shadow-sm"
123119
>
124120
<div className="flex items-center justify-center flex-shrink-0 w-16 text-sm font-medium text-white bg-indigo-600 rounded-l-md">
125-
Ox
121+
{";-)"}
126122
</div>
127123
<div className="flex items-center justify-between flex-1 truncate bg-white border-t border-b border-r border-gray-200 rounded-r-md">
128124
<div className="flex-1 px-4 py-2 text-sm truncate">
129-
<p className="text-gray-500">{owner}</p>
125+
<p className="text-gray-500"> {address}</p>
130126
</div>
131127
</div>
132128
</li>
133-
))}
134-
</ul>
129+
{owners.map((owner) => (
130+
<li
131+
key={owner}
132+
className="flex col-span-1 rounded-md shadow-sm"
133+
>
134+
<div className="flex items-center justify-center flex-shrink-0 w-16 text-sm font-medium text-white bg-indigo-600 rounded-l-md">
135+
Ox
136+
</div>
137+
<div className="flex items-center justify-between flex-1 truncate bg-white border-t border-b border-r border-gray-200 rounded-r-md">
138+
<div className="flex-1 px-4 py-2 text-sm truncate">
139+
<p className="text-gray-500">{owner}</p>
140+
</div>
141+
</div>
142+
</li>
143+
))}
144+
</ul>
145+
</div>
135146
{isSuccess && (
136147
<div>
137148
Successfully created DAO with address:
@@ -144,17 +155,19 @@ export function AddDaoForm() {
144155
</div>
145156
</div>
146157
)}
158+
<div className="flex justify-end mt-6">
159+
<Button type="button" variant="white" onClick={clearForm}>
160+
Clear form
161+
</Button>
162+
<Button
163+
type="submit"
164+
className="inline-flex justify-center ml-3"
165+
>
166+
Create DAO
167+
</Button>
168+
</div>
147169
</div>
148170
</div>
149-
150-
<div className="flex justify-end">
151-
<Button type="button" variant="white" onClick={clearForm}>
152-
Clear form
153-
</Button>
154-
<Button type="submit" className="inline-flex justify-center ml-3">
155-
Create DAO
156-
</Button>
157-
</div>
158171
</form>
159172
</div>
160173
</div>
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import { useDataDaoManagerAllInstitutions } from "@/utils/generated";
2+
import { ChevronRightIcon } from "@heroicons/react/20/solid";
3+
import { Users } from "lucide-react";
4+
import { useAccount } from "wagmi";
5+
6+
export function FindDaoForm() {
7+
const { address, isConnecting, isDisconnected } = useAccount();
8+
9+
const { data } = useDataDaoManagerAllInstitutions({});
10+
const daos = [
11+
{
12+
id: 1,
13+
name: "WarpSpace DAO",
14+
members: 22,
15+
description: "Focusing on biology in outer space.",
16+
},
17+
{
18+
id: 2,
19+
name: "Labio DAO",
20+
members: 27,
21+
description: "Marketplace for omics data.",
22+
},
23+
{
24+
id: 3,
25+
name: "Biomama DAO",
26+
members: 11,
27+
description: "All about X chromosome.",
28+
},
29+
];
30+
console.log("data", data);
31+
return (
32+
<div className="px-4 py-8 max-w-4xl sm:px-6 lg:px-8">
33+
<div className="flex flex-col">
34+
<div className="space-y-8 ">
35+
<div>
36+
<h3 className="text-lg font-medium leading-6 text-gray-900">
37+
Find your DAO
38+
</h3>
39+
<p className="mt-1 text-sm text-gray-500">
40+
Find a dao and apply to join
41+
</p>
42+
</div>
43+
<ul role="list" className="divide-y">
44+
{daos &&
45+
daos.map((dao) => (
46+
<li key={dao.id}>
47+
<a href="#" className="block hover:bg-gray-50">
48+
<div className="flex items-center px-4 py-4 sm:px-6">
49+
<div className="flex-1 min-w-0 sm:flex sm:items-center sm:justify-between">
50+
<div className="truncate">
51+
<div className="flex text-sm">
52+
<p className="font-medium text-indigo-600 truncate mr-3">
53+
{dao.name}{" "}
54+
</p>{" "}
55+
<Users
56+
className="h-3 w-3 flex-shrink-0 text-gray-500 mt-1"
57+
aria-hidden="true"
58+
/>
59+
<p className="flex-shrink-0 ml-1 font-normal text-gray-500">
60+
{dao.members}
61+
</p>
62+
</div>
63+
<div className="flex mt-2">
64+
<div className="flex items-center text-sm text-gray-500">
65+
<p>{dao.description} </p>
66+
</div>
67+
</div>
68+
</div>
69+
<div className="flex-shrink-0 mt-4 sm:mt-0 sm:ml-5">
70+
<div className="flex -space-x-1 overflow-hidden"></div>
71+
</div>
72+
</div>
73+
<div className="flex-shrink-0 ml-5">
74+
<ChevronRightIcon
75+
className="w-5 h-5 text-gray-400"
76+
aria-hidden="true"
77+
/>
78+
</div>
79+
</div>
80+
</a>
81+
</li>
82+
))}
83+
</ul>
84+
</div>
85+
</div>
86+
</div>
87+
);
88+
}

src/components/dao/getDaos.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import contractAbi from "@/utils/contractAbi.json";
2+
import { useDataDaoManagerGetAllInstitutionRegisteredToUser } from "@/utils/generated";
23
import { ChevronRightIcon, Database } from "lucide-react";
3-
import { Address, useContractRead } from "wagmi";
4+
import { Address, useAccount } from "wagmi";
45

56
export default function GetDaos() {
6-
const { data, isError, isLoading } = useContractRead({
7+
const { address } = useAccount();
8+
9+
const { data } = useDataDaoManagerGetAllInstitutionRegisteredToUser({
710
address: contractAbi.DataDaoManager[3141].contractAddress as Address,
8-
abi: contractAbi.DataDaoManager[3141].contractABI,
9-
functionName: "allInstitutions",
11+
args: [address],
1012
});
1113

12-
if (isLoading) return <p>Loading...</p>;
1314
if (!data) return null;
14-
15+
console.log("data", data);
1516
return (
1617
<div className="overflow-hidden bg-white sm:rounded-md">
1718
<ul role="list" className="divide-y">
@@ -22,12 +23,12 @@ export default function GetDaos() {
2223
<div className="truncate">
2324
<div className="flex text-sm">
2425
<p className="font-medium text-indigo-600 truncate">
25-
first file className
26+
first dao you are a member of
2627
</p>
2728
{/* <p className="flex-shrink-0 ml-1 font-normal text-gray-500">
2829
in {positions[0].journal}
2930
</p> */}
30-
{data && <p>{data as any}</p>}
31+
{data && <p>{JSON.stringify(data, null, 2)}</p>}
3132
</div>
3233
<div className="flex mt-2">
3334
<div className="flex items-center text-sm text-gray-500">

src/components/dashboard/forms/addPaperForm.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,9 @@ export function AddPaperForm() {
6464
return url;
6565
};
6666

67-
const getAccessConditions = async () => {
68-
const cid = "QmdK4iv8R1VBuE62ZEse4sSmmKfqGWDtxkngzwwmZbeHeH";
69-
const response = await lighthouse.getAccessConditions(cid);
70-
71-
// Display response
72-
console.log("ACCESSCON:", response);
73-
};
74-
console.log("encrypted :>>", encrypted);
7567
return (
7668
<div className="px-4 py-8 mx-auto max-w-7xl sm:px-6 lg:px-8">
7769
<div className="flex flex-col">
78-
<button onClick={() => getAccessConditions()}>
79-
get Access Conditions
80-
</button>
8170
<form onSubmit={handleSubmit(onSubmit)} className="space-y-8 ">
8271
<div className="space-y-8 ">
8372
<div>

src/components/dashboard/navigation.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ export function Navigation() {
161161
{({ active }) => (
162162
<Link
163163
href={item.href}
164+
onClick={
165+
item.name === "Sign out"
166+
? () => disconnect()
167+
: null
168+
}
164169
className={classNames(
165170
active ? "bg-gray-100" : "",
166171
"block py-2 px-4 text-sm text-gray-700"

src/components/dashboard/whatsNew.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
1+
import { Routes } from "@/utils/routes";
2+
import Link from "next/link";
3+
14
export function WhatsNew() {
25
return (
36
<div>
47
<dl className="overflow-hidden bg-white border border-gray-300 rounded-lg">
58
<div className="px-4 py-5 sm:p-6">
69
<dt className="text-base font-normal text-gray-900">What's new</dt>
10+
<dd className="flex items-baseline justify-between mt-1 md:block lg:flex">
11+
<div className="flex items-baseline">
12+
<span className="text-sm font-medium text-gray-500 ">
13+
<Link
14+
className="font-semibold text-indigo-600"
15+
href={Routes.dashboard.dao.member}
16+
>
17+
Susanne
18+
</Link>{" "}
19+
joined the dao.
20+
</span>
21+
</div>
722

23+
<div className=" text-gray-500 inline-flex items-baseline px-2.5 py-0.5 text-sm font-medium md:mt-2 lg:mt-0">
24+
<span aria-hidden="true"></span>
25+
</div>
26+
</dd>
827
<dd className="flex items-baseline justify-between mt-1 md:block lg:flex">
928
<div className="flex items-baseline">
1029
<span className="text-sm font-medium text-gray-500 ">
11-
Added upload of metadata to ComposableDB
30+
Paper{" "}
31+
<Link
32+
className="font-semibold text-indigo-600"
33+
href={Routes.dashboard.dao.member}
34+
>
35+
DAOs in Science
36+
</Link>{" "}
37+
added for review.
1238
</span>
1339
</div>
1440

src/pages/_app.tsx

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,16 @@
11
import "@/styles/globals.css";
22
// WAGMI Libraries
33
import type { AppProps } from "next/app";
4-
import { configureChains, createClient, WagmiConfig } from "wagmi";
5-
import { filecoin, filecoinHyperspace } from "wagmi/chains";
6-
import { jsonRpcProvider } from "wagmi/providers/jsonRpc";
4+
import { WagmiConfig } from "wagmi";
75

8-
import { Web3AuthConnectorInstance } from "@/utils/Web3AuthConnectorInstance";
6+
import { client } from "@/utils/wagmiClient";
97
import { Inter } from "@next/font/google";
108

119
const inter = Inter({
1210
subsets: ["latin"],
1311
variable: "--font-inter",
1412
});
1513

16-
// Configure chains & providers with the Public provider.
17-
const { chains, provider, webSocketProvider } = configureChains(
18-
[filecoin, filecoinHyperspace],
19-
[
20-
jsonRpcProvider({
21-
rpc: (chain) => ({
22-
http: `https://api.hyperspace.node.glif.io/rpc/v1`,
23-
}),
24-
}),
25-
]
26-
);
27-
28-
// Set up client
29-
const client = createClient({
30-
logger: {
31-
warn: (message) => console.log("wagmi: ", message),
32-
},
33-
autoConnect: false,
34-
connectors: [
35-
// new CoinbaseWalletConnector({
36-
// chains,
37-
// options: {
38-
// appName: "wagmi",
39-
// },
40-
// }),
41-
// new WalletConnectConnector({
42-
// chains,
43-
// options: {
44-
// qrcode: true,
45-
// },
46-
// }),
47-
// new InjectedConnector({
48-
// chains,
49-
// options: {
50-
// name: "Injected",
51-
// shimDisconnect: true,
52-
// },
53-
// }),
54-
Web3AuthConnectorInstance(chains),
55-
],
56-
provider,
57-
webSocketProvider,
58-
});
59-
6014
export default function App({ Component, pageProps }: AppProps) {
6115
return (
6216
<WagmiConfig client={client}>

0 commit comments

Comments
 (0)