summaryrefslogtreecommitdiff
path: root/src/components/pages/SearchLandingPage.svelte
blob: 3594ece4a6f13c259cb857347e83b4e5ef71c9f4 (plain)
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
29
30
31
32
33
<script lang="ts">
    import type { SearchLandingPage } from '@jet-app/app-store/api/models';
    import type { WebRenderablePage } from '@jet-app/app-store/api/models/web-renderable-page';
    import type { WebSearchFlowAction } from '@jet-app/app-store/common/search/web-search-action';
    import { unwrapOptional as unwrap } from '@jet/environment/types/optional';

    type SearchPage = SearchLandingPage;

    import DefaultPage from './DefaultPage.svelte';
    import ShelfWrapper from '~/components/Shelf/Wrapper.svelte';
    import SearchInput from '~/components/navigation/SearchInput.svelte';
    import { getI18n } from '~/stores/i18n';

    export let page: SearchPage;

    const i18n = getI18n();

    $: webNavigation = unwrap((page as WebRenderablePage).webNavigation);
    $: searchAction = webNavigation.searchAction as WebSearchFlowAction;
    $: hasShelves = !!page.shelves.filter(({ items }) => items?.length).length;

    $: pageWithoutEmptyShelves = {
        ...page,
        shelves: hasShelves ? page.shelves : [],
        title: $i18n.t('ASE.Web.AppStore.Meta.SearchLanding.Title'),
    };
</script>

<DefaultPage page={pageWithoutEmptyShelves}>
    <ShelfWrapper slot="before-shelves" centered>
        <SearchInput {searchAction} big />
    </ShelfWrapper>
</DefaultPage>