feat: ship creator journey v2 and profile updates
This commit is contained in:
@@ -18,7 +18,7 @@ function useDebounce(value, delay) {
|
||||
|
||||
const isMac = typeof navigator !== 'undefined' && /Mac|iPhone|iPod|iPad/.test(navigator.platform)
|
||||
|
||||
export default function SearchBar({ placeholder = 'Search artworks, groups, artists, tags\u2026' }) {
|
||||
export default function SearchBar({ placeholder = 'Search artworks, groups, artists, tags\u2026', initialIntent = null }) {
|
||||
const [phase, setPhase] = useState('idle') // idle | opening | open | closing
|
||||
const [query, setQuery] = useState('')
|
||||
const [artworks, setArtworks] = useState([])
|
||||
@@ -38,6 +38,7 @@ export default function SearchBar({ placeholder = 'Search artworks, groups, arti
|
||||
const closeTimerRef = useRef(null)
|
||||
const mobileOpenTimerRef = useRef(null)
|
||||
const mobileCloseTimerRef = useRef(null)
|
||||
const initialIntentHandledRef = useRef(false)
|
||||
|
||||
const debouncedQuery = useDebounce(query, DEBOUNCE_MS)
|
||||
const isExpanded = phase === 'opening' || phase === 'open'
|
||||
@@ -114,6 +115,23 @@ export default function SearchBar({ placeholder = 'Search artworks, groups, arti
|
||||
return () => document.removeEventListener('keydown', onKey)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (initialIntentHandledRef.current || !initialIntent) {
|
||||
return
|
||||
}
|
||||
|
||||
initialIntentHandledRef.current = true
|
||||
|
||||
if (initialIntent === 'mobile') {
|
||||
openMobileOverlay()
|
||||
return
|
||||
}
|
||||
|
||||
if (initialIntent === 'desktop') {
|
||||
expand()
|
||||
}
|
||||
}, [initialIntent])
|
||||
|
||||
// ── outside click ────────────────────────────────────────────────────────
|
||||
useEffect(() => {
|
||||
function onMouse(e) {
|
||||
@@ -308,6 +326,7 @@ export default function SearchBar({ placeholder = 'Search artworks, groups, arti
|
||||
<input
|
||||
ref={inputRef}
|
||||
type="search"
|
||||
role="combobox"
|
||||
value={query}
|
||||
onChange={e => { setQuery(e.target.value); setActiveIdx(-1) }}
|
||||
onFocus={() => hasSuggestions && setOpen(true)}
|
||||
@@ -315,7 +334,8 @@ export default function SearchBar({ placeholder = 'Search artworks, groups, arti
|
||||
placeholder={placeholder}
|
||||
aria-label="Search"
|
||||
aria-autocomplete="list"
|
||||
aria-expanded={open}
|
||||
aria-haspopup="listbox"
|
||||
aria-expanded={open && hasSuggestions}
|
||||
aria-controls={suggestionListId}
|
||||
aria-activedescendant={activeIdx >= 0 ? `sb-item-${activeIdx}` : undefined}
|
||||
autoComplete="off"
|
||||
|
||||
@@ -53,12 +53,15 @@ export default function SearchOverlay({
|
||||
<input
|
||||
ref={inputRef}
|
||||
type="search"
|
||||
role="combobox"
|
||||
value={query}
|
||||
onChange={(e) => onQueryChange(e.target.value)}
|
||||
onKeyDown={onKeyDown}
|
||||
placeholder="Search artworks, groups, creators, tags..."
|
||||
aria-label="Search"
|
||||
aria-autocomplete="list"
|
||||
aria-haspopup="listbox"
|
||||
aria-expanded={hasResults}
|
||||
aria-controls="sb-mobile-suggestions"
|
||||
aria-activedescendant={activeIdx >= 0 ? `sb-mobile-item-${activeIdx}` : undefined}
|
||||
autoComplete="off"
|
||||
|
||||
Reference in New Issue
Block a user