lightnet 3.4.6 → 3.6.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +67 -10
  2. package/__e2e__/fixtures/basics/node_modules/.bin/astro +2 -2
  3. package/__e2e__/fixtures/basics/package.json +2 -2
  4. package/exports/components.ts +2 -0
  5. package/exports/content.ts +13 -3
  6. package/package.json +8 -7
  7. package/src/astro-integration/config.ts +6 -3
  8. package/src/components/CategoriesSection.astro +69 -19
  9. package/src/components/HeroSection.astro +15 -7
  10. package/src/components/HighlightSection.astro +1 -1
  11. package/src/components/MediaGallery.astro +2 -2
  12. package/src/components/MediaList.astro +2 -2
  13. package/src/components/SearchInput.astro +30 -0
  14. package/src/components/SearchSection.astro +16 -0
  15. package/src/components/Section.astro +20 -4
  16. package/src/content/astro-image.ts +10 -0
  17. package/src/content/compare-media-collection-items.ts +1 -1
  18. package/src/content/content-schema.ts +38 -6
  19. package/src/content/get-categories.ts +64 -6
  20. package/src/content/get-media-items.ts +1 -1
  21. package/src/content/get-media-types.ts +1 -1
  22. package/src/content/query-media-items.ts +1 -1
  23. package/src/i18n/translations/TRANSLATION-STATUS.md +33 -1
  24. package/src/i18n/translations/ar.yml +22 -0
  25. package/src/i18n/translations/bn.yml +22 -0
  26. package/src/i18n/translations/de.yml +1 -2
  27. package/src/i18n/translations/en.yml +3 -8
  28. package/src/i18n/translations/es.yml +22 -0
  29. package/src/i18n/translations/fi.yml +22 -0
  30. package/src/i18n/translations/fr.yml +22 -0
  31. package/src/i18n/translations/hi.yml +22 -0
  32. package/src/i18n/translations/pt.yml +22 -0
  33. package/src/i18n/translations/ru.yml +1 -2
  34. package/src/i18n/translations/uk.yml +1 -2
  35. package/src/i18n/translations/zh.yml +22 -0
  36. package/src/i18n/translations.ts +10 -3
  37. package/src/layouts/MarkdownPage.astro +7 -1
  38. package/src/layouts/Page.astro +1 -0
  39. package/src/layouts/components/PageNavigation.astro +13 -7
  40. package/src/pages/api/search.ts +1 -1
  41. package/src/pages/details-page/components/main-details/AudioPlayer.astro +1 -1
  42. package/src/pages/details-page/components/main-details/Cover.astro +1 -0
  43. package/src/pages/details-page/components/main-details/Title.astro +1 -1
  44. package/src/pages/details-page/components/more-details/Categories.astro +11 -4
  45. package/src/pages/details-page/utils/get-collection-items.ts +1 -1
  46. package/src/pages/search-page/SearchPageRoute.astro +10 -40
  47. package/src/pages/search-page/components/LoadingSkeleton.tsx +19 -0
  48. package/src/pages/search-page/components/SearchFilter.astro +65 -0
  49. package/src/pages/search-page/components/SearchFilter.tsx +33 -84
  50. package/src/pages/search-page/components/SearchList.astro +50 -0
  51. package/src/pages/search-page/components/SearchList.tsx +117 -0
  52. package/src/pages/search-page/components/SearchListItem.tsx +105 -0
  53. package/src/pages/search-page/components/Select.tsx +5 -5
  54. package/src/pages/search-page/hooks/use-search-query-param.ts +31 -0
  55. package/src/pages/search-page/hooks/use-search.ts +103 -49
  56. package/src/pages/search-page/utils/search-filter-translations.ts +20 -0
  57. package/src/pages/search-page/utils/search-query.ts +76 -0
  58. package/src/pages/search-page/utils/search-translations.ts +1 -12
  59. package/src/content/content-schema-internal.ts +0 -52
  60. package/src/content/external-api.ts +0 -7
  61. package/src/content/resolve-category-label.ts +0 -20
  62. package/src/pages/search-page/Search.tsx +0 -71
  63. package/src/pages/search-page/components/ResultList.tsx +0 -135
  64. package/src/pages/search-page/types.ts +0 -11
  65. package/src/pages/search-page/utils/use-provided-translations.ts +0 -5
