Skip to content

Commit

Permalink
Merge pull request #1 from nostrocket/webworker
Browse files Browse the repository at this point in the history
Webworker
  • Loading branch information
gsovereignty authored Apr 13, 2024
2 parents 44f2bbb + 7017d0e commit df8c306
Show file tree
Hide file tree
Showing 19 changed files with 559 additions and 1,072 deletions.
24 changes: 24 additions & 0 deletions src/lib/components/Kind1.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
import type { EventTreeItem } from "@/workers/firehose.types";
import RenderNoteContent from "./RenderNoteContent.svelte";
import { ArrowRight } from "radix-icons-svelte";
import type { Writable } from "svelte/store";
export let treeItem:EventTreeItem;
export let newParent:Writable<string[]>
</script>
{#each treeItem.children as [id, tree], i (id)}
<div class="flex w-full items-start gap-2.5">
<!-- <Avatar ndk={$ndk} user={e.author} class="rounded-full w-10 h-10 object-cover" /> -->
<img class="w-8 h-8 rounded-full" src="https://zenquotes.io/img/marcus-aurelius.jpg" alt="profile pic" />
<div class="flex flex-col leading-1.5 p-4 border-gray-200 bg-gray-100 rounded-e-xl rounded-es-xl dark:bg-gray-700 my-2 overflow-hidden mr-2">
<div class="flex items-center space-x-2 rtl:space-x-reverse">
<span class="text-sm font-semibold text-gray-900 dark:text-white">username</span>
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">{new Date(tree.event.created_at*1000).toLocaleString()}</span>
</div>
<p class="text-sm font-normal py-2.5 text-gray-900 dark:text-white"><RenderNoteContent inputString={tree.event.content} /></p>
<a class="text-xs text-orange-600" href="#" on:click={()=>{console.log(tree)}}>print to console</a>
<a href="#" on:click={()=>{newParent.update(existing=>{existing.push(id); return existing})}} class="text-sm font-normal text-gray-500 dark:text-gray-400 float-right">{tree.children.size}<ArrowRight /></a>
</div>
</div>
{/each}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { ndk } from "$lib/ndk";
import { Button } from "@/components/ui/button";
import { currentPubkey } from "@/stores/user";
import { NDKNip07Signer } from "@nostr-dev-kit/ndk";
import { Person } from "radix-icons-svelte";
import { onMount } from "svelte";
Expand All @@ -19,8 +19,12 @@
const user = await signer.blockUntilReady();
if (user) {
$ndk.signer = signer;
$ndk = $ndk
currentPubkey.update(existing=>{
existing = user.pubkey
return existing
})
// $ndk.signer = signer;
// $ndk = $ndk
localStorage.setItem("signed-in", "true");
}
} catch (e) {
Expand All @@ -30,6 +34,5 @@
</script>

<Button on:click={nip07}>
<Person class="w-4 h-4 sm:hidden" />
<span class="hidden sm:block">Sign in</span>
<Person class="w-4 h-4" />
</Button>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
return `<img src="${url}" alt="Image" style="max-width: 100%; height: auto;">`;
});
const nostr = /nostr:\S+/g;
return formattedInput;
}
</script>
Expand Down
1 change: 0 additions & 1 deletion src/lib/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions src/lib/ndk.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/lib/stores/layout.ts

This file was deleted.

252 changes: 0 additions & 252 deletions src/lib/stores/session.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/lib/stores/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { writable, type Writable } from "svelte/store";

export let currentPubkey = writable(undefined)
38 changes: 0 additions & 38 deletions src/lib/stores/wot.ts

This file was deleted.

Loading

0 comments on commit df8c306

Please sign in to comment.