Commit Graph

867 Commits

Author SHA1 Message Date
Gigi
efa6d13726 feat: improve bunker error message formatting
- Add 'Failed:' prefix to error messages
- Add line breaks between error and signer suggestions
- Clearer visual separation of error and help text
2025-10-18 09:40:29 +02:00
Gigi
6116dd12bc feat: hide bookmark controls when logged out
- Only show heart/support button when logged out
- Hide refresh, grouping, and view mode buttons when not logged in
- Cleaner, simpler footer for logged out state
2025-10-18 09:37:17 +02:00
Gigi
210cdd41ec feat: rename Bunker button to Signer
Change button label from 'Bunker' to 'Signer' for better clarity and user-friendliness
2025-10-18 09:35:28 +02:00
Gigi
973409e82a feat: add signer suggestions to bunker URI validation error
- Show Amber and Aegis links when bunker URI format is invalid
- Consistent helpful messaging across all bunker errors
- Helps users even when they don't have the right format
2025-10-18 09:34:25 +02:00
Gigi
5d6f48b9a8 feat: add signer suggestions to bunker error messages
- Show helpful message when bunker connection fails
- Suggest Amber (Android) and Aegis (iOS) signers with links
- Links: Amber GitHub and Aegis TestFlight
- Similar pattern to extension error message
2025-10-18 09:33:18 +02:00
Gigi
4921427ad4 feat: simplify login description text
Change 'Connect your nostr npub' → 'Connect your npub'
npub is already nostr-specific, so 'nostr' is redundant
2025-10-18 09:23:20 +02:00
Gigi
8d4a4a04a3 fix: catch 'Signer extension missing' error message
- Add check for 'Signer extension missing' error
- Add case-insensitive check for 'extension missing'
- Ensure nos2x link is shown when no extension is found
2025-10-18 09:21:45 +02:00
Gigi
c77907f87a feat: improve extension login error messages
- Show specific message when no extension is found
- Show message when authentication is cancelled/denied
- Display actual error message for other failures
- Remove generic 'Login failed' message
2025-10-18 09:20:33 +02:00
Gigi
9345228e66 feat: add nos2x link to extension error message
- Update error message to mention 'like nos2x'
- Add clickable link to nos2x Chrome Web Store
- Change error type to support React nodes for richer messages
2025-10-18 09:19:20 +02:00
Gigi
811362175c feat: hide Extension button when Bunker input is shown
- Extension button now hidden when bunker input is visible
- Reduces visual clutter and confusion
- Clear focus on the active login method
2025-10-18 09:17:44 +02:00
Gigi
3d22e7a3cb feat: simplify button text to single words
- 'Extension Login' → 'Extension'
- 'Bunker Login' → 'Bunker'
Icons + context make the action clear, minimalist approach
2025-10-18 09:16:52 +02:00
Gigi
0b0d3c2859 feat: use nostr-native language in login description
Change 'Login to see' → 'Connect your nostr npub to see'
More specific and aligned with nostr terminology
2025-10-18 09:16:18 +02:00
Gigi
1f8d18071c feat: shorten login button text for cleaner UI
- 'Login with Extension' → 'Extension Login'
- 'Login with Bunker' → 'Bunker Login'
More concise and easier to scan
2025-10-18 09:15:13 +02:00
Gigi
a4afe59437 fix: properly display FontAwesome icons in login buttons
- Import and use FontAwesomeIcon component from @fortawesome/react-fontawesome
- Add puzzle piece icon (faPuzzlePiece) for Extension button
- Add shield icon (faShieldHalved) for Bunker button
- Add info circle icon (faCircleInfo) for error messages
- Update CSS to properly style SVG icons with correct sizing
2025-10-18 09:14:45 +02:00
Gigi
1fe3786a3d feat: update login title to be more personable
Change 'Welcome to Boris' to 'Hi! I'm Boris.' for a friendlier, more welcoming first impression
2025-10-18 09:13:05 +02:00
Gigi
42d265731f feat: hide login button and user icon when logged out
- Remove redundant login button from sidebar header
- Hide profile avatar when no active account
- Users can now only login through the main login screen
- Logout button only shown when logged in
- Clean up unused imports (useState, Accounts, faRightToBracket)
2025-10-18 09:12:22 +02:00
Gigi
e4b4b97874 feat: highlight 'your own highlights' in login copy
- Style 'your own highlights' text with user's mine highlight color
- Uses --highlight-color-mine CSS variable from settings
- Adds subtle padding and border-radius for clean highlight effect
2025-10-18 09:11:04 +02:00
Gigi
1870c307da feat: improve login UI with better copy and modern design
- Add welcoming title 'Welcome to Boris'
- Update description to highlight key features (bookmarks, long-form articles, highlights)
- Change button labels to 'Login with Extension' and 'Login with Bunker'
- Add FontAwesome icons to login buttons
- Create dedicated login.css with modern, mobile-first styling
- Improve bunker input UI with better spacing and visual hierarchy
- Use softer error styling with amber/warning colors instead of harsh red
- Add smooth transitions and hover effects
- Ensure mobile-optimized touch targets
2025-10-18 09:10:14 +02:00
Gigi
4da3a0347f feat: add bookmark grouping toggle (grouped by source vs flat chronological)
Changes:
- Updated groupIndividualBookmarks to group by source kind (10003, 30001, 39701) instead of content type
- Added toggle button in bookmark footer to switch between grouped and flat views
- Default mode is 'grouped by source' showing: My Bookmarks, Private Bookmarks, Amethyst Lists, Web Bookmarks
- Flat mode shows single 'All Bookmarks (X)' section sorted chronologically
- Preference persists to localStorage
- Implemented in both BookmarkList.tsx and Me.tsx

