Skip to content

Commit

Permalink
registration and explore dev
Browse files Browse the repository at this point in the history
  • Loading branch information
TuckerMcLachlan committed Jan 19, 2023
1 parent a6da867 commit b70dab5
Show file tree
Hide file tree
Showing 35 changed files with 5,278 additions and 5,604 deletions.
1 change: 0 additions & 1 deletion api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ <h5 class="card-title">DAOstar Endpoint Service v0.2 <span class="text-muted">(C
form.addEventListener('submit', async function (e) {
e.preventDefault();
const form_data = Object.fromEntries(new FormData(form).entries());
console.log(form_data);
if (checkboxElem.checked) {
window.location.href = `/api/view?cid=${form_data.contract_id}`;
} else {
Expand Down
2 changes: 0 additions & 2 deletions api/manage.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ <h5>
body: JSON.stringify(payload)
});

console.log(endpoint, response);
const result = await response.json();

updateAlert.classList.toggle("show");
Expand All @@ -253,7 +252,6 @@ <h5>
fetch(endpoint, { method: 'DELETE' })
.then(resp => resp.json())
.then(data => {
console.log(data);
window.location.href = "/api";
})
}
Expand Down
2 changes: 1 addition & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ iframe {
align-items: flex-start;
gap: 20px;
/* flex-wrap: wrap; */
margin: 5% auto;
margin: 32px auto;
}
.rows > div {
display: flex;
Expand Down
5,599 changes: 4,549 additions & 1,050 deletions daostar-website/package-lock.json

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion daostar-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dependencies": {
"@apollo/client": "^3.7.1",
"@blueprintjs/core": "^4.11.5",
"@react-three/fiber": "^8.9.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.2.2",
"@types/node": "^18.11.9",
Expand All @@ -21,15 +21,20 @@
"@web3modal/react": "^2.0.0-beta.1",
"axios": "^1.1.3",
"axios-hooks": "^4.0.0",
"babel-jest": "^29.3.1",
"caip": "^1.1.0",
"connectkit": "^1.0.0",
"ethers": "^5.7.2",
"graphql": "^16.6.0",
"jest": "^29.3.1",
"loadjs": "^4.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.2",
"react-scripts": "5.0.1",
"react-three-fiber": "^6.0.13",
"three": "^0.148.0",
"ts-jest": "^29.0.3",
"typescript": "^4.8.4",
"typewriter-effect": "^2.19.0",
"validator": "^13.7.0",
Expand Down Expand Up @@ -62,6 +67,9 @@
]
},
"devDependencies": {
"@babel/preset-env": "^7.20.2",
"@testing-library/react": "^13.4.0",
"react-test-renderer": "^18.2.0",
"source-map-loader": "^4.0.1",
"ts-loader": "^9.4.1"
}
Expand Down
26 changes: 25 additions & 1 deletion daostar-website/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@import "~@blueprintjs/icons/lib/css/blueprint-icons.css";
@import "~@blueprintjs/popover2/lib/css/blueprint-popover2.css";
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

/* Font imports */
@font-face {
Expand Down Expand Up @@ -33,7 +34,9 @@
--clr-light: rgb(233, 233, 233);
--clr-dark: #191919;
--clr-accent: #F8E441;
--clr-secondary: rgba(66, 142, 255, 1);
--font: 'IBM Plex Mono', 'Roboto Condensed', 'Roboto', 'Arial', sans-serif;
--heading-font: 'Space Mono', 'IBM Plex Mono', 'Roboto Condensed', 'Roboto', 'Arial', sans-serif;
font-family: 'Geogrotesque';
}

Expand Down Expand Up @@ -118,6 +121,16 @@ a:hover, a.active {
transition: 0.5s;
}

a.underline:hover {
text-decoration: underline;
}

a.no-underline,
a.no-underline:hover {
border-bottom: none;
text-decoration: none;
}


