blob: 6bc4ecb90f18ce209d932dce9b0e30eca014d595 (
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
34
35
36
37
38
|
<script lang="ts" context="module">
import type { ProductReview, Shelf } from '@jet-app/app-store/api/models';
interface ProductReviewShelf extends Shelf {
items: ProductReview[];
}
export function isProductReviewShelf(
shelf: Shelf,
): shelf is ProductReviewShelf {
let { contentType, items } = shelf;
return contentType === 'productReview' && Array.isArray(items);
}
</script>
<script lang="ts">
import ShelfItemLayout from '~/components/ShelfItemLayout.svelte';
import ShelfWrapper from '~/components/Shelf/Wrapper.svelte';
import EditorsChoiceReviewItem, {
isEditorsChoiceReviewItem,
} from '~/components/jet/item/ProductReview/EditorsChoiceReviewItem.svelte';
import UserReviewItem, {
isUserReviewItem,
} from '~/components/jet/item/ProductReview/UserReviewItem.svelte';
export let shelf: ProductReviewShelf;
</script>
<ShelfWrapper {shelf}>
<ShelfItemLayout {shelf} gridType="A" let:item>
{#if isUserReviewItem(item)}
<UserReviewItem {item} />
{:else if isEditorsChoiceReviewItem(item)}
<EditorsChoiceReviewItem {item} />
{/if}
</ShelfItemLayout>
</ShelfWrapper>
|