@burdenoff/microfe-headshotmarketing 2026.1029.1 → 2026.1029.2

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.
@@ -1,95 +1,107 @@
1
- import { useDeleteHeadshotmarketingSocialPostMutation as e, useHeadshotmarketingSocialPostsListQuery as t, usePublishHeadshotmarketingSocialPostMutation as ee, useUpdateHeadshotmarketingSocialPostMutation as te } from "../../../generated/wspace-operations.js";
1
+ import { useDeleteHeadshotmarketingSocialPostMutation as e, useHeadshotmarketingSocialPostsListQuery as t, usePublishHeadshotmarketingSocialPostMutation as n, useRetryHeadshotmarketingSocialPostMutation as ee, useUpdateHeadshotmarketingSocialPostMutation as te } from "../../../generated/wspace-operations.js";
2
2
  import { useHeadshotMarketing as ne } from "../../context/HeadshotMarketingContext.js";
3
- import { cn as n, formatDate as r, formatNumber as i, formatPercentage as re } from "../../utils/helpers.js";
4
- import { HeadshotmarketingSocialPostStatus as a } from "../../../generated/wspace-types.js";
3
+ import { cn as r, formatDate as i, formatNumber as a, formatPercentage as re } from "../../utils/helpers.js";
4
+ import { HeadshotmarketingSocialPostStatus as o } from "../../../generated/wspace-types.js";
5
5
  import { PageLayout as ie } from "../../components/PageLayout.js";
6
- import { StatCard as o } from "../../components/StatCard.js";
7
- import { StatusBadge as s } from "../../components/StatusBadge.js";
6
+ import { StatCard as s } from "../../components/StatCard.js";
7
+ import { StatusBadge as c } from "../../components/StatusBadge.js";
8
8
  import { EmptyState as ae } from "../../components/EmptyState.js";
9
9
  import { FilterBar as oe } from "../../components/FilterBar.js";
10
- import { Modal as c } from "../../components/Modal.js";
10
+ import { Modal as l } from "../../components/Modal.js";
11
11
  import { QueryStateBoundary as se } from "../../components/QueryStateBoundary.js";
12
12
  import { Pagination as ce } from "../../components/Pagination.js";
13
- import { ActionMenu as l } from "../../components/ActionMenu.js";
13
+ import { ActionMenu as u } from "../../components/ActionMenu.js";
14
14
  import "../../components/index.js";
15
15
  import { useHeadshotmarketingBootstrap as le } from "../../hooks/useHeadshotmarketingBootstrap.js";
16
16
  import { usePagination as ue } from "../../hooks/usePagination.js";
17
17
  import { toSocialPostModel as de } from "../../utils/socialMapper.js";
18
18
  import "../../hooks/index.js";
19
- import { useEffect as u, useMemo as d, useState as f } from "react";
20
- import { Eye as fe, Grid3X3 as pe, Heart as me, List as he, MessageCircle as ge, Pencil as p, Plus as m, Send as h, Share2 as _e, Trash2 as ve } from "lucide-react";
21
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
22
- import { EmphasisPanel as ye, PagePurpose as be } from "@burdenoff/fe-libs/ui";
19
+ import { useEffect as d, useMemo as f, useState as p } from "react";
20
+ import { AlertTriangle as fe, ExternalLink as pe, Eye as me, Grid3X3 as he, Heart as ge, List as _e, MessageCircle as ve, Pencil as ye, Plus as m, RotateCcw as h, Send as g, Share2 as be, Trash2 as _ } from "lucide-react";
21
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
22
+ import { EmphasisPanel as xe, PagePurpose as Se } from "@burdenoff/fe-libs/ui";
23
23
  //#region src/headshotmarketing/pages/social-media/PostsPage.tsx
