@playpilot/tpi 8.11.0-beta.2 → 8.11.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 +8 -8
- package/dist/link-injections.js +2 -2
- package/dist/mount.js +5 -5
- package/package.json +1 -1
- package/src/lib/api/externalPages.ts +15 -11
- package/src/lib/api/session.ts +5 -7
- package/src/lib/data/translations.ts +0 -5
- package/src/lib/injectionElements.ts +1 -1
- package/src/lib/meta.ts +2 -1
- package/src/main.ts +1 -4
- package/src/routes/+layout.svelte +6 -1
- package/src/routes/+page.svelte +4 -10
- package/src/routes/components/Editorial/Editor.svelte +3 -4
- package/src/routes/components/Editorial/ManualInjection.svelte +4 -3
- package/src/routes/components/Editorial/Session.svelte +2 -4
- package/src/routes/components/Explore/ExploreLayout.svelte +3 -8
- package/src/routes/components/Explore/Routes/ExploreHome.svelte +4 -6
- package/src/routes/components/Modals/RailModal.svelte +1 -1
- package/src/routes/components/Rails/TitlesRail.svelte +4 -19
- package/src/routes/components/Title.svelte +1 -1
- package/src/tests/lib/api/externalPages.test.js +44 -22
- package/src/tests/lib/api/session.test.js +2 -2
- package/src/tests/lib/meta.test.js +11 -2
- package/src/tests/main.test.js +0 -1
- package/src/tests/routes/+page.test.js +4 -4
- package/src/tests/routes/components/Editorial/ManualInjection.test.js +9 -9
- package/vite._mount.config.js.timestamp-1780937644427-faf490b0d476d8.mjs +0 -105
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import type { LinkInjectionResponse, LinkInjection } from '../types/injection'
|
|
|
6
6
|
import { getFullUrlPath } from '../url'
|
|
7
7
|
import { api } from './api'
|
|
8
8
|
import { getApiToken } from '$lib/token'
|
|
9
|
+
import { getPageTextAndElements } from '$lib/injectionElements'
|
|
9
10
|
|
|
10
11
|
let pollTimeout: ReturnType<typeof setTimeout> | null = null
|
|
11
12
|
|
|
@@ -13,9 +14,8 @@ let pollTimeout: ReturnType<typeof setTimeout> | null = null
|
|
|
13
14
|
* Fetch link injections for a URL. This will be either a POST or a GET request depending on whether on not the AI should run.
|
|
14
15
|
*/
|
|
15
16
|
export async function fetchLinkInjections(
|
|
16
|
-
|
|
17
|
-
{ url
|
|
18
|
-
{ url?: string, hash?: string, params?: Record<string, any>, method?: 'GET' | 'POST' } = {},
|
|
17
|
+
{ url = getFullUrlPath(), params = {}, method = 'GET' }:
|
|
18
|
+
{ url?: string, params?: Record<string, any>, method?: 'GET' | 'POST' } = {},
|
|
19
19
|
): Promise<LinkInjectionResponse> {
|
|
20
20
|
const apiToken = getApiToken()
|
|
21
21
|
const isEditorialMode = isEditorialModeEnabled() ? await authorize() : false
|
|
@@ -29,8 +29,10 @@ export async function fetchLinkInjections(
|
|
|
29
29
|
// We use separate requests when running the AI or setting the editor session vs when only getting the results.
|
|
30
30
|
// For regular requests we use a GET endpoint, but when saving data we POST to the same url.
|
|
31
31
|
if (method === 'POST') {
|
|
32
|
+
const { pageText } = getPageTextAndElements()
|
|
33
|
+
|
|
32
34
|
if (params.run_ai) {
|
|
33
|
-
params.hash =
|
|
35
|
+
params.hash = stringToHash(pageText || '')
|
|
34
36
|
params.page_text = pageText
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -60,7 +62,6 @@ export async function fetchLinkInjections(
|
|
|
60
62
|
* The results return `injections_ready=false` while the injections are not yet ready.
|
|
61
63
|
*/
|
|
62
64
|
export async function pollLinkInjections(
|
|
63
|
-
pageText: string,
|
|
64
65
|
{ requireCompletedResult = false, runAiWhenRelevant = false, pollInterval = 3000, maxTries = 600, onpoll = () => null }:
|
|
65
66
|
{ requireCompletedResult?: boolean, runAiWhenRelevant?: boolean, pollInterval?: number, maxTries?: number, onpoll?: (_response: LinkInjectionResponse) => void } = {},
|
|
66
67
|
): Promise<LinkInjectionResponse> {
|
|
@@ -77,19 +78,22 @@ export async function pollLinkInjections(
|
|
|
77
78
|
// if it does. We're still interested in handling the response from here and don't want it to short circuit
|
|
78
79
|
// just because the fetch failed.
|
|
79
80
|
try {
|
|
80
|
-
response = await fetchLinkInjections(
|
|
81
|
+
response = await fetchLinkInjections()
|
|
81
82
|
} catch(error: any) {
|
|
83
|
+
console.error(error)
|
|
82
84
|
if (error?.status === 404) {
|
|
83
85
|
// If the GET endpoint returns a 404 no article has been generated yet and we can safely generate
|
|
84
86
|
// a new article. We can safely throw here (meaning we poll again) as nothing will be returned.
|
|
85
87
|
// The first POST indexes the article, the second runs the AI if needed.
|
|
86
|
-
response = await fetchLinkInjections(
|
|
87
|
-
if (response.ai_enabled) response = await fetchLinkInjections(
|
|
88
|
+
response = await fetchLinkInjections({ method: 'POST' })
|
|
89
|
+
if (response.ai_enabled) response = await fetchLinkInjections({ params: { run_ai: true }, method: 'POST' })
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
throw new Error
|
|
91
93
|
}
|
|
92
94
|
|
|
95
|
+
const { pageText } = getPageTextAndElements()
|
|
96
|
+
|
|
93
97
|
if (response && runAiWhenRelevant) response = await runAiBasedOnResponse(pageText, response)
|
|
94
98
|
if (requireCompletedResult && (response.ai_enabled && response.ai_running)) throw new Error
|
|
95
99
|
|
|
@@ -133,10 +137,10 @@ export async function runAiBasedOnResponse(pageText: string, response: LinkInjec
|
|
|
133
137
|
if (response.ai_last_run && isCurrentTimeEqualToResponseTime) return response
|
|
134
138
|
if (new Date(currentModifiedTime || 0) <= new Date(responseModifiedTime || 0)) return response
|
|
135
139
|
|
|
136
|
-
return await fetchLinkInjections(
|
|
140
|
+
return await fetchLinkInjections({ params: { run_ai: true }, method: 'POST' })
|
|
137
141
|
}
|
|
138
142
|
|
|
139
|
-
export async function saveLinkInjections(linkInjections: LinkInjection[]
|
|
143
|
+
export async function saveLinkInjections(linkInjections: LinkInjection[]): Promise<LinkInjection[]> {
|
|
140
144
|
const selector = window.PlayPilotLinkInjections?.selector
|
|
141
145
|
|
|
142
146
|
// Only save manual injections, AI injections should be left intact and can't be saved over
|
|
@@ -156,7 +160,7 @@ export async function saveLinkInjections(linkInjections: LinkInjection[], pageTe
|
|
|
156
160
|
removed: !!linkInjection.removed,
|
|
157
161
|
}))
|
|
158
162
|
|
|
159
|
-
const response = await fetchLinkInjections(
|
|
163
|
+
const response = await fetchLinkInjections({
|
|
160
164
|
method: 'POST',
|
|
161
165
|
params: {
|
|
162
166
|
private_token: getAuthToken(),
|
package/src/lib/api/session.ts
CHANGED
|
@@ -11,10 +11,9 @@ export const sessionPeriodMilliseconds = sessionPollPeriodMilliseconds * 2
|
|
|
11
11
|
* where we save the session.
|
|
12
12
|
* Along with that, we also return ai_enabled and injections_enabled as they are used to update the state of
|
|
13
13
|
* the current editing session.
|
|
14
|
-
* @param pageText Despite not being used, the request still requires a valid pageText string
|
|
15
14
|
*/
|
|
16
|
-
export async function fetchAsSession(
|
|
17
|
-
const { ai_enabled, injections_enabled, ai_last_run, session_id, session_last_ping } = await fetchLinkInjections(
|
|
15
|
+
export async function fetchAsSession(): Promise<SessionResponse> {
|
|
16
|
+
const { ai_enabled, injections_enabled, ai_last_run, session_id, session_last_ping } = await fetchLinkInjections()
|
|
18
17
|
|
|
19
18
|
const isCurrentlyAllowToEdit = isAllowedToEdit(session_id || null, session_last_ping || null)
|
|
20
19
|
|
|
@@ -28,15 +27,14 @@ export async function fetchAsSession(pageText: string): Promise<SessionResponse>
|
|
|
28
27
|
|
|
29
28
|
if (!isCurrentlyAllowToEdit) return response
|
|
30
29
|
|
|
31
|
-
return await saveCurrentSession(
|
|
30
|
+
return await saveCurrentSession()
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* Save the current users session id as the currently active session. This is always completed regardless of if the user
|
|
36
35
|
* is the current owner of the session, so check that first if necessary!
|
|
37
|
-
* @param pageText Despite not being used, the request still requires a valid pageText string
|
|
38
36
|
*/
|
|
39
|
-
export async function saveCurrentSession(
|
|
37
|
+
export async function saveCurrentSession(): Promise<SessionResponse> {
|
|
40
38
|
const sessionId = getSessionId()
|
|
41
39
|
const now = new Date(Date.now()).toISOString()
|
|
42
40
|
|
|
@@ -45,7 +43,7 @@ export async function saveCurrentSession(pageText: string): Promise<SessionRespo
|
|
|
45
43
|
session_last_ping: now.toString(),
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
const { ai_enabled, injections_enabled, ai_last_run } = await fetchLinkInjections(
|
|
46
|
+
const { ai_enabled, injections_enabled, ai_last_run } = await fetchLinkInjections({ params })
|
|
49
47
|
|
|
50
48
|
return {
|
|
51
49
|
ai_enabled,
|
|
@@ -166,11 +166,6 @@ export const translations = {
|
|
|
166
166
|
[Language.Swedish]: 'Streaming Guide',
|
|
167
167
|
[Language.Danish]: 'Streaming Guide',
|
|
168
168
|
},
|
|
169
|
-
'Streaming Guide Heading': {
|
|
170
|
-
[Language.English]: 'Discover and search all movies and tv-shows',
|
|
171
|
-
[Language.Swedish]: 'Upptäck och sök bland alla filmer och tv-serier',
|
|
172
|
-
[Language.Danish]: 'Opdag og søg i alle film og tv-serier',
|
|
173
|
-
},
|
|
174
169
|
'Streaming Guide Description': {
|
|
175
170
|
[Language.English]: 'Find where to watch movies online - the ultimate guide that helps you find the best movies and shows across streaming services.',
|
|
176
171
|
[Language.Swedish]: 'Sök bland alla filmer och serier för att ta reda på var du kan streama dem',
|
|
@@ -91,7 +91,7 @@ export function getPageText(elements: HTMLElement[]): string {
|
|
|
91
91
|
return elements.map(element => element.innerText).join('\n\n')
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
export function getPageTextAndElements(config: ConfigResponse | null): { parentElement: HTMLElement, elements: HTMLElement[], pageText: string } {
|
|
94
|
+
export function getPageTextAndElements(config: ConfigResponse | null = window.PlayPilotLinkInjections?.config || null): { parentElement: HTMLElement, elements: HTMLElement[], pageText: string } {
|
|
95
95
|
const parentElement = getLinkInjectionsParentElement()
|
|
96
96
|
const elements = getLinkInjectionElements(parentElement, config?.exclude_elements_selector || '')
|
|
97
97
|
const pageText = getPageText(elements)
|
package/src/lib/meta.ts
CHANGED
|
@@ -68,7 +68,8 @@ export function getDatetime(datetime: string): string | null {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export function getSchemaJson(): Record<string, any> {
|
|
71
|
-
const
|
|
71
|
+
const schemaElements = Array.from(document.querySelectorAll('[type="application/ld+json"]'))
|
|
72
|
+
const schemaElement = schemaElements.find(element => element.textContent.includes('dateModified') || element.textContent.includes('datePublished'))
|
|
72
73
|
|
|
73
74
|
if (!schemaElement) return {}
|
|
74
75
|
|
package/src/main.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { fetchConfig } from '$lib/api/config'
|
|
|
3
3
|
import { pollLinkInjections } from '$lib/api/externalPages'
|
|
4
4
|
import { setConsent } from '$lib/consent'
|
|
5
5
|
import { isCrawler } from '$lib/crawler'
|
|
6
|
-
import { getPageTextAndElements } from '$lib/injectionElements'
|
|
7
6
|
import { isUrlExcludedViaConfig } from '$lib/url'
|
|
8
7
|
|
|
9
8
|
window.PlayPilotLinkInjections ||= {
|
|
@@ -70,9 +69,7 @@ window.PlayPilotLinkInjections ||= {
|
|
|
70
69
|
|
|
71
70
|
if (isUrlExcludedViaConfig(this.config)) return
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.initial_link_injections_promise = pollLinkInjections(pageText, { maxTries: 1, runAiWhenRelevant: !isCrawler() })
|
|
72
|
+
this.initial_link_injections_promise = pollLinkInjections({ maxTries: 1, runAiWhenRelevant: !isCrawler() })
|
|
76
73
|
|
|
77
74
|
this.mount()
|
|
78
75
|
},
|
|
@@ -128,9 +128,14 @@
|
|
|
128
128
|
line-height: 1.8;
|
|
129
129
|
|
|
130
130
|
nav {
|
|
131
|
-
display:
|
|
131
|
+
display: grid;
|
|
132
|
+
grid-template-columns: 1fr 1fr;
|
|
132
133
|
gap: margin(1);
|
|
133
134
|
|
|
135
|
+
@include desktop {
|
|
136
|
+
display: flex;
|
|
137
|
+
}
|
|
138
|
+
|
|
134
139
|
a {
|
|
135
140
|
padding: margin(0.25) margin(0.75);
|
|
136
141
|
border: 1px solid currentColor;
|
package/src/routes/+page.svelte
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { onDestroy } from 'svelte'
|
|
3
3
|
import { pollLinkInjections } from '$lib/api/externalPages'
|
|
4
4
|
import { clearLinkInjections, injectLinksInDocument, separateLinkInjectionTypes } from '$lib/injection'
|
|
5
|
-
import { getPageText, getPageTextAndElements } from '$lib/injectionElements'
|
|
6
5
|
import { fireQueuedTrackingEvents, setTrackingSids, track } from '$lib/tracking'
|
|
7
6
|
import { isUrlExcludedViaConfig } from '$lib/url'
|
|
8
7
|
import { isCrawler } from '$lib/crawler'
|
|
@@ -11,6 +10,7 @@
|
|
|
11
10
|
import { fetchConfig } from '$lib/api/config'
|
|
12
11
|
import { insertExplore, insertExploreIntoNavigation } from '$lib/explore'
|
|
13
12
|
import { authorize, getAuthToken, isEditorialModeEnabled, removeAuthCookie, setEditorialParamInUrl } from '$lib/api/auth'
|
|
13
|
+
import { getPageTextAndElements } from '$lib/injectionElements'
|
|
14
14
|
import type { LinkInjectionResponse, LinkInjection, LinkInjectionTypes } from '$lib/types/injection'
|
|
15
15
|
import Editor from './components/Editorial/Editor.svelte'
|
|
16
16
|
import EditorTrigger from './components/Editorial/EditorTrigger.svelte'
|
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
import PostersScrollReveal from './components/PostersScrollReveal.svelte'
|
|
23
23
|
import TrackingPixelsForTitleDataPerLink from './components/TrackingPixelsForTitleDataPerLink.svelte'
|
|
24
24
|
|
|
25
|
-
let elements: HTMLElement[] = $state([])
|
|
26
|
-
|
|
27
25
|
let response: LinkInjectionResponse | null = $state(null)
|
|
28
26
|
let isEditorialMode = $state(isEditorialModeEnabled())
|
|
29
27
|
let hasAuthToken = $state(!!getAuthToken())
|
|
@@ -35,8 +33,6 @@
|
|
|
35
33
|
// @ts-ignore It's ok if the response is empty
|
|
36
34
|
const { ai_injections: aiInjections = [], manual_injections: manualInjections = [] } = $derived(response || {})
|
|
37
35
|
|
|
38
|
-
const pageText = $derived(getPageText(elements))
|
|
39
|
-
|
|
40
36
|
const initializePromise = initialize()
|
|
41
37
|
|
|
42
38
|
$effect(() => {
|
|
@@ -86,8 +82,6 @@
|
|
|
86
82
|
if (isUrlExcluded) return
|
|
87
83
|
|
|
88
84
|
if (config?.html_selector) window.PlayPilotLinkInjections.selector = config?.html_selector
|
|
89
|
-
|
|
90
|
-
elements = getPageTextAndElements(window.PlayPilotLinkInjections.config).elements
|
|
91
85
|
} catch(error) {
|
|
92
86
|
// We return if the config did not get fetched properly, as we can't determine what should and should
|
|
93
87
|
// get injected without it.
|
|
@@ -98,7 +92,7 @@
|
|
|
98
92
|
|
|
99
93
|
try {
|
|
100
94
|
response = await window.PlayPilotLinkInjections.initial_link_injections_promise || null
|
|
101
|
-
response ||= await pollLinkInjections(
|
|
95
|
+
response ||= await pollLinkInjections({ maxTries: 1, runAiWhenRelevant: !isCrawler() })
|
|
102
96
|
|
|
103
97
|
loading = false
|
|
104
98
|
|
|
@@ -114,7 +108,7 @@
|
|
|
114
108
|
|
|
115
109
|
if (!isEditorialMode || isCrawler()) return
|
|
116
110
|
|
|
117
|
-
response = await pollLinkInjections(
|
|
111
|
+
response = await pollLinkInjections({ requireCompletedResult: true, onpoll: (update) => response = update })
|
|
118
112
|
inject({ aiInjections, manualInjections })
|
|
119
113
|
} catch(error: unknown) {
|
|
120
114
|
console.error(error)
|
|
@@ -136,6 +130,7 @@
|
|
|
136
130
|
}
|
|
137
131
|
|
|
138
132
|
function inject(injections: LinkInjectionTypes = { aiInjections, manualInjections }): void {
|
|
133
|
+
const { elements } = getPageTextAndElements()
|
|
139
134
|
const filteredInjections = injectLinksInDocument(elements, injections)
|
|
140
135
|
|
|
141
136
|
if (JSON.stringify(filteredInjections) !== JSON.stringify(linkInjections)) {
|
|
@@ -206,7 +201,6 @@
|
|
|
206
201
|
<svelte:boundary onerror={(error) => track(TrackingEvent.EditorError, null, { message: (error as Error).message })}>
|
|
207
202
|
<Editor
|
|
208
203
|
bind:linkInjections
|
|
209
|
-
{pageText}
|
|
210
204
|
{loading}
|
|
211
205
|
onreinitialize={reinitializeEditor}
|
|
212
206
|
injectionsEnabled={response?.injections_enabled}
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
|
|
34
34
|
let {
|
|
35
35
|
linkInjections = $bindable(),
|
|
36
|
-
pageText = '',
|
|
37
36
|
loading = false,
|
|
38
37
|
injectionsEnabled = false,
|
|
39
38
|
aiStatus = {},
|
|
@@ -46,6 +45,8 @@
|
|
|
46
45
|
const position: Position = JSON.parse(localStorage.getItem(editorPositionKey) || '{ "x": 0, "y": 0 }')
|
|
47
46
|
const height: number = parseInt(localStorage.getItem(editorHeightKey) || '0')
|
|
48
47
|
|
|
48
|
+
|
|
49
|
+
|
|
49
50
|
let editorElement: HTMLElement | null = $state(null)
|
|
50
51
|
let manualInjectionActive = $state(false)
|
|
51
52
|
let saving = $state(false)
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
saving = true
|
|
86
87
|
hasError = false
|
|
87
88
|
|
|
88
|
-
linkInjections = await saveLinkInjections(linkInjections
|
|
89
|
+
linkInjections = await saveLinkInjections(linkInjections)
|
|
89
90
|
initialStateString = linkInjectionsString
|
|
90
91
|
} catch {
|
|
91
92
|
hasError = true
|
|
@@ -177,7 +178,6 @@
|
|
|
177
178
|
|
|
178
179
|
{#if !loading}
|
|
179
180
|
<Session
|
|
180
|
-
{pageText}
|
|
181
181
|
onallow={() => allowEditing = true}
|
|
182
182
|
ondisallow={() => allowEditing = false}
|
|
183
183
|
ontakeover={onreinitialize}
|
|
@@ -231,7 +231,6 @@
|
|
|
231
231
|
style:top="{scrollDistance}px"
|
|
232
232
|
transition:fly={{ x: Math.min(window.innerWidth, 320), duration: 200, opacity: 1 }}>
|
|
233
233
|
<ManualInjection
|
|
234
|
-
{pageText}
|
|
235
234
|
onclose={() => manualInjectionActive = false}
|
|
236
235
|
onsave={(linkInjection) => linkInjections.push(linkInjection)} />
|
|
237
236
|
</div>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { onMount } from 'svelte'
|
|
5
5
|
import { playPilotBaseUrl } from '$lib/constants'
|
|
6
6
|
import { generateInjectionKey } from '$lib/api/externalPages'
|
|
7
|
-
import { getLinkInjectionsParentElement } from '$lib/injectionElements'
|
|
7
|
+
import { getLinkInjectionsParentElement, getPageTextAndElements } from '$lib/injectionElements'
|
|
8
8
|
import { heading } from '$lib/actions/heading'
|
|
9
9
|
import { findSurroundingPhrases, cleanPhrase } from '$lib/text'
|
|
10
10
|
import { getIndexOfSelection } from '$lib/selection'
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
import TitleSearch from './Search/TitleSearch.svelte'
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
18
|
-
pageText: string
|
|
19
18
|
onsave: (linkInjection: LinkInjection) => void
|
|
20
19
|
onclose?: () => void
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
const {
|
|
22
|
+
const { onsave, onclose = () => null }: Props = $props()
|
|
23
|
+
|
|
24
|
+
const { pageText } = getPageTextAndElements()
|
|
24
25
|
|
|
25
26
|
let currentSelection = $state('')
|
|
26
27
|
let selectionSentence = $state('')
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import Alert from './Alert.svelte'
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
pageText?: string,
|
|
8
7
|
onpoll?: ({ injectionsEnabled, aiEnabled }: { injectionsEnabled: boolean, aiEnabled: boolean }) => void,
|
|
9
8
|
onallow?: () => void,
|
|
10
9
|
ondisallow?: () => void,
|
|
@@ -12,7 +11,6 @@
|
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
const {
|
|
15
|
-
pageText = '',
|
|
16
14
|
onpoll = () => null,
|
|
17
15
|
onallow = () => null,
|
|
18
16
|
ondisallow = () => null,
|
|
@@ -36,7 +34,7 @@
|
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
async function setSession(): Promise<void> {
|
|
39
|
-
const result = await fetchAsSession(
|
|
37
|
+
const result = await fetchAsSession()
|
|
40
38
|
|
|
41
39
|
if (!result) return
|
|
42
40
|
|
|
@@ -49,7 +47,7 @@
|
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
function takeOverEditing(): void {
|
|
52
|
-
saveCurrentSession(
|
|
50
|
+
saveCurrentSession()
|
|
53
51
|
ontakeover()
|
|
54
52
|
}
|
|
55
53
|
</script>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<div class="divider"></div>
|
|
46
46
|
|
|
47
47
|
<div class="heading" use:heading>
|
|
48
|
-
{t('Streaming Guide
|
|
48
|
+
{t('Streaming Guide')}
|
|
49
49
|
</div>
|
|
50
50
|
|
|
51
51
|
{#if !useExploreRouter()}
|
|
@@ -99,13 +99,8 @@
|
|
|
99
99
|
display: flex;
|
|
100
100
|
flex-direction: column;
|
|
101
101
|
gap: margin(0.5);
|
|
102
|
-
margin: theme(explore-header-margin, 0 0 margin(
|
|
102
|
+
margin: theme(explore-header-margin, 0 0 margin(2));
|
|
103
103
|
width: 100%;
|
|
104
|
-
max-width: margin(12);
|
|
105
|
-
|
|
106
|
-
@include desktop {
|
|
107
|
-
max-width: margin(20);
|
|
108
|
-
}
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
.divider {
|
|
@@ -118,7 +113,7 @@
|
|
|
118
113
|
.heading {
|
|
119
114
|
margin: theme(explore-heading-margin, margin(0.25) 0);
|
|
120
115
|
color: theme(text-color);
|
|
121
|
-
font-size: theme(explore-heading-size, clamp(margin(1),
|
|
116
|
+
font-size: theme(explore-heading-size, clamp(margin(1.5), 5vw, margin(2)));
|
|
122
117
|
font-weight: theme(explore-heading-font-weight, font-bold);
|
|
123
118
|
text-transform: theme(explore-heading-text-transform, normal);
|
|
124
119
|
line-height: theme(explore-heading-line-height, 1.5);
|
|
@@ -6,11 +6,9 @@
|
|
|
6
6
|
import { track } from '$lib/tracking'
|
|
7
7
|
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
8
8
|
import TitlesRail from '../../Rails/TitlesRail.svelte'
|
|
9
|
-
import { mobileBreakpoint } from '$lib/constants'
|
|
10
9
|
|
|
11
10
|
let expandedTitle: TitleData | null = $state(null)
|
|
12
11
|
let expandedRailKey: string | null = $state(null)
|
|
13
|
-
let windowWidth: number = $state(window.innerWidth)
|
|
14
12
|
|
|
15
13
|
const rails: { heading: string, params: Record<string, any>, properties: Record<string, any> }[] = [{
|
|
16
14
|
heading: 'List: Trending',
|
|
@@ -19,7 +17,7 @@
|
|
|
19
17
|
}, {
|
|
20
18
|
heading: 'List: New',
|
|
21
19
|
params: { from_playlist_sid: 'li42WR', include_playable_types: 'SVOD,FREE' },
|
|
22
|
-
properties: { aside: true
|
|
20
|
+
properties: { aside: true },
|
|
23
21
|
}, {
|
|
24
22
|
heading: 'List: Upcoming',
|
|
25
23
|
params: { from_playlist_sid: 'li42wf', region: null, no_region_filter: true },
|
|
@@ -31,7 +29,7 @@
|
|
|
31
29
|
}, {
|
|
32
30
|
heading: 'List: Demand',
|
|
33
31
|
params: { from_playlist_sid: 'licBS' },
|
|
34
|
-
properties: { aside: true
|
|
32
|
+
properties: { aside: true },
|
|
35
33
|
}]
|
|
36
34
|
|
|
37
35
|
async function getListTitles(params: Record<string, any> = {}): Promise<TitleData[]> {
|
|
@@ -45,7 +43,7 @@
|
|
|
45
43
|
}
|
|
46
44
|
</script>
|
|
47
45
|
|
|
48
|
-
<svelte:window {onscroll}
|
|
46
|
+
<svelte:window {onscroll} />
|
|
49
47
|
|
|
50
48
|
<div data-testid="explore-home"></div>
|
|
51
49
|
|
|
@@ -54,7 +52,7 @@
|
|
|
54
52
|
<TitlesRail
|
|
55
53
|
heading={t(heading)}
|
|
56
54
|
titles={getListTitles(params)}
|
|
57
|
-
size=
|
|
55
|
+
size="flexible"
|
|
58
56
|
minimumLength={7}
|
|
59
57
|
{...properties}
|
|
60
58
|
bind:expandedTitle
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
border-radius: theme(rail-modal-item-border-radius, border-radius-huge) theme(rail-modal-item-border-radius, border-radius-huge) 0 0;
|
|
132
132
|
background: theme(rail-modal-item-background, light);
|
|
133
133
|
box-shadow: none;
|
|
134
|
-
height:
|
|
134
|
+
height: 80vh;
|
|
135
135
|
overflow: auto;
|
|
136
136
|
overscroll-behavior: contain;
|
|
137
137
|
transition: box-shadow var(--transition-duration);
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
titles: Promise<TitleData[]> | TitleData[]
|
|
17
17
|
minimumLength?: number,
|
|
18
18
|
heading?: string,
|
|
19
|
-
size?: 'small' | 'large' | '
|
|
19
|
+
size?: 'small' | 'large' | 'flexible'
|
|
20
20
|
aside?: boolean,
|
|
21
21
|
expandable?: boolean,
|
|
22
22
|
expandedTitle?: TitleData | null,
|
|
@@ -64,9 +64,7 @@
|
|
|
64
64
|
recentlyExpanded = true
|
|
65
65
|
setTimeout(() => recentlyExpanded = false, 500)
|
|
66
66
|
|
|
67
|
-
if (
|
|
68
|
-
slider?.setIndex(index - 2)
|
|
69
|
-
}
|
|
67
|
+
if (elementOffsetInParent < activeElement.clientWidth * 2) slider?.setIndex(index - 2)
|
|
70
68
|
|
|
71
69
|
expandTitleIntoTrailer(title)
|
|
72
70
|
|
|
@@ -208,7 +206,7 @@
|
|
|
208
206
|
.titles {
|
|
209
207
|
--width: #{theme(rail-size-default, margin(6))};
|
|
210
208
|
--image-height: #{calc(var(--width) * 3 / 2)};
|
|
211
|
-
--expanded-width: var(--
|
|
209
|
+
--expanded-width: #{calc(var(--image-height) / 9 * 16)};
|
|
212
210
|
--border-radius: #{theme(rail-border-radius, border-radius)};
|
|
213
211
|
|
|
214
212
|
&.with-aside {
|
|
@@ -219,13 +217,8 @@
|
|
|
219
217
|
--width: #{theme(rail-size-large, margin(7.5))};
|
|
220
218
|
}
|
|
221
219
|
|
|
222
|
-
&.huge {
|
|
223
|
-
--width: #{theme(rail-size-large, min(explore-width(65), margin(15)))};
|
|
224
|
-
}
|
|
225
|
-
|
|
226
220
|
&.flexible {
|
|
227
|
-
--width: #{theme(rail-size-flexible, clamp(margin(
|
|
228
|
-
--expanded-width: #{calc(var(--image-height) / 9 * 16)};
|
|
221
|
+
--width: #{theme(rail-size-flexible, clamp(margin(6), explore-width(18), margin(11.5)))};
|
|
229
222
|
}
|
|
230
223
|
}
|
|
231
224
|
|
|
@@ -293,14 +286,6 @@
|
|
|
293
286
|
:global(iframe) {
|
|
294
287
|
opacity: 0;
|
|
295
288
|
animation: fade-iframe 500ms 500ms forwards;
|
|
296
|
-
|
|
297
|
-
@include mobile {
|
|
298
|
-
position: absolute;
|
|
299
|
-
width: 225%;
|
|
300
|
-
top: 50%;
|
|
301
|
-
left: 50%;
|
|
302
|
-
transform: translateX(-50%) translateY(-50%);
|
|
303
|
-
}
|
|
304
289
|
}
|
|
305
290
|
|
|
306
291
|
:global(+ .poster) {
|