refactor: simplify LoadingErrorState and enhance MarketSearchBar functionality

- Removed unnecessary imports and streamlined the LoadingErrorState component by eliminating redundant props.
- Improved keyboard handling in MarketSearchBar to support basic Escape key functionality and enhanced keyboard shortcuts.
- Updated MerchantStore and MarketPage components to utilize the revised LoadingErrorState and MarketSearchBar, ensuring consistent loading/error handling and search capabilities.
- Enhanced StallView to provide better category filtering and product search experience.

These changes improve code clarity and maintainability while enhancing user interaction across the market module.
This commit is contained in:
padreug 2025-09-27 09:51:00 +02:00
parent c8860dc937
commit e68a7a9ed5
5 changed files with 109 additions and 81 deletions

View file

@ -292,14 +292,26 @@ const handleClear = () => {
}
const handleKeydown = (event: KeyboardEvent) => {
if (!props.showEnhancements || !useSearchKeyboardShortcuts.value) return
if (!props.showEnhancements) return
const shouldClear = handleSearchKeydown(event)
if (shouldClear) {
// Handle basic Escape key for simple mode
if (event.key === 'Escape') {
event.preventDefault()
if (searchQuery.value) {
handleClear()
} else {
blurSearchInput()
}
return
}
// Use enhanced keyboard shortcuts if available
if (useSearchKeyboardShortcuts.value && handleSearchKeydown) {
const shouldClear = handleSearchKeydown(event)
if (shouldClear) {
if (searchQuery.value) {
handleClear()
} else {
blurSearchInput()
}
}
}
}
@ -347,7 +359,7 @@ const handleBlur = () => {
// Enhanced mode methods (initialized conditionally)
let focusSearchInput = () => {}
let blurSearchInput = () => {}
let handleSearchKeydown = () => false
let handleSearchKeydown = (_event: KeyboardEvent) => false
// Initialize keyboard shortcuts for enhanced mode
watch(() => props.showEnhancements, async (showEnhancements) => {