Files modified:
- src/utils/bookmarkUtils.tsx - New grouping logic
- src/components/BookmarkList.tsx - Added state, toggle button, conditional sections
- src/components/Me.tsx - Added state, toggle button, conditional sections
2025-10-17 23:55:15 +02:00
Gigi
29ef21a1fa fix: restore Debug page decrypt display via onDecryptComplete callback
Added onDecryptComplete callback to controller:
- Controller emits decrypt results (eventId, publicCount, privateCount)
- Debug subscribes to see decryption progress
- setDecryptedEvents updated with decrypt results for UI display

Debug page now shows decrypted content counts for encrypted bookmark lists (like kind:30001 Amethyst-style NIP-04 bookmarks).
2025-10-17 23:14:10 +02:00
Gigi
9eef5855a9 feat: create shared bookmark controller for Debug-driven loading
Created bookmarkController.ts singleton:
- Encapsulates Debug's working streaming/decrypt logic
- API: start(), onRawEvent(), onBookmarks(), onLoading(), reset()
- Live deduplication, sequential decrypt, progressive updates

Updated App.tsx:
- Removed automatic loading triggers (useEffect)
- Subscribe to controller for bookmarks/loading state
- Manual refresh calls controller.start()

Updated Debug.tsx:
- Uses controller.start() instead of internal loader
- Subscribes to onRawEvent for UI display (unchanged)
- Pressing 'Load Bookmarks' now populates app sidebar

No automatic loads on login/mount. App passively receives updates from Debug-driven controller.
2025-10-17 23:08:36 +02:00
Gigi
2e70745bab fix: make bookmarksLoading optional in Me component
Made bookmarksLoading prop optional in MeProps since it's not currently used.
Reserved for future use when we want to show centralized loading state.

All linting and type checks now pass.
2025-10-17 22:52:16 +02:00
Gigi
8a971dfe52 refactor: pass bookmarks as props to Me component
Updated Me.tsx to receive bookmarks from centralized App state:
- Added bookmarks and bookmarksLoading to MeProps
- Removed local bookmarks state
- Removed bookmark caching (now handled at App level)

