@burdenoff/microfe-support 2026.830.1 → 2026.830.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.
- package/dist/index.js +2 -1
- package/dist/support/SupportAdminRoot.js +31 -34
- package/dist/support/SupportAdminRoot.js.map +1 -1
- package/dist/support/SupportUserRoot.js +19 -22
- package/dist/support/SupportUserRoot.js.map +1 -1
- package/dist/support/components/PageLayout.d.ts +1 -1
- package/dist/support/components/PageLayout.js +46 -44
- package/dist/support/components/PageLayout.js.map +1 -1
- package/dist/support/components/analytics/CategoryBreakdown.js +24 -23
- package/dist/support/components/analytics/CategoryBreakdown.js.map +1 -1
- package/dist/support/components/analytics/PriorityBreakdown.js +27 -26
- package/dist/support/components/analytics/PriorityBreakdown.js.map +1 -1
- package/dist/support/components/analytics/SLAReport.js +48 -54
- package/dist/support/components/analytics/SLAReport.js.map +1 -1
- package/dist/support/components/analytics/SatisfactionDistribution.js +56 -59
- package/dist/support/components/analytics/SatisfactionDistribution.js.map +1 -1
- package/dist/support/components/analytics/TopAgents.js +27 -26
- package/dist/support/components/analytics/TopAgents.js.map +1 -1
- package/dist/support/components/analytics/TrendChart.js +23 -21
- package/dist/support/components/analytics/TrendChart.js.map +1 -1
- package/dist/support/components/kb/ArticleForm.js +145 -132
- package/dist/support/components/kb/ArticleForm.js.map +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.js +104 -103
- package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.js +120 -123
- package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.js +175 -180
- package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -1
- package/dist/support/components/tickets/AttachmentList.js +21 -20
- package/dist/support/components/tickets/AttachmentList.js.map +1 -1
- package/dist/support/components/tickets/MessageComposer.js +35 -35
- package/dist/support/components/tickets/MessageThread.js +55 -54
- package/dist/support/components/tickets/MessageThread.js.map +1 -1
- package/dist/support/components/tickets/TicketDetailHeader.js +62 -57
- package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -1
- package/dist/support/components/tickets/TicketHeader.js +47 -47
- package/dist/support/components/tickets/TicketSidebar.js +122 -121
- package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
- package/dist/support/hooks/index.d.ts +1 -0
- package/dist/support/hooks/index.js +1 -0
- package/dist/support/hooks/useTr.d.ts +16 -0
- package/dist/support/hooks/useTr.js +12 -0
- package/dist/support/hooks/useTr.js.map +1 -0
- package/dist/support/index.d.ts +1 -0
- package/dist/support/index.js +2 -1
- package/dist/support/pages/AnalyticsPage.js +151 -145
- package/dist/support/pages/AnalyticsPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.js +134 -147
- package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailUserPage.js +70 -79
- package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
- package/dist/support/pages/ContactInquiriesPage.js +140 -139
- package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.js +259 -232
- package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
- package/dist/support/pages/CreateArticlePage.js +57 -56
- package/dist/support/pages/CreateArticlePage.js.map +1 -1
- package/dist/support/pages/CreateTicketPage.js +151 -146
- package/dist/support/pages/CreateTicketPage.js.map +1 -1
- package/dist/support/pages/EditArticlePage.js +80 -79
- package/dist/support/pages/EditArticlePage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.js +92 -99
- package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.js +85 -92
- package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
- package/dist/support/pages/SettingsPage.js +88 -87
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.js +91 -90
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/pages/TicketDetailUserPage.js +120 -118
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.js +139 -139
- package/dist/support/translations/en.d.ts +814 -0
- package/dist/support/translations/en.js +779 -0
- package/dist/support/translations/en.js.map +1 -0
- package/dist/support/translations/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { useSupport as t } from "../providers/SupportProvider.js";
|
|
3
|
+
import { Button as n, PagePurpose as r } from "../components/ui.js";
|
|
4
|
+
import { EmptyState as i, LoadingState as a, PageLayout as o } from "../components/PageLayout.js";
|
|
5
|
+
import { useKnowledgeBaseOperations as s } from "../hooks/useKnowledgeBaseOperations.js";
|
|
6
|
+
import { ArticleForm as c } from "../components/kb/ArticleForm.js";
|
|
7
|
+
import { useEffect as l, useRef as u, useState as d } from "react";
|
|
8
|
+
import { AlertCircle as f, ArrowLeft as p, CheckCircle as m, FileEdit as h, ShieldAlert as g } from "lucide-react";
|
|
9
|
+
import { useNavigate as _, useParams as v } from "react-router";
|
|
10
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
10
11
|
//#region src/support/pages/EditArticlePage.tsx
|
|
11
|
-
function
|
|
12
|
+
function x(e) {
|
|
12
13
|
return e ? [
|
|
13
14
|
"admin",
|
|
14
15
|
"super_admin",
|
|
@@ -16,14 +17,14 @@ function b(e) {
|
|
|
16
17
|
"owner"
|
|
17
18
|
].includes(e.toLowerCase()) : !1;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
function S() {
|
|
21
|
+
let S = _(), { slug: C } = v(), { basePath: w = "", currentUser: T } = t(), E = e(), D = x(T?.role), { articleDetail: O, articleLoading: k, categories: A, updateArticle: j, updatingArticle: M } = s(C), [N, P] = d(null), F = u(null), I = u(null);
|
|
22
|
+
l(() => () => {
|
|
23
|
+
F.current && clearTimeout(F.current), I.current && clearTimeout(I.current);
|
|
23
24
|
}, []);
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
await
|
|
25
|
+
let L = async (e) => {
|
|
26
|
+
if (O?.id) try {
|
|
27
|
+
await j(O.id, {
|
|
27
28
|
title: e.title,
|
|
28
29
|
slug: e.slug,
|
|
29
30
|
content: e.content,
|
|
@@ -32,117 +33,117 @@ function x() {
|
|
|
32
33
|
tags: e.tags.length > 0 ? e.tags : void 0,
|
|
33
34
|
metaDescription: e.metaDescription || void 0,
|
|
34
35
|
status: e.status
|
|
35
|
-
}),
|
|
36
|
+
}), P({
|
|
36
37
|
type: "success",
|
|
37
|
-
message: "Article updated successfully!"
|
|
38
|
-
}),
|
|
38
|
+
message: E("support.article.notifications.updated", "Article updated successfully!")
|
|
39
|
+
}), F.current && clearTimeout(F.current), F.current = setTimeout(() => S(`../../${e.slug}`), 1e3);
|
|
39
40
|
} catch {
|
|
40
|
-
|
|
41
|
+
P({
|
|
41
42
|
type: "error",
|
|
42
|
-
message: "Failed to update article. Please try again."
|
|
43
|
-
}),
|
|
43
|
+
message: E("support.article.errors.updateFailed", "Failed to update article. Please try again.")
|
|
44
|
+
}), I.current && clearTimeout(I.current), I.current = setTimeout(() => P(null), 3e3);
|
|
44
45
|
}
|
|
45
|
-
},
|
|
46
|
-
|
|
46
|
+
}, R = () => {
|
|
47
|
+
S("..");
|
|
47
48
|
};
|
|
48
|
-
if (!
|
|
49
|
+
if (!D) return /* @__PURE__ */ y(o, {
|
|
49
50
|
showHeader: !1,
|
|
50
|
-
children: /* @__PURE__ */
|
|
51
|
-
icon: /* @__PURE__ */
|
|
52
|
-
title: "Admin Access Required",
|
|
53
|
-
description: "You need administrator privileges to edit knowledge base articles.",
|
|
54
|
-
action: /* @__PURE__ */
|
|
55
|
-
onClick: () =>
|
|
56
|
-
children: [/* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ y(i, {
|
|
52
|
+
icon: /* @__PURE__ */ y(g, { size: 48 }),
|
|
53
|
+
title: E("support.article.adminRequired.title", "Admin Access Required"),
|
|
54
|
+
description: E("support.article.adminRequired.editDescription", "You need administrator privileges to edit knowledge base articles."),
|
|
55
|
+
action: /* @__PURE__ */ b(n, {
|
|
56
|
+
onClick: () => S(`${w}/kb`),
|
|
57
|
+
children: [/* @__PURE__ */ y(p, { size: 18 }), E("support.article.actions.backToKnowledgeBase", "Back to Knowledge Base")]
|
|
57
58
|
})
|
|
58
59
|
})
|
|
59
60
|
});
|
|
60
|
-
if (
|
|
61
|
+
if (k) return /* @__PURE__ */ y(o, {
|
|
61
62
|
showHeader: !1,
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ y(a, { message: E("support.article.loading", "Loading article...") })
|
|
63
64
|
});
|
|
64
|
-
if (!
|
|
65
|
+
if (!O) return /* @__PURE__ */ y(o, {
|
|
65
66
|
showHeader: !1,
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ y(i, {
|
|
67
68
|
illustration: "empty-search",
|
|
68
|
-
title: "Article not found",
|
|
69
|
-
description: "The article you're trying to edit doesn't exist or has been removed.",
|
|
70
|
-
action: /* @__PURE__ */
|
|
71
|
-
onClick: () =>
|
|
72
|
-
children: "Back to Knowledge Base"
|
|
69
|
+
title: E("support.article.notFound.title", "Article not found"),
|
|
70
|
+
description: E("support.article.notFound.editDescription", "The article you're trying to edit doesn't exist or has been removed."),
|
|
71
|
+
action: /* @__PURE__ */ y(n, {
|
|
72
|
+
onClick: () => S("../../.."),
|
|
73
|
+
children: E("support.article.actions.backToKnowledgeBase", "Back to Knowledge Base")
|
|
73
74
|
})
|
|
74
75
|
})
|
|
75
76
|
});
|
|
76
|
-
let
|
|
77
|
-
title:
|
|
78
|
-
slug:
|
|
79
|
-
content:
|
|
80
|
-
excerpt:
|
|
81
|
-
categoryId:
|
|
82
|
-
tags:
|
|
77
|
+
let z = {
|
|
78
|
+
title: O.title,
|
|
79
|
+
slug: O.slug,
|
|
80
|
+
content: O.content,
|
|
81
|
+
excerpt: O.excerpt || "",
|
|
82
|
+
categoryId: O.categoryId || "",
|
|
83
|
+
tags: O.tags || [],
|
|
83
84
|
metaDescription: "",
|
|
84
|
-
status:
|
|
85
|
+
status: O.status
|
|
85
86
|
};
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ b(o, {
|
|
87
88
|
showHeader: !1,
|
|
88
89
|
children: [
|
|
89
|
-
|
|
90
|
-
className: `fixed right-4 top-[calc(var(--header-height,4rem)+1rem)] z-[200] flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-200 ${
|
|
91
|
-
children: [
|
|
90
|
+
N && /* @__PURE__ */ b("div", {
|
|
91
|
+
className: `fixed right-4 top-[calc(var(--header-height,4rem)+1rem)] z-[200] flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-200 ${N.type === "success" ? "bg-success/10 text-success border-success/30" : "bg-error/10 text-error border-error/30"}`,
|
|
92
|
+
children: [N.type === "success" ? /* @__PURE__ */ y(m, {
|
|
92
93
|
size: 20,
|
|
93
94
|
className: "text-success"
|
|
94
|
-
}) : /* @__PURE__ */
|
|
95
|
+
}) : /* @__PURE__ */ y(f, {
|
|
95
96
|
size: 20,
|
|
96
97
|
className: "text-error"
|
|
97
|
-
}), /* @__PURE__ */
|
|
98
|
+
}), /* @__PURE__ */ y("span", {
|
|
98
99
|
className: "font-medium",
|
|
99
|
-
children:
|
|
100
|
+
children: N.message
|
|
100
101
|
})]
|
|
101
102
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ b("div", {
|
|
103
104
|
className: "flex items-center gap-4 mb-6",
|
|
104
|
-
children: [/* @__PURE__ */
|
|
105
|
+
children: [/* @__PURE__ */ y(n, {
|
|
105
106
|
variant: "ghost",
|
|
106
107
|
size: "sm",
|
|
107
|
-
onClick: () =>
|
|
108
|
+
onClick: () => S(".."),
|
|
108
109
|
className: "p-2",
|
|
109
|
-
children: /* @__PURE__ */
|
|
110
|
-
}), /* @__PURE__ */
|
|
110
|
+
children: /* @__PURE__ */ y(p, { size: 20 })
|
|
111
|
+
}), /* @__PURE__ */ b("div", {
|
|
111
112
|
className: "flex items-center gap-3",
|
|
112
|
-
children: [/* @__PURE__ */
|
|
113
|
+
children: [/* @__PURE__ */ y("div", {
|
|
113
114
|
className: "p-2 rounded-lg bg-action-primary-bg/10",
|
|
114
|
-
children: /* @__PURE__ */
|
|
115
|
+
children: /* @__PURE__ */ y(h, {
|
|
115
116
|
size: 24,
|
|
116
117
|
className: "text-primary"
|
|
117
118
|
})
|
|
118
|
-
}), /* @__PURE__ */
|
|
119
|
+
}), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("h1", {
|
|
119
120
|
className: "text-2xl font-bold text-text-primary",
|
|
120
|
-
children: "Edit Article"
|
|
121
|
-
}), /* @__PURE__ */
|
|
121
|
+
children: E("support.article.editTitle", "Edit Article")
|
|
122
|
+
}), /* @__PURE__ */ y("p", {
|
|
122
123
|
className: "text-sm text-text-secondary",
|
|
123
|
-
children:
|
|
124
|
+
children: O.title
|
|
124
125
|
})] })]
|
|
125
126
|
})]
|
|
126
127
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ y(r, {
|
|
128
129
|
className: "mb-6 max-w-3xl",
|
|
129
|
-
children: "Refine an existing knowledge base article. Keep guides accurate as your product evolves, fix unclear steps, or move an article between draft and published. Changes go live for customers as soon as you save a published article."
|
|
130
|
+
children: E("support.article.editPurpose", "Refine an existing knowledge base article. Keep guides accurate as your product evolves, fix unclear steps, or move an article between draft and published. Changes go live for customers as soon as you save a published article.")
|
|
130
131
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ y("div", {
|
|
132
133
|
className: "max-w-3xl",
|
|
133
|
-
children: /* @__PURE__ */
|
|
134
|
-
initialData:
|
|
135
|
-
categories:
|
|
136
|
-
onSubmit:
|
|
137
|
-
onCancel:
|
|
138
|
-
isSubmitting:
|
|
139
|
-
submitLabel: "Update Article"
|
|
134
|
+
children: /* @__PURE__ */ y(c, {
|
|
135
|
+
initialData: z,
|
|
136
|
+
categories: A,
|
|
137
|
+
onSubmit: L,
|
|
138
|
+
onCancel: R,
|
|
139
|
+
isSubmitting: M,
|
|
140
|
+
submitLabel: E("support.articleForm.actions.update", "Update Article")
|
|
140
141
|
})
|
|
141
142
|
})
|
|
142
143
|
]
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
//#endregion
|
|
146
|
-
export {
|
|
147
|
+
export { S as EditArticlePage };
|
|
147
148
|
|
|
148
149
|
//# sourceMappingURL=EditArticlePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditArticlePage.js","names":[],"sources":["../../../src/support/pages/EditArticlePage.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { useNavigate, useParams } from 'react-router';\nimport { ArrowLeft, FileEdit, AlertCircle, CheckCircle, ShieldAlert } from 'lucide-react';\nimport { Button, PagePurpose } from '../components/ui';\nimport { ArticleForm, type ArticleFormData } from '../components/kb/ArticleForm';\nimport { useKnowledgeBaseOperations } from '../hooks/useKnowledgeBaseOperations';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\nimport { useSupport } from '../providers/SupportProvider';\nimport { ArticleStatus } from '../../generated/global-types';\n\n/**\n * Check if the current user has admin privileges.\n */\nfunction isUserAdmin(role?: string): boolean {\n if (!role) return false;\n const adminRoles = ['admin', 'super_admin', 'workspace_admin', 'owner'];\n return adminRoles.includes(role.toLowerCase());\n}\n\nexport function EditArticlePage() {\n const navigate = useNavigate();\n const { slug } = useParams<{ slug: string }>();\n const { basePath = '', currentUser } = useSupport();\n const isAdmin = isUserAdmin(currentUser?.role);\n const { articleDetail, articleLoading, categories, updateArticle, updatingArticle } =\n useKnowledgeBaseOperations(slug);\n\n const [notification, setNotification] = useState<{\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const navigateTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const notificationTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (navigateTimerRef.current) clearTimeout(navigateTimerRef.current);\n if (notificationTimerRef.current) clearTimeout(notificationTimerRef.current);\n };\n }, []);\n\n const handleSubmit = async (data: ArticleFormData) => {\n if (!articleDetail?.id) return;\n\n try {\n await updateArticle(articleDetail.id, {\n title: data.title,\n slug: data.slug,\n content: data.content,\n excerpt: data.excerpt || undefined,\n categoryId: data.categoryId || undefined,\n tags: data.tags.length > 0 ? data.tags : undefined,\n metaDescription: data.metaDescription || undefined,\n status: data.status as ArticleStatus,\n });\n\n setNotification({ type: 'success', message: 'Article updated successfully!' });\n if (navigateTimerRef.current) clearTimeout(navigateTimerRef.current);\n navigateTimerRef.current = setTimeout(() => navigate(`../../${data.slug}`), 1000);\n } catch {\n setNotification({ type: 'error', message: 'Failed to update article. Please try again.' });\n if (notificationTimerRef.current) clearTimeout(notificationTimerRef.current);\n notificationTimerRef.current = setTimeout(() => setNotification(null), 3000);\n }\n };\n\n const handleCancel = () => {\n navigate('..');\n };\n\n // Non-admin users cannot edit articles\n if (!isAdmin) {\n return (\n <PageLayout showHeader={false}>\n <EmptyState\n icon={<ShieldAlert size={48} />}\n title=\"Admin Access Required\"\n description=\"You need administrator privileges to edit knowledge base articles.\"\n action={\n <Button onClick={() => navigate(`${basePath}/kb`)}>\n <ArrowLeft size={18} />\n Back to Knowledge Base\n </Button>\n }\n />\n </PageLayout>\n );\n }\n\n if (articleLoading) {\n return (\n <PageLayout showHeader={false}>\n <LoadingState message=\"Loading article...\" />\n </PageLayout>\n );\n }\n\n if (!articleDetail) {\n return (\n <PageLayout showHeader={false}>\n <EmptyState\n illustration=\"empty-search\"\n title=\"Article not found\"\n description=\"The article you're trying to edit doesn't exist or has been removed.\"\n action={<Button onClick={() => navigate('../../..')}>Back to Knowledge Base</Button>}\n />\n </PageLayout>\n );\n }\n\n const initialData: Partial<ArticleFormData> = {\n title: articleDetail.title,\n slug: articleDetail.slug,\n content: articleDetail.content,\n excerpt: articleDetail.excerpt || '',\n categoryId: articleDetail.categoryId || '',\n tags: articleDetail.tags || [],\n metaDescription: '',\n status: articleDetail.status as 'DRAFT' | 'PUBLISHED',\n };\n\n return (\n <PageLayout showHeader={false}>\n {/* Notification */}\n {notification && (\n <div\n className={`fixed right-4 top-[calc(var(--header-height,4rem)+1rem)] z-[200] flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-200 ${\n notification.type === 'success'\n ? 'bg-success/10 text-success border-success/30'\n : 'bg-error/10 text-error border-error/30'\n }`}\n >\n {notification.type === 'success' ? (\n <CheckCircle size={20} className=\"text-success\" />\n ) : (\n <AlertCircle size={20} className=\"text-error\" />\n )}\n <span className=\"font-medium\">{notification.message}</span>\n </div>\n )}\n\n {/* Header */}\n <div className=\"flex items-center gap-4 mb-6\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate('..')} className=\"p-2\">\n <ArrowLeft size={20} />\n </Button>\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-action-primary-bg/10\">\n <FileEdit size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">Edit Article</h1>\n <p className=\"text-sm text-text-secondary\">{articleDetail.title}</p>\n </div>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6 max-w-3xl\">\n Refine an existing knowledge base article. Keep guides accurate as your product evolves, fix\n unclear steps, or move an article between draft and published. Changes go live for customers\n as soon as you save a published article.\n </PagePurpose>\n\n {/* Form */}\n <div className=\"max-w-3xl\">\n <ArticleForm\n initialData={initialData}\n categories={categories}\n onSubmit={handleSubmit}\n onCancel={handleCancel}\n isSubmitting={updatingArticle}\n submitLabel=\"Update Article\"\n />\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAS,EAAY,GAAwB;CAG3C,OAFK,IAEE;EADa;EAAS;EAAe;EAAmB;CACxD,CAAA,CAAW,SAAS,EAAK,YAAY,CAAC,IAF3B;AAGpB;AAEA,SAAgB,IAAkB;CAChC,IAAM,IAAW,EAAY,GACvB,EAAE,YAAS,EAA4B,GACvC,EAAE,cAAW,IAAI,mBAAgB,EAAW,GAC5C,IAAU,EAAY,GAAa,IAAI,GACvC,EAAE,kBAAe,mBAAgB,eAAY,kBAAe,uBAChE,EAA2B,CAAI,GAE3B,CAAC,GAAc,KAAmB,EAG9B,IAAI,GACR,IAAmB,EAA6C,IAAI,GACpE,IAAuB,EAA6C,IAAI;CAE9E,cACe;EAEX,AADI,EAAiB,WAAS,aAAa,EAAiB,OAAO,GAC/D,EAAqB,WAAS,aAAa,EAAqB,OAAO;CAC7E,GACC,CAAC,CAAC;CAEL,IAAM,IAAe,OAAO,MAA0B;EAC/C,OAAe,IAEpB,IAAI;GAcF,AAbA,MAAM,EAAc,EAAc,IAAI;IACpC,OAAO,EAAK;IACZ,MAAM,EAAK;IACX,SAAS,EAAK;IACd,SAAS,EAAK,WAAW,KAAA;IACzB,YAAY,EAAK,cAAc,KAAA;IAC/B,MAAM,EAAK,KAAK,SAAS,IAAI,EAAK,OAAO,KAAA;IACzC,iBAAiB,EAAK,mBAAmB,KAAA;IACzC,QAAQ,EAAK;GACf,CAAC,GAED,EAAgB;IAAE,MAAM;IAAW,SAAS;GAAgC,CAAC,GACzE,EAAiB,WAAS,aAAa,EAAiB,OAAO,GACnE,EAAiB,UAAU,iBAAiB,EAAS,SAAS,EAAK,MAAM,GAAG,GA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gB,CAAA,IAEjD,kBAAC,GAAD;KAAa,MAAM;KAAI,WAAU;IAAc,CAAA,GAEjD,kBAAC,QAAD;KAAM,WAAU;KAAe,UAAA,EAAa;IAAc,CAAA,CACvD;;GAIP,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,GAAD;KAAQ,SAAQ;KAAQ,MAAK;KAAK,eAAe,EAAS,IAAI;KAAG,WAAU;KACzE,UAAA,kBAAC,GAAD,EAAW,MAAM,GAAK,CAAA;IAChB,CAAA,GACR,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAAC,GAAD;OAAU,MAAM;OAAI,WAAU;MAAgB,CAAA;KAC3C,CAAA,GACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;MAAuC,UAAA;KAAgB,CAAA,GACrE,kBAAC,KAAD;MAAG,WAAU;MAA+B,UAAA,EAAc;KAAS,CAAA,CAChE,EAAA,CAAA,CACF;IACF,CAAA,CAAA;;GAEL,kBAAC,GAAD;IAAa,WAAU;IAAiB,UAAA;GAI3B,CAAA;GAGb,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,GAAD;KACe;KACD;KACZ,UAAU;KACV,UAAU;KACV,cAAc;KACd,aAAY;IACb,CAAA;GACE,CAAA;EACK;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"EditArticlePage.js","names":[],"sources":["../../../src/support/pages/EditArticlePage.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { useNavigate, useParams } from 'react-router';\nimport { ArrowLeft, FileEdit, AlertCircle, CheckCircle, ShieldAlert } from 'lucide-react';\nimport { Button, PagePurpose } from '../components/ui';\nimport { ArticleForm, type ArticleFormData } from '../components/kb/ArticleForm';\nimport { useTr } from '../hooks/useTr';\nimport { useKnowledgeBaseOperations } from '../hooks/useKnowledgeBaseOperations';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\nimport { useSupport } from '../providers/SupportProvider';\nimport { ArticleStatus } from '../../generated/global-types';\n\n/**\n * Check if the current user has admin privileges.\n */\nfunction isUserAdmin(role?: string): boolean {\n if (!role) return false;\n const adminRoles = ['admin', 'super_admin', 'workspace_admin', 'owner'];\n return adminRoles.includes(role.toLowerCase());\n}\n\nexport function EditArticlePage() {\n const navigate = useNavigate();\n const { slug } = useParams<{ slug: string }>();\n const { basePath = '', currentUser } = useSupport();\n const tr = useTr();\n const isAdmin = isUserAdmin(currentUser?.role);\n const { articleDetail, articleLoading, categories, updateArticle, updatingArticle } =\n useKnowledgeBaseOperations(slug);\n\n const [notification, setNotification] = useState<{\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const navigateTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const notificationTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (navigateTimerRef.current) clearTimeout(navigateTimerRef.current);\n if (notificationTimerRef.current) clearTimeout(notificationTimerRef.current);\n };\n }, []);\n\n const handleSubmit = async (data: ArticleFormData) => {\n if (!articleDetail?.id) return;\n\n try {\n await updateArticle(articleDetail.id, {\n title: data.title,\n slug: data.slug,\n content: data.content,\n excerpt: data.excerpt || undefined,\n categoryId: data.categoryId || undefined,\n tags: data.tags.length > 0 ? data.tags : undefined,\n metaDescription: data.metaDescription || undefined,\n status: data.status as ArticleStatus,\n });\n\n setNotification({\n type: 'success',\n message: tr('support.article.notifications.updated', 'Article updated successfully!'),\n });\n if (navigateTimerRef.current) clearTimeout(navigateTimerRef.current);\n navigateTimerRef.current = setTimeout(() => navigate(`../../${data.slug}`), 1000);\n } catch {\n setNotification({\n type: 'error',\n message: tr(\n 'support.article.errors.updateFailed',\n 'Failed to update article. Please try again.'\n ),\n });\n if (notificationTimerRef.current) clearTimeout(notificationTimerRef.current);\n notificationTimerRef.current = setTimeout(() => setNotification(null), 3000);\n }\n };\n\n const handleCancel = () => {\n navigate('..');\n };\n\n // Non-admin users cannot edit articles\n if (!isAdmin) {\n return (\n <PageLayout showHeader={false}>\n <EmptyState\n icon={<ShieldAlert size={48} />}\n title={tr('support.article.adminRequired.title', 'Admin Access Required')}\n description={tr(\n 'support.article.adminRequired.editDescription',\n 'You need administrator privileges to edit knowledge base articles.'\n )}\n action={\n <Button onClick={() => navigate(`${basePath}/kb`)}>\n <ArrowLeft size={18} />\n {tr('support.article.actions.backToKnowledgeBase', 'Back to Knowledge Base')}\n </Button>\n }\n />\n </PageLayout>\n );\n }\n\n if (articleLoading) {\n return (\n <PageLayout showHeader={false}>\n <LoadingState message={tr('support.article.loading', 'Loading article...')} />\n </PageLayout>\n );\n }\n\n if (!articleDetail) {\n return (\n <PageLayout showHeader={false}>\n <EmptyState\n illustration=\"empty-search\"\n title={tr('support.article.notFound.title', 'Article not found')}\n description={tr(\n 'support.article.notFound.editDescription',\n \"The article you're trying to edit doesn't exist or has been removed.\"\n )}\n action={\n <Button onClick={() => navigate('../../..')}>\n {tr('support.article.actions.backToKnowledgeBase', 'Back to Knowledge Base')}\n </Button>\n }\n />\n </PageLayout>\n );\n }\n\n const initialData: Partial<ArticleFormData> = {\n title: articleDetail.title,\n slug: articleDetail.slug,\n content: articleDetail.content,\n excerpt: articleDetail.excerpt || '',\n categoryId: articleDetail.categoryId || '',\n tags: articleDetail.tags || [],\n metaDescription: '',\n status: articleDetail.status as 'DRAFT' | 'PUBLISHED',\n };\n\n return (\n <PageLayout showHeader={false}>\n {/* Notification */}\n {notification && (\n <div\n className={`fixed right-4 top-[calc(var(--header-height,4rem)+1rem)] z-[200] flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-200 ${\n notification.type === 'success'\n ? 'bg-success/10 text-success border-success/30'\n : 'bg-error/10 text-error border-error/30'\n }`}\n >\n {notification.type === 'success' ? (\n <CheckCircle size={20} className=\"text-success\" />\n ) : (\n <AlertCircle size={20} className=\"text-error\" />\n )}\n <span className=\"font-medium\">{notification.message}</span>\n </div>\n )}\n\n {/* Header */}\n <div className=\"flex items-center gap-4 mb-6\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate('..')} className=\"p-2\">\n <ArrowLeft size={20} />\n </Button>\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-action-primary-bg/10\">\n <FileEdit size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">\n {tr('support.article.editTitle', 'Edit Article')}\n </h1>\n <p className=\"text-sm text-text-secondary\">{articleDetail.title}</p>\n </div>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6 max-w-3xl\">\n {tr(\n 'support.article.editPurpose',\n 'Refine an existing knowledge base article. Keep guides accurate as your product evolves, fix unclear steps, or move an article between draft and published. Changes go live for customers as soon as you save a published article.'\n )}\n </PagePurpose>\n\n {/* Form */}\n <div className=\"max-w-3xl\">\n <ArticleForm\n initialData={initialData}\n categories={categories}\n onSubmit={handleSubmit}\n onCancel={handleCancel}\n isSubmitting={updatingArticle}\n submitLabel={tr('support.articleForm.actions.update', 'Update Article')}\n />\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;AAcA,SAAS,EAAY,GAAwB;CAG3C,OAFK,IAEE;EADa;EAAS;EAAe;EAAmB;CACxD,CAAA,CAAW,SAAS,EAAK,YAAY,CAAC,IAF3B;AAGpB;AAEA,SAAgB,IAAkB;CAChC,IAAM,IAAW,EAAY,GACvB,EAAE,YAAS,EAA4B,GACvC,EAAE,cAAW,IAAI,mBAAgB,EAAW,GAC5C,IAAK,EAAM,GACX,IAAU,EAAY,GAAa,IAAI,GACvC,EAAE,kBAAe,mBAAgB,eAAY,kBAAe,uBAChE,EAA2B,CAAI,GAE3B,CAAC,GAAc,KAAmB,EAG9B,IAAI,GACR,IAAmB,EAA6C,IAAI,GACpE,IAAuB,EAA6C,IAAI;CAE9E,cACe;EAEX,AADI,EAAiB,WAAS,aAAa,EAAiB,OAAO,G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U;MACX,UAAA,EAAG,6BAA6B,cAAc;KAC7C,CAAA,GACJ,kBAAC,KAAD;MAAG,WAAU;MAA+B,UAAA,EAAc;KAAS,CAAA,CAChE,EAAA,CAAA,CACF;IACF,CAAA,CAAA;;GAEL,kBAAC,GAAD;IAAa,WAAU;IACpB,UAAA,EACC,+BACA,oOACF;GACW,CAAA;GAGb,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,GAAD;KACe;KACD;KACZ,UAAU;KACV,UAAU;KACV,cAAc;KACd,aAAa,EAAG,sCAAsC,gBAAgB;IACvE,CAAA;GACE,CAAA;EACK;;AAEhB"}
|
|
@@ -1,212 +1,205 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { useSupport as t } from "../providers/SupportProvider.js";
|
|
3
|
+
import { Badge as n, Button as r, GlassCard as i, Input as a, PagePurpose as o } from "../components/ui.js";
|
|
4
|
+
import { EmptyState as s, LoadingState as c, PageLayout as l } from "../components/PageLayout.js";
|
|
5
|
+
import { getCategoryBadgeClass as u } from "../utils/categoryColors.js";
|
|
6
|
+
import { useKnowledgeBaseOperations as d } from "../hooks/useKnowledgeBaseOperations.js";
|
|
7
|
+
import { useState as f } from "react";
|
|
8
|
+
import { Archive as p, BookOpen as m, Eye as h, FolderOpen as g, GlobeLock as _, Plus as v, Search as y, ThumbsUp as b, TrendingUp as x } from "lucide-react";
|
|
9
|
+
import { useNavigate as S } from "react-router";
|
|
10
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
10
11
|
//#region src/support/pages/KnowledgeBaseAdminPage.tsx
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
e.preventDefault(),
|
|
14
|
-
},
|
|
15
|
-
|
|
12
|
+
function E() {
|
|
13
|
+
let E = S(), { basePath: D = "" } = t(), O = e(), { articles: k, popularArticles: A, categories: j, searchResults: M, articlesLoading: N, popularLoading: P, categoriesLoading: F, searchLoading: I, searchArticles: L, filterArticles: R, hasMoreArticles: z, loadMoreArticles: B } = d(), [V, H] = f(""), [U, W] = f(null), [G, K] = f(!1), q = (e) => {
|
|
14
|
+
e.preventDefault(), V.trim() && (L(V, { categoryId: U ?? void 0 }), K(!0));
|
|
15
|
+
}, J = () => {
|
|
16
|
+
H(""), K(!1), W(null), R({
|
|
16
17
|
categoryId: void 0,
|
|
17
18
|
tags: []
|
|
18
19
|
});
|
|
19
|
-
},
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
title: "Knowledge Base",
|
|
22
|
-
subtitle: "Manage help articles and documentation",
|
|
23
|
-
icon: /* @__PURE__ */
|
|
24
|
-
headerActions: /* @__PURE__ */
|
|
25
|
-
onClick: () =>
|
|
26
|
-
children: [/* @__PURE__ */
|
|
20
|
+
}, Y = j.find((e) => e.id === U)?.name, X = G && V ? M : k, Z = G ? I : N;
|
|
21
|
+
return /* @__PURE__ */ T(l, {
|
|
22
|
+
title: O("support.knowledgeBase.title", "Knowledge Base"),
|
|
23
|
+
subtitle: O("support.knowledgeBase.subtitleAdmin", "Manage help articles and documentation"),
|
|
24
|
+
icon: /* @__PURE__ */ w(m, { size: 24 }),
|
|
25
|
+
headerActions: /* @__PURE__ */ T(r, {
|
|
26
|
+
onClick: () => E(`${D}/kb/articles/new`),
|
|
27
|
+
children: [/* @__PURE__ */ w(v, { size: 18 }), O("support.knowledgeBase.actions.newArticle", "New Article")]
|
|
27
28
|
}),
|
|
28
29
|
children: [
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ w(o, { children: O("support.knowledgeBase.purposeAdmin", "Author and curate the self-serve help center customers see. Write clear how-to guides and FAQ articles here to deflect repetitive tickets — well-covered topics mean fewer support requests. Draft and archived articles are visible to you but hidden from customers until published.") }),
|
|
31
|
+
/* @__PURE__ */ w(i, {
|
|
31
32
|
treatment: "glass",
|
|
32
33
|
glow: !0,
|
|
33
34
|
className: "max-w-2xl p-4 sm:p-5",
|
|
34
|
-
children: /* @__PURE__ */
|
|
35
|
-
onSubmit:
|
|
35
|
+
children: /* @__PURE__ */ T("form", {
|
|
36
|
+
onSubmit: q,
|
|
36
37
|
className: "relative",
|
|
37
38
|
children: [
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ w(y, {
|
|
39
40
|
size: 20,
|
|
40
41
|
className: "absolute left-4 top-1/2 -translate-y-1/2 text-text-secondary"
|
|
41
42
|
}),
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ w(a, {
|
|
43
44
|
type: "text",
|
|
44
|
-
value:
|
|
45
|
-
onChange: (e) =>
|
|
46
|
-
placeholder: "Search for help articles...",
|
|
45
|
+
value: V,
|
|
46
|
+
onChange: (e) => H(e.target.value),
|
|
47
|
+
placeholder: O("support.knowledgeBase.searchPlaceholder", "Search for help articles..."),
|
|
47
48
|
className: "pl-12 pr-4 py-6 text-lg"
|
|
48
49
|
}),
|
|
49
|
-
|
|
50
|
+
V && /* @__PURE__ */ w(r, {
|
|
50
51
|
type: "button",
|
|
51
52
|
variant: "ghost",
|
|
52
53
|
size: "sm",
|
|
53
|
-
onClick:
|
|
54
|
+
onClick: J,
|
|
54
55
|
className: "absolute right-2 top-1/2 -translate-y-1/2",
|
|
55
|
-
children: "Clear"
|
|
56
|
+
children: O("support.knowledgeBase.clear", "Clear")
|
|
56
57
|
})
|
|
57
58
|
]
|
|
58
59
|
})
|
|
59
60
|
}),
|
|
60
|
-
!
|
|
61
|
+
!G && !F && j.length > 0 && /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("h2", {
|
|
61
62
|
className: "text-lg font-semibold mb-4 flex items-center gap-2 text-text-primary",
|
|
62
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ w(g, {
|
|
63
64
|
size: 20,
|
|
64
65
|
className: "text-primary"
|
|
65
|
-
}), "Browse by Category"]
|
|
66
|
-
}), /* @__PURE__ */
|
|
66
|
+
}), O("support.knowledgeBase.browseByCategory", "Browse by Category")]
|
|
67
|
+
}), /* @__PURE__ */ w("div", {
|
|
67
68
|
className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",
|
|
68
|
-
children:
|
|
69
|
+
children: j.slice(0, 8).map((e) => /* @__PURE__ */ T("button", {
|
|
69
70
|
type: "button",
|
|
70
71
|
onClick: () => {
|
|
71
|
-
|
|
72
|
+
W(e.id), K(!1), R({ categoryId: e.id });
|
|
72
73
|
},
|
|
73
|
-
className: `p-4 rounded-xl border border-border-seam text-left transition-[box-shadow,border-color] duration-200 shadow-[var(--shadow-pop)] hover:shadow-[var(--shadow-pop-hover)] hover:border-border-strong bg-bg-surface ${
|
|
74
|
+
className: `p-4 rounded-xl border border-border-seam text-left transition-[box-shadow,border-color] duration-200 shadow-[var(--shadow-pop)] hover:shadow-[var(--shadow-pop-hover)] hover:border-border-strong bg-bg-surface ${U === e.id ? "border-primary ring-2 ring-primary/20" : ""}`,
|
|
74
75
|
children: [
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ w("div", {
|
|
76
77
|
className: "text-2xl mb-2",
|
|
77
78
|
children: e.icon || "📁"
|
|
78
79
|
}),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ w("p", {
|
|
80
81
|
className: "font-medium text-text-primary mb-1",
|
|
81
82
|
children: e.name
|
|
82
83
|
}),
|
|
83
84
|
/* @__PURE__ */ w("p", {
|
|
84
85
|
className: "text-xs text-text-secondary",
|
|
85
|
-
children:
|
|
86
|
+
children: O("support.knowledgeBase.articleCount", "{{count}} articles", { count: e.articleCount || 0 })
|
|
86
87
|
})
|
|
87
88
|
]
|
|
88
89
|
}, e.id))
|
|
89
90
|
})] }),
|
|
90
|
-
!
|
|
91
|
+
!G && !P && A.length > 0 && /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("h2", {
|
|
91
92
|
className: "text-lg font-semibold mb-4 flex items-center gap-2 text-text-primary",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
93
|
+
children: [/* @__PURE__ */ w(x, {
|
|
93
94
|
size: 20,
|
|
94
95
|
className: "text-primary"
|
|
95
|
-
}), "Popular Articles"]
|
|
96
|
-
}), /* @__PURE__ */
|
|
96
|
+
}), O("support.knowledgeBase.popularArticles", "Popular Articles")]
|
|
97
|
+
}), /* @__PURE__ */ w("div", {
|
|
97
98
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
98
|
-
children:
|
|
99
|
+
children: A.map((e) => /* @__PURE__ */ T("button", {
|
|
99
100
|
type: "button",
|
|
100
|
-
onClick: () =>
|
|
101
|
+
onClick: () => E(`${D}/kb/articles/${e.slug}`),
|
|
101
102
|
className: "p-5 rounded-xl border border-border-seam bg-bg-surface text-left transition-[box-shadow,border-color] duration-200 shadow-[var(--shadow-pop)] hover:shadow-[var(--shadow-pop-hover)] hover:border-border-strong group",
|
|
102
103
|
children: [
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ w("h3", {
|
|
104
105
|
className: "font-semibold text-text-primary mb-2 group-hover:text-primary transition-colors",
|
|
105
106
|
children: e.title
|
|
106
107
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ w("p", {
|
|
108
109
|
className: "text-sm text-text-secondary mb-3 line-clamp-2",
|
|
109
110
|
children: e.excerpt
|
|
110
111
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ T("div", {
|
|
112
113
|
className: "flex items-center gap-4 text-xs text-text-secondary",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
114
|
+
children: [/* @__PURE__ */ T("span", {
|
|
114
115
|
className: "flex items-center gap-1",
|
|
115
|
-
children: [
|
|
116
|
-
|
|
117
|
-
e.viewCount,
|
|
118
|
-
" views"
|
|
119
|
-
]
|
|
120
|
-
}), /* @__PURE__ */ w("span", {
|
|
116
|
+
children: [/* @__PURE__ */ w(h, { size: 14 }), O("support.knowledgeBase.views", "{{count}} views", { count: e.viewCount })]
|
|
117
|
+
}), /* @__PURE__ */ T("span", {
|
|
121
118
|
className: "flex items-center gap-1",
|
|
122
|
-
children: [
|
|
123
|
-
/* @__PURE__ */ C(y, { size: 14 }),
|
|
124
|
-
e.helpfulCount,
|
|
125
|
-
" helpful"
|
|
126
|
-
]
|
|
119
|
+
children: [/* @__PURE__ */ w(b, { size: 14 }), O("support.knowledgeBase.helpful", "{{count}} helpful", { count: e.helpfulCount })]
|
|
127
120
|
})]
|
|
128
121
|
})
|
|
129
122
|
]
|
|
130
123
|
}, e.id))
|
|
131
124
|
})] }),
|
|
132
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("div", {
|
|
133
126
|
className: "flex items-center justify-between mb-4",
|
|
134
|
-
children: [/* @__PURE__ */
|
|
127
|
+
children: [/* @__PURE__ */ w("h2", {
|
|
135
128
|
className: "text-lg font-semibold text-text-primary",
|
|
136
|
-
children:
|
|
137
|
-
}), (
|
|
129
|
+
children: G && V ? O("support.knowledgeBase.searchResults", "Search Results for \"{{query}}\"", { query: V }) : Y || O("support.knowledgeBase.allArticles", "All Articles")
|
|
130
|
+
}), (G || U) && /* @__PURE__ */ w(r, {
|
|
138
131
|
variant: "outline",
|
|
139
132
|
size: "sm",
|
|
140
|
-
onClick:
|
|
141
|
-
children:
|
|
133
|
+
onClick: J,
|
|
134
|
+
children: G ? O("support.knowledgeBase.clearSearch", "Clear Search") : O("support.knowledgeBase.allArticles", "All Articles")
|
|
142
135
|
})]
|
|
143
|
-
}),
|
|
136
|
+
}), Z ? /* @__PURE__ */ w(c, { message: O("support.knowledgeBase.loading", "Loading articles...") }) : X.length > 0 ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
|
|
144
137
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
145
|
-
children:
|
|
138
|
+
children: X.map((e) => /* @__PURE__ */ T("button", {
|
|
146
139
|
type: "button",
|
|
147
|
-
onClick: () =>
|
|
140
|
+
onClick: () => E(`${D}/kb/articles/${e.slug}`),
|
|
148
141
|
className: "p-6 rounded-xl border border-border-seam bg-bg-surface text-left transition-[box-shadow,border-color] duration-200 shadow-[var(--shadow-pop)] hover:shadow-[var(--shadow-pop-hover)] hover:border-border-strong group",
|
|
149
142
|
children: [
|
|
150
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ T("div", {
|
|
151
144
|
className: "flex items-center gap-2 mb-2 flex-wrap",
|
|
152
145
|
children: [
|
|
153
|
-
e.category && /* @__PURE__ */
|
|
146
|
+
e.category && /* @__PURE__ */ w(n, {
|
|
154
147
|
variant: "outline",
|
|
155
|
-
className:
|
|
148
|
+
className: u(e.category.color),
|
|
156
149
|
children: e.category.name
|
|
157
150
|
}),
|
|
158
|
-
e.status === "DRAFT" && /* @__PURE__ */
|
|
151
|
+
e.status === "DRAFT" && /* @__PURE__ */ T(n, {
|
|
159
152
|
className: "bg-status-warning-bg-subtle text-status-warning-text text-xs",
|
|
160
|
-
children: [/* @__PURE__ */
|
|
153
|
+
children: [/* @__PURE__ */ w(_, {
|
|
161
154
|
size: 10,
|
|
162
155
|
className: "mr-1"
|
|
163
|
-
}), "Draft"]
|
|
156
|
+
}), O("support.knowledgeBase.status.draft", "Draft")]
|
|
164
157
|
}),
|
|
165
|
-
e.status === "ARCHIVED" && /* @__PURE__ */
|
|
158
|
+
e.status === "ARCHIVED" && /* @__PURE__ */ T(n, {
|
|
166
159
|
className: "bg-bg-sunken text-text-secondary text-xs",
|
|
167
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ w(p, {
|
|
168
161
|
size: 10,
|
|
169
162
|
className: "mr-1"
|
|
170
|
-
}), "Archived"]
|
|
163
|
+
}), O("support.knowledgeBase.status.archived", "Archived")]
|
|
171
164
|
})
|
|
172
165
|
]
|
|
173
166
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ w("h3", {
|
|
175
168
|
className: "font-semibold text-lg text-text-primary mb-2 group-hover:text-primary transition-colors",
|
|
176
169
|
children: e.title
|
|
177
170
|
}),
|
|
178
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ w("p", {
|
|
179
172
|
className: "text-sm text-text-secondary mb-4 line-clamp-3",
|
|
180
173
|
children: e.excerpt
|
|
181
174
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ T("div", {
|
|
183
176
|
className: "flex items-center justify-between text-xs text-text-secondary",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
177
|
+
children: [/* @__PURE__ */ T("span", {
|
|
185
178
|
className: "flex items-center gap-1",
|
|
186
|
-
children: [/* @__PURE__ */
|
|
187
|
-
}), /* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ w(h, { size: 14 }), e.viewCount]
|
|
180
|
+
}), /* @__PURE__ */ T("span", {
|
|
188
181
|
className: "flex items-center gap-1",
|
|
189
|
-
children: [/* @__PURE__ */
|
|
182
|
+
children: [/* @__PURE__ */ w(b, { size: 14 }), e.helpfulCount]
|
|
190
183
|
})]
|
|
191
184
|
})
|
|
192
185
|
]
|
|
193
186
|
}, e.id))
|
|
194
|
-
}),
|
|
187
|
+
}), z && /* @__PURE__ */ w("div", {
|
|
195
188
|
className: "flex justify-center mt-6",
|
|
196
|
-
children: /* @__PURE__ */
|
|
189
|
+
children: /* @__PURE__ */ w(r, {
|
|
197
190
|
variant: "outline",
|
|
198
|
-
onClick:
|
|
199
|
-
children: "Load More"
|
|
191
|
+
onClick: B,
|
|
192
|
+
children: O("support.knowledgeBase.loadMore", "Load More")
|
|
200
193
|
})
|
|
201
|
-
})] }) : /* @__PURE__ */
|
|
202
|
-
illustration:
|
|
203
|
-
title:
|
|
204
|
-
description:
|
|
194
|
+
})] }) : /* @__PURE__ */ w(s, {
|
|
195
|
+
illustration: G ? "empty-search" : "empty-files",
|
|
196
|
+
title: G ? O("support.knowledgeBase.empty.searchTitle", "No articles found") : O("support.knowledgeBase.empty.title", "No articles available"),
|
|
197
|
+
description: G ? O("support.knowledgeBase.empty.searchDescription", "Try adjusting your search terms or browse by category") : O("support.knowledgeBase.empty.description", "Check back later for helpful articles and guides")
|
|
205
198
|
})] })
|
|
206
199
|
]
|
|
207
200
|
});
|
|
208
201
|
}
|
|
209
202
|
//#endregion
|
|
210
|
-
export {
|
|
203
|
+
export { E as KnowledgeBaseAdminPage };
|
|
211
204
|
|
|
212
205
|
//# sourceMappingURL=KnowledgeBaseAdminPage.js.map
|