sonda/web/src/components/ProviderMessage.tsx
tgiachi e2899c6647 feat(web): artists, albums and songs pages with provider data and attribution
- lists of artists, albums and songs, loaded 50 at a time, with the search text taken from the address
- album page and artist page; a click on a song plays the list from there
- artist page shows a Wikipedia text, similar artists and tags with their credits, and the photo credit
- providers that are off, unreachable or without an id give a short explanation, never an error page
- artists a provider named, with nothing to play, still have a page
2026-11-12 11:36:35 +01:00

13 lines
739 B
TypeScript

import { useTranslation } from 'react-i18next'
import { EmptyMessage } from './Status'
export type ProviderStatus = 'ok' | 'disabled' | 'error' | 'no_id'
/** Why a provider section is empty. `ok` is not a reason: the caller says "nothing found" itself. */
export default function ProviderMessage({ status, provider }: { status: Exclude<ProviderStatus, 'ok'>; provider: string }) {
const { t } = useTranslation()
const name = t(`provider.${provider}`)
if (status === 'disabled') return <EmptyMessage>{t('empty.providerDisabled', { provider: name })}</EmptyMessage>
if (status === 'no_id') return <EmptyMessage>{t('empty.noId')}</EmptyMessage>
return <EmptyMessage>{t('empty.providerError', { provider: name })}</EmptyMessage>
}