mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
[upload] Suggest one-tap hashtag chips from the user's past videos (#45)
The upload modal's Hashtags section now shows chips of the user's most-used past
hashtags ("Reuse a tag from your videos:"). Clicking one adds it to the NIP-71 't'
repeater; already-added chips dim + disable; the row is hidden for users with no
past tags.
- js/utils/hashtagSuggestions.js: pure rankHashtagsByFrequency(videos) — count =
number of the user's videos using each tag, normalized (case + '#') and deduped
per video, ranked by count then alphabetically. Reads video.nip71.hashtags, falls
back to raw event 't' tags minus bitvid's fixed t=video marker.
- app.getUserHashtagSuggestions() sources the user's own videos via
nostrService.getActiveVideosByAuthors([pubkey]) and ranks them (top 12), injected
into the modal as getHashtagSuggestions.
- UploadModal renders the chips on open and wires clicks through the existing
Nip71FormManager (addRepeaterEntry + setFieldValue, dedup via collectRepeaterValues).
Tests: tests/hashtag-suggestions.test.mjs (5 — per-video counting, normalization,
marker exclusion, tie-break + limit, empty input). Lint + build green.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
6bdf28fb30
commit
3df398d7ad
7 files changed
+318
-5
No files matched your search
@@ -249,6 +249,10 @@
|
||||
<!-- Hashtags -->
|
||||
<div class="space-y-2">
|
||||
<label class="block text-sm font-medium text-text">Hashtags</label>
|
||||
<div id="hashtag-suggestions-wrap" class="space-y-1 hidden">
|
||||
<p class="text-xs text-muted">Reuse a tag from your videos:</p>
|
||||
<div id="hashtag-suggestions" class="flex flex-wrap gap-2"></div>
|
||||
</div>
|
||||
<div
|
||||
class="rounded-lg border border-border/70 bg-surface/30 p-3 space-y-3"
|
||||
data-nip71-repeater="t"
|
||||
|
||||
Reference in new issue
Block a user