Skip to content

Commit

Permalink
another day with another update
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Bichler committed Feb 6, 2023
1 parent 2924bb0 commit 4cc70ee
Show file tree
Hide file tree
Showing 18 changed files with 3,390 additions and 150 deletions.
77 changes: 45 additions & 32 deletions src/components/dao/forms/addDaoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function AddDaoForm() {
}

return (
<div className="px-4 py-8 mx-auto max-w-7xl sm:px-6 lg:px-8">
<div className="px-4 py-8 mx-auto max-w-4xl sm:px-6 lg:px-8">
<div className="flex flex-col">
<form onSubmit={onSubmit} className="space-y-8 ">
<div className="space-y-8 ">
Expand All @@ -45,11 +45,11 @@ export function AddDaoForm() {
Create a new DAO
</h3>
<p className="mt-1 text-sm text-gray-500">
This creates a new data DAO contract which will be deployed to
Filecon Hyperspace.
This creates a new data DAO which will be saved on the Filecon
Hyperspace network.
</p>
</div>
<div className="grid grid-cols-1 mt-6 gap-y-6 gap-x-4 sm:grid-cols-6">
<div className="grid grid-cols-1 mt-6 gap-y-6 gap-x-4 ">
<div className="sm:col-span-4">
<label
htmlFor="name"
Expand All @@ -73,7 +73,7 @@ export function AddDaoForm() {
htmlFor="owners"
className="block text-sm font-medium text-gray-700"
>
DAO owner addresses
DAO owner address
</label>
<div className="flex mt-1 rounded-md shadow-sm">
<input
Expand Down Expand Up @@ -102,36 +102,47 @@ export function AddDaoForm() {
</div>
</div>
</div>
<ul role="list" className="grid max-w-md grid-cols-1 gap-5 mt-3">
<li
key={owner}
className="flex col-span-1 rounded-md shadow-sm"
<div className="sm:col-span-4">
<label
htmlFor="owners"
className="block text-sm font-medium text-gray-700 mt-3"
>
DAO owners
</label>
<ul
role="list"
className="grid max-w-md grid-cols-1 gap-5 mt-1"
>
<div className="flex items-center justify-center flex-shrink-0 w-16 text-sm font-medium text-white bg-indigo-600 rounded-l-md">
{";-)"}
</div>
<div className="flex items-center justify-between flex-1 truncate bg-white border-t border-b border-r border-gray-200 rounded-r-md">
<div className="flex-1 px-4 py-2 text-sm truncate">
<p className="text-gray-500"> {address}</p>
</div>
</div>
</li>
{owners.map((owner) => (
<li
key={owner}
className="flex col-span-1 rounded-md shadow-sm"
>
<div className="flex items-center justify-center flex-shrink-0 w-16 text-sm font-medium text-white bg-indigo-600 rounded-l-md">
Ox
{";-)"}
</div>
<div className="flex items-center justify-between flex-1 truncate bg-white border-t border-b border-r border-gray-200 rounded-r-md">
<div className="flex-1 px-4 py-2 text-sm truncate">
<p className="text-gray-500">{owner}</p>
<p className="text-gray-500"> {address}</p>
</div>
</div>
</li>
))}
</ul>
{owners.map((owner) => (
<li
key={owner}
className="flex col-span-1 rounded-md shadow-sm"
>
<div className="flex items-center justify-center flex-shrink-0 w-16 text-sm font-medium text-white bg-indigo-600 rounded-l-md">
Ox
</div>
<div className="flex items-center justify-between flex-1 truncate bg-white border-t border-b border-r border-gray-200 rounded-r-md">
<div className="flex-1 px-4 py-2 text-sm truncate">
<p className="text-gray-500">{owner}</p>
</div>
</div>
</li>
))}
</ul>
</div>
{isSuccess && (
<div>
Successfully created DAO with address:
Expand All @@ -144,17 +155,19 @@ export function AddDaoForm() {
</div>
</div>
)}
<div className="flex justify-end mt-6">
<Button type="button" variant="white" onClick={clearForm}>
Clear form
</Button>
<Button
type="submit"
className="inline-flex justify-center ml-3"
>
Create DAO
</Button>
</div>
</div>
</div>

<div className="flex justify-end">
<Button type="button" variant="white" onClick={clearForm}>
Clear form
</Button>
<Button type="submit" className="inline-flex justify-center ml-3">
Create DAO
</Button>
</div>
</form>
</div>
</div>
Expand Down
88 changes: 88 additions & 0 deletions src/components/dao/forms/findDaoForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { useDataDaoManagerAllInstitutions } from "@/utils/generated";
import { ChevronRightIcon } from "@heroicons/react/20/solid";
import { Users } from "lucide-react";
import { useAccount } from "wagmi";

export function FindDaoForm() {
const { address, isConnecting, isDisconnected } = useAccount();

const { data } = useDataDaoManagerAllInstitutions({});
const daos = [
{
id: 1,
name: "WarpSpace DAO",
members: 22,
description: "Focusing on biology in outer space.",
},
{
id: 2,
name: "Labio DAO",
members: 27,
description: "Marketplace for omics data.",
},
{
id: 3,
name: "Biomama DAO",
members: 11,
description: "All about X chromosome.",
},
];
console.log("data", data);
return (
<div className="px-4 py-8 max-w-4xl sm:px-6 lg:px-8">
<div className="flex flex-col">
<div className="space-y-8 ">
<div>
<h3 className="text-lg font-medium leading-6 text-gray-900">
Find your DAO
</h3>
<p className="mt-1 text-sm text-gray-500">
Find a dao and apply to join
</p>
</div>
<ul role="list" className="divide-y">
{daos &&
daos.map((dao) => (
<li key={dao.id}>
<a href="#" className="block hover:bg-gray-50">
<div className="flex items-center px-4 py-4 sm:px-6">
<div className="flex-1 min-w-0 sm:flex sm:items-center sm:justify-between">
<div className="truncate">
<div className="flex text-sm">
<p className="font-medium text-indigo-600 truncate mr-3">
{dao.name}{" "}
</p>{" "}
<Users
className="h-3 w-3 flex-shrink-0 text-gray-500 mt-1"
aria-hidden="true"
/>
<p className="flex-shrink-0 ml-1 font-normal text-gray-500">
{dao.members}
</p>
</div>
<div className="flex mt-2">
<div className="flex items-center text-sm text-gray-500">
<p>{dao.description} </p>
</div>
</div>
</div>
<div className="flex-shrink-0 mt-4 sm:mt-0 sm:ml-5">
<div className="flex -space-x-1 overflow-hidden"></div>
</div>
</div>
<div className="flex-shrink-0 ml-5">
<ChevronRightIcon
className="w-5 h-5 text-gray-400"
aria-hidden="true"
/>
</div>
</div>
</a>
</li>
))}
</ul>
</div>
</div>
</div>
);
}
17 changes: 9 additions & 8 deletions src/components/dao/getDaos.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import contractAbi from "@/utils/contractAbi.json";
import { useDataDaoManagerGetAllInstitutionRegisteredToUser } from "@/utils/generated";
import { ChevronRightIcon, Database } from "lucide-react";
import { Address, useContractRead } from "wagmi";
import { Address, useAccount } from "wagmi";

export default function GetDaos() {
const { data, isError, isLoading } = useContractRead({
const { address } = useAccount();

const { data } = useDataDaoManagerGetAllInstitutionRegisteredToUser({
address: contractAbi.DataDaoManager[3141].contractAddress as Address,
abi: contractAbi.DataDaoManager[3141].contractABI,
functionName: "allInstitutions",
args: [address],
});

if (isLoading) return <p>Loading...</p>;
if (!data) return null;

console.log("data", data);
return (
<div className="overflow-hidden bg-white sm:rounded-md">
<ul role="list" className="divide-y">
Expand All @@ -22,12 +23,12 @@ export default function GetDaos() {
<div className="truncate">
<div className="flex text-sm">
<p className="font-medium text-indigo-600 truncate">
first file className
first dao you are a member of
</p>
{/* <p className="flex-shrink-0 ml-1 font-normal text-gray-500">
in {positions[0].journal}
</p> */}
{data && <p>{data as any}</p>}
{data && <p>{JSON.stringify(data, null, 2)}</p>}
</div>
<div className="flex mt-2">
<div className="flex items-center text-sm text-gray-500">
Expand Down
11 changes: 0 additions & 11 deletions src/components/dashboard/forms/addPaperForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,9 @@ export function AddPaperForm() {
return url;
};

const getAccessConditions = async () => {
const cid = "QmdK4iv8R1VBuE62ZEse4sSmmKfqGWDtxkngzwwmZbeHeH";
const response = await lighthouse.getAccessConditions(cid);

// Display response
console.log("ACCESSCON:", response);
};
console.log("encrypted :>>", encrypted);
return (
<div className="px-4 py-8 mx-auto max-w-7xl sm:px-6 lg:px-8">
<div className="flex flex-col">
<button onClick={() => getAccessConditions()}>
get Access Conditions
</button>
<form onSubmit={handleSubmit(onSubmit)} className="space-y-8 ">
<div className="space-y-8 ">
<div>
Expand Down
5 changes: 5 additions & 0 deletions src/components/dashboard/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ export function Navigation() {
{({ active }) => (
<Link
href={item.href}
onClick={
item.name === "Sign out"
? () => disconnect()
: null
}
className={classNames(
active ? "bg-gray-100" : "",
"block py-2 px-4 text-sm text-gray-700"
Expand Down
28 changes: 27 additions & 1 deletion src/components/dashboard/whatsNew.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
import { Routes } from "@/utils/routes";
import Link from "next/link";

export function WhatsNew() {
return (
<div>
<dl className="overflow-hidden bg-white border border-gray-300 rounded-lg">
<div className="px-4 py-5 sm:p-6">
<dt className="text-base font-normal text-gray-900">What's new</dt>
<dd className="flex items-baseline justify-between mt-1 md:block lg:flex">
<div className="flex items-baseline">
<span className="text-sm font-medium text-gray-500 ">
<Link
className="font-semibold text-indigo-600"
href={Routes.dashboard.dao.member}
>
Susanne
</Link>{" "}
joined the dao.
</span>
</div>

<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">
<span aria-hidden="true"></span>
</div>
</dd>
<dd className="flex items-baseline justify-between mt-1 md:block lg:flex">
<div className="flex items-baseline">
<span className="text-sm font-medium text-gray-500 ">
Added upload of metadata to ComposableDB
Paper{" "}
<Link
className="font-semibold text-indigo-600"
href={Routes.dashboard.dao.member}
>
DAOs in Science
</Link>{" "}
added for review.
</span>
</div>

Expand Down
50 changes: 2 additions & 48 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
import "@/styles/globals.css";
// WAGMI Libraries
import type { AppProps } from "next/app";
import { configureChains, createClient, WagmiConfig } from "wagmi";
import { filecoin, filecoinHyperspace } from "wagmi/chains";
import { jsonRpcProvider } from "wagmi/providers/jsonRpc";
import { WagmiConfig } from "wagmi";

import { Web3AuthConnectorInstance } from "@/utils/Web3AuthConnectorInstance";
import { client } from "@/utils/wagmiClient";
import { Inter } from "@next/font/google";

const inter = Inter({
subsets: ["latin"],
variable: "--font-inter",
});

// Configure chains & providers with the Public provider.
const { chains, provider, webSocketProvider } = configureChains(
[filecoin, filecoinHyperspace],
[
jsonRpcProvider({
rpc: (chain) => ({
http: `https://api.hyperspace.node.glif.io/rpc/v1`,
}),
}),
]
);

// Set up client
const client = createClient({
logger: {
warn: (message) => console.log("wagmi: ", message),
},
autoConnect: false,
connectors: [
// new CoinbaseWalletConnector({
// chains,
// options: {
// appName: "wagmi",
// },
// }),
// new WalletConnectConnector({
// chains,
// options: {
// qrcode: true,
// },
// }),
// new InjectedConnector({
// chains,
// options: {
// name: "Injected",
// shimDisconnect: true,
// },
// }),
Web3AuthConnectorInstance(chains),
],
provider,
webSocketProvider,
});

export default function App({ Component, pageProps }: AppProps) {
return (
<WagmiConfig client={client}>
Expand Down
Loading

0 comments on commit 4cc70ee

Please sign in to comment.