24
- var y = {
24
+ var x = {
25
25
  instagram: "bg-[var(--color-accent-soft)] text-action-primary-bg",
26
26
  facebook: "bg-status-info-bg text-status-info-text",
27
27
  twitter: "bg-status-info-bg text-status-info-text",
28
28
  linkedin: "bg-status-info-bg text-status-info-text",
29
29
  youtube: "bg-status-error-bg text-status-error-text",
30
30
  tiktok: "bg-bg-sunken text-text-secondary"
31
- }, xe = {
32
- published: a.Published,
33
- scheduled: a.Scheduled,
34
- draft: a.Draft,
35
- failed: a.Failed
31
+ }, Ce = {
32
+ published: o.Published,
33
+ scheduled: o.Scheduled,
34
+ draft: o.Draft,
35
+ failed: o.Failed
36
36
  };
37
- function Se(e) {
37
+ function we(e) {
38
+ return !e || e.status !== o.Failed ? null : `Publishing failed: ${e.errorMessage ?? "the platform rejected the post."}`;
39
+ }
40
+ function Te(e) {
38
41
  return Array.from(new Set(e.match(/#\w+/g) ?? []));
39
42
  }
40
- var b = () => {
41
- let { navigate: a, basePath: b } = ne(), { data: x, refetch: Ce } = le(), [S, we] = f(""), [C, Te] = f("all"), [w, Ee] = f("all"), [T, De] = f("newest"), [E, D] = f("grid"), [O, k] = f(null), [Oe, A] = f(!1), [ke, j] = f(!1), [M, Ae] = f(null), [N, P] = f(""), [F, I] = f(null), [L, R] = f(null), z = ue({ initialPageSize: 12 }), { limit: je, offset: Me, setPage: B, setTotal: V } = z, { data: H, loading: U, error: Ne, refetch: W } = t({
43
+ var S = () => {
44
+ let { navigate: o, basePath: S } = ne(), { data: C, refetch: Ee } = le(), [w, De] = p(""), [T, Oe] = p("all"), [E, ke] = p("all"), [D, Ae] = p("newest"), [O, je] = p("grid"), [k, Me] = p(null), [Ne, A] = p(!1), [Pe, j] = p(!1), [M, Fe] = p(null), [N, P] = p(""), [F, I] = p(null), [L, R] = p(null), z = ue({ initialPageSize: 12 }), { limit: Ie, offset: Le, setPage: B, setTotal: V } = z, { data: H, loading: U, error: Re, refetch: W } = t({
42
45
  variables: {
43
- limit: je,
44
- offset: Me,
45
- search: S.trim() || void 0,
46
- status: C === "all" ? void 0 : xe[C]
46
+ limit: Ie,
47
+ offset: Le,
48
+ search: w.trim() || void 0,
49
+ status: T === "all" ? void 0 : Ce[T]
47
50
  },
48
51
  notifyOnNetworkStatusChange: !0
49
- }), [Pe] = e(), [Fe] = ee(), [Ie, { loading: G }] = te();
50
- u(() => {
52
+ }), [ze] = e(), [Be] = n(), [Ve] = ee(), [He, { loading: G }] = te();
53
+ d(() => {
51
54
  B(1);
52
55
  }, [
53
- S,
54
- C,
56
+ w,
57
+ T,
55
58
  B
56
- ]), u(() => {
59
+ ]), d(() => {
57
60
  V(H?.headshotmarketingSocialPosts.total ?? 0);
58
61
  }, [H?.headshotmarketingSocialPosts.total, V]);
59
- let K = d(() => Object.fromEntries((x?.headshotmarketingSocialAccounts.items ?? []).map((e) => [e.id, e.accountName])), [x?.headshotmarketingSocialAccounts.items]), q = d(() => Object.fromEntries((x?.headshotmarketingSocialAccounts.items ?? []).map((e) => [e.id, e.platform === "FACEBOOK" ? "facebook" : e.platform === "INSTAGRAM" ? "instagram" : e.platform === "TWITTER" ? "twitter" : e.platform === "LINKEDIN" ? "linkedin" : e.platform === "TIKTOK" ? "tiktok" : e.platform === "YOUTUBE" ? "youtube" : "instagram"])), [x?.headshotmarketingSocialAccounts.items]), J = d(() => (x?.headshotmarketingSocialPosts.items ?? []).map((e) => de(e, K, q)), [
60
- x?.headshotmarketingSocialPosts.items,
62
+ let K = f(() => Object.fromEntries((C?.headshotmarketingSocialAccounts.items ?? []).map((e) => [e.id, e.accountName])), [C?.headshotmarketingSocialAccounts.items]), q = f(() => Object.fromEntries((C?.headshotmarketingSocialAccounts.items ?? []).map((e) => [e.id, e.platform === "FACEBOOK" ? "facebook" : e.platform === "INSTAGRAM" ? "instagram" : e.platform === "TWITTER" ? "twitter" : e.platform === "LINKEDIN" ? "linkedin" : e.platform === "TIKTOK" ? "tiktok" : e.platform === "YOUTUBE" ? "youtube" : "instagram"])), [C?.headshotmarketingSocialAccounts.items]), J = f(() => (C?.headshotmarketingSocialPosts.items ?? []).map((e) => de(e, K, q)), [
63
+ C?.headshotmarketingSocialPosts.items,
61
64
  K,
62
65
  q
63
- ]), Y = d(() => {
66
+ ]), Y = f(() => {
64
67
  let e = (H?.headshotmarketingSocialPosts.items ?? []).map((e) => de(e, K, q));
65
- return w !== "all" && (e = e.filter((e) => e.platform === w)), [...e].sort((e, t) => T === "newest" ? new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime() : T === "oldest" ? new Date(e.createdAt).getTime() - new Date(t.createdAt).getTime() : T === "engagement" ? t.metrics.engagementRate - e.metrics.engagementRate : 0);
68
+ return E !== "all" && (e = e.filter((e) => e.platform === E)), [...e].sort((e, t) => D === "newest" ? new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime() : D === "oldest" ? new Date(e.createdAt).getTime() - new Date(t.createdAt).getTime() : D === "engagement" ? t.metrics.engagementRate - e.metrics.engagementRate : 0);
66
69
  }, [
67
70
  H?.headshotmarketingSocialPosts.items,
68
71
  K,
69
72
  q,
70
- w,
71
- T
72
- ]), Le = J.length, Re = J.filter((e) => e.status === "published").length, ze = J.filter((e) => e.status === "scheduled").length, Be = J.reduce((e, t) => e + t.metrics.likes + t.metrics.comments + t.metrics.shares, 0), X = J.filter((e) => e.status === "published"), Ve = X.length > 0 ? X.reduce((e, t) => e + t.metrics.engagementRate, 0) / X.length : 0, Z = async () => {
73
- await Promise.all([W(), Ce()]);
74
- }, He = async (e) => {
73
+ E,
74
+ D
75
+ ]), X = J.length, Ue = J.filter((e) => e.status === "published").length, We = J.filter((e) => e.status === "scheduled").length, Ge = J.reduce((e, t) => e + t.metrics.likes + t.metrics.comments + t.metrics.shares, 0), Z = J.filter((e) => e.status === "published"), Ke = Z.length > 0 ? Z.reduce((e, t) => e + t.metrics.engagementRate, 0) / Z.length : 0, Q = async () => {
76
+ await Promise.all([W(), Ee()]);
77
+ }, qe = async (e) => {
75
78
  if (window.confirm("Delete this post? This cannot be undone.")) {
76
79
  R(null);
77
80
  try {
78
- await Pe({ variables: { id: e.id } }), O?.id === e.id && A(!1), await Z();
81
+ await ze({ variables: { id: e.id } }), k?.id === e.id && A(!1), await Q();
79
82
  } catch (e) {
80
83
  R(e instanceof Error ? e.message : "Failed to delete post.");
81
84
  }
82
85
  }
83
- }, Ue = async (e) => {
86
+ }, Je = async (e) => {
84
87
  R(null);
85
88
  try {
86
- await Fe({ variables: { id: e.id } }), O?.id === e.id && A(!1), await Z();
89
+ let { data: t } = await Be({ variables: { id: e.id } }), n = we(t?.publishHeadshotmarketingSocialPost);
90
+ n && R(n), k?.id === e.id && A(!1), await Q();
87
91
  } catch (e) {
88
92
  R(e instanceof Error ? e.message : "Failed to publish post.");
89
93
  }
90
- }, We = (e) => {
91
- Ae(e), P(e.content), I(null), A(!1), j(!0);
92
- }, Ge = async () => {
94
+ }, Ye = async (e) => {
95
+ R(null);
96
+ try {
97
+ let { data: t } = await Ve({ variables: { id: e.id } }), n = we(t?.retryHeadshotmarketingSocialPost);
98
+ n && R(n), k?.id === e.id && A(!1), await Q();
99
+ } catch (e) {
100
+ R(e instanceof Error ? e.message : "Failed to retry post.");
101
+ }
102
+ }, Xe = (e) => {
103
+ Fe(e), P(e.content), I(null), A(!1), j(!0);
104
+ }, Ze = async () => {
93
105
  if (!M) return;
94
106
  let e = N.trim();
95
107
  if (!e) {
@@ -98,274 +110,296 @@ var b = () => {
98
110
  }
99
111
  I(null);
100
112
  try {
101
- await Ie({ variables: {
113
+ await He({ variables: {
102
114
  id: M.id,
103
115
  input: {
104
116
  content: e,
105
- tags: Se(e)
117
+ tags: Te(e)
106
118
  }
107
- } }), j(!1), await Z();
119
+ } }), j(!1), await Q();
108
120
  } catch (e) {
109
121
  I(e instanceof Error ? e.message : "Failed to save post.");
110
122
  }
111
- }, Q = (e) => [
123
+ }, Qe = (e) => [
112
124
  {
113
125
  key: "edit",
114
126
  label: "Edit",
115
- icon: /* @__PURE__ */ _(p, { className: "h-4 w-4" }),
116
- onClick: () => We(e)
127
+ icon: /* @__PURE__ */ y(ye, { className: "h-4 w-4" }),
128
+ onClick: () => Xe(e)
117
129
  },
118
130
  ...e.status === "draft" || e.status === "scheduled" ? [{
119
131
  key: "publish",
120
132
  label: "Publish now",
121
- icon: /* @__PURE__ */ _(h, { className: "h-4 w-4" }),
122
- onClick: () => void Ue(e)
133
+ icon: /* @__PURE__ */ y(g, { className: "h-4 w-4" }),
134
+ onClick: () => void Je(e)
135
+ }] : [],
136
+ ...e.status === "failed" ? [{
137
+ key: "retry",
138
+ label: "Retry publish",
139
+ icon: /* @__PURE__ */ y(h, { className: "h-4 w-4" }),
140
+ onClick: () => void Ye(e)
141
+ }] : [],
142
+ ...e.postUrl ? [{
143
+ key: "view",
144
+ label: "View on platform",
145
+ icon: /* @__PURE__ */ y(pe, { className: "h-4 w-4" }),
146
+ onClick: () => {
147
+ window.open(e.postUrl ?? "", "_blank", "noopener,noreferrer");
148
+ }
123
149
  }] : [],
124
150
  {
125
151
  key: "delete",
126
152
  label: "Delete",
127
- icon: /* @__PURE__ */ _(ve, { className: "h-4 w-4" }),
153
+ icon: /* @__PURE__ */ y(_, { className: "h-4 w-4" }),
128
154
  danger: !0,
129
- onClick: () => void He(e)
155
+ onClick: () => void qe(e)
130
156
  }
131
- ], $ = Le > 0;
132
- return /* @__PURE__ */ v(ie, {
157
+ ], $ = X > 0;
158
+ return /* @__PURE__ */ b(ie, {
133
159
  title: "Posts",
134
160
  description: "Manage all your social media posts",
135
- actions: /* @__PURE__ */ v("button", {
136
- onClick: () => a(b + "/social/compose"),
161
+ actions: /* @__PURE__ */ b("button", {
162
+ onClick: () => o(S + "/social/compose"),
137
163
  className: "inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90",
138
- children: [/* @__PURE__ */ _(m, { className: "h-4 w-4" }), "Create Post"]
164
+ children: [/* @__PURE__ */ y(m, { className: "h-4 w-4" }), "Create Post"]
139
165
  }),
140
166
  children: [
141
- /* @__PURE__ */ _(be, { children: "Every social post you've drafted, scheduled or published, in one feed. Filter by status or platform, switch between grid and list views, and open any post to see how it performed — so you can learn what resonates and post more of it." }),
142
- /* @__PURE__ */ _(ye, { children: /* @__PURE__ */ v("div", {
167
+ /* @__PURE__ */ y(Se, { children: "Every social post you've drafted, scheduled or published, in one feed. Filter by status or platform, switch between grid and list views, and open any post to see how it performed — so you can learn what resonates and post more of it." }),
168
+ /* @__PURE__ */ y(xe, { children: /* @__PURE__ */ b("div", {
143
169
  className: "grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5",
144
170
  children: [
145
- /* @__PURE__ */ _(o, {
171
+ /* @__PURE__ */ y(s, {
146
172
  title: "Total Posts",
147
- value: Le,
148
- icon: /* @__PURE__ */ _(ge, { className: "h-4 w-4" })
173
+ value: X,
174
+ icon: /* @__PURE__ */ y(ve, { className: "h-4 w-4" })
149
175
  }),
150
- /* @__PURE__ */ _(o, {
176
+ /* @__PURE__ */ y(s, {
151
177
  title: "Published",
152
- value: Re,
153
- icon: /* @__PURE__ */ _(fe, { className: "h-4 w-4" })
178
+ value: Ue,
179
+ icon: /* @__PURE__ */ y(me, { className: "h-4 w-4" })
154
180
  }),
155
- /* @__PURE__ */ _(o, {
181
+ /* @__PURE__ */ y(s, {
156
182
  title: "Scheduled",
157
- value: ze,
183
+ value: We,
158
184
  change: 12
159
185
  }),
160
- /* @__PURE__ */ _(o, {
186
+ /* @__PURE__ */ y(s, {
161
187
  title: "Total Engagement",
162
- value: i(Be),
188
+ value: a(Ge),
163
189
  change: 8.4
164
190
  }),
165
- /* @__PURE__ */ _(o, {
191
+ /* @__PURE__ */ y(s, {
166
192
  title: "Avg Engagement",
167
- value: re(Ve),
193
+ value: re(Ke),
168
194
  change: 1.2
169
195
  })
170
196
  ]
171
197
  }) }),
172
- L && /* @__PURE__ */ _("div", {
198
+ L && /* @__PURE__ */ y("div", {
173
199
  className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text",
174
200
  children: L
175
201
  }),
176
- /* @__PURE__ */ _(oe, {
177
- searchValue: S,
178
- onSearchChange: we,
202
+ /* @__PURE__ */ y(oe, {
203
+ searchValue: w,
204
+ onSearchChange: De,
179
205
  searchPlaceholder: "Search posts...",
180
- filters: /* @__PURE__ */ v(g, { children: [
181
- /* @__PURE__ */ v("select", {
182
- value: C,
183
- onChange: (e) => Te(e.target.value),
206
+ filters: /* @__PURE__ */ b(v, { children: [
207
+ /* @__PURE__ */ b("select", {
208
+ value: T,
209
+ onChange: (e) => Oe(e.target.value),
184
210
  className: "rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary",
185
211
  children: [
186
- /* @__PURE__ */ _("option", {
212
+ /* @__PURE__ */ y("option", {
187
213
  value: "all",
188
214
  children: "All Status"
189
215
  }),
190
- /* @__PURE__ */ _("option", {
216
+ /* @__PURE__ */ y("option", {
191
217
  value: "published",
192
218
  children: "Published"
193
219
  }),
194
- /* @__PURE__ */ _("option", {
220
+ /* @__PURE__ */ y("option", {
195
221
  value: "scheduled",
196
222
  children: "Scheduled"
197
223
  }),
198
- /* @__PURE__ */ _("option", {
224
+ /* @__PURE__ */ y("option", {
199
225
  value: "draft",
200
226
  children: "Draft"
201
227
  }),
202
- /* @__PURE__ */ _("option", {
228
+ /* @__PURE__ */ y("option", {
203
229
  value: "failed",
204
230
  children: "Failed"
205
231
  })
206
232
  ]
207
233
  }),
208
- /* @__PURE__ */ v("select", {
209
- value: w,
210
- onChange: (e) => Ee(e.target.value),
234
+ /* @__PURE__ */ b("select", {
235
+ value: E,
236
+ onChange: (e) => ke(e.target.value),
211
237
  className: "rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary",
212
238
  children: [
213
- /* @__PURE__ */ _("option", {
239
+ /* @__PURE__ */ y("option", {
214
240
  value: "all",
215
241
  children: "All Platforms"
216
242
  }),
217
- /* @__PURE__ */ _("option", {
243
+ /* @__PURE__ */ y("option", {
218
244
  value: "instagram",
219
245
  children: "Instagram"
220
246
  }),
221
- /* @__PURE__ */ _("option", {
247
+ /* @__PURE__ */ y("option", {
222
248
  value: "facebook",
223
249
  children: "Facebook"
224
250
  }),
225
- /* @__PURE__ */ _("option", {
251
+ /* @__PURE__ */ y("option", {
226
252
  value: "twitter",
227
253
  children: "Twitter"
228
254
  }),
229
- /* @__PURE__ */ _("option", {
255
+ /* @__PURE__ */ y("option", {
230
256
  value: "linkedin",
231
257
  children: "LinkedIn"
232
258
  }),
233
- /* @__PURE__ */ _("option", {
259
+ /* @__PURE__ */ y("option", {
234
260
  value: "tiktok",
235
261
  children: "TikTok"
236
262
  })
237
263
  ]
238
264
  }),
239
- /* @__PURE__ */ v("select", {
240
- value: T,
241
- onChange: (e) => De(e.target.value),
265
+ /* @__PURE__ */ b("select", {
266
+ value: D,
267
+ onChange: (e) => Ae(e.target.value),
242
268
  className: "rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary",
243
269
  children: [
244
- /* @__PURE__ */ _("option", {
270
+ /* @__PURE__ */ y("option", {
245
271
  value: "newest",
246
272
  children: "Newest"
247
273
  }),
248
- /* @__PURE__ */ _("option", {
274
+ /* @__PURE__ */ y("option", {
249
275
  value: "oldest",
250
276
  children: "Oldest"
251
277
  }),
252
- /* @__PURE__ */ _("option", {
278
+ /* @__PURE__ */ y("option", {
253
279
  value: "engagement",
254
280
  children: "Engagement"
255
281
  })
256
282
  ]
257
283
  })
258
284
  ] }),
259
- actions: /* @__PURE__ */ v("div", {
285
+ actions: /* @__PURE__ */ b("div", {
260
286
  className: "flex rounded-md border border-border-subtle",
261
- children: [/* @__PURE__ */ _("button", {
262
- onClick: () => D("grid"),
263
- className: n("p-2", E === "grid" ? "bg-foreground text-background" : "text-text-secondary"),
287
+ children: [/* @__PURE__ */ y("button", {
288
+ onClick: () => je("grid"),
289
+ className: r("p-2", O === "grid" ? "bg-foreground text-background" : "text-text-secondary"),
264
290
  "aria-label": "Grid view",
265
- children: /* @__PURE__ */ _(pe, { className: "h-4 w-4" })
266
- }), /* @__PURE__ */ _("button", {
267
- onClick: () => D("list"),
268
- className: n("p-2", E === "list" ? "bg-foreground text-background" : "text-text-secondary"),
291
+ children: /* @__PURE__ */ y(he, { className: "h-4 w-4" })
292
+ }), /* @__PURE__ */ y("button", {
293
+ onClick: () => je("list"),
294
+ className: r("p-2", O === "list" ? "bg-foreground text-background" : "text-text-secondary"),
269
295
  "aria-label": "List view",
270
- children: /* @__PURE__ */ _(he, { className: "h-4 w-4" })
296
+ children: /* @__PURE__ */ y(_e, { className: "h-4 w-4" })
271
297
  })]
272
298
  })
273
299
  }),
274
- /* @__PURE__ */ v(se, {
300
+ /* @__PURE__ */ b(se, {
275
301
  loading: U,
276
- error: Ne,
302
+ error: Re,
277
303
  onRetry: W,
278
304
  hasData: !!H,
279
- children: [Y.length === 0 ? /* @__PURE__ */ _(ae, {
305
+ children: [Y.length === 0 ? /* @__PURE__ */ y(ae, {
280
306
  illustration: $ ? "empty-search" : "empty-notifications",
281
307
  title: $ ? "No posts match your filters" : "No posts yet",
282
308
  description: $ ? "Try a different search term, status or platform." : "Compose your first social post to start building your feed.",
283
- action: $ ? void 0 : /* @__PURE__ */ v("button", {
284
- onClick: () => a(b + "/social/compose"),
309
+ action: $ ? void 0 : /* @__PURE__ */ b("button", {
310
+ onClick: () => o(S + "/social/compose"),
285
311
  className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90",
286
- children: [/* @__PURE__ */ _(m, { className: "h-4 w-4" }), "Create Post"]
312
+ children: [/* @__PURE__ */ y(m, { className: "h-4 w-4" }), "Create Post"]
287
313
  })
288
- }) : E === "grid" ? /* @__PURE__ */ _("div", {
314
+ }) : O === "grid" ? /* @__PURE__ */ y("div", {
289
315
  className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",
290
- children: Y.map((e) => /* @__PURE__ */ v("div", {
316
+ children: Y.map((e) => /* @__PURE__ */ b("div", {
291
317
  onClick: () => {
292
- k(e), A(!0);
318
+ Me(e), A(!0);
293
319
  },
294
320
  className: "cursor-pointer rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 space-y-3 hover:border-foreground/30 transition-colors",
295
321
  children: [
296
- /* @__PURE__ */ v("div", {
322
+ /* @__PURE__ */ b("div", {
297
323
  className: "flex items-center justify-between",
298
- children: [/* @__PURE__ */ _("span", {
299
- className: n("rounded-full px-2.5 py-0.5 text-xs font-medium capitalize", y[e.platform]),
324
+ children: [/* @__PURE__ */ y("span", {
325
+ className: r("rounded-full px-2.5 py-0.5 text-xs font-medium capitalize", x[e.platform]),
300
326
  children: e.platform
301
- }), /* @__PURE__ */ v("div", {
327
+ }), /* @__PURE__ */ b("div", {
302
328
  className: "flex items-center gap-1",
303
- children: [/* @__PURE__ */ _(s, { status: e.status }), /* @__PURE__ */ _(l, {
329
+ children: [/* @__PURE__ */ y(c, { status: e.status }), /* @__PURE__ */ y(u, {
304
330
  id: `hm-post-grid-${e.id}`,
305
- items: Q(e),
331
+ items: Qe(e),
306
332
  buttonLabel: "Post actions"
307
333
  })]
308
334
  })]
309
335
  }),
310
- /* @__PURE__ */ _("p", {
336
+ /* @__PURE__ */ y("p", {
311
337
  className: "text-sm text-text-primary line-clamp-3",
312
338
  children: e.content
313
339
  }),
314
- /* @__PURE__ */ v("div", {
340
+ e.status === "failed" && e.errorMessage && /* @__PURE__ */ b("p", {
341
+ className: "flex items-start gap-1.5 text-xs text-status-error-text",
342
+ "data-testid": "hm-post-error",
343
+ children: [/* @__PURE__ */ y(fe, { className: "mt-0.5 h-3 w-3 shrink-0" }), /* @__PURE__ */ y("span", {
344
+ className: "line-clamp-2",
345
+ children: e.errorMessage
346
+ })]
347
+ }),
348
+ /* @__PURE__ */ b("div", {
315
349
  className: "flex items-center justify-between text-xs text-text-secondary",
316
- children: [/* @__PURE__ */ _("span", { children: r(e.createdAt) }), e.status === "published" && /* @__PURE__ */ v("div", {
350
+ children: [/* @__PURE__ */ y("span", { children: i(e.createdAt) }), e.status === "published" && /* @__PURE__ */ b("div", {
317
351
  className: "flex items-center gap-3",
318
352
  children: [
319
- /* @__PURE__ */ v("span", {
353
+ /* @__PURE__ */ b("span", {
320
354
  className: "flex items-center gap-1",
321
- children: [/* @__PURE__ */ _(me, { className: "h-3 w-3" }), i(e.metrics.likes)]
355
+ children: [/* @__PURE__ */ y(ge, { className: "h-3 w-3" }), a(e.metrics.likes)]
322
356
  }),
323
- /* @__PURE__ */ v("span", {
357
+ /* @__PURE__ */ b("span", {
324
358
  className: "flex items-center gap-1",
325
- children: [/* @__PURE__ */ _(ge, { className: "h-3 w-3" }), i(e.metrics.comments)]
359
+ children: [/* @__PURE__ */ y(ve, { className: "h-3 w-3" }), a(e.metrics.comments)]
326
360
  }),
327
- /* @__PURE__ */ v("span", {
361
+ /* @__PURE__ */ b("span", {
328
362
  className: "flex items-center gap-1",
329
- children: [/* @__PURE__ */ _(_e, { className: "h-3 w-3" }), i(e.metrics.shares)]
363
+ children: [/* @__PURE__ */ y(be, { className: "h-3 w-3" }), a(e.metrics.shares)]
330
364
  })
331
365
  ]
332
366
  })]
333
367
  })
334
368
  ]
335
369
  }, e.id))
336
- }) : /* @__PURE__ */ _("div", {
370
+ }) : /* @__PURE__ */ y("div", {
337
371
  className: "space-y-2",
338
- children: Y.map((e) => /* @__PURE__ */ v("div", {
372
+ children: Y.map((e) => /* @__PURE__ */ b("div", {
339
373
  onClick: () => {
340
- k(e), A(!0);
374
+ Me(e), A(!0);
341
375
  },
342
376
  className: "cursor-pointer flex flex-wrap items-center gap-4 rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 hover:border-foreground/30 transition-colors",
343
377
  children: [
344
- /* @__PURE__ */ _("span", {
345
- className: n("rounded-full px-2.5 py-0.5 text-xs font-medium capitalize whitespace-nowrap", y[e.platform]),
378
+ /* @__PURE__ */ y("span", {
379
+ className: r("rounded-full px-2.5 py-0.5 text-xs font-medium capitalize whitespace-nowrap", x[e.platform]),
346
380
  children: e.platform
347
381
  }),
348
- /* @__PURE__ */ _("p", {
382
+ /* @__PURE__ */ y("p", {
349
383
  className: "text-sm text-text-primary flex-1 min-w-[8rem] truncate",
350
384
  children: e.content
351
385
  }),
352
- /* @__PURE__ */ _(s, { status: e.status }),
353
- e.status === "published" && /* @__PURE__ */ v("div", {
386
+ /* @__PURE__ */ y(c, { status: e.status }),
387
+ e.status === "published" && /* @__PURE__ */ b("div", {
354
388
  className: "flex items-center gap-3 text-xs text-text-secondary",
355
- children: [/* @__PURE__ */ v("span", { children: [i(e.metrics.likes), " likes"] }), /* @__PURE__ */ v("span", { children: [i(e.metrics.reach), " reach"] })]
389
+ children: [/* @__PURE__ */ b("span", { children: [a(e.metrics.likes), " likes"] }), /* @__PURE__ */ b("span", { children: [a(e.metrics.reach), " reach"] })]
356
390
  }),
357
- /* @__PURE__ */ _("span", {
391
+ /* @__PURE__ */ y("span", {
358
392
  className: "text-xs text-text-secondary whitespace-nowrap",
359
- children: r(e.createdAt)
393
+ children: i(e.createdAt)
360
394
  }),
361
- /* @__PURE__ */ _(l, {
395
+ /* @__PURE__ */ y(u, {
362
396
  id: `hm-post-list-${e.id}`,
363
- items: Q(e),
397
+ items: Qe(e),
364
398
  buttonLabel: "Post actions"
365
399
  })
366
400
  ]
367
401
  }, e.id))
368
- }), $ && /* @__PURE__ */ _(ce, {
402
+ }), $ && /* @__PURE__ */ y(ce, {
369
403
  page: z.page,
370
404
  pageSize: z.pageSize,
371
405
  total: z.total,
@@ -374,90 +408,129 @@ var b = () => {
374
408
  disabled: U
375
409
  })]
376
410
  }),
377
- /* @__PURE__ */ _(c, {
378
- open: Oe,
411
+ /* @__PURE__ */ y(l, {
412
+ open: Ne,
379
413
  onClose: () => A(!1),
380
414
  title: "Post Details",
381
415
  size: "lg",
382
- footer: O ? /* @__PURE__ */ v(g, { children: [
383
- /* @__PURE__ */ v("button", {
416
+ footer: k ? /* @__PURE__ */ b(v, { children: [
417
+ /* @__PURE__ */ b("button", {
384
418
  type: "button",
385
- onClick: () => We(O),
419
+ onClick: () => Xe(k),
386
420
  className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
387
- children: [/* @__PURE__ */ _(p, { className: "h-4 w-4" }), "Edit"]
421
+ children: [/* @__PURE__ */ y(ye, { className: "h-4 w-4" }), "Edit"]
388
422
  }),
389
- (O.status === "draft" || O.status === "scheduled") && /* @__PURE__ */ v("button", {
423
+ k.status === "failed" && /* @__PURE__ */ b("button", {
390
424
  type: "button",
391
- onClick: () => void Ue(O),
425
+ onClick: () => void Ye(k),
392
426
  className: "inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90",
393
- children: [/* @__PURE__ */ _(h, { className: "h-4 w-4" }), "Publish"]
427
+ children: [/* @__PURE__ */ y(h, { className: "h-4 w-4" }), "Retry publish"]
394
428
  }),
395
- /* @__PURE__ */ v("button", {
429
+ (k.status === "draft" || k.status === "scheduled") && /* @__PURE__ */ b("button", {
396
430
  type: "button",
397
- onClick: () => void He(O),
431
+ onClick: () => void Je(k),
432
+ className: "inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90",
433
+ children: [/* @__PURE__ */ y(g, { className: "h-4 w-4" }), "Publish"]
434
+ }),
435
+ /* @__PURE__ */ b("button", {
436
+ type: "button",
437
+ onClick: () => void qe(k),
398
438
  className: "inline-flex items-center gap-2 rounded-md border border-status-error-border px-4 py-2 text-sm font-medium text-status-error-text hover:bg-status-error-bg/40",
399
- children: [/* @__PURE__ */ _(ve, { className: "h-4 w-4" }), "Delete"]
439
+ children: [/* @__PURE__ */ y(_, { className: "h-4 w-4" }), "Delete"]
400
440
  })
401
441
  ] }) : void 0,
402
- children: O && /* @__PURE__ */ v("div", {
442
+ children: k && /* @__PURE__ */ b("div", {
403
443
  className: "space-y-4",
404
444
  children: [
405
- /* @__PURE__ */ v("div", {
445
+ /* @__PURE__ */ b("div", {
406
446
  className: "flex flex-wrap items-center gap-3",
407
447
  children: [
408
- /* @__PURE__ */ _("span", {
409
- className: n("rounded-full px-2.5 py-0.5 text-xs font-medium capitalize", y[O.platform]),
410
- children: O.platform
448
+ /* @__PURE__ */ y("span", {
449
+ className: r("rounded-full px-2.5 py-0.5 text-xs font-medium capitalize", x[k.platform]),
450
+ children: k.platform
411
451
  }),
412
- /* @__PURE__ */ _(s, { status: O.status }),
413
- /* @__PURE__ */ v("span", {
452
+ /* @__PURE__ */ y(c, { status: k.status }),
453
+ /* @__PURE__ */ b("span", {
414
454
  className: "text-xs text-text-secondary",
415
- children: ["by ", O.author]
455
+ children: ["by ", k.author]
416
456
  })
417
457
  ]
418
458
  }),
419
- /* @__PURE__ */ _("p", {
459
+ /* @__PURE__ */ y("p", {
420
460
  className: "text-sm text-text-primary whitespace-pre-wrap",
421
- children: O.content
461
+ children: k.content
462
+ }),
463
+ k.status === "scheduled" && k.scheduledAt && /* @__PURE__ */ b("p", {
464
+ className: "text-xs text-text-secondary",
465
+ children: [
466
+ "Publishes automatically at",
467
+ " ",
468
+ new Date(k.scheduledAt).toLocaleString()
469
+ ]
470
+ }),
471
+ k.status === "failed" && /* @__PURE__ */ b("div", {
472
+ className: "rounded-md border border-status-error-border/30 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
473
+ "data-testid": "hm-post-detail-error",
474
+ children: [
475
+ /* @__PURE__ */ y("p", {
476
+ className: "font-medium",
477
+ children: "Publishing failed"
478
+ }),
479
+ /* @__PURE__ */ y("p", {
480
+ className: "mt-1 break-words",
481
+ children: k.errorMessage ?? "The platform rejected the post."
482
+ }),
483
+ (k.deliveryAttempts ?? 0) > 0 && /* @__PURE__ */ b("p", {
484
+ className: "mt-1 text-xs",
485
+ children: ["Failed attempts: ", k.deliveryAttempts]
486
+ })
487
+ ]
488
+ }),
489
+ k.postUrl && /* @__PURE__ */ b("a", {
490
+ href: k.postUrl,
491
+ target: "_blank",
492
+ rel: "noopener noreferrer",
493
+ className: "inline-flex items-center gap-1.5 text-sm font-medium text-text-primary underline underline-offset-2 hover:text-text-secondary",
494
+ children: [/* @__PURE__ */ y(pe, { className: "h-4 w-4" }), "View on platform"]
422
495
  }),
423
- O.status === "published" && /* @__PURE__ */ v("div", {
496
+ k.status === "published" && /* @__PURE__ */ b("div", {
424
497
  className: "grid grid-cols-3 gap-4",
425
498
  children: [
426
- /* @__PURE__ */ v("div", {
499
+ /* @__PURE__ */ b("div", {
427
500
  className: "text-center p-3 rounded-md bg-bg-sunken/50",
428
- children: [/* @__PURE__ */ _("p", {
501
+ children: [/* @__PURE__ */ y("p", {
429
502
  className: "text-lg font-bold text-text-primary",
430
- children: i(O.metrics.likes)
431
- }), /* @__PURE__ */ _("p", {
503
+ children: a(k.metrics.likes)
504
+ }), /* @__PURE__ */ y("p", {
432
505
  className: "text-xs text-text-secondary",
433
506
  children: "Likes"
434
507
  })]
435
508
  }),
436
- /* @__PURE__ */ v("div", {
509
+ /* @__PURE__ */ b("div", {
437
510
  className: "text-center p-3 rounded-md bg-bg-sunken/50",
438
- children: [/* @__PURE__ */ _("p", {
511
+ children: [/* @__PURE__ */ y("p", {
439
512
  className: "text-lg font-bold text-text-primary",
440
- children: i(O.metrics.comments)
441
- }), /* @__PURE__ */ _("p", {
513
+ children: a(k.metrics.comments)
514
+ }), /* @__PURE__ */ y("p", {
442
515
  className: "text-xs text-text-secondary",
443
516
  children: "Comments"
444
517
  })]
445
518
  }),
446
- /* @__PURE__ */ v("div", {
519
+ /* @__PURE__ */ b("div", {
447
520
  className: "text-center p-3 rounded-md bg-bg-sunken/50",
448
- children: [/* @__PURE__ */ _("p", {
521
+ children: [/* @__PURE__ */ y("p", {
449
522
  className: "text-lg font-bold text-text-primary",
450
- children: i(O.metrics.reach)
451
- }), /* @__PURE__ */ _("p", {
523
+ children: a(k.metrics.reach)
524
+ }), /* @__PURE__ */ y("p", {
452
525
  className: "text-xs text-text-secondary",
453
526
  children: "Reach"
454
527
  })]
455
528
  })
456
529
  ]
457
530
  }),
458
- /* @__PURE__ */ _("div", {
531
+ /* @__PURE__ */ y("div", {
459
532
  className: "flex flex-wrap gap-1",
460
- children: O.tags.map((e) => /* @__PURE__ */ _("span", {
533
+ children: k.tags.map((e) => /* @__PURE__ */ y("span", {
461
534
  className: "rounded-full border border-border-subtle px-2.5 py-0.5 text-xs text-text-secondary",
462
535
  children: e.startsWith("#") ? e : `#${e}`
463
536
  }, e))
@@ -465,30 +538,30 @@ var b = () => {
465
538
  ]
466
539
  })
467
540
  }),
468
- /* @__PURE__ */ _(c, {
469
- open: ke,
541
+ /* @__PURE__ */ y(l, {
542
+ open: Pe,
470
543
  onClose: () => j(!1),
471
544
  title: "Edit Post",
472
545
  description: "Update the caption. Hashtags are re-detected automatically.",
473
546
  size: "lg",
474
- footer: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("button", {
547
+ footer: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("button", {
475
548
  type: "button",
476
549
  onClick: () => j(!1),
477
550
  className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
478
551
  children: "Cancel"
479
- }), /* @__PURE__ */ _("button", {
552
+ }), /* @__PURE__ */ y("button", {
480
553
  type: "button",
481
- onClick: Ge,
554
+ onClick: Ze,
482
555
  disabled: G,
483
556
  className: "inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90 disabled:opacity-60",
484
557
  children: G ? "Saving..." : "Save changes"
485
558
  })] }),
486
- children: /* @__PURE__ */ v("div", {
559
+ children: /* @__PURE__ */ b("div", {
487
560
  className: "space-y-3",
488
- children: [F && /* @__PURE__ */ _("div", {
561
+ children: [F && /* @__PURE__ */ y("div", {
489
562
  className: "rounded-md border border-status-error-border/30 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
490
563
  children: F
491
- }), /* @__PURE__ */ _("textarea", {
564
+ }), /* @__PURE__ */ y("textarea", {
492
565
  value: N,
493
566
  onChange: (e) => P(e.target.value),
494
567
  rows: 6,
@@ -501,6 +574,6 @@ var b = () => {
501
574
  });
502
575
  };
503
576
  //#endregion
504
- export { b as PostsPage };
577
+ export { S as PostsPage };
505
578
 
506
579
  //# sourceMappingURL=PostsPage.js.map