mirror of
https://github.com/edufeed-org/polloer.git
synced 2025-12-10 00:34:31 +00:00
How did this get in here? Removing...
This commit is contained in:
parent
2d093489c0
commit
69d1c51bdb
12 changed files with 0 additions and 284 deletions
|
|
@ -1,69 +0,0 @@
|
||||||
# SvelteKit NDK App
|
|
||||||
|
|
||||||
This project is a SvelteKit application that utilizes the NDK (Nostr Development Kit) library for building decentralized applications. It incorporates Tailwind CSS for styling, providing a modern and responsive UI.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- User authentication via browser extension or key pair creation.
|
|
||||||
- Ability to submit questions and receive comments.
|
|
||||||
- Voting mechanism after a timer expires.
|
|
||||||
- Real-time event handling using Nostr protocol.
|
|
||||||
|
|
||||||
## Project Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
sveltekit-ndk-app
|
|
||||||
├── src
|
|
||||||
│ ├── lib
|
|
||||||
│ │ └── components
|
|
||||||
│ │ └── ExampleComponent.svelte
|
|
||||||
│ ├── routes
|
|
||||||
│ │ ├── +layout.svelte
|
|
||||||
│ │ ├── +page.svelte
|
|
||||||
│ │ └── api
|
|
||||||
│ │ └── +server.js
|
|
||||||
│ ├── app.css
|
|
||||||
│ └── app.html
|
|
||||||
├── static
|
|
||||||
│ └── favicon.ico
|
|
||||||
├── tailwind.config.cjs
|
|
||||||
├── postcss.config.cjs
|
|
||||||
├── package.json
|
|
||||||
├── svelte.config.js
|
|
||||||
├── tsconfig.json
|
|
||||||
└── README.md
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
1. Clone the repository:
|
|
||||||
```
|
|
||||||
git clone <repository-url>
|
|
||||||
cd sveltekit-ndk-app
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Install dependencies:
|
|
||||||
```
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Run the development server:
|
|
||||||
```
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Open your browser and navigate to `http://localhost:3000`.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
- Users can log in using a browser extension or create a new key pair.
|
|
||||||
- After logging in, users can submit questions and view responses.
|
|
||||||
- Comments can be made until the timer expires, after which users can vote on the questions.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This project is licensed under the MIT License. See the LICENSE file for more details.
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"name": "sveltekit-ndk-app",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "vite",
|
|
||||||
"build": "vite build",
|
|
||||||
"preview": "vite preview"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"svelte": "^3.44.0",
|
|
||||||
"sveltekit": "latest",
|
|
||||||
"@nostr-dev-kit/ndk-svelte": "^0.1.0",
|
|
||||||
"tailwindcss": "^2.2.19",
|
|
||||||
"postcss": "^8.4.6",
|
|
||||||
"autoprefixer": "^10.4.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"vite": "^2.6.14",
|
|
||||||
"svelte-preprocess": "^4.9.4"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "",
|
|
||||||
"license": "MIT"
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
plugins: {
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
@tailwind base;
|
|
||||||
@tailwind components;
|
|
||||||
@tailwind utilities;
|
|
||||||
|
|
||||||
/* Custom styles can be added below this line */
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>SvelteKit NDK App</title>
|
|
||||||
<link rel="stylesheet" href="/app.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="svelte"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
<!-- filepath: /sveltekit-ndk-app/sveltekit-ndk-app/src/routes/+layout.svelte -->
|
|
||||||
<script>
|
|
||||||
export let segment;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="min-h-screen flex flex-col">
|
|
||||||
<header class="bg-blue-600 text-white p-4">
|
|
||||||
<h1 class="text-xl">Nostr Event App</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main class="flex-grow p-4">
|
|
||||||
<slot />
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer class="bg-gray-800 text-white p-4 text-center">
|
|
||||||
<p>© 2023 Nostr Event App</p>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* Additional styles can be added here */
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
<script>
|
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import NDKSvelte from '@nostr-dev-kit/ndk-svelte';
|
|
||||||
import { writable, derived } from 'svelte/store';
|
|
||||||
|
|
||||||
const ndk = new NDKSvelte({
|
|
||||||
explicitRelayUrls: ['wss://relay-rpi.edufeed.org']
|
|
||||||
});
|
|
||||||
|
|
||||||
const connected = writable(false);
|
|
||||||
let events = writable([]);
|
|
||||||
let liascriptEvents = writable([]);
|
|
||||||
const count = derived(events, ($events) => $events.length);
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
try {
|
|
||||||
await ndk.connect();
|
|
||||||
connected.set(true);
|
|
||||||
|
|
||||||
events = ndk.storeSubscribe({ kinds: [30142] }, { closeOnEose: false });
|
|
||||||
liascriptEvents = ndk.storeSubscribe({ kinds: [30143] }, { closeOnEose: false });
|
|
||||||
|
|
||||||
console.log('Subscription created and store initialized');
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error connecting to Nostr relay:', error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if $connected}
|
|
||||||
<p class="status connected">Connected to Nostr relay</p>
|
|
||||||
{:else}
|
|
||||||
<p class="status connecting">Connecting to Nostr relay...</p>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<h1>Nostr Events</h1>
|
|
||||||
<p>
|
|
||||||
{$count} events seen
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{#if $events && $events.length > 0}
|
|
||||||
<h2>Recent events</h2>
|
|
||||||
<ul>
|
|
||||||
{#each $events as event}
|
|
||||||
<li>
|
|
||||||
Event ID: {event.id.substring(0, 8)}...
|
|
||||||
{#if event.content}
|
|
||||||
<p>Content: {event.content}</p>
|
|
||||||
{/if}
|
|
||||||
</li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
{:else}
|
|
||||||
<p>No events received yet. Waiting for events...</p>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.status {
|
|
||||||
padding: 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
.connecting {
|
|
||||||
background-color: #fff3cd;
|
|
||||||
color: #856404;
|
|
||||||
}
|
|
||||||
.connected {
|
|
||||||
background-color: #d4edda;
|
|
||||||
color: #155724;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
ul {
|
|
||||||
list-style-type: none;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
border: 1px solid #eee;
|
|
||||||
padding: 12px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import { json } from '@sveltejs/kit';
|
|
||||||
|
|
||||||
export async function POST({ request }) {
|
|
||||||
const data = await request.json();
|
|
||||||
|
|
||||||
// Here you would handle the data, e.g., save it to a database or process it
|
|
||||||
// For demonstration, we'll just return the received data
|
|
||||||
|
|
||||||
return json({
|
|
||||||
status: 'success',
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function GET({ url }) {
|
|
||||||
// Here you could fetch data from a database or another API
|
|
||||||
// For demonstration, we'll return a static response
|
|
||||||
|
|
||||||
const exampleData = {
|
|
||||||
message: 'Hello from the API!',
|
|
||||||
timestamp: new Date().toISOString()
|
|
||||||
};
|
|
||||||
|
|
||||||
return json(exampleData);
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<!-- This file is intentionally left blank. -->
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import adapter from '@sveltejs/adapter-auto';
|
|
||||||
import preprocess from 'svelte-preprocess';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
preprocess: preprocess(),
|
|
||||||
kit: {
|
|
||||||
adapter: adapter(),
|
|
||||||
vite: {
|
|
||||||
css: {
|
|
||||||
postcss: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
content: [
|
|
||||||
'./src/**/*.{svelte,js,ts}',
|
|
||||||
'./src/lib/**/*.{svelte,js,ts}',
|
|
||||||
'./src/routes/**/*.{svelte,js,ts}',
|
|
||||||
],
|
|
||||||
theme: {
|
|
||||||
extend: {},
|
|
||||||
},
|
|
||||||
plugins: [],
|
|
||||||
};
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "@sveltejs/tsconfig",
|
|
||||||
"compilerOptions": {
|
|
||||||
"strict": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"forceConsistentCasingInFileNames": true
|
|
||||||
},
|
|
||||||
"include": ["src/**/*"],
|
|
||||||
"exclude": ["node_modules", "**/*.spec.ts"]
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue