15 changed files with 256 additions and 147 deletions
@ -1,12 +1,14 @@ |
|||||||
import { useTranslation } from 'react-i18next' |
import { useTranslation } from 'react-i18next' |
||||||
|
import type { ReactNode } from 'react' |
||||||
|
|
||||||
export default function NotFound() { |
export default function NotFound({ children }: { children?: ReactNode }) { |
||||||
const { t } = useTranslation() |
const { t } = useTranslation() |
||||||
|
|
||||||
return ( |
return ( |
||||||
<div className="text-muted-foreground w-full h-full flex flex-col items-center justify-center gap-2"> |
<div className="text-muted-foreground w-full h-full flex flex-col items-center justify-center gap-2 px-4"> |
||||||
<div>{t('Lost in the void')} 🌌</div> |
<div>{t('Lost in the void')} 🌌</div> |
||||||
<div>(404)</div> |
<div>(404)</div> |
||||||
|
{children} |
||||||
</div> |
</div> |
||||||
) |
) |
||||||
} |
} |
||||||
|
|||||||
@ -0,0 +1,39 @@ |
|||||||
|
import { describe, expect, it } from 'vitest' |
||||||
|
import { |
||||||
|
ALEXANDRIA_NEXT_EVENTS_BASE, |
||||||
|
buildAlexandriaEventsSearchUrlForTSearchParams |
||||||
|
} from './alexandria-events-search-url' |
||||||
|
|
||||||
|
describe('buildAlexandriaEventsSearchUrlForTSearchParams', () => { |
||||||
|
it('maps profile search to n= query', () => { |
||||||
|
const url = buildAlexandriaEventsSearchUrlForTSearchParams({ |
||||||
|
type: 'profile', |
||||||
|
search: 'npub1test' |
||||||
|
}) |
||||||
|
expect(url).toBe(`${ALEXANDRIA_NEXT_EVENTS_BASE}?n=npub1test`) |
||||||
|
}) |
||||||
|
|
||||||
|
it('maps hashtag search to t= query', () => { |
||||||
|
const url = buildAlexandriaEventsSearchUrlForTSearchParams({ |
||||||
|
type: 'hashtag', |
||||||
|
search: 'nostr' |
||||||
|
}) |
||||||
|
expect(url).toBe(`${ALEXANDRIA_NEXT_EVENTS_BASE}?t=nostr`) |
||||||
|
}) |
||||||
|
|
||||||
|
it('maps relay search to q= query', () => { |
||||||
|
const url = buildAlexandriaEventsSearchUrlForTSearchParams({ |
||||||
|
type: 'relay', |
||||||
|
search: 'wss://relay.example.com' |
||||||
|
}) |
||||||
|
expect(url).toBe(`${ALEXANDRIA_NEXT_EVENTS_BASE}?q=wss%3A%2F%2Frelay.example.com`) |
||||||
|
}) |
||||||
|
|
||||||
|
it('maps notes search to free-text q= when no special tokens', () => { |
||||||
|
const url = buildAlexandriaEventsSearchUrlForTSearchParams({ |
||||||
|
type: 'notes', |
||||||
|
search: 'hello world' |
||||||
|
}) |
||||||
|
expect(url).toBe(`${ALEXANDRIA_NEXT_EVENTS_BASE}?q=hello%20world`) |
||||||
|
}) |
||||||
|
}) |
||||||
Loading…
Reference in new issue