@playpilot/tpi 8.23.5 → 8.25.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editorial.mount.js +10 -10
- package/dist/link-injections.js +2 -2
- package/dist/mount.js +6 -6
- package/package.json +1 -1
- package/src/lib/data/translations.ts +573 -558
- package/src/routes/components/Explore/Filter/Filter.svelte +148 -144
- package/src/routes/components/InjectionPopover.svelte +1 -1
- package/src/routes/components/Modals/ParticipantModal.svelte +1 -1
- package/src/routes/components/{Participant.svelte → Participants/Participant.svelte} +27 -9
- package/src/routes/components/Participants/ParticipantImage.svelte +56 -0
- package/src/routes/components/Rails/ParticipantsRail.svelte +19 -21
- package/src/routes/components/TitlePoster.svelte +1 -1
- package/src/routes/elements/+page.svelte +10 -0
- package/src/tests/routes/components/Explore/Filter/Filter.test.js +2 -2
- package/src/tests/routes/components/{Participant.test.js → Participants/Participant.test.js} +20 -1
- package/src/tests/routes/components/Rails/ParticipantsRail.test.js +13 -0
|
@@ -1,144 +1,148 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ExploreFilter } from '$lib/types/filter'
|
|
3
|
-
import genres from '$lib/data/genres.json'
|
|
4
|
-
import { fetchProviders } from '$lib/api/providers'
|
|
5
|
-
import { t } from '$lib/localization'
|
|
6
|
-
import FilterItem from './FilterItem.svelte'
|
|
7
|
-
import FilterSorting from './FilterSorting.svelte'
|
|
8
|
-
import Button from '../../Button.svelte'
|
|
9
|
-
import IconArrow from '../../Icons/IconArrow.svelte'
|
|
10
|
-
import IconFilter from '../../Icons/IconFilter.svelte'
|
|
11
|
-
import { fly, scale } from 'svelte/transition'
|
|
12
|
-
import ActiveFilterItems from './ActiveFilterItems.svelte'
|
|
13
|
-
import { isFilterItemActive } from '$lib/filter'
|
|
14
|
-
import { cdnBaseUrl } from '$lib/constants'
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
filter: ExploreFilter
|
|
18
|
-
limit?: boolean
|
|
19
|
-
showSorting?: boolean
|
|
20
|
-
searchQuery?: string
|
|
21
|
-
onchange?: () => void
|
|
22
|
-
onempty?: () => void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
filter,
|
|
27
|
-
limit = true,
|
|
28
|
-
showSorting = true,
|
|
29
|
-
searchQuery = '',
|
|
30
|
-
onchange = () => null,
|
|
31
|
-
onempty = () => null,
|
|
32
|
-
}: Props = $props()
|
|
33
|
-
|
|
34
|
-
const shownItemsLimit = 3
|
|
35
|
-
const items = [{
|
|
36
|
-
label: t('Services'),
|
|
37
|
-
param: 'providers',
|
|
38
|
-
fetchData: async () => (await fetchProviders()).map(playlink => ({ label: playlink.name, value: playlink.slug })),
|
|
39
|
-
}, {
|
|
40
|
-
label: t('Genres'),
|
|
41
|
-
param: 'genres',
|
|
42
|
-
data: genres.filter(genre => parseInt(genre.slug) < 900).map(genre => ({ label: t(genre.name), value: genre.slug })),
|
|
43
|
-
}, {
|
|
44
|
-
label: t('IMDb'),
|
|
45
|
-
param: 'imdb_score',
|
|
46
|
-
range: [0, 10] as [number, number],
|
|
47
|
-
}, {
|
|
48
|
-
label: t('Year'),
|
|
49
|
-
param: 'year',
|
|
50
|
-
range: [1900, new Date().getFullYear()] as [number, number],
|
|
51
|
-
}, {
|
|
52
|
-
label: t('Runtime'),
|
|
53
|
-
param: 'length',
|
|
54
|
-
range: [0, 180] as [number, number],
|
|
55
|
-
valueAppend: t('Minutes'),
|
|
56
|
-
}, {
|
|
57
|
-
label: t('Countries'),
|
|
58
|
-
param: 'country_codes',
|
|
59
|
-
fetchData: async () => import.meta.env.DEV ?
|
|
60
|
-
(await import('$lib/data/countries.json')).default :
|
|
61
|
-
(await fetch(`${cdnBaseUrl}/src/lib/data/countries.json`)).json(),
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ExploreFilter } from '$lib/types/filter'
|
|
3
|
+
import genres from '$lib/data/genres.json'
|
|
4
|
+
import { fetchProviders } from '$lib/api/providers'
|
|
5
|
+
import { t } from '$lib/localization'
|
|
6
|
+
import FilterItem from './FilterItem.svelte'
|
|
7
|
+
import FilterSorting from './FilterSorting.svelte'
|
|
8
|
+
import Button from '../../Button.svelte'
|
|
9
|
+
import IconArrow from '../../Icons/IconArrow.svelte'
|
|
10
|
+
import IconFilter from '../../Icons/IconFilter.svelte'
|
|
11
|
+
import { fly, scale } from 'svelte/transition'
|
|
12
|
+
import ActiveFilterItems from './ActiveFilterItems.svelte'
|
|
13
|
+
import { isFilterItemActive } from '$lib/filter'
|
|
14
|
+
import { cdnBaseUrl } from '$lib/constants'
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
filter: ExploreFilter
|
|
18
|
+
limit?: boolean
|
|
19
|
+
showSorting?: boolean
|
|
20
|
+
searchQuery?: string
|
|
21
|
+
onchange?: () => void
|
|
22
|
+
onempty?: () => void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
filter,
|
|
27
|
+
limit = true,
|
|
28
|
+
showSorting = true,
|
|
29
|
+
searchQuery = '',
|
|
30
|
+
onchange = () => null,
|
|
31
|
+
onempty = () => null,
|
|
32
|
+
}: Props = $props()
|
|
33
|
+
|
|
34
|
+
const shownItemsLimit = 3
|
|
35
|
+
const items = [{
|
|
36
|
+
label: t('Services'),
|
|
37
|
+
param: 'providers',
|
|
38
|
+
fetchData: async () => (await fetchProviders()).map(playlink => ({ label: playlink.name, value: playlink.slug })),
|
|
39
|
+
}, {
|
|
40
|
+
label: t('Genres'),
|
|
41
|
+
param: 'genres',
|
|
42
|
+
data: genres.filter(genre => parseInt(genre.slug) < 900).map(genre => ({ label: t(genre.name), value: genre.slug })),
|
|
43
|
+
}, {
|
|
44
|
+
label: t('IMDb'),
|
|
45
|
+
param: 'imdb_score',
|
|
46
|
+
range: [0, 10] as [number, number],
|
|
47
|
+
}, {
|
|
48
|
+
label: t('Year'),
|
|
49
|
+
param: 'year',
|
|
50
|
+
range: [1900, new Date().getFullYear()] as [number, number],
|
|
51
|
+
}, {
|
|
52
|
+
label: t('Runtime'),
|
|
53
|
+
param: 'length',
|
|
54
|
+
range: [0, 180] as [number, number],
|
|
55
|
+
valueAppend: t('Minutes'),
|
|
56
|
+
}, {
|
|
57
|
+
label: t('Countries'),
|
|
58
|
+
param: 'country_codes',
|
|
59
|
+
fetchData: async () => import.meta.env.DEV ?
|
|
60
|
+
(await import('$lib/data/countries.json')).default :
|
|
61
|
+
(await fetch(`${cdnBaseUrl}/src/lib/data/countries.json`)).json(),
|
|
62
|
+
}, {
|
|
63
|
+
label: t('Category'),
|
|
64
|
+
param: 'category',
|
|
65
|
+
data: [{ label: t('Movies'), value: 'movie' }, { label: t('Shows'), value: 'series' }, { label: t('Kids'), value: 'kids' }, { label: t('Documentary'), value: 'documentary' }],
|
|
66
|
+
}]
|
|
67
|
+
|
|
68
|
+
let limited = $state(limit)
|
|
69
|
+
let wasPreviouslyActive = false
|
|
70
|
+
|
|
71
|
+
$effect(() => {
|
|
72
|
+
const hasAnyActiveFilter = Object.keys(filter).some((param) => {
|
|
73
|
+
const { range } = items.find((i: any) => param === i.param) || {}
|
|
74
|
+
|
|
75
|
+
return isFilterItemActive(filter[param], range)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
if (hasAnyActiveFilter || searchQuery) {
|
|
79
|
+
wasPreviouslyActive = true
|
|
80
|
+
} else if (wasPreviouslyActive) {
|
|
81
|
+
wasPreviouslyActive = false
|
|
82
|
+
onempty()
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<div class="filter" role="navigation" class:limit>
|
|
88
|
+
<div class="items">
|
|
89
|
+
{#each limited ? items.slice(0, shownItemsLimit) : items as item}
|
|
90
|
+
<div transition:scale={{ start: 0.75, duration: 100 }}>
|
|
91
|
+
<FilterItem {filter} {onchange} {...item} />
|
|
92
|
+
</div>
|
|
93
|
+
{/each}
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div class="actions">
|
|
97
|
+
{#if limit}
|
|
98
|
+
<Button variant="link" onclick={() => limited = !limited}>
|
|
99
|
+
<IconFilter />
|
|
100
|
+
{t('All Filters')}
|
|
101
|
+
<IconArrow direction={limited ? 'down' : 'up'} />
|
|
102
|
+
</Button>
|
|
103
|
+
{/if}
|
|
104
|
+
|
|
105
|
+
{#if showSorting}
|
|
106
|
+
<div class="sorting" transition:fly={{ x: 5, duration: 100 }}>
|
|
107
|
+
<FilterSorting {filter} {onchange} />
|
|
108
|
+
</div>
|
|
109
|
+
{/if}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<ActiveFilterItems {filter} {items} />
|
|
114
|
+
|
|
115
|
+
<style lang="scss">
|
|
116
|
+
.filter {
|
|
117
|
+
position: relative;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.items {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
gap: margin(0.5);
|
|
124
|
+
padding-right: margin(7);
|
|
125
|
+
|
|
126
|
+
.limit & {
|
|
127
|
+
padding-right: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.actions {
|
|
132
|
+
position: absolute;
|
|
133
|
+
top: margin(0.25);
|
|
134
|
+
right: 0;
|
|
135
|
+
|
|
136
|
+
.limit & {
|
|
137
|
+
position: initial;
|
|
138
|
+
top: auto;
|
|
139
|
+
display: flex;
|
|
140
|
+
justify-content: space-between;
|
|
141
|
+
margin-top: margin(0.5);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.sorting {
|
|
146
|
+
margin-top: margin(0.1);
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { trackViaPixel } from '@playpilot/retargeting-tracking'
|
|
11
11
|
import Popover from './Popover.svelte'
|
|
12
12
|
import Title from './Title.svelte'
|
|
13
|
-
import Participant from './Participant.svelte'
|
|
13
|
+
import Participant from './Participants/Participant.svelte'
|
|
14
14
|
import TopScroll from './Ads/TopScroll.svelte'
|
|
15
15
|
import Display from './Ads/Display.svelte'
|
|
16
16
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import Modal from './Modal.svelte'
|
|
4
|
-
import Participant from '../Participant.svelte'
|
|
4
|
+
import Participant from '../Participants/Participant.svelte'
|
|
5
5
|
import type { ParticipantData } from '$lib/types/participant'
|
|
6
6
|
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
7
7
|
import { track } from '$lib/tracking'
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { openModal } from '$lib/modal'
|
|
6
6
|
import type { ParticipantData } from '$lib/types/participant'
|
|
7
7
|
import type { TitleData } from '$lib/types/title'
|
|
8
|
-
import ListTitle from './ListTitle.svelte'
|
|
9
8
|
import { t } from '$lib/localization'
|
|
10
9
|
import { hasConsentedTo } from '$lib/consent'
|
|
11
10
|
import { trackViaPixel } from '@playpilot/retargeting-tracking'
|
|
12
11
|
import { MetaEvent } from '$lib/enums/TrackingEvent'
|
|
12
|
+
import ParticipantImage from './ParticipantImage.svelte'
|
|
13
|
+
import ListTitle from '../ListTitle.svelte'
|
|
13
14
|
|
|
14
15
|
interface Props {
|
|
15
16
|
participant: ParticipantData
|
|
@@ -54,13 +55,17 @@
|
|
|
54
55
|
</script>
|
|
55
56
|
|
|
56
57
|
<div class="header" class:small>
|
|
57
|
-
<
|
|
58
|
+
<ParticipantImage {participant} />
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
<div>
|
|
61
|
+
<div class="heading" use:heading={2} id="heading">{name}</div>
|
|
62
|
+
|
|
63
|
+
{#if birth_date}
|
|
64
|
+
<p class="dates">
|
|
65
|
+
{t('Born On')} <strong>{formatDate(birth_date)}</strong>{#if death_date}, {t('Died On')} <strong>{formatDate(death_date)}</strong>{/if}
|
|
66
|
+
</p>
|
|
67
|
+
{/if}
|
|
68
|
+
</div>
|
|
64
69
|
</div>
|
|
65
70
|
|
|
66
71
|
<div class="content">
|
|
@@ -85,13 +90,22 @@
|
|
|
85
90
|
|
|
86
91
|
<style lang="scss">
|
|
87
92
|
.header {
|
|
88
|
-
|
|
93
|
+
--participant-image-size: #{margin(6)};
|
|
94
|
+
display: grid;
|
|
95
|
+
grid-template-columns: calc(var(--participant-image-size)) auto;
|
|
96
|
+
align-items: center;
|
|
97
|
+
gap: margin(1);
|
|
98
|
+
padding: margin(3) margin(1) margin(2);
|
|
89
99
|
font-family: theme(detail-font-family, font-family);
|
|
90
100
|
font-weight: theme(detail-font-weight, normal);
|
|
91
101
|
font-size: theme(detail-font-size, font-size-base);
|
|
92
102
|
line-height: theme(participant-description-line-height, normal);
|
|
93
103
|
color: theme(detail-text-color, text-color);
|
|
94
104
|
|
|
105
|
+
@include desktop {
|
|
106
|
+
--participant-image-size: #{margin(8)};
|
|
107
|
+
}
|
|
108
|
+
|
|
95
109
|
&.small {
|
|
96
110
|
padding: margin(1);
|
|
97
111
|
}
|
|
@@ -101,7 +115,7 @@
|
|
|
101
115
|
margin: 0;
|
|
102
116
|
font-family: theme(detail-title-font-family, font-family);
|
|
103
117
|
font-weight: theme(detail-title-font-weight, lighter);
|
|
104
|
-
font-size:
|
|
118
|
+
font-size: clamp(1.25em, 5vw, 1.5em);
|
|
105
119
|
line-height: normal;
|
|
106
120
|
font-style: theme(detail-title-font-style, normal);
|
|
107
121
|
|
|
@@ -109,6 +123,10 @@
|
|
|
109
123
|
margin: 0 0 margin(0.5);
|
|
110
124
|
font-size: theme(detail-title-small-font-size, margin(1.25));
|
|
111
125
|
}
|
|
126
|
+
|
|
127
|
+
.small & {
|
|
128
|
+
font-size: 1em;
|
|
129
|
+
}
|
|
112
130
|
}
|
|
113
131
|
|
|
114
132
|
.dates {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ParticipantData } from '$lib/types/participant'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
participant?: ParticipantData | null
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const { participant = null }: Props = $props()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class="image">
|
|
12
|
+
{#if participant?.image}
|
|
13
|
+
<img loading="lazy" src={participant.image} alt="" />
|
|
14
|
+
{/if}
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style lang="scss">
|
|
18
|
+
$item-width: #{var(--participant-image-size, margin(6))};
|
|
19
|
+
|
|
20
|
+
.image {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: block;
|
|
23
|
+
width: $item-width;
|
|
24
|
+
height: $item-width;
|
|
25
|
+
border-radius: 50%;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
background: theme(cast-background, lighter);
|
|
28
|
+
|
|
29
|
+
&::before,
|
|
30
|
+
&::after {
|
|
31
|
+
content: "";
|
|
32
|
+
display: block;
|
|
33
|
+
position: absolute;
|
|
34
|
+
width: 50%;
|
|
35
|
+
height: 50%;
|
|
36
|
+
top: 50%;
|
|
37
|
+
left: 50%;
|
|
38
|
+
border-radius: 50%;
|
|
39
|
+
transform: translateX(-50%) translateY(-50%);
|
|
40
|
+
background: currentColor;
|
|
41
|
+
opacity: 0.1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&::after {
|
|
45
|
+
top: 100%;
|
|
46
|
+
width: 75%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
img {
|
|
50
|
+
z-index: 1;
|
|
51
|
+
position: relative;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: auto;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { track } from '$lib/tracking'
|
|
9
9
|
import type { ParticipantData } from '$lib/types/participant'
|
|
10
10
|
import type { TitleData } from '$lib/types/title'
|
|
11
|
+
import ParticipantImage from '../Participants/ParticipantImage.svelte'
|
|
11
12
|
import Rail from './Rail.svelte'
|
|
12
13
|
|
|
13
14
|
interface Props {
|
|
@@ -35,8 +36,6 @@
|
|
|
35
36
|
participantsByOccurrence[participant.sid] = { participant, count }
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
// Sort all participants by their occurrences. If a participant did not occur their positioned will be retained
|
|
39
|
-
// relative to where it was before
|
|
40
39
|
const participantsSortedByCount = Object.values(participantsByOccurrence).sort((a, b) => b.count - a.count)
|
|
41
40
|
|
|
42
41
|
return participantsSortedByCount.map(({ participant }) => participant)
|
|
@@ -51,7 +50,10 @@
|
|
|
51
50
|
{#await fetchParticipantsForTitle(title)}
|
|
52
51
|
<Rail {heading}>
|
|
53
52
|
{#each { length: 5 }}
|
|
54
|
-
<div class="participant"
|
|
53
|
+
<div class="participant">
|
|
54
|
+
<ParticipantImage />
|
|
55
|
+
<div class="name"></div>
|
|
56
|
+
</div>
|
|
55
57
|
{/each}
|
|
56
58
|
</Rail>
|
|
57
59
|
{:then participants}
|
|
@@ -59,11 +61,9 @@
|
|
|
59
61
|
<Rail {heading}>
|
|
60
62
|
{#each orderParticipantsByPageTextOccurrence(participants).slice(0, 15) as participant}
|
|
61
63
|
<button class="participant" data-testid="participant" onclick={event => onclick(event, participant)}>
|
|
62
|
-
<
|
|
64
|
+
<ParticipantImage {participant} />
|
|
63
65
|
|
|
64
|
-
{
|
|
65
|
-
<div class="character truncate">{participant.character}</div>
|
|
66
|
-
{/if}
|
|
66
|
+
<div class="name">{participant.name}</div>
|
|
67
67
|
</button>
|
|
68
68
|
{/each}
|
|
69
69
|
</Rail>
|
|
@@ -71,22 +71,25 @@
|
|
|
71
71
|
{/await}
|
|
72
72
|
|
|
73
73
|
<style lang="scss">
|
|
74
|
+
$item-width: #{theme(rail-size-default, margin(6))};
|
|
75
|
+
|
|
74
76
|
.participant {
|
|
77
|
+
--participant-image-size: #{$item-width};
|
|
75
78
|
display: flex;
|
|
76
79
|
flex-direction: column;
|
|
77
|
-
flex: 0 0
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
padding:
|
|
81
|
-
border: theme(cast-border, 0);
|
|
80
|
+
flex: 0 0 $item-width;
|
|
81
|
+
gap: margin(0.5);
|
|
82
|
+
width: $item-width;
|
|
83
|
+
padding: 0;
|
|
82
84
|
border-radius: theme(cast-border-radius, border-radius);
|
|
83
|
-
|
|
85
|
+
border: 0;
|
|
86
|
+
background: transparent;
|
|
84
87
|
cursor: pointer;
|
|
85
|
-
font-family: inherit;
|
|
86
|
-
text-align: left;
|
|
87
88
|
color: inherit;
|
|
89
|
+
font-family: inherit;
|
|
88
90
|
font-size: theme(cast-font-size, font-size-small);
|
|
89
91
|
line-height: normal;
|
|
92
|
+
text-align: center;
|
|
90
93
|
white-space: nowrap;
|
|
91
94
|
|
|
92
95
|
&:is(button):hover,
|
|
@@ -96,12 +99,7 @@
|
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
|
|
99
|
-
.
|
|
100
|
-
color: theme(cast-character-text-color, text-color-alt);
|
|
101
|
-
font-style: italic;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.truncate {
|
|
102
|
+
.name {
|
|
105
103
|
overflow: hidden;
|
|
106
104
|
text-overflow: ellipsis;
|
|
107
105
|
white-space: nowrap;
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<img
|
|
18
|
+
loading={lazy ? 'lazy' : null}
|
|
18
19
|
src={removeImageUrlPrefix(title.standing_poster)}
|
|
19
20
|
alt="Movie poster for '{title.title}'"
|
|
20
21
|
{width}
|
|
21
22
|
{height}
|
|
22
23
|
onerror={({ target }) => (target as HTMLImageElement).src = imagePlaceholderDataUrl}
|
|
23
|
-
loading={lazy ? 'lazy' : null}
|
|
24
24
|
{onload} />
|
|
25
25
|
|
|
26
26
|
<style lang="scss">
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import Tooltip from '../components/Tooltip.svelte'
|
|
21
21
|
import ExploreRouter from '../components/Explore/ExploreRouter.svelte'
|
|
22
22
|
import TitlesRail from '../components/Rails/TitlesRail.svelte'
|
|
23
|
+
import ParticipantsRail from '../components/Rails/ParticipantsRail.svelte'
|
|
23
24
|
|
|
24
25
|
if (browser) {
|
|
25
26
|
// @ts-ignore
|
|
@@ -125,6 +126,15 @@
|
|
|
125
126
|
</div>
|
|
126
127
|
</div>
|
|
127
128
|
|
|
129
|
+
<h2>Participants</h2>
|
|
130
|
+
|
|
131
|
+
<div class="group">
|
|
132
|
+
<div>
|
|
133
|
+
<h3>Participants.svelte</h3>
|
|
134
|
+
<div class="item"><ParticipantsRail {title} /></div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
128
138
|
<h2>After article</h2>
|
|
129
139
|
|
|
130
140
|
<div class="group">
|
|
@@ -27,13 +27,13 @@ describe('Filter.svelte', () => {
|
|
|
27
27
|
|
|
28
28
|
await fireEvent.click(getByText('All filters'))
|
|
29
29
|
|
|
30
|
-
expect(getAllByTestId('filter-item')).toHaveLength(
|
|
30
|
+
expect(getAllByTestId('filter-item')).toHaveLength(7)
|
|
31
31
|
})
|
|
32
32
|
|
|
33
33
|
it('Should not limit the number of filter items by default if limit is set to false', () => {
|
|
34
34
|
const { getAllByTestId, getByRole } = render(Filter, { filter: {}, limit: false })
|
|
35
35
|
|
|
36
|
-
expect(getAllByTestId('filter-item')).toHaveLength(
|
|
36
|
+
expect(getAllByTestId('filter-item')).toHaveLength(7)
|
|
37
37
|
expect(getByRole('navigation').classList).not.toContain('limit')
|
|
38
38
|
})
|
|
39
39
|
|
package/src/tests/routes/components/{Participant.test.js → Participants/Participant.test.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fireEvent, render, waitFor } from '@testing-library/svelte'
|
|
2
2
|
import { describe, expect, it, vi, beforeEach } from 'vitest'
|
|
3
3
|
|
|
4
|
-
import Participant from '
|
|
4
|
+
import Participant from '../../../../routes/components/Participants/Participant.svelte'
|
|
5
5
|
import { participants, title } from '$lib/fakeData'
|
|
6
6
|
import { fetchTitlesForParticipant } from '$lib/api/participants'
|
|
7
7
|
|
|
@@ -80,4 +80,23 @@ describe('Participant.svelte', () => {
|
|
|
80
80
|
expect(queryByText('Credits')).not.toBeTruthy()
|
|
81
81
|
expect(container.querySelector('.small')).toBeTruthy()
|
|
82
82
|
})
|
|
83
|
+
|
|
84
|
+
it('Should render image if given', async () => {
|
|
85
|
+
const participantWithImage = { ...participants[0], image: 'some-image.jpg' }
|
|
86
|
+
|
|
87
|
+
const { getByRole } = render(Participant, { participant: participantWithImage })
|
|
88
|
+
|
|
89
|
+
await waitFor(() => {
|
|
90
|
+
expect(getByRole('presentation')).toBeTruthy()
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('Should not render image if not given', async () => {
|
|
95
|
+
|
|
96
|
+
const { queryByRole } = render(Participant, { participant: participants[0] })
|
|
97
|
+
|
|
98
|
+
await waitFor(() => {
|
|
99
|
+
expect(queryByRole('presentation')).not.toBeTruthy()
|
|
100
|
+
})
|
|
101
|
+
})
|
|
83
102
|
})
|
|
@@ -36,6 +36,19 @@ describe('ParticipantsRail.svelte', () => {
|
|
|
36
36
|
})
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
+
it('Should render image only for participants with image', async () => {
|
|
40
|
+
const participantsWithImage = [...participants]
|
|
41
|
+
participantsWithImage[0].image = 'some-image.jpg'
|
|
42
|
+
|
|
43
|
+
vi.mocked(fetchParticipantsForTitle).mockResolvedValueOnce(participantsWithImage)
|
|
44
|
+
|
|
45
|
+
const { getAllByRole } = render(ParticipantsRail, { title })
|
|
46
|
+
|
|
47
|
+
await waitFor(() => {
|
|
48
|
+
expect(getAllByRole('presentation')).toHaveLength(1)
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
|
|
39
52
|
it('Should order participants by their number of occurrences on the page', async () => {
|
|
40
53
|
document.body.innerHTML = `<main>${participants[1].name}. ${participants[2].name}, ${participants[2].name}</main>`
|
|
41
54
|
vi.mocked(fetchParticipantsForTitle).mockResolvedValueOnce(participants)
|