diff --git a/src/components/InviteePicker/index.tsx b/src/components/InviteePicker/index.tsx index 6bf979e0..f8422f8f 100644 --- a/src/components/InviteePicker/index.tsx +++ b/src/components/InviteePicker/index.tsx @@ -1,5 +1,6 @@ import { Input } from '@/components/ui/input' import { useSearchProfiles } from '@/hooks' +import { inviteInputToHexPubkey } from '@/lib/pubkey' import { cn } from '@/lib/utils' import { useNostr } from '@/providers/NostrProvider' import { X } from 'lucide-react' @@ -89,6 +90,12 @@ export function InviteePicker({ type="text" value={search} onChange={(e) => setSearch(e.target.value)} + onKeyDown={(e) => { + if (e.key !== 'Enter') return + e.preventDefault() + const pk = inviteInputToHexPubkey(search) + if (pk) addInvitee(pk) + }} placeholder={placeholder ?? t('Search by name or npub…')} className="mt-1" autoComplete="off" diff --git a/src/components/Note/ZapPoll.tsx b/src/components/Note/ZapPoll.tsx index 5f5a3afe..dde527c3 100644 --- a/src/components/Note/ZapPoll.tsx +++ b/src/components/Note/ZapPoll.tsx @@ -78,6 +78,18 @@ export default function ZapPoll({ !!meta && (closed || viewerZapped || event.pubkey === pubkey || tallyRevealed) + /** When results are visible, list options by total sats (largest first). */ + const optionsDisplayOrder = useMemo(() => { + if (!meta) return [] + if (!showTally || !tally) return meta.options + return [...meta.options].sort((a, b) => { + const sa = tally.satsByOption.get(a.index) ?? 0 + const sb = tally.satsByOption.get(b.index) ?? 0 + if (sb !== sa) return sb - sa + return a.index - b.index + }) + }, [meta, showTally, tally]) + const satsBounds = useMemo(() => { if (!meta) return { min: 1, max: undefined as number | undefined } return { @@ -184,7 +196,7 @@ export default function ZapPoll({ )}