Updated Bookmarks.tsx to pass bookmarks props to Me component:
- Both 'me' and 'profile' views receive centralized bookmarks

All bookmark data now flows from App.tsx -> Bookmarks.tsx -> Me.tsx with no duplicate fetching or local state.
2025-10-17 22:50:07 +02:00
Gigi
a004e96eca feat: extract bookmark streaming helpers and centralize loading
Created bookmarkStream.ts with shared helpers:
- getEventKey: deduplication logic
- hasEncryptedContent: encryption detection
- loadBookmarksStream: streaming with non-blocking decryption

Refactored bookmarkService.ts to use shared helpers:
- Uses loadBookmarksStream for consistent behavior with Debug page
- Maintains progressive loading via callbacks
- Added accountManager parameter to fetchBookmarks

Updated App.tsx to pass accountManager to fetchBookmarks:
- Progressive loading indicators via onProgressUpdate callback

All bookmark loading now uses the same battle-tested streaming logic as Debug page.
2025-10-17 22:47:20 +02:00
Gigi
ce2432632c refactor: consolidate bookmark loading into single centralized function
Removed duplicate bookmark loading logic from Debug page:
- Debug 'Load Bookmarks' button now calls centralized onRefreshBookmarks
- Removed redundant state (bookmarkEvents, bookmarkStats, decryptedEvents)
- Removed unused helper functions (getKindName, getEventSize, etc.)
- Cleaned up imports (Helpers, queryEvents, collectBookmarksFromEvents)
- Simplified UI to show timing only, bookmarks visible in sidebar

Now there's truly ONE place for bookmark loading (bookmarkService.ts),
called from App.tsx and used throughout the app. Debug page's button
is now the same as clicking refresh in the bookmark sidebar.
2025-10-17 22:28:35 +02:00
Gigi
56b3100c8e fix: correct TypeScript types in Debug component
Fixed type error in Debug.tsx:
- Changed highlightVisibility from string to proper HighlightVisibility object
- Used 'support' prop instead of invalid 'children' prop for ThreePaneLayout
- Set showSupport={true} to properly render debug content

All linting and type checks now pass.
2025-10-17 22:19:09 +02:00
Gigi
327d65a128 feat: add bookmarks sidebar to Debug page
Added ThreePaneLayout to Debug page so bookmarks are visible:
- Debug page now has same layout as other pages
- Shows bookmarks sidebar on the left
- Debug content in the main pane
- Can compare centralized app bookmarks with Debug bookmarks side-by-side

This makes it easy to verify that centralized bookmark loading
works the same as the Debug page implementation.
2025-10-17 22:17:11 +02:00
Gigi
c2223e6b08 feat: centralize bookmark loading with streaming and auto-decrypt
Implemented centralized bookmark loading system:
- Bookmarks loaded in App.tsx with streaming + auto-decrypt pattern
- Load triggers: login, app mount, manual refresh only
- No redundant fetching on route changes

Changes:
1. bookmarkService.ts: Refactored fetchBookmarks for streaming
   - Events stream with onEvent callback
   - Auto-decrypt encrypted content (NIP-04/NIP-44) as events arrive
   - Progressive UI updates during loading

2. App.tsx: Added centralized bookmark state
   - bookmarks and bookmarksLoading state in AppRoutes
   - loadBookmarks function with streaming support
   - Load on mount if account exists (app reopen)
   - Load when activeAccount changes (login)
   - handleRefreshBookmarks for manual refresh
   - Pass props to all Bookmarks components

3. Bookmarks.tsx: Accept bookmarks as props
   - Receive bookmarks, bookmarksLoading, onRefreshBookmarks
   - Pass onRefreshBookmarks to useBookmarksData

