@burdenoff/microfe-hookmovies 2026.827.1 → 2026.829.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/dist/hookmovies/HookMoviesRoot.d.ts.map +1 -1
- package/dist/hookmovies/HookMoviesRoot.js +51 -54
- package/dist/hookmovies/HookMoviesRoot.js.map +1 -1
- package/dist/hookmovies/components/AddToListButton.d.ts.map +1 -1
- package/dist/hookmovies/components/AddToListButton.js +122 -121
- package/dist/hookmovies/components/AddToListButton.js.map +1 -1
- package/dist/hookmovies/components/Pagination.d.ts.map +1 -1
- package/dist/hookmovies/components/Pagination.js +32 -31
- package/dist/hookmovies/components/Pagination.js.map +1 -1
- package/dist/hookmovies/components/StateViews.d.ts.map +1 -1
- package/dist/hookmovies/components/StateViews.js +39 -32
- package/dist/hookmovies/components/StateViews.js.map +1 -1
- package/dist/hookmovies/pages/HomePage.d.ts.map +1 -1
- package/dist/hookmovies/pages/HomePage.js +148 -141
- package/dist/hookmovies/pages/HomePage.js.map +1 -1
- package/dist/hookmovies/pages/catalog/TitlesPage.d.ts.map +1 -1
- package/dist/hookmovies/pages/catalog/TitlesPage.js +126 -125
- package/dist/hookmovies/pages/catalog/TitlesPage.js.map +1 -1
- package/dist/shared/hooks/index.d.ts +2 -0
- package/dist/shared/hooks/index.d.ts.map +1 -0
- package/dist/shared/hooks/useTr.d.ts +17 -0
- package/dist/shared/hooks/useTr.d.ts.map +1 -0
- package/dist/shared/hooks/useTr.js +14 -0
- package/dist/shared/hooks/useTr.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HookMoviesRoot.d.ts","sourceRoot":"","sources":["../../src/hookmovies/HookMoviesRoot.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAmBhC,OAAO,KAAK,EAAE,mBAAmB,EAAW,MAAM,SAAS,CAAC;AAY5D,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"HookMoviesRoot.d.ts","sourceRoot":"","sources":["../../src/hookmovies/HookMoviesRoot.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAmBhC,OAAO,KAAK,EAAE,mBAAmB,EAAW,MAAM,SAAS,CAAC;AAY5D,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA0IlD,CAAC"}
|
|
@@ -1,129 +1,126 @@
|
|
|
1
1
|
import { HookMoviesProvider as e } from "./context/HookMoviesContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useTr as t } from "../shared/hooks/useTr.js";
|
|
3
|
+
import { HookMoviesRoutes as n } from "./HookMoviesRoutes.js";
|
|
4
|
+
import { useEffect as r } from "react";
|
|
4
5
|
import { QueryClient as i, QueryClientProvider as a } from "@tanstack/react-query";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { FeatureFlagProvider as v } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
6
|
+
import { Building2 as o, Clapperboard as s, Film as c, Home as l, ListVideo as u, Megaphone as d, ScrollText as f, Star as p, Ticket as m, Users as h } from "lucide-react";
|
|
7
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
8
|
+
import { FeatureFlagProvider as _ } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
9
9
|
//#region src/hookmovies/HookMoviesRoot.tsx
|
|
10
|
-
var
|
|
10
|
+
var v = new i({ defaultOptions: { queries: {
|
|
11
11
|
staleTime: 300 * 1e3,
|
|
12
12
|
retry: 1
|
|
13
|
-
} } }),
|
|
14
|
-
let { registerNavItems:
|
|
15
|
-
let n = C(e);
|
|
16
|
-
return n === e ? t : n;
|
|
17
|
-
}, [C]), T = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
13
|
+
} } }), y = (i) => {
|
|
14
|
+
let { registerNavItems: y, registerFooterItems: b, basePath: x = "/" } = i, S = t(), C = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
18
15
|
return r(() => {
|
|
19
|
-
if (
|
|
16
|
+
if (y) return y([
|
|
20
17
|
{
|
|
21
18
|
id: "hookmovies-home",
|
|
22
|
-
label:
|
|
23
|
-
path:
|
|
24
|
-
icon: /* @__PURE__ */
|
|
19
|
+
label: S("hookmovies.nav.home", "Overview"),
|
|
20
|
+
path: C(x, ""),
|
|
21
|
+
icon: /* @__PURE__ */ g(l, { size: 20 }),
|
|
25
22
|
order: 1,
|
|
26
23
|
group: "main"
|
|
27
24
|
},
|
|
28
25
|
{
|
|
29
26
|
id: "hookmovies-titles",
|
|
30
|
-
label:
|
|
31
|
-
path:
|
|
32
|
-
icon: /* @__PURE__ */
|
|
27
|
+
label: S("hookmovies.nav.titles", "Catalog"),
|
|
28
|
+
path: C(x, "catalog/titles"),
|
|
29
|
+
icon: /* @__PURE__ */ g(c, { size: 20 }),
|
|
33
30
|
order: 10,
|
|
34
31
|
group: "catalog"
|
|
35
32
|
},
|
|
36
33
|
{
|
|
37
34
|
id: "hookmovies-studios",
|
|
38
|
-
label:
|
|
39
|
-
path:
|
|
40
|
-
icon: /* @__PURE__ */
|
|
35
|
+
label: S("hookmovies.nav.studios", "Studios"),
|
|
36
|
+
path: C(x, "catalog/studios"),
|
|
37
|
+
icon: /* @__PURE__ */ g(o, { size: 20 }),
|
|
41
38
|
order: 11,
|
|
42
39
|
group: "catalog"
|
|
43
40
|
},
|
|
44
41
|
{
|
|
45
42
|
id: "hookmovies-people",
|
|
46
|
-
label:
|
|
47
|
-
path:
|
|
48
|
-
icon: /* @__PURE__ */
|
|
43
|
+
label: S("hookmovies.nav.people", "People"),
|
|
44
|
+
path: C(x, "catalog/people"),
|
|
45
|
+
icon: /* @__PURE__ */ g(h, { size: 20 }),
|
|
49
46
|
order: 12,
|
|
50
47
|
group: "catalog"
|
|
51
48
|
},
|
|
52
49
|
{
|
|
53
50
|
id: "hookmovies-productions",
|
|
54
|
-
label:
|
|
55
|
-
path:
|
|
56
|
-
icon: /* @__PURE__ */
|
|
51
|
+
label: S("hookmovies.nav.productions", "Productions"),
|
|
52
|
+
path: C(x, "productions"),
|
|
53
|
+
icon: /* @__PURE__ */ g(s, { size: 20 }),
|
|
57
54
|
order: 20,
|
|
58
55
|
group: "production"
|
|
59
56
|
},
|
|
60
57
|
{
|
|
61
58
|
id: "hookmovies-auditions",
|
|
62
|
-
label:
|
|
63
|
-
path:
|
|
64
|
-
icon: /* @__PURE__ */
|
|
59
|
+
label: S("hookmovies.nav.auditions", "Auditions"),
|
|
60
|
+
path: C(x, "auditions"),
|
|
61
|
+
icon: /* @__PURE__ */ g(d, { size: 20 }),
|
|
65
62
|
order: 21,
|
|
66
63
|
group: "production"
|
|
67
64
|
},
|
|
68
65
|
{
|
|
69
66
|
id: "hookmovies-reviews",
|
|
70
|
-
label:
|
|
71
|
-
path:
|
|
72
|
-
icon: /* @__PURE__ */
|
|
67
|
+
label: S("hookmovies.nav.reviews", "Reviews"),
|
|
68
|
+
path: C(x, "engagement/reviews"),
|
|
69
|
+
icon: /* @__PURE__ */ g(p, { size: 20 }),
|
|
73
70
|
order: 30,
|
|
74
71
|
group: "audience"
|
|
75
72
|
},
|
|
76
73
|
{
|
|
77
74
|
id: "hookmovies-rights",
|
|
78
|
-
label:
|
|
79
|
-
path:
|
|
80
|
-
icon: /* @__PURE__ */
|
|
75
|
+
label: S("hookmovies.nav.rights", "Rights & Distribution"),
|
|
76
|
+
path: C(x, "distribution/rights"),
|
|
77
|
+
icon: /* @__PURE__ */ g(f, { size: 20 }),
|
|
81
78
|
order: 31,
|
|
82
79
|
group: "audience"
|
|
83
80
|
},
|
|
84
81
|
{
|
|
85
82
|
id: "hookmovies-lists",
|
|
86
|
-
label:
|
|
87
|
-
path:
|
|
88
|
-
icon: /* @__PURE__ */
|
|
83
|
+
label: S("hookmovies.nav.lists", "My Library"),
|
|
84
|
+
path: C(x, "library/lists"),
|
|
85
|
+
icon: /* @__PURE__ */ g(u, { size: 20 }),
|
|
89
86
|
order: 40,
|
|
90
87
|
group: "library"
|
|
91
88
|
},
|
|
92
89
|
{
|
|
93
90
|
id: "hookmovies-entitlements",
|
|
94
|
-
label:
|
|
95
|
-
path:
|
|
96
|
-
icon: /* @__PURE__ */
|
|
91
|
+
label: S("hookmovies.nav.entitlements", "My Entitlements"),
|
|
92
|
+
path: C(x, "library/entitlements"),
|
|
93
|
+
icon: /* @__PURE__ */ g(m, { size: 20 }),
|
|
97
94
|
order: 41,
|
|
98
95
|
group: "library"
|
|
99
96
|
}
|
|
100
97
|
]);
|
|
101
98
|
}, [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
y,
|
|
100
|
+
x,
|
|
101
|
+
S
|
|
105
102
|
]), r(() => {
|
|
106
|
-
if (
|
|
103
|
+
if (b) return b([{
|
|
107
104
|
id: "hookmovies-status",
|
|
108
|
-
label:
|
|
105
|
+
label: S("hookmovies.footer.ready", "HookMovies Ready"),
|
|
109
106
|
type: "status",
|
|
110
107
|
order: 10,
|
|
111
108
|
section: "left"
|
|
112
109
|
}]);
|
|
113
|
-
}, [
|
|
114
|
-
client:
|
|
115
|
-
children: /* @__PURE__ */ _
|
|
110
|
+
}, [b, S]), /* @__PURE__ */ g(a, {
|
|
111
|
+
client: v,
|
|
112
|
+
children: /* @__PURE__ */ g(_, {
|
|
116
113
|
workspaceId: null,
|
|
117
114
|
gateway: "global",
|
|
118
115
|
defaultEnabled: !0,
|
|
119
|
-
children: /* @__PURE__ */
|
|
116
|
+
children: /* @__PURE__ */ g(e, {
|
|
120
117
|
...i,
|
|
121
|
-
children: /* @__PURE__ */
|
|
118
|
+
children: /* @__PURE__ */ g(n, {})
|
|
122
119
|
})
|
|
123
120
|
})
|
|
124
121
|
});
|
|
125
122
|
};
|
|
126
123
|
//#endregion
|
|
127
|
-
export {
|
|
124
|
+
export { y as HookMoviesRoot };
|
|
128
125
|
|
|
129
126
|
//# sourceMappingURL=HookMoviesRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HookMoviesRoot.js","names":[],"sources":["../../src/hookmovies/HookMoviesRoot.tsx"],"sourcesContent":["/**\n * HookMovies Root Component\n * @module hookmovies\n */\n\nimport type { FC } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"HookMoviesRoot.js","names":[],"sources":["../../src/hookmovies/HookMoviesRoot.tsx"],"sourcesContent":["/**\n * HookMovies Root Component\n * @module hookmovies\n */\n\nimport type { FC } from 'react';\nimport { useEffect } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport {\n Home,\n Film,\n Building2,\n Users,\n Clapperboard,\n Megaphone,\n Star,\n ScrollText,\n ListVideo,\n Ticket,\n} from 'lucide-react';\nimport { HookMoviesProvider } from './context/HookMoviesContext';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useTr } from '../shared/hooks/useTr';\nimport { HookMoviesRoutes } from './HookMoviesRoutes';\nimport type { HookMoviesRootProps, NavItem } from './types';\n\n// Create a query client for this microfrontend\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 5 * 60 * 1000,\n retry: 1,\n },\n },\n});\n\nexport const HookMoviesRoot: FC<HookMoviesRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const tr = useTr();\n\n // Helper to join paths correctly\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with shell on mount\n useEffect(() => {\n if (!registerNavItems) return;\n\n const navItems: NavItem[] = [\n // Overview\n {\n id: 'hookmovies-home',\n label: tr('hookmovies.nav.home', 'Overview'),\n path: joinPath(basePath, ''),\n icon: <Home size={20} />,\n order: 1,\n group: 'main',\n },\n\n // Catalog\n {\n id: 'hookmovies-titles',\n label: tr('hookmovies.nav.titles', 'Catalog'),\n path: joinPath(basePath, 'catalog/titles'),\n icon: <Film size={20} />,\n order: 10,\n group: 'catalog',\n },\n {\n id: 'hookmovies-studios',\n label: tr('hookmovies.nav.studios', 'Studios'),\n path: joinPath(basePath, 'catalog/studios'),\n icon: <Building2 size={20} />,\n order: 11,\n group: 'catalog',\n },\n {\n id: 'hookmovies-people',\n label: tr('hookmovies.nav.people', 'People'),\n path: joinPath(basePath, 'catalog/people'),\n icon: <Users size={20} />,\n order: 12,\n group: 'catalog',\n },\n\n // Production\n {\n id: 'hookmovies-productions',\n label: tr('hookmovies.nav.productions', 'Productions'),\n path: joinPath(basePath, 'productions'),\n icon: <Clapperboard size={20} />,\n order: 20,\n group: 'production',\n },\n {\n id: 'hookmovies-auditions',\n label: tr('hookmovies.nav.auditions', 'Auditions'),\n path: joinPath(basePath, 'auditions'),\n icon: <Megaphone size={20} />,\n order: 21,\n group: 'production',\n },\n\n // Audience & distribution\n {\n id: 'hookmovies-reviews',\n label: tr('hookmovies.nav.reviews', 'Reviews'),\n path: joinPath(basePath, 'engagement/reviews'),\n icon: <Star size={20} />,\n order: 30,\n group: 'audience',\n },\n {\n id: 'hookmovies-rights',\n label: tr('hookmovies.nav.rights', 'Rights & Distribution'),\n path: joinPath(basePath, 'distribution/rights'),\n icon: <ScrollText size={20} />,\n order: 31,\n group: 'audience',\n },\n\n // Library (self-scoped)\n {\n id: 'hookmovies-lists',\n label: tr('hookmovies.nav.lists', 'My Library'),\n path: joinPath(basePath, 'library/lists'),\n icon: <ListVideo size={20} />,\n order: 40,\n group: 'library',\n },\n {\n id: 'hookmovies-entitlements',\n label: tr('hookmovies.nav.entitlements', 'My Entitlements'),\n path: joinPath(basePath, 'library/entitlements'),\n icon: <Ticket size={20} />,\n order: 41,\n group: 'library',\n },\n ];\n\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath, tr]);\n\n // Register footer items\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'hookmovies-status',\n label: tr('hookmovies.footer.ready', 'HookMovies Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems, tr]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <HookMoviesProvider {...props}>\n <HookMoviesRoutes />\n </HookMoviesProvider>\n </FeatureFlagProvider>\n </QueryClientProvider>\n );\n};\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddToListButton.d.ts","sourceRoot":"","sources":["../../../src/hookmovies/components/AddToListButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAuC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AddToListButton.d.ts","sourceRoot":"","sources":["../../../src/hookmovies/components/AddToListButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAuC,MAAM,OAAO,CAAC;AA+BrE,UAAU,oBAAoB;IAC5B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA0UpD,CAAC"}
|
|
@@ -1,208 +1,209 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
+
import { cn as t } from "../utils/cn.js";
|
|
3
|
+
import { parseListItems as n, useCreateList as r, useMyLists as i, useUpdateList as a } from "../hooks/useHookMoviesApi.js";
|
|
4
|
+
import { ErrorState as o, LoadingState as s } from "./StateViews.js";
|
|
5
|
+
import { useEffect as c, useState as l } from "react";
|
|
6
|
+
import { Bookmark as u, Check as d, ListPlus as f, ListVideo as p, Loader2 as m, Plus as h, X as g } from "lucide-react";
|
|
7
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
7
8
|
//#region src/hookmovies/components/AddToListButton.tsx
|
|
8
|
-
var
|
|
9
|
+
var b = {
|
|
9
10
|
limit: 100,
|
|
10
11
|
offset: 0
|
|
11
|
-
},
|
|
12
|
-
WATCHLIST:
|
|
13
|
-
PLAYLIST:
|
|
14
|
-
},
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
if (!
|
|
12
|
+
}, x = ["WATCHLIST", "PLAYLIST"], S = {
|
|
13
|
+
WATCHLIST: u,
|
|
14
|
+
PLAYLIST: p
|
|
15
|
+
}, C = (e) => e.charAt(0) + e.slice(1).toLowerCase().replace(/_/g, " "), w = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", T = "mb-1.5 block text-xs font-medium text-text-secondary", E = ({ titleId: u, titleName: p, variant: E = "cta", className: D }) => {
|
|
16
|
+
let O = e(), [k, A] = l(!1), [j, M] = l(!1), [N, P] = l(null), [F, I] = l(null), [L, R] = l(""), [z, B] = l("WATCHLIST"), V = i(void 0, b), H = a(), U = r(), W = V.data?.items ?? [], G = W.filter((e) => n(e.items).some((e) => e.titleId === u)).length > 0;
|
|
17
|
+
c(() => {
|
|
18
|
+
if (!k) return;
|
|
18
19
|
let e = (e) => {
|
|
19
|
-
e.key === "Escape" &&
|
|
20
|
+
e.key === "Escape" && A(!1);
|
|
20
21
|
};
|
|
21
22
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
22
|
-
}, [
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
let
|
|
28
|
-
titleId:
|
|
23
|
+
}, [k]);
|
|
24
|
+
let K = () => {
|
|
25
|
+
A(!1), M(!1), I(null);
|
|
26
|
+
}, q = async (e) => {
|
|
27
|
+
I(null), P(e.id);
|
|
28
|
+
let t = n(e.items), r = t.some((e) => e.titleId === u) ? t.filter((e) => e.titleId !== u) : [...t, {
|
|
29
|
+
titleId: u,
|
|
29
30
|
note: null
|
|
30
31
|
}];
|
|
31
32
|
try {
|
|
32
|
-
await
|
|
33
|
+
await H.mutateAsync({
|
|
33
34
|
id: e.id,
|
|
34
35
|
input: { items: r }
|
|
35
36
|
});
|
|
36
37
|
} catch (e) {
|
|
37
|
-
|
|
38
|
+
I(e instanceof Error ? e.message : O("hookmovies.list.updateError", "Failed to update the list (you can only edit your own)"));
|
|
38
39
|
} finally {
|
|
39
|
-
|
|
40
|
+
P(null);
|
|
40
41
|
}
|
|
41
|
-
},
|
|
42
|
-
if (e.preventDefault(),
|
|
43
|
-
|
|
42
|
+
}, J = async (e) => {
|
|
43
|
+
if (e.preventDefault(), I(null), !L.trim()) {
|
|
44
|
+
I(O("hookmovies.list.nameRequired", "Name is required."));
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
47
|
try {
|
|
47
|
-
await
|
|
48
|
-
name:
|
|
49
|
-
kind:
|
|
48
|
+
await U.mutateAsync({
|
|
49
|
+
name: L.trim(),
|
|
50
|
+
kind: z,
|
|
50
51
|
visibility: "PRIVATE",
|
|
51
52
|
items: [{
|
|
52
|
-
titleId:
|
|
53
|
+
titleId: u,
|
|
53
54
|
note: null
|
|
54
55
|
}]
|
|
55
|
-
}),
|
|
56
|
+
}), R(""), B("WATCHLIST"), M(!1);
|
|
56
57
|
} catch (e) {
|
|
57
|
-
|
|
58
|
+
I(e instanceof Error ? e.message : O("hookmovies.list.createError", "Failed to create the list"));
|
|
58
59
|
}
|
|
59
|
-
},
|
|
60
|
-
return /* @__PURE__ */
|
|
60
|
+
}, Y = p ? ` ${p}` : "", X = G ? O("hookmovies.list.inYourLists", "In your lists") : O("hookmovies.list.addToList", "Add to List");
|
|
61
|
+
return /* @__PURE__ */ y(_, { children: [E === "icon" ? /* @__PURE__ */ v("button", {
|
|
61
62
|
type: "button",
|
|
62
|
-
onClick: () =>
|
|
63
|
-
"aria-label": `${
|
|
64
|
-
title:
|
|
65
|
-
className:
|
|
66
|
-
children:
|
|
67
|
-
}) : /* @__PURE__ */
|
|
63
|
+
onClick: () => A(!0),
|
|
64
|
+
"aria-label": `${X}${Y ? ` —${Y}` : ""}`,
|
|
65
|
+
title: X,
|
|
66
|
+
className: t("inline-flex size-8 items-center justify-center rounded-lg border border-border-seam", "bg-bg-overlay/80 text-text-secondary backdrop-blur-sm transition-colors", "hover:border-border-strong hover:text-text-primary", "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", G && "text-status-success-text", D),
|
|
67
|
+
children: v(G ? d : f, { className: "h-4 w-4" })
|
|
68
|
+
}) : /* @__PURE__ */ y("button", {
|
|
68
69
|
type: "button",
|
|
69
|
-
onClick: () =>
|
|
70
|
-
"aria-label": `${
|
|
71
|
-
className:
|
|
72
|
-
children: [
|
|
73
|
-
}),
|
|
70
|
+
onClick: () => A(!0),
|
|
71
|
+
"aria-label": `${X}${Y ? ` —${Y}` : ""}`,
|
|
72
|
+
className: t("inline-flex items-center gap-2 rounded-xl border border-border-seam bg-bg-surface/60", "px-5 py-2.5 text-sm font-semibold text-text-primary backdrop-blur transition-colors", "hover:bg-bg-surface focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", D),
|
|
73
|
+
children: [G ? /* @__PURE__ */ v(d, { className: "h-5 w-5 text-status-success-text" }) : /* @__PURE__ */ v(h, { className: "h-5 w-5" }), X]
|
|
74
|
+
}), k && /* @__PURE__ */ v("div", {
|
|
74
75
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-bg-canvas/90 p-4 backdrop-blur-sm",
|
|
75
76
|
role: "dialog",
|
|
76
77
|
"aria-modal": "true",
|
|
77
|
-
"aria-label":
|
|
78
|
-
onClick:
|
|
79
|
-
children: /* @__PURE__ */
|
|
78
|
+
"aria-label": O("hookmovies.list.dialogAria", "Add{{title}} to a list", { title: Y }),
|
|
79
|
+
onClick: K,
|
|
80
|
+
children: /* @__PURE__ */ y("div", {
|
|
80
81
|
className: "relative w-full max-w-md overflow-hidden rounded-2xl border border-border-seam bg-bg-surface shadow-2xl",
|
|
81
82
|
onClick: (e) => e.stopPropagation(),
|
|
82
|
-
children: [/* @__PURE__ */
|
|
83
|
+
children: [/* @__PURE__ */ y("div", {
|
|
83
84
|
className: "flex items-start justify-between gap-3 border-b border-border-seam px-5 py-4",
|
|
84
|
-
children: [/* @__PURE__ */
|
|
85
|
+
children: [/* @__PURE__ */ y("div", {
|
|
85
86
|
className: "min-w-0",
|
|
86
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ v("h2", {
|
|
87
88
|
className: "text-sm font-semibold text-text-primary",
|
|
88
|
-
children: "Add to a list"
|
|
89
|
-
}), /* @__PURE__ */
|
|
89
|
+
children: O("hookmovies.list.dialogTitle", "Add to a list")
|
|
90
|
+
}), /* @__PURE__ */ v("p", {
|
|
90
91
|
className: "mt-0.5 line-clamp-1 text-xs text-text-secondary",
|
|
91
|
-
children:
|
|
92
|
+
children: p ?? O("hookmovies.list.dialogDescription", "Pick one of your watchlists or playlists.")
|
|
92
93
|
})]
|
|
93
|
-
}), /* @__PURE__ */
|
|
94
|
+
}), /* @__PURE__ */ v("button", {
|
|
94
95
|
type: "button",
|
|
95
|
-
onClick:
|
|
96
|
-
"aria-label": "Close",
|
|
96
|
+
onClick: K,
|
|
97
|
+
"aria-label": O("common.close", "Close"),
|
|
97
98
|
className: "rounded-md p-1 text-text-secondary transition-colors hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
98
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ v(g, { className: "h-4 w-4" })
|
|
99
100
|
})]
|
|
100
|
-
}), /* @__PURE__ */
|
|
101
|
+
}), /* @__PURE__ */ y("div", {
|
|
101
102
|
className: "px-5 py-4",
|
|
102
103
|
children: [
|
|
103
|
-
|
|
104
|
+
F && /* @__PURE__ */ v("div", {
|
|
104
105
|
role: "alert",
|
|
105
106
|
className: "mb-3 rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-xs text-status-error-text",
|
|
106
|
-
children:
|
|
107
|
+
children: F
|
|
107
108
|
}),
|
|
108
|
-
|
|
109
|
-
label: "Loading your lists…",
|
|
109
|
+
V.isLoading ? /* @__PURE__ */ v(s, {
|
|
110
|
+
label: O("hookmovies.list.loading", "Loading your lists…"),
|
|
110
111
|
className: "min-h-[8rem]"
|
|
111
|
-
}) :
|
|
112
|
-
title: "Couldn't load your lists",
|
|
113
|
-
onRetry: () => void
|
|
112
|
+
}) : V.isError ? /* @__PURE__ */ v(o, {
|
|
113
|
+
title: O("hookmovies.list.loadError", "Couldn't load your lists"),
|
|
114
|
+
onRetry: () => void V.refetch(),
|
|
114
115
|
className: "min-h-[8rem]"
|
|
115
|
-
}) :
|
|
116
|
+
}) : W.length === 0 ? /* @__PURE__ */ v("p", {
|
|
116
117
|
className: "mb-3 text-sm text-text-secondary",
|
|
117
|
-
children: "You don't have any lists yet — create one below and this title goes straight into it."
|
|
118
|
-
}) : /* @__PURE__ */
|
|
118
|
+
children: O("hookmovies.list.empty", "You don't have any lists yet — create one below and this title goes straight into it.")
|
|
119
|
+
}) : /* @__PURE__ */ v("ul", {
|
|
119
120
|
className: "-mx-1 max-h-[45vh] space-y-1 overflow-y-auto px-1",
|
|
120
|
-
children:
|
|
121
|
-
let r =
|
|
122
|
-
return /* @__PURE__ */
|
|
121
|
+
children: W.map((e) => {
|
|
122
|
+
let r = S[e.kind], i = n(e.items).some((e) => e.titleId === u), a = N === e.id;
|
|
123
|
+
return /* @__PURE__ */ v("li", { children: /* @__PURE__ */ y("button", {
|
|
123
124
|
type: "button",
|
|
124
|
-
onClick: () => void
|
|
125
|
+
onClick: () => void q(e),
|
|
125
126
|
disabled: a,
|
|
126
127
|
"aria-pressed": i,
|
|
127
|
-
className:
|
|
128
|
+
className: t("flex w-full items-center gap-3 rounded-lg border px-3 py-2 text-left transition-colors", "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", "disabled:opacity-60", i ? "border-status-success-border bg-status-success-bg-subtle" : "border-border-subtle hover:border-border-strong hover:bg-bg-sunken"),
|
|
128
129
|
children: [
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ v(r, { className: "h-4 w-4 shrink-0 text-text-secondary" }),
|
|
131
|
+
/* @__PURE__ */ y("span", {
|
|
131
132
|
className: "min-w-0 flex-1",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
133
|
+
children: [/* @__PURE__ */ v("span", {
|
|
133
134
|
className: "line-clamp-1 block text-sm font-medium text-text-primary",
|
|
134
|
-
children:
|
|
135
|
-
}), /* @__PURE__ */
|
|
135
|
+
children: e.name
|
|
136
|
+
}), /* @__PURE__ */ y("span", {
|
|
136
137
|
className: "block text-[11px] text-text-secondary",
|
|
137
138
|
children: [
|
|
138
|
-
|
|
139
|
+
C(e.kind),
|
|
139
140
|
" · ",
|
|
140
|
-
|
|
141
|
+
e.itemCount,
|
|
141
142
|
" ",
|
|
142
|
-
|
|
143
|
+
e.itemCount === 1 ? O("hookmovies.list.item", "item") : O("hookmovies.list.items", "items")
|
|
143
144
|
]
|
|
144
145
|
})]
|
|
145
146
|
}),
|
|
146
|
-
a ? /* @__PURE__ */
|
|
147
|
+
a ? /* @__PURE__ */ v(m, { className: "h-4 w-4 shrink-0 animate-spin text-text-secondary" }) : i ? /* @__PURE__ */ v(d, { className: "h-4 w-4 shrink-0 text-status-success-text" }) : /* @__PURE__ */ v(h, { className: "h-4 w-4 shrink-0 text-text-secondary" })
|
|
147
148
|
]
|
|
148
|
-
}) },
|
|
149
|
+
}) }, e.id);
|
|
149
150
|
})
|
|
150
151
|
}),
|
|
151
|
-
!
|
|
152
|
+
!V.isLoading && !V.isError && /* @__PURE__ */ v("div", {
|
|
152
153
|
className: "mt-3 border-t border-border-seam pt-3",
|
|
153
|
-
children:
|
|
154
|
-
onSubmit: (e) => void
|
|
154
|
+
children: j || W.length === 0 ? /* @__PURE__ */ y("form", {
|
|
155
|
+
onSubmit: (e) => void J(e),
|
|
155
156
|
className: "space-y-3",
|
|
156
157
|
children: [
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
htmlFor: `add-to-list-name-${
|
|
159
|
-
className:
|
|
160
|
-
children: "New list name *"
|
|
161
|
-
}), /* @__PURE__ */
|
|
162
|
-
id: `add-to-list-name-${
|
|
158
|
+
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ y("label", {
|
|
159
|
+
htmlFor: `add-to-list-name-${u}`,
|
|
160
|
+
className: T,
|
|
161
|
+
children: [O("hookmovies.list.newListName", "New list name"), " *"]
|
|
162
|
+
}), /* @__PURE__ */ v("input", {
|
|
163
|
+
id: `add-to-list-name-${u}`,
|
|
163
164
|
type: "text",
|
|
164
|
-
value:
|
|
165
|
-
onChange: (e) =>
|
|
166
|
-
placeholder: "e.g. Weekend Watch",
|
|
167
|
-
className:
|
|
165
|
+
value: L,
|
|
166
|
+
onChange: (e) => R(e.target.value),
|
|
167
|
+
placeholder: O("hookmovies.list.newListPlaceholder", "e.g. Weekend Watch"),
|
|
168
|
+
className: w,
|
|
168
169
|
autoFocus: !0,
|
|
169
170
|
required: !0
|
|
170
171
|
})] }),
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
htmlFor: `add-to-list-kind-${
|
|
172
|
+
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
173
|
+
htmlFor: `add-to-list-kind-${u}`,
|
|
174
|
+
className: T,
|
|
175
|
+
children: O("hookmovies.list.kind", "Kind")
|
|
176
|
+
}), /* @__PURE__ */ v("select", {
|
|
177
|
+
id: `add-to-list-kind-${u}`,
|
|
178
|
+
value: z,
|
|
179
|
+
onChange: (e) => B(e.target.value),
|
|
173
180
|
className: w,
|
|
174
|
-
children: "
|
|
175
|
-
}), /* @__PURE__ */ _("select", {
|
|
176
|
-
id: `add-to-list-kind-${l}`,
|
|
177
|
-
value: L,
|
|
178
|
-
onChange: (e) => R(e.target.value),
|
|
179
|
-
className: C,
|
|
180
|
-
children: b.map((e) => /* @__PURE__ */ _("option", {
|
|
181
|
+
children: x.map((e) => /* @__PURE__ */ v("option", {
|
|
181
182
|
value: e,
|
|
182
|
-
children:
|
|
183
|
+
children: C(e)
|
|
183
184
|
}, e))
|
|
184
185
|
})] }),
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ y("div", {
|
|
186
187
|
className: "flex items-center gap-2",
|
|
187
|
-
children: [/* @__PURE__ */
|
|
188
|
+
children: [/* @__PURE__ */ y("button", {
|
|
188
189
|
type: "submit",
|
|
189
|
-
disabled:
|
|
190
|
+
disabled: U.isPending,
|
|
190
191
|
className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-text transition-opacity hover:opacity-90 disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
191
|
-
children: [/* @__PURE__ */
|
|
192
|
-
}),
|
|
192
|
+
children: [/* @__PURE__ */ v(h, { className: "h-3.5 w-3.5" }), U.isPending ? O("hookmovies.list.creating", "Creating…") : O("hookmovies.list.createAndAdd", "Create & add")]
|
|
193
|
+
}), W.length > 0 && /* @__PURE__ */ v("button", {
|
|
193
194
|
type: "button",
|
|
194
|
-
onClick: () =>
|
|
195
|
-
disabled:
|
|
195
|
+
onClick: () => M(!1),
|
|
196
|
+
disabled: U.isPending,
|
|
196
197
|
className: "rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-secondary transition-colors hover:text-text-primary disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
197
|
-
children: "Cancel"
|
|
198
|
+
children: O("common.cancel", "Cancel")
|
|
198
199
|
})]
|
|
199
200
|
})
|
|
200
201
|
]
|
|
201
|
-
}) : /* @__PURE__ */
|
|
202
|
+
}) : /* @__PURE__ */ y("button", {
|
|
202
203
|
type: "button",
|
|
203
|
-
onClick: () =>
|
|
204
|
+
onClick: () => M(!0),
|
|
204
205
|
className: "inline-flex items-center gap-2 text-xs font-medium text-text-secondary transition-colors hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] rounded",
|
|
205
|
-
children: [/* @__PURE__ */
|
|
206
|
+
children: [/* @__PURE__ */ v(h, { className: "h-3.5 w-3.5" }), O("hookmovies.list.newList", "New list")]
|
|
206
207
|
})
|
|
207
208
|
})
|
|
208
209
|
]
|
|
@@ -211,6 +212,6 @@ var y = {
|
|
|
211
212
|
})] });
|
|
212
213
|
};
|
|
213
214
|
//#endregion
|
|
214
|
-
export {
|
|
215
|
+
export { E as AddToListButton };
|
|
215
216
|
|
|
216
217
|
//# sourceMappingURL=AddToListButton.js.map
|