From 70ca44226cb1a7ee4a394c2f4bba263d9eab5674 Mon Sep 17 00:00:00 2001
From: Jonathan Staab
Date: Wed, 7 Dec 2022 22:27:07 -0800
Subject: [PATCH] Generalize notes/tabs
---
README.md | 2 -
src/App.svelte | 6 +-
src/partials/Note.svelte | 2 +-
src/partials/Notes.svelte | 82 +++++++++++++++++++++++++++
src/partials/Tabs.svelte | 19 +++++++
src/routes/Notes.svelte | 106 ++++++-----------------------------
src/routes/UserDetail.svelte | 78 ++------------------------
7 files changed, 126 insertions(+), 169 deletions(-)
create mode 100644 src/partials/Notes.svelte
create mode 100644 src/partials/Tabs.svelte
diff --git a/README.md b/README.md
index 0d95a640..524fb76b 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,6 @@
Bugs
-- [ ] Pubkeys expand the width of the page, hiding the plus post button
- [ ] Permalink note detail (share/permalink button?)
-- [ ] Back button no longer works if a modal is closed normally
- [ ] Prevent tabs from re-mounting (or at least re- animating)
- [ ] Go "back" after adding a note
- [ ] uniq and sortBy are sprinkled all over the place, figure out a better solution
diff --git a/src/App.svelte b/src/App.svelte
index cecb46de..f6de8fc1 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -92,11 +92,7 @@
{/key}
-
- {#key params.type}
-
- {/key}
-
+
diff --git a/src/partials/Note.svelte b/src/partials/Note.svelte
index f91c4788..af5f9d10 100644
--- a/src/partials/Note.svelte
+++ b/src/partials/Note.svelte
@@ -121,7 +121,7 @@
deleteReaction(flag)}>Unflag
{:else}
-
+
{#if note.content.length > 500 && !showEntire}
{ellipsize(note.content, 500)}
{:else}
diff --git a/src/partials/Notes.svelte b/src/partials/Notes.svelte
new file mode 100644
index 00000000..f03ddd63
--- /dev/null
+++ b/src/partials/Notes.svelte
@@ -0,0 +1,82 @@
+
+
+
+
+
+ {#each $notes as n (n.id)}
+ -
+
+ {#each n.replies as r (r.id)}
+
+
+
+ {/each}
+
+ {:else}
+ {#if loading}
+
+ {:else}
+ - No notes found.
+ {/if}
+ {/each}
+
diff --git a/src/partials/Tabs.svelte b/src/partials/Tabs.svelte
new file mode 100644
index 00000000..c9116633
--- /dev/null
+++ b/src/partials/Tabs.svelte
@@ -0,0 +1,19 @@
+
+
+
+ {#each tabs as tab}
+ - setActiveTab(tab)}>
+ {toTitle(tab)}
+
+ {/each}
+
diff --git a/src/routes/Notes.svelte b/src/routes/Notes.svelte
index 9d28cbb5..30265c15 100644
--- a/src/routes/Notes.svelte
+++ b/src/routes/Notes.svelte
@@ -1,65 +1,21 @@
-
-
{#if $relays.length === 0}
{:else}
-
-
-{#if type === 'follows' && authors.length === 0}
+
+{#if activeTab === 'follows' && authors.length === 0}
You haven't yet followed anyone. Visit a user's profile to follow them.
+{:else if activeTab === 'follows'}
+
{:else}
-
- {#each (notes ? $notes : []) as n (n.id)}
- -
-
- {#each n.replies as r (r.id)}
-
-
-
- {/each}
-
- {/each}
-
-
-
-
+
{/if}
-
-
+ items-center border border-dark shadow-2xl cursor-pointer">
-
+
{/if}
diff --git a/src/routes/UserDetail.svelte b/src/routes/UserDetail.svelte
index 69608698..f9cf151b 100644
--- a/src/routes/UserDetail.svelte
+++ b/src/routes/UserDetail.svelte
@@ -1,73 +1,24 @@
-
-
{#if user}
-
- {#each (notes ? $notes : []) as n (n.id)}
- -
-
- {#each n.replies as r (r.id)}
-
-
-
- {/each}
-
- {:else}
- {#if loading}
-
- {:else}
- - No notes found.
- {/if}
- {/each}
-
+
{/if}