4. useBookmarksData.ts: Simplified to accept bookmarks as props
   - Removed bookmark fetching logic
   - Removed handleFetchBookmarks function
   - Accept onRefreshBookmarks callback
   - Use onRefreshBookmarks in handleRefreshAll

5. Me.tsx: Removed fallback bookmark loading
   - Removed fetchBookmarks import and calls
   - Use bookmarks directly from props (centralized source)

Benefits:
- Single source of truth for bookmarks
- No duplicate fetching across components
- Streaming + auto-decrypt for better UX
- Simpler, more maintainable code
- DRY principle: one place for bookmark loading
2025-10-17 22:06:33 +02:00
Gigi
d1ffc8c3f9 feat: auto-decrypt bookmarks as they arrive
Simplified bookmark loading by chaining loading and decryption:
- Events with encrypted content are automatically decrypted as they arrive
- Removed separate "Decrypt" button - now automatic
- Removed individual decrypt buttons - happens automatically
- Removed handleDecryptSingleEvent and related state
- Cleaner UI with just "Load Bookmarks" and "Clear" buttons

Benefits:
- Simpler, more intuitive UX
- DRY - single flow instead of 2-step process
- Shows decryption results inline as events stream in
- Uses same collectBookmarksFromEvents for consistency

Each event with encrypted content (NIP-04 or NIP-44) is decrypted
immediately in the onEvent callback, with results displayed inline.
2025-10-17 21:44:55 +02:00
Gigi
21228cd212 refactor: unify debug logging under [bunker] prefix
Changed all debug console logs to use [bunker] prefix with emojis:
- 🔵 Individual decrypt clicked
- 🔓 Decrypting event (with details)
-  Event decrypted (with results)
- ⚠️  Warnings (no account, 0 private items)
-  Errors

Now users can filter console by 'bunker' to see all relevant logs.
2025-10-17 21:38:23 +02:00
Gigi
e0b86a84ba debug: add detailed logging for individual bookmark decryption
Added extensive debug logging to help diagnose decryption issues:
- Event details (kind, content length, encryption type)
- Signer information (type, availability)
- Warning when 0 private items found despite encrypted content

This will help identify why decryption might be failing silently.
2025-10-17 21:34:47 +02:00
Gigi
c3a4e41968 fix: detect NIP-04 encrypted content in bookmark events
Added explicit detection for NIP-04 encrypted content format:
- NIP-04: base64 content with ?iv= suffix
- NIP-44: detected by Helpers.hasHiddenContent()
- Encrypted tags: detected by Helpers.hasHiddenTags()

Created hasEncryptedContent() helper that checks all three cases.
Now properly shows padlock emoji and decrypt button for events with
NIP-04 encrypted content (like the example with ?iv=5KzDXv09...).
2025-10-17 21:31:21 +02:00
Gigi
f3205843ac fix: use consistent encrypted content detection for padlock and decrypt button
Fixed mismatch between padlock display and decrypt button visibility:
- Both now use Helpers.hasHiddenContent() and Helpers.hasHiddenTags()
- Previously padlock showed for ANY content, button only for encrypted
- Now both correctly detect actual encrypted content

This ensures decrypt buttons appear whenever padlocks are shown.
2025-10-17 21:27:02 +02:00
Gigi
9a03dd312f feat: add individual decrypt buttons for bookmark events
Added per-event decryption on debug page:
- Small 'decrypt' button appears on events with encrypted content
- Shows spinner while decrypting individual event
- Displays decryption results (public/private counts) inline
- Button disappears after successful decryption

Uses Helpers.hasHiddenContent() and Helpers.hasHiddenTags() to detect
which events need decryption.

Allows testing individual event decryption without batch operation.
2025-10-17 21:25:28 +02:00
Gigi
b711b21048 feat: show correct connection type on debug page
Updated debug page to display the actual account type:
- Browser Extension (type: 'extension')
- Bunker Connection (type: 'nostr-connect')
- Account Connection (fallback)