.wrapper {
margin: 0 auto;
Expand Down Expand Up @@ -191,7 +204,7 @@ iframe {
align-items: flex-start;
gap: 20px;
/* flex-wrap: wrap; */
margin: 5% auto;
margin: 24px auto;
}
.rows > div {
display: flex;
Expand Down Expand Up @@ -408,6 +421,17 @@ footer {
box-shadow: 0 0 0 0;
color: #999;
}
.btn.primary {
border: 1px solid var(--clr-accent) !important;
color: var(--clr-accent);
}
.btn.secondary {
border: 1px solid var(--clr-secondary) !important;
color: var(--clr-secondary);
}
.btn.secondary:hover {
box-shadow: 5px 5px 0 0 var(--clr-secondary);
}

/* Spline */
canvas { width: 100%; height: 100%; outline: none; z-index: 10; }
Expand Down
2 changes: 2 additions & 0 deletions daostar-website/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ConnectKitProvider, getDefaultClient } from "connectkit";

import './App.css';
import './bp4-theme.css';
import Eye from './components/Homepage/Eye/Eye';

const alchemyId = process.env.ALCHEMY_ID;

Expand Down Expand Up @@ -41,6 +42,7 @@ function App() {
{/* <Homepage /> */}

<Routes>
<Route path='/eye' element={<Eye />} />
<Route path='/register' element={<Register />} />
<Route path='/registration/:regID' element={<RegistrationPage />} />
<Route path='/explore' element={<ExplorePage />} />
Expand Down
8 changes: 0 additions & 8 deletions daostar-website/src/App.test.js

This file was deleted.

4 changes: 4 additions & 0 deletions daostar-website/src/bp4-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ body {
border: 1px solid var(--primary-color-hover)
}

.bp4-button .bp4-icon {
color: #fff;
}

.bp4-callout.bp4-intent-danger {
background: rgba(226, 68, 68, 0.4);
color: #E24444;
Expand Down
15 changes: 15 additions & 0 deletions daostar-website/src/components/ExplorePage/ExplorePage.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,19 @@

.explore-page .dao-cards .bp4-card {
max-width: 438px;
}

.explore-page .filter {
margin-bottom: 56px;
}

@media (max-width: 950px) {
.explore-page {
max-width: 80%;
}

.explore-page .dao-cards .bp4-card {
max-width: none;
}

}
31 changes: 27 additions & 4 deletions daostar-website/src/components/ExplorePage/ExplorePage.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
import React from 'react';
import React, { useState } from 'react';
import RegistrationCard from '../RegistrationCard/RegistrationCard';
import { mockExploreData } from './mockExploreData';
import './ExplorePage.css';
import validator from 'validator';
import { useQuery } from '@apollo/client';
import REGISTRATIONS from './queries/registrations';
import { InputGroup } from '@blueprintjs/core';

export const filterRegistrations = (registration, filterVal = '') => {
if (!registration.daoName) {
return false;
}
if (filterVal !== '') {
return registration.daoName.toLowerCase().includes(filterVal.toLowerCase());
}
return true;
}

const ExplorePage = ({

}) => {

const [filterVal, setFilterVal] = useState('');
const onChangeFilter = (e) => setFilterVal(e.target.value);

const { loading, error, data } = useQuery(REGISTRATIONS);
if (error) return 'error';
if (loading) return 'loading...';

console.log('data', data);

const daoCards = data.newRegistrations.map((registration, i) => {
const daoCards = data.registrationInstances
.filter(reg => filterRegistrations(reg, filterVal))
.map((registration, i) => {
return (
<RegistrationCard
key={i}
Expand All @@ -26,6 +41,14 @@ const ExplorePage = ({

return (
<div className='explore-page'>
<div className='filter'>
<InputGroup
large
placeholder='Filter DAOs...'
value={filterVal}
onChange={onChangeFilter}
/>
</div>
<div className='dao-cards'>
{daoCards}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ import { gql } from "@apollo/client";

const REGISTRATIONS = gql`
query Registrations {
newRegistrations(first: 5) {
registrationInstances(first: 5) {
id
daoAddress
daoURI
registration
daoName
daoDescription
membersURI
proposalsURI
governanceURI
activityLogURI
registrationAddress
network
}
}
`
Expand Down
30 changes: 30 additions & 0 deletions daostar-website/src/components/Homepage/Eye/Box.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useRef, useState, useMemo } from 'react'
import { useFrame } from '@react-three/fiber'
import { Color } from 'three'

export default function Box({ text, ...props }) {
const ref = useRef()
const black = useMemo(() => new Color('black'), [])
const lime = useMemo(() => new Color('lime'), [])
const [hovered, setHovered] = useState(false)

useFrame(({ mouse, viewport }) => {
const x = (mouse.x * viewport.width) / 2.5
const y = (mouse.y * viewport.height) / 2.5
ref.current.lookAt(x, y, 1)
ref.current.material.color.lerp(hovered ? lime : black, 0.05)
})

return (
<mesh
{...props}
ref={ref}
onPointerOver={() => setHovered(true)}
onPointerOut={() => setHovered(false)}
>
<boxGeometry />
<meshStandardMaterial color={lime} />
{props.children}
</mesh>
)
}
8 changes: 8 additions & 0 deletions daostar-website/src/components/Homepage/Eye/Eye.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.eye-canvas canvas {
height: 400px;
width: 400px;
display: block;
background: red;
position: fixed;
top: 0;
}
55 changes: 55 additions & 0 deletions daostar-website/src/components/Homepage/Eye/Eye.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React, { useEffect, useRef, useState } from "react";
import { Canvas, useFrame, useThree } from '@react-three/fiber';
import * as THREE from "three";
import { Vector3 } from 'three'
import eyeIllustration from './eye_illustration.jpeg';
import './Eye.css';
import Box from "./Box";

function Rig() {
const { camera, mouse } = useThree()
const vec = new Vector3()

return useFrame(() => {
camera.position.lerp(vec.set(-mouse.x, -mouse.y, camera.position.z), 0.5)
camera.lookAt(0, 0, 0)
})
}

const Sphere = () => {

const ref = useRef()
const base = new THREE.TextureLoader().load(eyeIllustration)

// useFrame(() => console.log('executing'));

return (
<mesh visible castShadow ref={ref}
rotation={[0, 0.25, 0.25]}
position={[0, 0, -1]}
>
<sphereGeometry attach="geometry" args={[3, 48, 48]} />
<meshPhongMaterial
map={base}
color="white"
/>
</mesh>
);
};

const Eye = () => {

return (
<div className='BigEye'>
<Canvas>
<ambientLight intensity={0.5} castShadow={true} />
<directionalLight color="white" position={[-50, 0, -100]} castShadow={true} />
<directionalLight color="white" position={[-2000, 0, -200]} castShadow={true} />
<Sphere />
<Rig />
</Canvas>
</div>
);
};

export default Eye;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b70dab5

Please sign in to comment.