Commit Graph

22 Commits

Author SHA1 Message Date
Alex Gleason 12a4966b84 Add haptic feedback to emoji reaction selection in QuickReactMenu
The popover emoji picker (both quick presets and full picker) was
publishing reactions internally without triggering haptic feedback.
Add impactLight() at the top of publishReaction() so every emoji
selection path gets tactile feedback.
2026-04-14 11:29:22 -05:00
Alex Gleason 29696fa3d3 Apply nearest-neighbor scaling to small custom emoji images
Custom emoji images with natural dimensions <= 16x16 now render with
image-rendering: pixelated to preserve crisp pixels instead of blurring.

Also consolidates 6 direct <img> sites to use the shared CustomEmojiImg
component so all custom emoji rendering benefits from this behavior.
2026-04-04 22:58:42 -05:00
Lemon 1ef1400699 Track custom emoji usage so they appear in quick-react bar
Custom emojis were explicitly excluded from usage tracking, so they could
never accumulate enough count to appear in the quick-react popover. The
bar already handles displaying and filtering custom emojis correctly
(including removing stale ones from deleted packs), so the only missing
piece was the tracking call.
2026-03-28 23:07:21 -07:00
Chad Curtis a827744ddc Remove focus ring from reaction buttons and add double-click to heart react 2026-03-14 11:43:53 -05:00
Mary Kate Fain 929bb32c69 Fix custom emoji reactions on /i/ external content pages
Two bugs prevented NIP-30 custom emoji reactions from working on /i/
pages (e.g. country pages):

1. Publishing: QuickReactMenu's onReact callback discarded the emoji
   tag, so kind 17 events were published without the ['emoji', name,
   url] tag needed to resolve custom emojis. Now passes emojiTag
   through to the callback.

2. Display: The reaction button rendered a plain <span> that showed
   raw :shortcode: text. Now uses ReactionEmoji component which
   resolves custom emoji images from the event's tags.

Also updated useExternalUserReaction to return the event's tags
alongside the emoji string so custom emojis can be rendered.

Closes #62
2026-03-04 23:37:52 -06:00
Alex Gleason 543eda02ee Fix linter errors: conditional hook, unused vars/imports, and unstable deps 2026-03-02 10:24:32 -06:00
Alex Gleason e5e7dd6564 Merge branch 'main' of gitlab.com:soapbox-pub/ditto
# Conflicts:
#	src/lib/sidebarItems.tsx
2026-03-01 22:23:17 -06:00
Mary Kate 95deb01787 Merge branch 'emoji-packs' into 'main'
Add NIP-30 custom emoji packs support

See merge request soapbox-pub/ditto!24
2026-03-02 04:19:54 +00:00
Alex Gleason fad790be16 Extract non-component exports to separate modules to fix react-refresh warnings
Move helper functions, types, and constants out of component files into
dedicated lib/hooks modules so each component file only exports components:

- getContentWarning -> src/lib/contentWarning.ts
- isCustomEmoji, getCustomEmojiUrl, buildEmojiMap, ResolvedEmoji, resolveReactionEmoji -> src/lib/customEmoji.ts
- ExternalContent, parseExternalUri, formatIsbn, headerLabel, seoTitle -> src/lib/externalContent.ts
- extractYouTubeId, extractTweetId, and other URL helpers -> src/lib/linkEmbed.ts
- isSingleImagePost -> src/lib/noteContent.ts
- useOnboarding, OnboardingContext -> src/hooks/useOnboarding.ts