Changes:
- Section title now reflects active account type
- Connection status message updated accordingly
- No longer always shows 'Bunker Connection' regardless of type

Makes it clear to users which authentication method they're using.
2025-10-17 21:21:39 +02:00
Gigi
8eaba04d91 refactor: disable account queue globally
Set accounts.disableQueue = true on AccountManager during initialization:
- Applies to all accounts automatically
- No need for temporary queue toggling in individual operations
- Makes all bunker requests instant (no internal queueing)

Removed temporary queue disabling from bookmarkProcessing.ts since
it's now globally disabled.

Updated Amber.md to document the global approach.

This eliminates the root cause of decrypt hangs - requests no longer
wait in an internal queue for previous requests to complete.
2025-10-17 21:19:21 +02:00
Gigi
0785b034e4 perf: use shorter timeouts for debug page bookmark loading
Reduced timeouts to trust EOSE from fast relays:
- Local: 800ms (down from 1200ms)
- Remote: 2000ms (down from 6000ms)

The query completes when relays send EOSE, not when timeout expires.
Fast relays send EOSE in <1 second, so total time should be much less
than the previous 6-second wait.

Result: Debug page bookmark loading now completes in ~1-2 seconds instead of always 6 seconds.
2025-10-17 21:06:05 +02:00
Gigi
47e698f197 feat: stream bookmark events on debug page
Implemented live streaming of bookmark events as they arrive from relays:
- Events appear immediately as relays respond
- Live deduplication of replaceable events (30003, 30001, 10003)
- Keep newest version when duplicates found
- Web bookmarks (39701) not deduplicated (each unique)

Benefits:
- Much more responsive UI - see events immediately
- Better user experience with progress visibility
- Deduplication happens in real-time

Uses queryEvents onEvent callback to process events as they stream in.
2025-10-17 21:01:10 +02:00
Gigi
68ee1b3122 feat: add clear button for bookmark data
- Right-aligned clear button in the same row as load/decrypt
- Clears events, stats, and timing data
- Disabled when no data to clear
2025-10-17 20:35:17 +02:00
Gigi
a37735fc1c refactor: show decrypted bookmarks above loaded events 2025-10-17 20:33:25 +02:00
Gigi
de0f587174 refactor: display bookmark event stats on separate lines 2025-10-17 20:21:24 +02:00
Gigi
f977561779 feat: restore padlock emoji for encrypted content indicator 2025-10-17 20:21:07 +02:00
Gigi
043ea168fb feat: display full event ID for easy copy/paste 2025-10-17 20:20:48 +02:00
Gigi
5336bafed4 refactor: remove emojis from bookmark event display 2025-10-17 20:20:24 +02:00
Gigi
c51291bf81 feat: add performance timing to bookmark loading and decryption
- Track load and decrypt operation durations
- Display live timing with spinner during operations
- Show completed timing in milliseconds
- Uses same Stat component as encryption timing
2025-10-17 20:19:48 +02:00
Gigi
489e48fe4d feat: enhance bookmark event display with detailed info
- Show kind names (Simple List, Replaceable List, etc)
- Display data size in human-readable format (B, KB, MB)
- Show count of public bookmarks per event
- Indicate presence of encrypted content
- Show d-tag and title for better identification
2025-10-17 20:17:58 +02:00
Gigi
7ad925dbd3 feat: add bookmark loading and decryption section to debug page 2025-10-17 20:08:08 +02:00
Gigi
18bf8f9a2c ui(debug): use existing color pattern for red disconnect button with proper styling and hover effects 2025-10-17 12:56:47 +02:00
Gigi
37f3a32a1c fix(debug): use inline red styling for disconnect button since btn-danger class doesn't exist 2025-10-17 12:56:06 +02:00
Gigi
c9678564a5 ui(debug): change disconnect button to red (btn-danger) for better visual indication 2025-10-17 12:54:26 +02:00