@@ -3,7 +3,7 @@ import { z } from "astro/zod"
3
3
  import type { SchemaContext } from "astro:content"
4
4
  import { defineCollection, reference } from "astro:content"
5
5
 
6
- import { astroImage } from "./astro-image"
6
+ import { astroImage, imageSchema } from "./astro-image"
7
7
 
8
8
  /**
9
9
  * Category Schema
@@ -18,6 +18,16 @@ export const categorySchema = z.object({
18
18
  * @example "category.biography"
19
19
  */
20
20
  label: z.string(),
21
+
22
+ /* Relative path to the thumbnail image of this category.
23
+ *
24
+ * The image is expected to be inside the `images` folder next to category definition json.
25
+ * It can have one of these file types: png, jpg, tiff, webp, gif, svg, avif.
26
+ * We suggest to give it a size of at least 1000px for it's longer side.
27
+ *
28
+ * @example "./images/devotionals.jpg"
29
+ */
30
+ image: imageSchema.optional(),
21
31
  })
22
32
 
23
33
  /**
@@ -117,12 +127,12 @@ export const mediaItemSchema = z.object({
117
127
  *
118
128
  * The image is expected to be inside the `images` folder next to the media item definition json.
119
129
  * This image will be used for previews and on the media item detail page.
120
- * It can have on of this file types: png, jpg, tiff, webp, gif, svg, avif.
130
+ * It can have one of these file types: png, jpg, tiff, webp, gif, svg, avif.
121
131
  * We suggest to give it a size of at least 1000px for it's longer side.
122
132
  *
123
133
  * @example "./images/a-book-about-love--en.jpg"
124
134
  */
125
- image: z.string(),
135
+ image: imageSchema,
126
136
  /**
127
137
  * List of objects defining the content of this media item.
128
138
  */
