forked from dalindev/XNOHub.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
25,355 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# See https://prettier.io/docs/en/ignore.html for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
.pnp | ||
.pnp.js | ||
|
||
# testing | ||
coverage | ||
|
||
# next.js | ||
.next/ | ||
.vercel/ | ||
out/ | ||
build | ||
dist | ||
|
||
# misc | ||
tsconfig.tsbuildinfo | ||
.DS_Store | ||
*.pem | ||
.idea | ||
.vscode | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# turbo | ||
.turbo | ||
|
||
# autogenerated files | ||
pnpm-lock.yaml | ||
|
||
#markdown | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"arrowParens": "avoid", | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"prettier.semi": false, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,57 @@ | ||
import { Card, Title, Text } from '@tremor/react'; | ||
import { queryBuilder } from '../lib/planetscale'; | ||
import Search from './search'; | ||
import UsersTable from './table'; | ||
import Test from './three-scence'; | ||
|
||
export const dynamic = 'force-dynamic'; | ||
|
||
export default async function IndexPage({ | ||
searchParams | ||
}: { | ||
searchParams: { q: string }; | ||
}) { | ||
const search = searchParams.q ?? ''; | ||
const users = await queryBuilder | ||
.selectFrom('users') | ||
.select(['id', 'name', 'username', 'email']) | ||
.where('name', 'like', `%${search}%`) | ||
.execute(); | ||
interface Rep { | ||
rep_address: string; | ||
est_payment: string | null; | ||
donation_address: string | null; | ||
weight: number; | ||
delegators: number; | ||
uptime: string; | ||
synced: number; | ||
website: string | null; | ||
latitude: number; | ||
longitude: number; | ||
alias: string; | ||
uptime_over: { | ||
week: number; | ||
day: number; | ||
}; | ||
score: number; | ||
donation: string | null; | ||
lastVoted: string; | ||
} | ||
|
||
async function fetchData(): Promise<Rep[] | null> { | ||
const body = { | ||
action: 'reps' | ||
}; | ||
|
||
const response = await fetch('https://rpc.nano.to', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
cache: 'force-cache', | ||
body: JSON.stringify(body) | ||
}); | ||
|
||
const data = await response.json(); | ||
console.log(data); | ||
return data; | ||
} | ||
|
||
export default async function IndexPage({}: {}) { | ||
// const data = fetchData();const myGlobe = Globe(); | ||
|
||
return ( | ||
<main className="p-4 md:p-10 mx-auto max-w-7xl"> | ||
<Title>Users</Title> | ||
<Text> | ||
A list of users retrieved from a MySQL database (PlanetScale). | ||
</Text> | ||
<Search /> | ||
<Card className="mt-6"> | ||
<UsersTable users={users} /> | ||
</Card> | ||
<main className="p-4 md:p-10 mx-auto max-w-7xl h-full"> | ||
<Title>XNO Globe</Title> | ||
<div className="flex justify-center items-center h-full"> | ||
<Test /> | ||
</div> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { GeoJsonGeometry } from 'three-geojson-geometry'; | ||
|
||
import geoJson from '../public/ne_110m_admin_0_countries.geojson.json'; | ||
|
||
const ThreeCountries = () => { | ||
return ( | ||
<group> | ||
{geoJson.features.map((data, index) => { | ||
const { geometry } = data as any; | ||
return ( | ||
<lineSegments key={index} geometry={new GeoJsonGeometry(geometry, 1)}> | ||
<lineBasicMaterial color="#5c5c5c" /> | ||
</lineSegments> | ||
); | ||
})} | ||
</group> | ||
); | ||
}; | ||
|
||
export default ThreeCountries; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { GeoJsonGeometry } from 'three-geojson-geometry'; | ||
import { geoGraticule10 } from 'd3-geo'; | ||
|
||
const ThreeGraticule = () => { | ||
return ( | ||
<group> | ||
<lineSegments geometry={new GeoJsonGeometry(geoGraticule10(), 1)}> | ||
<lineBasicMaterial color="#3c3c3c" /> | ||
</lineSegments> | ||
</group> | ||
); | ||
}; | ||
|
||
export default ThreeGraticule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import ThreeGraticule from './three-graticule'; | ||
import ThreeCountries from './three-country'; | ||
|
||
const ThreeMesh = () => { | ||
return ( | ||
<mesh> | ||
<sphereGeometry args={[1, 32]} /> | ||
<meshPhongMaterial color="#191919" transparent={true} opacity={0.8} /> | ||
<ThreeGraticule /> | ||
<ThreeCountries /> | ||
</mesh> | ||
); | ||
}; | ||
|
||
export default ThreeMesh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { Canvas } from '@react-three/fiber'; | ||
import { OrbitControls } from '@react-three/drei'; | ||
import ThreeMesh from './three-mesh'; | ||
|
||
const ThreeScene = () => { | ||
return ( | ||
<Canvas | ||
camera={{ | ||
fov: 75, | ||
position: [0, 0, 2.1] | ||
}} | ||
style={{ | ||
cursor: 'move' | ||
}} | ||
> | ||
<OrbitControls enableRotate={true} enableZoom={false} enablePan={false} /> | ||
<ambientLight intensity={1.3} /> | ||
<pointLight position={[-10, -10, -10]} intensity={0.4} /> | ||
<ThreeMesh /> | ||
</Canvas> | ||
); | ||
}; | ||
|
||
export default ThreeScene; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.