All files / src/shared/components SearchDestinationBanner.tsx

71.42% Statements 5/7
33.33% Branches 2/6
66.66% Functions 2/3
60% Lines 3/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28      20x 68x 20x                                            
import { useTranslation } from 'react-i18next'
import { useSearchDestinationStore } from '@/shared/stores/searchDestination.store'
export function SearchDestinationBanner() {
  const { t } = useTranslation()
  const target = useSearchDestinationStore((state) => state.target)
  Eif (!target || target.path === '/dashboard') return null
  return (
    <div
      role="status"
      className="mb-5 flex flex-wrap items-center justify-between gap-2 rounded-2xl border border-primary/25 bg-card px-5 py-3"
    >
      <p className="break-words text-sm text-ink">
        {t(
          target.source === 'notification' ? 'notifications.destination' : 'search.ui.destination',
          { query: target.query },
        )}
      </p>
      <button
        type="button"
        className="min-h-11 font-semibold text-primary"
        onClick={() => useSearchDestinationStore.getState().set(null)}
      >
        {t('search.ui.showAll')}
      </button>
    </div>
  )
}