Skip to content

Commit

Permalink
single relay pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Dec 9, 2024
1 parent 88725c2 commit 42c2a23
Show file tree
Hide file tree
Showing 49 changed files with 1,967 additions and 215 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
10 changes: 8 additions & 2 deletions apps/gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@
"prettier-plugin-svelte": "^3.1.2",
"prettier-plugin-tailwindcss": "^0.6.4",
"publint": "^0.2.0",
"sass-embedded": "^1.82.0",
"serve": "^14.2.4",
"svelte": "^5.2.7",
"svelte-bricks": "^0.2.1",
"svelte-check": "^3.6.0",
"svelte-preprocess": "^6.0.3",
"svelte-radix": "^1.1.0",
"tailwind-merge": "^2.4.0",
"tailwind-variants": "^0.2.1",
"tailwindcss": "^3.4.4",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"typescript": "^5.7.2",
"vite": "^5.0.11",
"vite-plugin-copy": "^0.1.6",
"vite-plugin-top-level-await": "^1.4.4",
Expand All @@ -100,16 +102,20 @@
"compress-json": "^3.1.0",
"country-code-to-flag-emoji": "^1.3.3",
"dexie": "^4.0.8",
"dompurify": "^3.2.3",
"lodash": "^4.17.21",
"lucide-svelte": "^0.462.0",
"marked": "^15.0.3",
"minisearch": "^7.1.0",
"nostr-tools": "^2.10.3",
"radix-svelte": "^0.9.0",
"surrealdb": "^1.0.6",
"svelte-geolocation": "^1.0.0",
"svelte-headless-table": "^0.18.3",
"svelte-masonry": "^0.1.1",
"svelte-time": "^0.9.0",
"svelte-timeago": "^0.1.2",
"vite-plugin-compression": "^0.5.1"
"vite-plugin-compression": "^0.5.1",
"webcoreui": "^0.8.1"
}
}
45 changes: 45 additions & 0 deletions apps/gui/src/lib/components/blocks/Masonry.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<script>
import Masonry from 'svelte-bricks'
let nItems = 30
$: items = [
'general',
'network',
'insights',
'checks',
'map',
]
let [minColWidth, maxColWidth, gap] = [200, 800, 20]
let width, height
</script>

<Masonry
{items}
{minColWidth}
{maxColWidth}
{gap}
let:item
bind:width
bind:height
>
{#if item === 'map'}

{/if}
{#if item === 'network'}

{/if}
{#if item === 'insights'}

{/if}
{#if item === 'checks'}

{/if}
{#if item === 'general'}

{/if}
{#if item === 'map'}

{/if}
</Masonry>
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<script lang="ts">
import { User } from '$lib/models/User.js';
import type { UserFeed } from '$lib/services/UserService';
import { UserService } from '$lib/services/UserService';
import { nip66 } from '$lib/stores';
import { parseNote } from '$lib/utils/notes';
import { onMount } from 'svelte';
import { get, writable, type Writable } from 'svelte/store';
import { userService } from '$lib/stores/user.js';
import OperatorFeedNote from './OperatorFeedNote.svelte';
export let pubkey: string;
let user: User;
const feed: Writable<UserFeed> = writable([]);
onMount( async () => {
const instance = get(nip66);
while(!instance || !instance.ready || !pubkey) {
await new Promise(resolve => setTimeout(resolve, 100));
}
userService.set(new UserService(instance.adapters));
if(!$userService) return console.warn('user service does not exist.');
console.log('user pubkey', pubkey)
user = $userService.userFromPubkey(pubkey);
console.log(user)
await user.ready();
console.log('user feed: user', user)
await $userService.feed(user).then( (data: UserFeed) => {
console.log('user feed: data', data)
feed.set(data);
});
userService.set($userService);
});
</script>

<section id="operator-feed" class="block">
wtf <br/>
<h2>Operator Feed</h2>
{#if $userService}
<ul>
{#each $feed as noteExtended}
<OperatorFeedNote {noteExtended} />
{/each}
</ul>
{/if}
</section>

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<script lang="ts">
import type { UserFeedItem } from '$lib/services/UserService';
import { parseNote } from '$lib/utils/notes';
import { timeAgo } from '$lib/utils/time';
import { onMount } from 'svelte';
import type { Writable } from 'svelte/store';
export let noteExtended: UserFeedItem;
// Initialize content as Writable<string>
let content: Writable<string>;
// Assign the store directly upon component initialization
onMount( () => {
content = parseNote(noteExtended.note.content, {
removeHashtags: true,
nip19: true,
markdown: true,
images: true,
videos: true,
truncate: true,
truncateLength: 100,
sanitize: false,
replaceAmpersand: true,
});
})
</script>

<section id="note-{noteExtended.note.id}" class="note px-8 py-5 rounded-lg bg-white/5 text-md block mb-3">
<div class="text-xs text-gray-400">
{#if noteExtended.note?.created_at}
<span class="">{timeAgo(noteExtended.note.created_at*1000)}</span>
{/if}
|
<a href="https://njump.me/{noteExtended.note.reference}" target="_blank">link</a>
</div>

<div class="content text-white/55 text-xl my-6 overflow-hidden overflow-ellipsis">
{@html $content}
</div>
<div class="actions flex mt-2 opacity-25 hover:opacity-100">
<div class="flex-grow">
<a href="">♡</a>
{noteExtended.reactions.length}
</div>
<div class="flex-grow">
<a href="">⚡</a>
{noteExtended.zaps.length}
</div>
<div class="flex-grow">
<a href="">🗨</a>
{noteExtended.comments.length}
</div>
</div>

</section>

<style global>
.note > .content {
@apply leading-8;
}
.note > .content > p {
margin-bottom: 10px;
}
.note > .content > ul {
@apply p-2;
}
.note > .content > ul > li {
@apply list-decimal list-item mb-4 list-inside leading-6 text-lg;
padding: 5px;
}
.note > .actions > div > a {
@apply py-1 px-2 hover:bg-black/20 hover:rounded-full;
}
</style>
Loading

0 comments on commit 42c2a23

Please sign in to comment.