Also un-exported module-private symbols in VinesFeedPage and SettingsPage.
2026-03-01 22:15:47 -06:00
Mary Kate Fain 8df5fa7d16 Remove superseded files, fix quick reactions and compose preview for custom emojis
- Remove CustomEmojiPicker.tsx and useUserEmojiPacks.ts (replaced by
  Derek's useCustomEmojis + emoji-mart custom categories)
- Update EmojiPackContent to use local kind 10030 query
- Update EmojiShortcodeAutocomplete to use useCustomEmojis
- Fix quick reaction buttons to render custom emojis as images
- Fix quick reaction buttons to include emoji tag when reacting
- Filter stale custom emojis from quick reaction row
- Add emoji tags to compose box mock event for preview rendering
2026-03-01 22:04:44 -06:00
Derek Ross addbece173 Add NIP-30 custom emoji picker support (kind 10030)
Integrate custom emojis from the user's kind 10030 emoji list into
the emoji picker, compose flow, reactions, and DMs:

Hook:
- useCustomEmojis: query kind 10030, extract emoji shortcode/url pairs

EmojiPicker:
- Accept customEmojis prop, render as dedicated 'Custom' tab via
  emoji-mart's custom categories feature
- Changed onSelect from string to EmojiSelection union type
  (native unicode | custom shortcode+url)

ComposeBox:
- Pass custom emojis to picker, insert :shortcode: on selection
- Scan content on publish for :shortcode: patterns, cross-reference
  against user's emoji list, add ['emoji', name, url] tags (NIP-30)

QuickReactMenu:
- Custom emoji reactions: content=':shortcode:', with emoji tag
- Optimistic cache update includes custom emoji URL/name

DMChatArea:
- Pass custom emojis to picker, insert :shortcode: text

Settings:
- Registered as 'Custom Emojis' in Other Stuff > Whimsy section
- showCustomEmojis toggle (default true) gates all custom emoji
  features — when disabled, no kind 10030 queries are made
- Fix pre-existing Bot icon missing import in sidebarItems
2026-03-01 20:28:08 -05:00
Chad Curtis 31a543ce0c Add react/share action bar to external content (/i/) pages
Implements NIP-25 kind 17 reactions and kind 1 shares for external
content identifiers (URLs, ISBNs, countries) on the /i/ page.
2026-02-28 21:27:09 -06:00
Alex Gleason 4f2eb23a62 Replace accent color with foreground/neutral in nav, headings, and emoji picker
The accent (secondary) color is now gold/amber which looks wrong for
active nav states, section titles, and interactive backgrounds. Change
these to use foreground or neutral surface colors instead:

- Left sidebar active items: text-accent -> text-foreground
- Right sidebar headings: text-accent -> text-foreground
- Mobile bottom nav active items: text-accent -> text-foreground
- Mobile explore drawer active items: text-accent -> text-foreground
- Quick react emoji picker: hover:bg-accent -> hover:bg-secondary
- Section labels (Explore, Settings, My Themes): text-accent/70 -> text-muted-foreground
- Search page trending heading and Rising tab: text-accent -> text-foreground/text-primary
- Sidebar theme palette icon: text-accent -> text-primary
2026-02-25 23:22:39 -06:00
Mary Kate Fain edd13e26f7 Fix emoji picker closing when expanding to full picker
The popover's mouse-leave timeout was firing during the DOM transition
from the quick-select bar to the full emoji-mart picker, causing it to
close immediately. Added an expanded state flag that disables the
hover-to-close behavior when the full picker is shown.
2026-02-23 12:07:53 -06:00
Mary Kate Fain c046e33f6b Replace hardcoded emoji picker with emoji-mart for full emoji support 2026-02-23 12:05:21 -06:00
Chad Curtis 4707b37ad7 Fix emoji picker flashing quick select after deeper picker selection
Close the popover via onClose callback when an emoji is selected from
the full picker. Add a 300ms cooldown (justClosedRef) to prevent the
popover from immediately reopening via hover when the picker disappears
and the cursor lands on the trigger button.
2026-02-20 23:49:02 -06:00
Alex Gleason 7e3f104ace Fix NIP-30 custom emoji reactions rendering as raw :shortcode: text
Custom emoji reactions from kind 7 events with emoji tags were displaying
the raw shortcode text (e.g., ':soapbox:') instead of rendering the image.
Add custom emoji resolution throughout the reaction pipeline: data hooks
now extract emoji URLs from event tags, and all rendering locations
(ReactionButton, PostDetailPage stats, InteractionsModal, Notifications)
now display custom emojis as inline images.
2026-02-19 18:39:43 -06:00
Chad Curtis a484c8b95c Delay stats invalidation after publish to preserve optimistic updates
The relay needs time to index newly published events. Immediate
invalidation caused a refetch that returned stale counts, overwriting
the optimistic +1 and making the count briefly appear then vanish.
2026-02-19 16:21:14 -06:00
Chad Curtis 35422ec6bb Fix optimistic updates, show user reaction emoji, compact embeds, and unify repost menu
- Add true optimistic updates for reactions and reposts via setQueryData
  instead of only invalidating queries after publish
- Track user's own reaction per event and display their emoji in place of
  the Heart icon across feed, post details, and notifications
- Strip whitespace around block embeds and skipped media URLs to eliminate
  blank lines caused by whitespace-pre-wrap
- Only render link preview cards for standalone URLs; inline URLs in
  sentences render as plain clickable links
- Remove border-b separators and use fixed-height object-cover on preview
  images to eliminate gaps
- Tighten padding on EmbeddedNote and EmbeddedNaddr cards
- Use fixed-height object-cover for ImageGallery grid images
- Unify RepostMenu to use Popover on all screen sizes instead of Drawer
  on mobile
2026-02-19 16:19:19 -06:00
shakespeare.diy afac29036a Fix "..." button to properly show full emoji picker
- Clicking "..." now replaces quick menu with full emoji picker
- Removed nested Popover that was causing the menu to close
- Full picker stays open and functional within the same popover
- Simplified state management with showFullPicker boolean

Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
2026-02-19 06:46:47 -06:00
shakespeare.diy 9f7cd4ed62 Add hover trigger and personalized emoji suggestions
- Created useEmojiUsage hook to track user's most-used emojis
- QuickReactMenu now shows user's top 6 emojis, falling back to defaults
- Default emojis: ❤️, 👍, 👎, 😂, 😮, 😢
- ReactionButton triggers menu on hover for faster access
- Menu aligns to start (left) to begin from the heart icon
- Emoji usage persists per user in localStorage

Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
2026-02-19 06:44:52 -06:00
shakespeare.diy 256b46394c Implement Ditto-style quick reaction menu
- Created QuickReactMenu component with horizontal emoji bar
- Quick access to 6 common emojis (❤️, 😂, 💯, 🔥, 👍, 📌)
- "..." button opens full EmojiPicker for more options
- Updated ReactionButton to use QuickReactMenu instead of full picker
- Matches Ditto UX: click shows quick react menu, ... reveals full picker

Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
2026-02-19 06:40:49 -06:00