mirror of
https://github.com/smolgrrr/TAO.git
synced 2024-09-20 09:21:25 +00:00
initial global feed
This commit is contained in:
parent
7889c2fc05
commit
78e6a0350c
2491
client/package-lock.json
generated
2491
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,10 +10,11 @@
|
|||||||
"@types/node": "^17.0.45",
|
"@types/node": "^17.0.45",
|
||||||
"@types/react": "^18.2.21",
|
"@types/react": "^18.2.21",
|
||||||
"@types/react-dom": "^18.2.7",
|
"@types/react-dom": "^18.2.7",
|
||||||
|
"nostr-tools": "^1.14.2",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-router-dom": "^6.15.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"typescript": "^4.9.5",
|
|
||||||
"web-vitals": "^2.1.4",
|
"web-vitals": "^2.1.4",
|
||||||
"workbox-background-sync": "^6.6.0",
|
"workbox-background-sync": "^6.6.0",
|
||||||
"workbox-broadcast-update": "^6.6.0",
|
"workbox-broadcast-update": "^6.6.0",
|
||||||
@ -51,5 +52,8 @@
|
|||||||
"last 1 firefox version",
|
"last 1 firefox version",
|
||||||
"last 1 safari version"
|
"last 1 safari version"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
client/public/192_tao.png
Normal file
BIN
client/public/192_tao.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
client/public/512_tao.png
Normal file
BIN
client/public/512_tao.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 19 KiB |
@ -21,7 +21,7 @@
|
|||||||
work correctly both with client-side routing and a non-root public URL.
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
-->
|
-->
|
||||||
<title>React App</title>
|
<title>TAO</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"short_name": "React App",
|
"short_name": "TAO",
|
||||||
"name": "Create React App Sample",
|
"name": "The Anon Operation",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "favicon.ico",
|
"src": "favicon.ico",
|
||||||
@ -8,12 +8,12 @@
|
|||||||
"type": "image/x-icon"
|
"type": "image/x-icon"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "logo192.png",
|
"src": "192_tao.png",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"sizes": "192x192"
|
"sizes": "192x192"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "logo512.png",
|
"src": "512_tao.png",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"sizes": "512x512"
|
"sizes": "512x512"
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,18 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import logo from './logo.svg';
|
import logo from './logo.svg';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
|
||||||
|
import Home from './components/Home';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<Router>
|
||||||
<header className="App-header">
|
<div>
|
||||||
<img src={logo} className="App-logo" alt="logo" />
|
<Routes>
|
||||||
<p>
|
<Route path="/" element={<Home />} />
|
||||||
Edit <code>src/App.tsx</code> and save to reload.
|
</Routes>
|
||||||
</p>
|
|
||||||
<a
|
|
||||||
className="App-link"
|
|
||||||
href="https://reactjs.org"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
Learn React
|
|
||||||
</a>
|
|
||||||
</header>
|
|
||||||
</div>
|
</div>
|
||||||
|
</Router>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
52
client/src/components/Home.tsx
Normal file
52
client/src/components/Home.tsx
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { relayInit } from 'nostr-tools';
|
||||||
|
import PostCard from './PostCard/PostCard';
|
||||||
|
|
||||||
|
// Define the Event interface
|
||||||
|
interface Event {
|
||||||
|
id: string;
|
||||||
|
content: string;
|
||||||
|
created_at: number;
|
||||||
|
// Add other fields if necessary
|
||||||
|
}
|
||||||
|
|
||||||
|
const relay = relayInit('wss://powrelay.xyz');
|
||||||
|
|
||||||
|
const Home = () => {
|
||||||
|
// Define the type of the state variable
|
||||||
|
const [events, setEvents] = useState<Event[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
relay.on('connect', async () => {
|
||||||
|
console.log(`connected to ${relay.url}`);
|
||||||
|
|
||||||
|
const eventList = await relay.list([
|
||||||
|
{
|
||||||
|
kinds: [1],
|
||||||
|
limit: 10,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Assuming eventList is of type Event[]
|
||||||
|
setEvents(eventList);
|
||||||
|
});
|
||||||
|
|
||||||
|
relay.on('error', () => {
|
||||||
|
console.log(`failed to connect to ${relay.url}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
relay.connect();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-gray-900 text-white min-h-screen">
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 p-4">
|
||||||
|
{events.map((event, index) => (
|
||||||
|
<PostCard key={index} content={event.content} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Home;
|
9
client/src/components/PostCard/CardContainer.tsx
Normal file
9
client/src/components/PostCard/CardContainer.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { PropsWithChildren } from 'react';
|
||||||
|
|
||||||
|
export default function CardContainer({ children }: PropsWithChildren) {
|
||||||
|
return (
|
||||||
|
<div className="card bg-gradient-to-r from-base-200 to-base-100 shadow-lg shadow-black">
|
||||||
|
<div className="card-body gap-4 p-4">{children}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
19
client/src/components/PostCard/PostCard.tsx
Normal file
19
client/src/components/PostCard/PostCard.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import CardContainer from './CardContainer';
|
||||||
|
|
||||||
|
const PostCard = ({ content }: { content: string }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<CardContainer>
|
||||||
|
<div className="flex flex-col gap-4">
|
||||||
|
<div className="ml-16 mr-2 flex flex-col gap-4 break-words">
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr className="-mx-4 mt-2 opacity-10" />
|
||||||
|
</CardContainer>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PostCard;
|
9
client/tailwind.config.js
Normal file
9
client/tailwind.config.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
content: [],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user