-
Notifications
You must be signed in to change notification settings - Fork 0
Redesign UI with onboarding walkthrough and query presets #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4861c9b
Add walkthrough modal and query presets data
Catrya ecaf5bb
Redesign EventMonitor with segmented controls and inline NIP field
Catrya 019ac41
Restyle with new palette, sticky topbar, and stream-bar indicator
Catrya 6599d43
coderabbit-suggestions
Catrya 8d9e189
improve-events-color
Catrya 42964b9
improve stream
Catrya d33902b
select-buttons
Catrya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import { useState } from 'react'; | ||
|
|
||
| export const WALK_STORAGE_KEY = 'nem-walk-seen'; | ||
|
|
||
| interface WalkthroughProps { | ||
| onClose: () => void; | ||
| } | ||
|
|
||
| const steps = [ | ||
| { | ||
| label: 'Step 01 / 03', | ||
| title: 'Point it at a relay', | ||
| render: () => ( | ||
| <> | ||
| Nostr is a network of relays — public servers that hold events. Add at least one{' '} | ||
| <code>wss://</code> URL to query. You can add several and this tool will query them in parallel. | ||
| </> | ||
| ), | ||
| }, | ||
| { | ||
| label: 'Step 02 / 03', | ||
| title: 'Filter by Kind or NIP', | ||
| render: () => ( | ||
| <> | ||
| Each event has a numeric <code>kind</code>. If you know it, use <strong>Kind</strong>. If not, | ||
| search by <strong>NIP</strong> — the spec number — and we'll resolve its kinds automatically. | ||
| Then narrow with author, tags, or time range. | ||
| </> | ||
| ), | ||
| }, | ||
| { | ||
| label: 'Step 03 / 03', | ||
| title: 'Search vs Stream', | ||
| render: () => ( | ||
| <> | ||
| <strong>Search</strong> fetches a snapshot (past events, bounded by <code>limit</code>).{' '} | ||
| <strong>Stream</strong> keeps a live socket open and prints new events as they land. | ||
| Use Stream to debug relays or watch a kind in real time. | ||
| </> | ||
| ), | ||
| }, | ||
| ]; | ||
|
|
||
| export function Walkthrough({ onClose }: WalkthroughProps) { | ||
| const [step, setStep] = useState(0); | ||
| const s = steps[step]; | ||
| const isLast = step === steps.length - 1; | ||
|
|
||
| return ( | ||
| <div | ||
| className="walk-overlay" | ||
| onClick={onClose} | ||
| role="dialog" | ||
| aria-modal="true" | ||
| aria-labelledby="walk-title" | ||
| > | ||
| <div className="walk-card" onClick={(e) => e.stopPropagation()}> | ||
| <div className="walk-step">{s.label}</div> | ||
| <h2 id="walk-title" className="walk-title">{s.title}</h2> | ||
| <p className="walk-desc">{s.render()}</p> | ||
| <div className="walk-nav"> | ||
| <div className="walk-dots"> | ||
| {steps.map((_, i) => ( | ||
| <span key={i} className={`walk-dot ${i <= step ? 'on' : ''}`} /> | ||
| ))} | ||
| </div> | ||
| <div style={{ display: 'flex', gap: '8px' }}> | ||
| <button | ||
| type="button" | ||
| onClick={onClose} | ||
| className="h-8 px-3 text-xs bg-accent/10 border border-accent/30 hover:bg-accent/20 rounded" | ||
| > | ||
| Skip | ||
| </button> | ||
| <button | ||
| type="button" | ||
| onClick={() => (isLast ? onClose() : setStep(step + 1))} | ||
| className="h-8 px-4 text-xs bg-accent/80 hover:bg-accent border-accent/50 rounded" | ||
| > | ||
| {isLast ? 'Start monitoring' : 'Next'} | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| export const SUGGESTED_RELAYS: string[] = [ | ||
| 'relay.damus.io', | ||
| 'relay.primal.net', | ||
| 'nos.lol', | ||
| 'relay.nostr.band', | ||
| 'relay.mostro.network', | ||
| ]; | ||
|
|
||
| export interface QueryPreset { | ||
| id: string; | ||
| title: string; | ||
| desc: string; | ||
| kind: string; | ||
| } | ||
|
|
||
| export const PRESETS: QueryPreset[] = [ | ||
| { id: 'notes', title: 'Recent notes', desc: 'kind:1 · short text notes', kind: '1' }, | ||
| { id: 'mostro', title: 'Mostro P2P orders', desc: 'kind:38383 · NIP-69', kind: '38383' }, | ||
| { id: 'zaps', title: 'Zap receipts', desc: 'kind:9735 · NIP-57', kind: '9735' }, | ||
| { id: 'profiles', title: 'User metadata', desc: 'kind:0 · profile updates', kind: '0' }, | ||
| ]; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.