-
Notifications
You must be signed in to change notification settings - Fork 482
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
49 changed files
with
1,967 additions
and
215 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -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.
50 changes: 50 additions & 0 deletions
50
apps/gui/src/lib/components/partials/relay-single/OperatorFeed.svelte
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,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> | ||
|
79 changes: 79 additions & 0 deletions
79
apps/gui/src/lib/components/partials/relay-single/OperatorFeedNote.svelte
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,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> |
Oops, something went wrong.