@playpilot/tpi 8.23.0-beta.3 → 8.23.0-beta.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "8.23.0-beta.3",
3
+ "version": "8.23.0-beta.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -146,6 +146,11 @@ export const translations = {
146
146
  [Language.Swedish]: 'Visa mer',
147
147
  [Language.Danish]: 'Vis mere',
148
148
  },
149
+ 'Show Less': {
150
+ [Language.English]: 'Show less',
151
+ [Language.Swedish]: 'Visa mindre',
152
+ [Language.Danish]: 'Vis mindre',
153
+ },
149
154
  'Cast': {
150
155
  [Language.English]: 'Cast',
151
156
  [Language.Swedish]: 'Rollista',
@@ -333,6 +338,11 @@ export const translations = {
333
338
  [Language.Swedish]: 'Snart på Bio',
334
339
  [Language.Danish]: 'Kommende film',
335
340
  },
341
+ 'Explore All Movies And Shows': {
342
+ [Language.English]: 'Explore all movies and TV-shows',
343
+ [Language.Swedish]: 'Utforska alla filmer och TV-serier',
344
+ [Language.Danish]: 'Udforsk alle film og tv-serier',
345
+ },
336
346
 
337
347
  // Genres
338
348
  'All': {
@@ -1,4 +1,6 @@
1
1
  <script lang="ts">
2
+ import { t } from '$lib/localization'
3
+
2
4
  interface Props {
3
5
  text: string
4
6
  blurb?: string
@@ -12,8 +14,8 @@
12
14
 
13
15
  const limitedText = $derived(text.slice(0, limit))
14
16
 
15
- function expand(): void {
16
- expanded = true
17
+ function toggle(): void {
18
+ expanded = !expanded
17
19
  onclick()
18
20
  }
19
21
  </script>
@@ -23,7 +25,7 @@
23
25
  {expanded ? text : limitedText}{#if !expanded && text.length > limit}...{/if}
24
26
 
25
27
  {#if !expanded && (text.length > limit || blurb)}
26
- <button class="show-more" onclick={() => expand()}>Show more</button>
28
+ <button class="toggle" onclick={toggle}>{t('Show More')}</button>
27
29
  {/if}
28
30
  </span>
29
31
 
@@ -32,10 +34,16 @@
32
34
  {/if}
33
35
  </div>
34
36
 
37
+ {#if expanded}
38
+ <button class="toggle" onclick={toggle}>{t('Show Less')}</button>
39
+ {/if}
40
+
35
41
  <style lang="scss">
36
42
  .description:first-child {
37
43
  margin: margin(-1) 0 margin(1);
38
44
  max-width: theme(description-max-width, 100%);
45
+ max-height: theme(description-max-height, 100vh);
46
+ overflow: auto;
39
47
  }
40
48
 
41
49
  .paragraph {
@@ -44,7 +52,7 @@
44
52
  font-family: theme(description-font-family, font-family);
45
53
  }
46
54
 
47
- .show-more {
55
+ .toggle {
48
56
  display: inline;
49
57
  appearance: none;
50
58
  padding: 0;
@@ -2,6 +2,7 @@
2
2
  import { onMount, type Snippet } from 'svelte'
3
3
  import TinySlider from 'svelte-tiny-slider'
4
4
  import { fade } from 'svelte/transition'
5
+ import { t } from '$lib/localization'
5
6
  import Modal from './Modal.svelte'
6
7
  import IconArrow from '../Icons/IconArrow.svelte'
7
8
  import ModalCloseOverlay from './ModalCloseOverlay.svelte'
@@ -74,7 +75,7 @@
74
75
  </div>
75
76
 
76
77
  <div class="close">
77
- <ModalCloseOverlay {onclose} label={window.location.href.includes('route=modal') ? 'Streaming guide' : ''} />
78
+ <ModalCloseOverlay {onclose} label={window.location.href.includes('route=modal') ? t('Explore All Movies And Shows') : ''} />
78
79
  </div>
79
80
  {/snippet}
80
81
  </Modal>
@@ -209,6 +210,6 @@
209
210
  }
210
211
 
211
212
  .close {
212
- --modal-close-overlay-left: calc((100vw - $size) / 2)
213
+ --modal-close-overlay-left: calc((100vw - #{$size}) / 2);
213
214
  }
214
215
  </style>
@@ -83,7 +83,7 @@
83
83
  </TinySlider>
84
84
  </div>
85
85
 
86
- <ModalCloseOverlay label="Streaming guide" />
86
+ <ModalCloseOverlay label={t('Explore All Movies And Shows')} />
87
87
  {/snippet}
88
88
  </Modal>
89
89
  </div>
@@ -97,6 +97,7 @@
97
97
  --playpilot-detail-background-border-radius: 0;
98
98
  --playpilot-detail-background-width: 400%;
99
99
  --playpilot-detail-backdrop: rgba(0, 0, 0, 0.85);
100
+ --playpilot-description-max-height: 40dvh;
100
101
 
101
102
  :global(*) {
102
103
  box-sizing: border-box;
@@ -23,15 +23,20 @@ describe('Description.svelte', () => {
23
23
  expect(queryByRole('button')).not.toBeTruthy()
24
24
  })
25
25
 
26
- it('Should expand description and remove show more button after clicking', async () => {
27
- const { getByText, queryByRole } = render(Description, { text: 'Some test description', limit: 5 })
26
+ it('Should expand description and collapse again after clicking Show more and Show less', async () => {
27
+ const { getByText, queryByText } = render(Description, { text: 'Some test description', limit: 5 })
28
28
 
29
29
  expect(getByText('Some ...')).toBeTruthy()
30
30
 
31
- await fireEvent.click(/** @type {Node} **/(queryByRole('button')))
31
+ await fireEvent.click(/** @type {Node} **/(getByText('Show more')))
32
32
 
33
33
  expect(getByText('Some test description')).toBeTruthy()
34
- expect(queryByRole('button')).not.toBeTruthy()
34
+ expect(queryByText('Show more')).not.toBeTruthy()
35
+
36
+ await fireEvent.click(/** @type {Node} **/(getByText('Show less')))
37
+
38
+ expect(queryByText('Some test description')).not.toBeTruthy()
39
+ expect(queryByText('Show less')).not.toBeTruthy()
35
40
  })
36
41
 
37
42
  it('Should include blurb after expanding if given', async () => {