@playpilot/tpi 8.35.2 → 8.36.0
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 +9 -9
- package/dist/link-injections.js +1 -1
- package/dist/mount.css +1 -1
- package/dist/mount.js +7 -7
- package/package.json +1 -1
- package/src/lib/api/providers.ts +3 -1
- package/src/lib/data/translations.ts +40 -0
- package/src/lib/fakeData.ts +6 -0
- package/src/lib/types/filter.d.ts +5 -2
- package/src/lib/types/participant.d.ts +1 -1
- package/src/routes/components/Explore/Filter/Filter.svelte +11 -5
- package/src/routes/components/Explore/Filter/FilterSorting.svelte +5 -4
- package/src/routes/components/Explore/Routes/ExploreResults.svelte +13 -8
- package/src/routes/components/GridTitle.svelte +11 -4
- package/src/routes/components/Icons/IconAttribution.svelte +1 -1
- package/src/routes/components/Modals/Modal.svelte +1 -1
- package/src/routes/components/Modals/ParticipantModal.svelte +1 -5
- package/src/routes/components/Participants/Participant.svelte +76 -135
- package/src/routes/components/Participants/ParticipantImage.svelte +2 -1
- package/src/tests/lib/api/providers.test.js +9 -0
- package/src/tests/routes/components/Explore/Filter/Filter.test.js +2 -1
- package/src/tests/routes/components/Participants/Participant.test.js +59 -21
package/package.json
CHANGED
package/src/lib/api/providers.ts
CHANGED
|
@@ -15,7 +15,9 @@ export async function fetchProviders(): Promise<PlaylinkData[]> {
|
|
|
15
15
|
include_count: false,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
let response = await api<PlaylinkData[]>(`/providers/?api-token=${apiToken}&` + paramsToString(params))
|
|
19
|
+
|
|
20
|
+
response = response.filter((a, i, providers) => providers.findIndex(b => (b.slug === a.slug)) === i)
|
|
19
21
|
|
|
20
22
|
return response
|
|
21
23
|
}
|
|
@@ -151,6 +151,16 @@ export const translations = {
|
|
|
151
151
|
[Language.Swedish]: 'Visa mindre',
|
|
152
152
|
[Language.Danish]: 'Vis mindre',
|
|
153
153
|
},
|
|
154
|
+
'Read More': {
|
|
155
|
+
[Language.English]: 'Read more',
|
|
156
|
+
[Language.Swedish]: 'Läs mer',
|
|
157
|
+
[Language.Danish]: 'Læs mere',
|
|
158
|
+
},
|
|
159
|
+
'Read Less': {
|
|
160
|
+
[Language.English]: 'Read less',
|
|
161
|
+
[Language.Swedish]: 'Läs mindre',
|
|
162
|
+
[Language.Danish]: 'Læs mindre',
|
|
163
|
+
},
|
|
154
164
|
'Cast': {
|
|
155
165
|
[Language.English]: 'Cast',
|
|
156
166
|
[Language.Swedish]: 'Rollista',
|
|
@@ -368,6 +378,36 @@ export const translations = {
|
|
|
368
378
|
[Language.Swedish]: 'Utforska alla filmer och tv-serier',
|
|
369
379
|
[Language.Danish]: 'Udforsk alle film og tv-serier',
|
|
370
380
|
},
|
|
381
|
+
'Job: all': {
|
|
382
|
+
[Language.English]: 'All',
|
|
383
|
+
[Language.Swedish]: 'Alla',
|
|
384
|
+
[Language.Danish]: 'Alle',
|
|
385
|
+
},
|
|
386
|
+
'Job: actor': {
|
|
387
|
+
[Language.English]: 'Actor',
|
|
388
|
+
[Language.Swedish]: 'Skådespelare',
|
|
389
|
+
[Language.Danish]: 'Skuespiller',
|
|
390
|
+
},
|
|
391
|
+
'Job: producer': {
|
|
392
|
+
[Language.English]: 'Producer',
|
|
393
|
+
[Language.Swedish]: 'Producent',
|
|
394
|
+
[Language.Danish]: 'Producer',
|
|
395
|
+
},
|
|
396
|
+
'Job: executive-producer': {
|
|
397
|
+
[Language.English]: 'Executive Producer',
|
|
398
|
+
[Language.Swedish]: 'Verkställande producent',
|
|
399
|
+
[Language.Danish]: 'Administrerende producer',
|
|
400
|
+
},
|
|
401
|
+
'Job: writer': {
|
|
402
|
+
[Language.English]: 'Writer',
|
|
403
|
+
[Language.Swedish]: 'Manusförfattare',
|
|
404
|
+
[Language.Danish]: 'Manuskriptforfatter',
|
|
405
|
+
},
|
|
406
|
+
'Job: director': {
|
|
407
|
+
[Language.English]: 'Director',
|
|
408
|
+
[Language.Swedish]: 'Regissör',
|
|
409
|
+
[Language.Danish]: 'Instruktør',
|
|
410
|
+
},
|
|
371
411
|
|
|
372
412
|
// Genres
|
|
373
413
|
'All': {
|
package/src/lib/fakeData.ts
CHANGED
|
@@ -54,6 +54,7 @@ export const participants: ParticipantData[] = [
|
|
|
54
54
|
image_uuid: null,
|
|
55
55
|
gender: 'Male',
|
|
56
56
|
character: 'Will Rodman (archive footage) (uncredited)',
|
|
57
|
+
description: 'Some description',
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
sid: 'pr8bZm',
|
|
@@ -65,6 +66,7 @@ export const participants: ParticipantData[] = [
|
|
|
65
66
|
image_uuid: null,
|
|
66
67
|
gender: 'Male',
|
|
67
68
|
character: 'Old Man',
|
|
69
|
+
description: 'Some description',
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
72
|
sid: 'pr45Dp',
|
|
@@ -76,6 +78,7 @@ export const participants: ParticipantData[] = [
|
|
|
76
78
|
image_uuid: null,
|
|
77
79
|
gender: 'Male',
|
|
78
80
|
character: 'Self (archive footage) (uncredited)',
|
|
81
|
+
description: 'Some description',
|
|
79
82
|
},
|
|
80
83
|
{
|
|
81
84
|
sid: 'pr6DnN',
|
|
@@ -87,6 +90,7 @@ export const participants: ParticipantData[] = [
|
|
|
87
90
|
image_uuid: null,
|
|
88
91
|
gender: 'Male',
|
|
89
92
|
character: 'Dreyfus',
|
|
93
|
+
description: 'Some description',
|
|
90
94
|
},
|
|
91
95
|
{
|
|
92
96
|
sid: 'pr7GK8',
|
|
@@ -98,6 +102,7 @@ export const participants: ParticipantData[] = [
|
|
|
98
102
|
image_uuid: null,
|
|
99
103
|
gender: 'Male',
|
|
100
104
|
character: 'Cannon-Gunner',
|
|
105
|
+
description: 'Some description',
|
|
101
106
|
},
|
|
102
107
|
{
|
|
103
108
|
sid: 'pr88KG',
|
|
@@ -109,6 +114,7 @@ export const participants: ParticipantData[] = [
|
|
|
109
114
|
image_uuid: null,
|
|
110
115
|
gender: 'Female',
|
|
111
116
|
character: 'Cornelia',
|
|
117
|
+
description: 'Some description',
|
|
112
118
|
},
|
|
113
119
|
]
|
|
114
120
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { Sorting } from '$lib/enums/Sorting'
|
|
2
|
+
|
|
1
3
|
export type ExploreFilterType = 'array' | 'range' | 'string'
|
|
2
|
-
export type ExploreFilterItem = { type: ExploreFilterType
|
|
4
|
+
export type ExploreFilterItem = { type: ExploreFilterType; value: unknown }
|
|
3
5
|
export type ExploreFilter = Record<string, ExploreFilterItem>
|
|
4
|
-
export type ExploreFilterItemArrayValue = { label: string
|
|
6
|
+
export type ExploreFilterItemArrayValue = { label: string; value: string }
|
|
7
|
+
export type ExploreTitleSorting = { label: string; value: (typeof Sorting)[keyof typeof Sorting] }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type ParticipantData = {
|
|
2
2
|
sid: string
|
|
3
3
|
name: string
|
|
4
|
+
description: string
|
|
4
5
|
birth_date: string
|
|
5
6
|
death_date: string | null
|
|
6
7
|
jobs: Job[]
|
|
@@ -16,7 +17,6 @@ export type ParticipantData = {
|
|
|
16
17
|
}
|
|
17
18
|
gender: string
|
|
18
19
|
character?: string | null
|
|
19
|
-
bio?: string | null
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export type Job = 'actor' | 'writer' | 'director'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ExploreFilter } from '$lib/types/filter'
|
|
2
|
+
import type { ExploreFilter, ExploreTitleSorting } from '$lib/types/filter'
|
|
3
3
|
import genres from '$lib/data/genres.json'
|
|
4
4
|
import { fetchProviders } from '$lib/api/providers'
|
|
5
5
|
import { t } from '$lib/localization'
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
interface Props {
|
|
17
17
|
filter: ExploreFilter
|
|
18
18
|
limit?: boolean
|
|
19
|
+
hideActive?: boolean
|
|
19
20
|
showSorting?: boolean
|
|
21
|
+
sortings?: null | ExploreTitleSorting[]
|
|
20
22
|
searchQuery?: string
|
|
21
23
|
onchange?: () => void
|
|
22
24
|
onempty?: () => void
|
|
@@ -25,7 +27,9 @@
|
|
|
25
27
|
const {
|
|
26
28
|
filter,
|
|
27
29
|
limit = true,
|
|
30
|
+
hideActive = false,
|
|
28
31
|
showSorting = true,
|
|
32
|
+
sortings = null,
|
|
29
33
|
searchQuery = '',
|
|
30
34
|
onchange = () => null,
|
|
31
35
|
onempty = () => null,
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
data: [{ label: t('Movies'), value: 'movie' }, { label: t('Shows'), value: 'series' }, { label: t('Kids'), value: 'kids' }, { label: t('Documentary'), value: 'documentary' }],
|
|
66
70
|
}]
|
|
67
71
|
|
|
68
|
-
let limited = $
|
|
72
|
+
let limited = $derived(limit)
|
|
69
73
|
let wasPreviouslyActive = false
|
|
70
74
|
|
|
71
75
|
$effect(() => {
|
|
@@ -97,20 +101,22 @@
|
|
|
97
101
|
{#if limit}
|
|
98
102
|
<Button variant="link" onclick={() => limited = !limited}>
|
|
99
103
|
<IconFilter />
|
|
100
|
-
{t('
|
|
104
|
+
{limited ? t('Show More') : t('Show Less')}
|
|
101
105
|
<IconArrow direction={limited ? 'down' : 'up'} />
|
|
102
106
|
</Button>
|
|
103
107
|
{/if}
|
|
104
108
|
|
|
105
109
|
{#if showSorting}
|
|
106
110
|
<div class="sorting" transition:fly={{ x: 5, duration: 100 }}>
|
|
107
|
-
<FilterSorting {filter} {onchange} />
|
|
111
|
+
<FilterSorting {filter} {onchange} {sortings} />
|
|
108
112
|
</div>
|
|
109
113
|
{/if}
|
|
110
114
|
</div>
|
|
111
115
|
</div>
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
{#if !hideActive}
|
|
118
|
+
<ActiveFilterItems {filter} {items} />
|
|
119
|
+
{/if}
|
|
114
120
|
|
|
115
121
|
<style lang="scss">
|
|
116
122
|
.filter {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Button from '../../Button.svelte'
|
|
3
3
|
import IconArrow from '../../Icons/IconArrow.svelte'
|
|
4
|
-
import type { ExploreFilter } from '$lib/types/filter'
|
|
4
|
+
import type { ExploreFilter, ExploreTitleSorting } from '$lib/types/filter'
|
|
5
5
|
import { t } from '$lib/localization'
|
|
6
6
|
import Dropdown from './Dropdown.svelte'
|
|
7
7
|
import { Sorting } from '$lib/enums/Sorting'
|
|
@@ -9,18 +9,19 @@
|
|
|
9
9
|
interface Props {
|
|
10
10
|
filter: ExploreFilter
|
|
11
11
|
onchange?: () => void
|
|
12
|
+
sortings?: null | ExploreTitleSorting[]
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const { filter, onchange = () => null }: Props = $props()
|
|
15
|
+
const { filter, onchange = () => null, sortings = null }: Props = $props()
|
|
15
16
|
|
|
16
17
|
const param = 'ordering'
|
|
17
18
|
|
|
18
|
-
const options = [
|
|
19
|
+
const options = $derived(sortings || [
|
|
19
20
|
{ label: 'Popularity', value: Sorting.Popular },
|
|
20
21
|
{ label: 'New', value: Sorting.New },
|
|
21
22
|
{ label: 'Top Rated', value: Sorting.Best },
|
|
22
23
|
{ label: 'IMDb Rating', value: Sorting.IMDb },
|
|
23
|
-
]
|
|
24
|
+
])
|
|
24
25
|
|
|
25
26
|
const label = $derived(options.find(({ value }) => value === filter[param]?.value)?.label || 'Sort By')
|
|
26
27
|
|
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
searchQuery?: string,
|
|
22
22
|
filter?: ExploreFilter
|
|
23
23
|
forceGrid?: boolean
|
|
24
|
+
hidePlaylinks?: boolean
|
|
25
|
+
onTitleClick?: null | ((event: MouseEvent, titles: TitleData[], index: number) => void)
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
const { searchQuery = '', filter = {}, forceGrid = false }: Props = $props()
|
|
28
|
+
const { searchQuery = '', filter = {}, forceGrid = false, hidePlaylinks = false, onTitleClick = null }: Props = $props()
|
|
27
29
|
|
|
28
30
|
// svelte-ignore non_reactive_update
|
|
29
31
|
let page = 1
|
|
@@ -53,9 +55,7 @@
|
|
|
53
55
|
if (filter) setFilter()
|
|
54
56
|
})
|
|
55
57
|
|
|
56
|
-
onDestroy(
|
|
57
|
-
emptyFilter()
|
|
58
|
-
})
|
|
58
|
+
onDestroy(emptyFilter)
|
|
59
59
|
|
|
60
60
|
async function getTitlesForFilter(): Promise<APIPaginatedResult<TitleData>> {
|
|
61
61
|
latestRequestId += 1
|
|
@@ -132,7 +132,12 @@
|
|
|
132
132
|
track(TrackingEvent.ExploreShowMore, null, { page })
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
function openTitle(event: MouseEvent, title: TitleData): void {
|
|
135
|
+
function openTitle(event: MouseEvent, title: TitleData, index: number): void {
|
|
136
|
+
if (onTitleClick) {
|
|
137
|
+
onTitleClick(event, titles, index)
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
|
|
136
141
|
openModal({ event, data: title })
|
|
137
142
|
track(TrackingEvent.ExploreTitleClick, title)
|
|
138
143
|
}
|
|
@@ -147,9 +152,9 @@
|
|
|
147
152
|
</script>
|
|
148
153
|
|
|
149
154
|
<div class="titles" class:grid role="main" style:--grid-columns={gridColumns} bind:clientWidth={width} data-testid="explore-results">
|
|
150
|
-
{#each titles as title}
|
|
155
|
+
{#each titles as title, index}
|
|
151
156
|
{#key title.sid}
|
|
152
|
-
<TitleComponent {title} onclick={(event: MouseEvent) => openTitle(event, title)} />
|
|
157
|
+
<TitleComponent {title} {hidePlaylinks} onclick={(event: MouseEvent) => openTitle(event, title, index)} />
|
|
153
158
|
{/key}
|
|
154
159
|
{/each}
|
|
155
160
|
|
|
@@ -165,7 +170,7 @@
|
|
|
165
170
|
{#await promise then { next }}
|
|
166
171
|
{#if next}
|
|
167
172
|
<div class="show-more" class:grid>
|
|
168
|
-
<Button size="large" onclick={fetchMoreTitles}>{t('Show More')}</Button>
|
|
173
|
+
<Button size="large" onclick={fetchMoreTitles} label="Show more movies & shows">{t('Show More')}</Button>
|
|
169
174
|
</div>
|
|
170
175
|
{/if}
|
|
171
176
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { TitleData } from '$lib/types/title'
|
|
3
|
+
import { getContext } from 'svelte'
|
|
3
4
|
import IconIMDb from './Icons/IconIMDb.svelte'
|
|
4
5
|
import PlaylinksCompact from './Playlinks/PlaylinksCompact.svelte'
|
|
5
6
|
import TitlePoster from './TitlePoster.svelte'
|
|
@@ -7,9 +8,10 @@
|
|
|
7
8
|
interface Props {
|
|
8
9
|
title: TitleData
|
|
9
10
|
onclick?: (event: MouseEvent) => void
|
|
11
|
+
hidePlaylinks?: boolean
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
const { title, onclick = () => null }: Props = $props()
|
|
14
|
+
const { title, onclick = () => null, hidePlaylinks = false }: Props = $props()
|
|
13
15
|
</script>
|
|
14
16
|
|
|
15
17
|
<button class="title" {onclick} data-testid="title">
|
|
@@ -33,9 +35,11 @@
|
|
|
33
35
|
</div>
|
|
34
36
|
|
|
35
37
|
<div class="content">
|
|
36
|
-
<div class="heading">{title.title}</div>
|
|
38
|
+
<div class="heading" class:margin={!hidePlaylinks}>{title.title}</div>
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
{#if !hidePlaylinks}
|
|
41
|
+
<PlaylinksCompact playlinks={title.providers} size={20} />
|
|
42
|
+
{/if}
|
|
39
43
|
</div>
|
|
40
44
|
</button>
|
|
41
45
|
|
|
@@ -81,7 +85,6 @@
|
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
.heading {
|
|
84
|
-
margin-bottom: margin(0.5);
|
|
85
88
|
overflow: hidden;
|
|
86
89
|
text-overflow: ellipsis;
|
|
87
90
|
white-space: nowrap;
|
|
@@ -96,6 +99,10 @@
|
|
|
96
99
|
color: theme(grid-item-title-hover-text-color, text-color);
|
|
97
100
|
text-decoration: theme(grid-item-title-hover-text-decoration, none);
|
|
98
101
|
}
|
|
102
|
+
|
|
103
|
+
&.margin {
|
|
104
|
+
margin-bottom: margin(0.5);
|
|
105
|
+
}
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
.meta {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg height="
|
|
1
|
+
<svg width="21px" height="21px" viewBox="0 -960 960 960">
|
|
2
2
|
<path fill="currentColor" d="M430-200h100v-180h60v-184q0-27-28.5-41.5T480-620q-53 0-81.5 14.5T370-564v184h60v180Zm-105 88.5q-73-31.5-127.5-86t-86-127.5Q80-398 80-480.5t31.5-155q31.5-72.5 86-127t127.5-86Q398-880 480.5-880t155 31.5q72.5 31.5 127 86t86 127Q880-563 880-480.5T848.5-325q-31.5 73-86 127.5t-127 86Q563-80 480.5-80T325-111.5Zm381.5-142Q800-347 800-480t-93.5-226.5Q613-800 480-800t-226.5 93.5Q160-613 160-480t93.5 226.5Q347-160 480-160t226.5-93.5ZM523-657q17-17 17-43t-17-43q-17-17-43-17t-43 17q-17 17-17 43t17 43q17 17 43 17t43-17Zm-43 177Z"/>
|
|
3
3
|
</svg>
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
|
|
15
15
|
const { participant, initialScrollPosition = 0, ...restProps }: Props = $props()
|
|
16
16
|
|
|
17
|
-
let windowWidth = $state(0)
|
|
18
|
-
|
|
19
17
|
track(TrackingEvent.ParticipantModalView, null, { participant: participant.name })
|
|
20
18
|
|
|
21
19
|
onMount(() => {
|
|
@@ -25,8 +23,6 @@
|
|
|
25
23
|
})
|
|
26
24
|
</script>
|
|
27
25
|
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
<Modal {initialScrollPosition} {...restProps} closeButtonStyle="flat" tall>
|
|
26
|
+
<Modal {initialScrollPosition} {...restProps} closeButtonStyle="flat" tall wide blur>
|
|
31
27
|
<Participant {participant} />
|
|
32
28
|
</Modal>
|