@@ -160,11 +170,16 @@ export const mediaItemSchema = z.object({
160
170
  * @param schemaContext that is passed by astro's defineCollection schema.
161
171
  * @returns schema with image mixed in.
162
172
  */
163
- export const mediaSchema = ({ image }: SchemaContext) =>
173
+ export const createMediaItemSchema = ({ image }: SchemaContext) =>
164
174
  mediaItemSchema.extend({
165
175
  image: astroImage(image),
166
176
  })
167
177
 
178
+ export const createCategorySchema = ({ image }: SchemaContext) =>
179
+ categorySchema.extend({
180
+ image: astroImage(image).optional(),
181
+ })
182
+
168
183
  /**
169
184
  * Media Type Schema
170
185
  */
@@ -246,7 +261,7 @@ export const mediaTypeSchema = z.object({
246
261
  export const LIGHTNET_COLLECTIONS = {
247
262
  categories: defineCollection({
248
263
  loader: glob({ pattern: "*.json", base: "./src/content/categories" }),
249
- schema: categorySchema,
264
+ schema: createCategorySchema,
250
265
  }),
251
266
  "media-collections": defineCollection({
252
267
  loader: glob({
@@ -260,7 +275,7 @@ export const LIGHTNET_COLLECTIONS = {
260
275
  pattern: "*.json",
261
276
  base: "./src/content/media",
262
277
  }),
263
- schema: mediaSchema,
278
+ schema: createMediaItemSchema,
264
279
  }),
265
280
  "media-types": defineCollection({
266
281
  loader: glob({
@@ -270,3 +285,20 @@ export const LIGHTNET_COLLECTIONS = {
270
285
  schema: mediaTypeSchema,
271
286
  }),
272
287
  }
288
+
289
+ export const mediaItemEntrySchema = z.object({
290
+ id: z.string(),
291
+ data: mediaItemSchema,
292
+ })
293
+
294
+ export type MediaItemEntry = z.infer<typeof mediaItemEntrySchema>
295
+
296
+ export const mediaTypeEntrySchema = z.object({
297
+ id: z.string(),
298
+ data: mediaTypeSchema,
299
+ })
300
+
301
+ export const categoryEntrySchema = z.object({
302
+ id: z.string(),
303
+ data: categorySchema,
304
+ })
@@ -1,15 +1,73 @@
1
+ import { AstroError } from "astro/errors"
2
+ import { getCollection } from "astro:content"
3
+
1
4
  import { type TranslateFn } from "../i18n/translate"
5
+ import { verifySchemaAsync } from "../utils/verify-schema"
6
+ import { categoryEntrySchema } from "./content-schema"
2
7
  import { getMediaItems } from "./get-media-items"
3
- import { resolveCategoryLabel } from "./resolve-category-label"
4
8
 
5
- const contentCategories = new Set<string>(
9
+ const categoriesById = Object.fromEntries(
10
+ (await loadCategories()).map(({ id, data }) => [id, data]),
11
+ )
12
+
13
+ const contentCategories = Object.fromEntries(
6
14
  (await getMediaItems())
7
15
  .flatMap((item) => item.data.categories ?? [])
8
- .map((c) => c.id),
16
+ .map((c) => {
17
+ const category = categoriesById[c.id]
18
+ if (!category) {
19
+ throw new AstroError(
20
+ "Missing Category",
21
+ `A media item references a non-existent category: "${c.id}".\n` +
22
+ `To fix this, create a category file at:\n` +
23
+ `src/content/categories/${c.id}.json`,
24
+ )
25
+ }
26
+ return [c.id, category]
27
+ }),
9
28
  )
10
29
 
11
- export async function getCategories(currentLocale: string, t: TranslateFn) {
12
- return [...contentCategories.values()]
13
- .map((id) => ({ id, name: resolveCategoryLabel(t, id) }))
30
+ /**
31
+ * Get categories that are referenced from media items.
32
+ * Adds the translated name of the category and sorts by this name.
33
+ *
34
+ * @param currentLocale current locale
35
+ * @param t translate function
36
+ * @returns categories sorted by name
37
+ */
38
+ export async function getUsedCategories(currentLocale: string, t: TranslateFn) {
39
+ return [...Object.entries(contentCategories)]
40
+ .map(([id, data]) => ({ id, ...data, name: t(data.label) }))
14
41
  .sort((a, b) => a.name.localeCompare(b.name, currentLocale))
15
42
  }
43
+
44
+ export async function getCategory(id: string) {
45
+ const category = categoriesById[id]
46
+ if (!category) {
47
+ throw new AstroError(
48
+ `Missing category "${id}"`,
49
+ `To fix the issue, add a category at "src/content/categories/${id}.json".`,
50
+ )
51
+ }
52
+ return {
53
+ id,
54
+ ...category,
55
+ }
56
+ }
57
+
58
+ async function loadCategories() {
59
+ return Promise.all(
60
+ (await getCollection("categories")).map((category: unknown) =>
61
+ parseCategory(category),
62
+ ),
63
+ )
64
+ }
65
+
66
+ function parseCategory(item: unknown) {
67
+ return verifySchemaAsync(
68
+ categoryEntrySchema,
69
+ item,
70
+ (id) => `Invalid category: ${id}`,
71
+ (id) => `Fix these issues inside "src/content/category/${id}.json":`,
72
+ )
73
+ }
@@ -1,7 +1,7 @@
1
1
  import { getCollection, getEntry } from "astro:content"
2
2
 
3
3
  import { verifySchemaAsync } from "../utils/verify-schema"
4
- import { mediaItemEntrySchema } from "./content-schema-internal"
4
+ import { mediaItemEntrySchema } from "./content-schema"
5
5
 
6
6
  /**
7
7
  * Internal API to get media items. Since this package is a Astro integration
@@ -1,7 +1,7 @@
1
1
  import { getCollection, getEntry } from "astro:content"
2
2
 
3
3
  import { verifySchema } from "../utils/verify-schema"
4
- import { mediaTypeEntrySchema } from "./content-schema-internal"
4
+ import { mediaTypeEntrySchema } from "./content-schema"
5
5
 
6
6
  export const getMediaType = async (id: string) => {
7
7
  return verifySchema(
@@ -1,5 +1,5 @@
1
1
  import { compareMediaCollectionItems } from "./compare-media-collection-items"
2
- import type { MediaItemEntry } from "./content-schema-internal"
2
+ import type { MediaItemEntry } from "./content-schema"
3
3
 
4
4
  export type MediaItemQuery<TMediaItem extends MediaItemEntry> = {
5
5
  /**
@@ -1,6 +1,14 @@
1
1
  # Translation status
2
2
 
3
- This report provides an overview of all built-in languages and the current progress of their translations.
3
+ This autogenerated report shows all built-in languages and the current status of their translations.
4
+
5
+ ## **AR** ([ar.yml](./ar.yml))
6
+
7
+ All keys have been translated. ✅
8
+
9
+ ## **BN** ([bn.yml](./bn.yml))
10
+
11
+ All keys have been translated. ✅
4
12
 
5
13
  ## **DE** ([de.yml](./de.yml))
6
14
 
@@ -10,6 +18,26 @@ All keys have been translated. ✅
10
18
 
11
19
  All keys have been translated. ✅
12
20
 
21
+ ## **ES** ([es.yml](./es.yml))
22
+
23
+ All keys have been translated. ✅
24
+
25
+ ## **FI** ([fi.yml](./fi.yml))
26
+
27
+ All keys have been translated. ✅
28
+
29
+ ## **FR** ([fr.yml](./fr.yml))
30
+
31
+ All keys have been translated. ✅
32
+
33
+ ## **HI** ([hi.yml](./hi.yml))
34
+
35
+ All keys have been translated. ✅
36
+
37
+ ## **PT** ([pt.yml](./pt.yml))
38
+
39
+ All keys have been translated. ✅
40
+
13
41
  ## **RU** ([ru.yml](./ru.yml))
14
42
 
15
43
  All keys have been translated. ✅
@@ -17,3 +45,7 @@ All keys have been translated. ✅
17
45
  ## **UK** ([uk.yml](./uk.yml))
18
46
 
19
47
  All keys have been translated. ✅
48
+
49
+ ## **ZH** ([zh.yml](./zh.yml))
50
+
51
+ All keys have been translated. ✅
@@ -0,0 +1,22 @@
1
+ ln.header.open-main-menu: افتح القائمة الرئيسية
2
+ ln.header.select-language: اختر اللغة
3
+ ln.home.title: الصفحة الرئيسية
4
+ ln.category: الفئة
5
+ ln.categories: الفئات
6
+ ln.language: اللغة
7
+ ln.languages: اللغات
8
+ ln.type: النوع
9
+ ln.external-link: رابط خارجي
10
+ ln.search.title: بحث
11
+ ln.search.placeholder: ابحث في الوسائط
12
+ ln.search.all-languages: جميع اللغات
13
+ ln.search.all-types: جميع الأنواع
14
+ ln.search.all-categories: جميع الفئات
15
+ ln.search.no-results: لا توجد نتائج
16
+ ln.details.open: فتح
17
+ ln.details.share: مشاركة
18
+ ln.details.part-of-collection: جزء من مجموعة
19
+ ln.details.download: تنزيل
20
+ ln.share.url-copied-to-clipboard: تم نسخ الرابط إلى الحافظة
21
+ ln.404.page-not-found: الصفحة غير موجودة
22
+ ln.404.go-to-the-home-page: العودة إلى الصفحة الرئيسية
@@ -0,0 +1,22 @@
1
+ ln.header.open-main-menu: প্রধান মেনু খুলুন
2
+ ln.header.select-language: ভাষা নির্বাচন করুন
3
+ ln.home.title: হোম
4
+ ln.category: বিভাগ
5
+ ln.categories: বিভাগসমূহ
6
+ ln.language: ভাষা
7
+ ln.languages: ভাষাসমূহ
8
+ ln.type: ধরন
9
+ ln.external-link: বহিরাগত লিঙ্ক
10
+ ln.search.title: অনুসন্ধান
11
+ ln.search.placeholder: মিডিয়া অনুসন্ধান করুন
12
+ ln.search.all-languages: সকল ভাষা
13
+ ln.search.all-types: সকল ধরন
14
+ ln.search.all-categories: সকল বিভাগ
15
+ ln.search.no-results: কোনো ফলাফল নেই
16
+ ln.details.open: খুলুন
17
+ ln.details.share: শেয়ার করুন
18
+ ln.details.part-of-collection: সংগ্রহের অংশ
19
+ ln.details.download: ডাউনলোড করুন
20
+ ln.share.url-copied-to-clipboard: লিঙ্ক ক্লিপবোর্ডে কপি হয়েছে
21
+ ln.404.page-not-found: পৃষ্ঠা পাওয়া যায়নি
22
+ ln.404.go-to-the-home-page: হোম পৃষ্ঠায় যান
@@ -16,8 +16,7 @@ ln.home.title: Startseite
16
16
  ln.search.all-categories: Alle Kategorien
17
17
  ln.search.all-languages: Alle Sprachen
18
18
  ln.search.all-types: Alle Typen
19
- ln.search.more-results: Mehr Ergebnisse
20
19
  ln.search.no-results: Keine Ergebnisse
21
- ln.search.placeholder: Suche in Titel, Autor, Beschreibung...
20
+ ln.search.placeholder: Suche Medien
22
21
  ln.search.title: Suche
23
22
  ln.share.url-copied-to-clipboard: Link in die Zwischenablage kopiert
@@ -61,11 +61,11 @@ ln.external-link: External link
61
61
  # Used on: https://sk8-ministries.pages.dev/en/media/ (not visible)
62
62
  ln.search.title: Search
63
63
 
64
- # Placeholder text for the main search box.
65
- # English: Search by title, author or description...
64
+ # Placeholder text for the search input to search for media items.
65
+ # English: Search media
66
66
  #
67
67
  # Used on: https://sk8-ministries.pages.dev/en/media/
68
- ln.search.placeholder: Search by title, author or description...
68
+ ln.search.placeholder: Search media
69
69
 
70
70
  # Filter option to display content in all languages.
71
71
  #
@@ -85,11 +85,6 @@ ln.search.all-types: All types
85
85
  # Used on: https://sk8-ministries.pages.dev/en/media/
86
86
  ln.search.all-categories: All categories
87
87
 
88
- # Button label to load more search results.
89
- #
90
- # English: More results
91
- ln.search.more-results: More results
92
-
93
88
  # Message displayed when no search results are found.
94
89
  #
95
90
  # English: No results
@@ -0,0 +1,22 @@
1
+ ln.header.open-main-menu: Abrir menú principal
2
+ ln.header.select-language: Seleccionar idioma
3
+ ln.home.title: Inicio
4
+ ln.category: Categoría
5
+ ln.categories: Categorías
6
+ ln.language: Idioma
7
+ ln.languages: Idiomas
8
+ ln.type: Tipo
9
+ ln.external-link: Enlace externo
10
+ ln.search.title: Buscar
11
+ ln.search.placeholder: Buscar medios
12
+ ln.search.all-languages: Todos los idiomas
13
+ ln.search.all-types: Todos los tipos
14
+ ln.search.all-categories: Todas las categorías
15
+ ln.search.no-results: Sin resultados
16
+ ln.details.open: Abrir
17
+ ln.details.share: Compartir
18
+ ln.details.part-of-collection: Parte de la colección
19
+ ln.details.download: Descargar
20
+ ln.share.url-copied-to-clipboard: Enlace copiado al portapapeles
21
+ ln.404.page-not-found: Página no encontrada
22
+ ln.404.go-to-the-home-page: Ir a la página de inicio
@@ -0,0 +1,22 @@
1
+ ln.header.open-main-menu: Avaa päävalikko
2
+ ln.header.select-language: Valitse kieli
3
+ ln.home.title: Etusivu
4
+ ln.category: Kategoria
5
+ ln.categories: Kategoriat
6
+ ln.language: Kieli
7
+ ln.languages: Kielet
8
+ ln.type: Mediatyyppi
9
+ ln.external-link: Ulkoinen linkki
10
+ ln.search.title: Haku
11
+ ln.search.placeholder: Hae mediaa
12
+ ln.search.all-languages: Kaikki kielet
13
+ ln.search.all-types: Kaikki mediatyypit
14
+ ln.search.all-categories: Kaikki kategoriat
15
+ ln.search.no-results: Ei tuloksia
16
+ ln.details.open: Avaa
17
+ ln.details.share: Jaa
18
+ ln.details.part-of-collection: Osa kokoelmaa
19
+ ln.details.download: Lataa
20
+ ln.share.url-copied-to-clipboard: Linkki kopioitu leikepöydälle
21
+ ln.404.page-not-found: Sivua ei löytynyt
22
+ ln.404.go-to-the-home-page: Palaa etusivulle
@@ -0,0 +1,22 @@
1
+ ln.header.open-main-menu: Ouvrir le menu principal
2
+ ln.header.select-language: Sélectionner la langue
3
+ ln.home.title: Accueil
4
+ ln.category: Catégorie
5
+ ln.categories: Catégories
6
+ ln.language: Langue
7
+ ln.languages: Langues
8
+ ln.type: Type
9
+ ln.external-link: Lien externe
10
+ ln.search.title: Recherche
11
+ ln.search.placeholder: Rechercher des médias
12
+ ln.search.all-languages: Toutes les langues
13
+ ln.search.all-types: Tous les types
14
+ ln.search.all-categories: Toutes les catégories
15
+ ln.search.no-results: Aucun résultat
16
+ ln.details.open: Ouvrir
17
+ ln.details.share: Partager
18
+ ln.details.part-of-collection: Fait partie de la collection
19
+ ln.details.download: Télécharger
20
+ ln.share.url-copied-to-clipboard: Lien copié dans le presse-papiers
21
+ ln.404.page-not-found: Page non trouvée
22
+ ln.404.go-to-the-home-page: Aller à la page d’accueil
@@ -0,0 +1,22 @@
1
+ ln.header.open-main-menu: मुख्य मेनू खोलें
2
+ ln.header.select-language: भाषा चुनें
3
+ ln.home.title: मुखपृष्ठ
4
+ ln.category: श्रेणी
5
+ ln.categories: श्रेणियाँ
6
+ ln.language: भाषा
7
+ ln.languages: भाषाएँ
8
+ ln.type: प्रकार
9
+ ln.external-link: बाहरी लिंक
10
+ ln.search.title: खोज
11
+ ln.search.placeholder: मीडिया खोजें
12
+ ln.search.all-languages: सभी भाषाएँ
13
+ ln.search.all-types: सभी प्रकार
14
+ ln.search.all-categories: सभी श्रेणियाँ
15
+ ln.search.no-results: कोई परिणाम नहीं मिला
16
+ ln.details.open: खोलें
17
+ ln.details.share: साझा करें
18
+ ln.details.part-of-collection: संग्रह का भाग
19
+ ln.details.download: डाउनलोड करें
20
+ ln.share.url-copied-to-clipboard: लिंक क्लिपबोर्ड पर कॉपी हो गया है
21
+ ln.404.page-not-found: पृष्ठ नहीं मिला
22
+ ln.404.go-to-the-home-page: मुखपृष्ठ पर जाएँ
@@ -0,0 +1,22 @@
1
+ ln.header.open-main-menu: Abrir menu principal
2
+ ln.header.select-language: Escolher idioma
3
+ ln.home.title: Início
4
+ ln.category: Categoria
5
+ ln.categories: Categorias
6
+ ln.language: Idioma
7
+ ln.languages: Idiomas
8
+ ln.type: Tipo
9
+ ln.external-link: Ligação externa
10
+ ln.search.title: Pesquisa
11
+ ln.search.placeholder: Pesquisar conteúdos
12
+ ln.search.all-languages: Todos os idiomas
13
+ ln.search.all-types: Todos os tipos
14
+ ln.search.all-categories: Todas as categorias
15
+ ln.search.no-results: Nenhum resultado
16
+ ln.details.open: Abrir
17
+ ln.details.share: Partilhar
18
+ ln.details.part-of-collection: Parte da coleção
19
+ ln.details.download: Transferir
20
+ ln.share.url-copied-to-clipboard: Ligação copiada para a área de transferência
21
+ ln.404.page-not-found: Página não encontrada
22
+ ln.404.go-to-the-home-page: Ir para a página inicial
@@ -8,11 +8,10 @@ ln.languages: Языки
8
8
  ln.type: Тип
9
9
  ln.external-link: Внешняя ссылка
10
10
  ln.search.title: Поиск
11
- ln.search.placeholder: Поиск по названию, автору, описанию...
11
+ ln.search.placeholder: Поиск медиа
12
12
  ln.search.all-languages: Все языки
13
13
  ln.search.all-types: Все типы
14
14
  ln.search.all-categories: Все категории
15
- ln.search.more-results: Больше результатов
16
15
  ln.search.no-results: Нет результатов
17
16
  ln.details.open: Открыть
18
17
  ln.details.share: Поделиться
@@ -8,11 +8,10 @@ ln.languages: Мови
8
8
  ln.type: Тип
9
9
  ln.external-link: Зовнішнє посилання
10
10
  ln.search.title: Пошук
11
- ln.search.placeholder: Пошук за назвою, автором, описом...
11
+ ln.search.placeholder: Пошук медіа
12
12
  ln.search.all-languages: Усі мови
13
13
  ln.search.all-types: Усі типи
14
14
  ln.search.all-categories: Усі категорії
15
- ln.search.more-results: Більше результатів
16
15
  ln.search.no-results: Немає результатів
17
16
  ln.details.open: Відкрити
18
17
  ln.details.share: Поділитися
@@ -0,0 +1,22 @@
1
+ ln.header.open-main-menu: 打开主菜单
2
+ ln.header.select-language: 选择语言
3
+ ln.home.title: 首页
4
+ ln.category: 分类
5
+ ln.categories: 分类
6
+ ln.language: 语言
7
+ ln.languages: 语言
8
+ ln.type: 类型
9
+ ln.external-link: 外部链接
10
+ ln.search.title: 搜索
11
+ ln.search.placeholder: 搜索媒体…
12
+ ln.search.all-languages: 所有语言
13
+ ln.search.all-types: 所有类型
14
+ ln.search.all-categories: 所有分类
15
+ ln.search.no-results: 没有结果
16
+ ln.details.open: 打开
17
+ ln.details.share: 分享
18
+ ln.details.part-of-collection: 属于一个合集
19
+ ln.details.download: 下载
20
+ ln.share.url-copied-to-clipboard: 链接已复制到剪贴板
21
+ ln.404.page-not-found: 页面未找到
22
+ ln.404.go-to-the-home-page: 返回首页
@@ -1,10 +1,18 @@
1
1
  import YAML from "yaml"
2
2
 
3
3
  const builtInTranslations = {
4
- en: () => import("./translations/en.yml?raw"),
4
+ ar: () => import("./translations/ar.yml?raw"),
5
+ bn: () => import("./translations/bn.yml?raw"),
5
6
  de: () => import("./translations/de.yml?raw"),
6
- uk: () => import("./translations/uk.yml?raw"),
7
+ en: () => import("./translations/en.yml?raw"),
8
+ es: () => import("./translations/es.yml?raw"),
9
+ fi: () => import("./translations/fi.yml?raw"),
10
+ fr: () => import("./translations/fr.yml?raw"),
11
+ hi: () => import("./translations/hi.yml?raw"),
12
+ pt: () => import("./translations/pt.yml?raw"),
7
13
  ru: () => import("./translations/ru.yml?raw"),
14
+ uk: () => import("./translations/uk.yml?raw"),
15
+ zh: () => import("./translations/zh.yml?raw"),
8
16
  } as const
9
17
 
10
18
  type BuiltInLanguage = keyof typeof builtInTranslations
@@ -66,7 +74,6 @@ export type LightNetTranslationKey =
66
74
  | "ln.search.all-categories"
67
75
  | "ln.search.all-languages"
68
76
  | "ln.search.all-types"
69
- | "ln.search.more-results"
70
77
  | "ln.search.no-results"
71
78
  | "ln.search.placeholder"
72
79
  | "ln.search.title"
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  import Page from "./Page.astro"
3
+
4
+ // prettier-ignore
5
+ type Props = {
6
+ className?: string
7
+ };
3
8
  ---
4
9
 
5
10
  <Page>
6
11
  <article
7
- class="prose prose-gray mx-auto mt-8 max-w-screen-md px-4 sm:mt-16 md:px-8"
12
+ class="prose prose-img:rounded-md mx-auto mt-8 max-w-screen-md px-4 sm:mt-16 md:px-8"
13
+ class:list={[Astro.props.className]}
8
14
  >
9
15
  <slot />
10
16
  </article>
@@ -35,6 +35,7 @@ const language = resolveLanguage(currentLocale)
35
35
  <ClientRouter />
36
36
  </head>
37
37
  <body
38
+ transition:animate="none"
38
39
  class="flex min-h-screen flex-col overflow-y-scroll bg-gray-50 text-gray-900"
39
40
  >
40
41
  <Header />
@@ -32,13 +32,19 @@ const t = Astro.locals.i18n.t
32
32
  ---
33
33
 
34
34
  <nav class="-me-3 flex items-center">
35
- <a
36
- class="hover:text-primary flex p-3 text-gray-600"
37
- aria-label={t("ln.search.title")}
38
- data-astro-prefetch="viewport"
39
- href={searchPagePath(Astro.currentLocale)}
40
- ><Icon className="mdi--magnify" ariaLabel="" /></a
41
- >
35
+ {
36
+ !config.searchPage?.hideHeaderSearchIcon && (
37
+ <a
38
+ class="hover:text-primary flex p-3 text-gray-600"
39
+ aria-label={t("ln.search.title")}
40
+ data-astro-prefetch="viewport"
41
+ href={searchPagePath(Astro.currentLocale)}
42
+ >
43
+ <Icon className="mdi--magnify" ariaLabel="" />
44
+ </a>
45
+ )
46
+ }
47
+
42
48
  <LanguagePicker />
43
49
 
44
50
  {
@@ -1,7 +1,7 @@
1
1
  import type { APIRoute } from "astro"
2
2
  import { getImage } from "astro:assets"
3
3
 
4
- import type { MediaItemEntry } from "../../content/content-schema-internal"
4
+ import type { MediaItemEntry } from "../../content/content-schema"
5
5
  import { getMediaItems } from "../../content/get-media-items"
6
6
  import { markdownToText } from "../../utils/markdown"
7
7
  import type { SearchItem } from "./search-response"
@@ -14,7 +14,7 @@ if (!src.endsWith(".mp3")) {
14
14
  }
15
15
  ---
16
16
 
17
- <audio class="rounded-xl" class:list={[className]} src={src} controls></audio>
17
+ <audio class="rounded-2xl" class:list={[className]} src={src} controls></audio>
18
18
 
19
19
  <style>
20
20
  audio::-webkit-media-controls-enclosure {
@@ -26,6 +26,7 @@ const isPortraitImage = image.height > image.width
26
26
  src={image}
27
27
  quality="high"
28
28
  loading="eager"
29
+ fetchpriority="high"
29
30
  />
30
31
  {
31
32
  style === "book" && (
@@ -17,7 +17,7 @@ const titleSize = {
17
17
  ---
18
18
 
19
19
  <h1
20
- class="font-bold"
20
+ class="text-balance font-bold"
21
21
  lang={language}
22
22
  class:list={[
23
23
  titleSize[title.length > 20 ? "md" : "xl"],
@@ -1,6 +1,6 @@
1
1
  ---
2
+ import { getCategory } from "../../../../content/get-categories"
2
3
  import { getMediaItem } from "../../../../content/get-media-items"
3
- import { resolveCategoryLabel } from "../../../../content/resolve-category-label"
4
4
  import { searchPagePath } from "../../../../utils/paths"
5
5
  import Label from "./Label.astro"
6
6
 
@@ -10,8 +10,11 @@ interface Props {
10
10
 
11
11
  const item = await getMediaItem(Astro.props.mediaId)
12
12
 
13
- const categories = item.data.categories?.map(({ id }) => id)
14
13
  const { t } = Astro.locals.i18n
14
+
15
+ const categories = await Promise.all(
16
+ item.data.categories?.map(({ id }) => getCategory(id)) ?? [],
17
+ )
15
18
  ---
16
19
 
17
20
  {
@@ -21,8 +24,12 @@ const { t } = Astro.locals.i18n
21
24
  <ul class="flex flex-wrap gap-2">
22
25
  {categories.map(async (category) => (
23
26
  <li class="flex rounded-lg bg-gray-200 px-4 py-1 text-gray-500 hover:bg-gray-300">
24
- <a href={searchPagePath(Astro.currentLocale, { category })}>
25
- {resolveCategoryLabel(Astro.locals.i18n.t, category)}
27
+ <a
28
+ href={searchPagePath(Astro.currentLocale, {
29
+ category: category.id,
30
+ })}
31
+ >
32
+ {t(category.label)}
26
33
  </a>
27
34
  </li>
28
35
  ))}