@playpilot/tpi 8.34.5 → 8.35.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/package.json +1 -1
- package/src/lib/data/translations.ts +573 -573
- package/src/routes/components/Explore/Filter/Filter.svelte +148 -148
- package/src/routes/components/Explore/Routes/ExploreResults.svelte +6 -4
- package/src/routes/components/Explore/Routes/ExploreTitle.svelte +1 -1
- package/src/routes/components/Modals/Modal.svelte +4 -0
- package/src/routes/components/Rails/ParticipantsRail.svelte +1 -1
|
@@ -1,148 +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
|
-
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>
|
|
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>
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
interface Props {
|
|
21
21
|
searchQuery?: string,
|
|
22
22
|
filter?: ExploreFilter
|
|
23
|
+
forceGrid?: boolean
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
const { searchQuery = '', filter = {} }: Props = $props()
|
|
26
|
+
const { searchQuery = '', filter = {}, forceGrid = false }: Props = $props()
|
|
26
27
|
|
|
27
28
|
// svelte-ignore non_reactive_update
|
|
28
29
|
let page = 1
|
|
@@ -33,12 +34,13 @@
|
|
|
33
34
|
let promise = $state(getTitlesForFilter())
|
|
34
35
|
let width = $state(0)
|
|
35
36
|
|
|
36
|
-
const grid = $derived(width > 500)
|
|
37
|
+
const grid = $derived(forceGrid || width > 500)
|
|
37
38
|
const gridColumns = $derived.by(() => {
|
|
38
39
|
if (width > 1400) return 8
|
|
39
40
|
if (width > 900) return 6
|
|
40
|
-
|
|
41
|
-
return 3
|
|
41
|
+
if (width > 600) return 4
|
|
42
|
+
if (width > 400) return 3
|
|
43
|
+
return 2
|
|
42
44
|
})
|
|
43
45
|
const TitleComponent = $derived(grid ? GridTitle : ListTitle)
|
|
44
46
|
const SkeletonComponent = $derived(grid ? GridTitleSkeleton : ListTitleSkeleton)
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
async function getParticipants(): Promise<ParticipantData[]> {
|
|
57
57
|
const participants = await fetchParticipantsForTitle(title)
|
|
58
58
|
|
|
59
|
-
if (participants
|
|
59
|
+
if (participants?.length) track(TrackingEvent.TitleParticipantsView, title, { participants: participants.map(p => p.name).slice(0, 20) })
|
|
60
60
|
|
|
61
61
|
return participants
|
|
62
62
|
}
|