@adminide-stack/yantra-help-browser 12.0.16-alpha.1 → 12.0.16-alpha.14
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/lib/components/HelpCenterHeader.d.ts +1 -0
- package/lib/components/HelpCenterHeader.d.ts.map +1 -1
- package/lib/components/HelpCenterHeader.js +222 -36
- package/lib/components/HelpCenterHeader.js.map +1 -1
- package/lib/components/SidebarSearch.d.ts +8 -0
- package/lib/components/SidebarSearch.d.ts.map +1 -0
- package/lib/components/SidebarSearch.js +111 -0
- package/lib/components/SidebarSearch.js.map +1 -0
- package/lib/pages/ArticlePage/ArticlePage.d.ts +3 -0
- package/lib/pages/ArticlePage/ArticlePage.d.ts.map +1 -0
- package/lib/pages/ArticlePage/ArticlePage.js +222 -0
- package/lib/pages/ArticlePage/ArticlePage.js.map +1 -0
- package/lib/pages/ArticlePage/ArticlePageLayout.d.ts +3 -0
- package/lib/pages/ArticlePage/ArticlePageLayout.d.ts.map +1 -0
- package/lib/pages/ArticlePage/ArticlePageLayout.js +250 -0
- package/lib/pages/ArticlePage/ArticlePageLayout.js.map +1 -0
- package/lib/pages/ArticlePage/index.d.ts +2 -3
- package/lib/pages/ArticlePage/index.d.ts.map +1 -1
- package/lib/pages/ArticlePage/index.js +4 -189
- package/lib/pages/ArticlePage/index.js.map +1 -1
- package/lib/pages/CategoryCollection/index.d.ts.map +1 -1
- package/lib/pages/CategoryCollection/index.js +2 -2
- package/lib/pages/CategoryCollection/index.js.map +1 -1
- package/lib/{content → templates/content}/account-management/account-setup.md +10 -0
- package/lib/{content → templates/content}/account-management/delete-account.md +10 -0
- package/lib/{content → templates/content}/account-management/preferences.md +10 -0
- package/lib/{content → templates/content}/account-management/privacy-settings.md +10 -0
- package/lib/{content → templates/content}/account-management/profile-settings.md +8 -0
- package/lib/{content → templates/content}/data-privacy/data-collection.md +9 -0
- package/lib/{content → templates/content}/data-privacy/privacy-policy.md +10 -0
- package/lib/{content → templates/content}/data-subject-privacy/data-access.md +12 -0
- package/lib/{content → templates/content}/data-subject-privacy/data-portability.md +15 -0
- package/lib/{content → templates/content}/data-subject-privacy/privacy-requests.md +11 -0
- package/lib/{content → templates/content}/file-uploads/file-upload-overview.md +9 -0
- package/lib/{content → templates/content}/getting-started/getting-started-guide.md +9 -0
- package/lib/{content → templates/content}/product-features/ai-models.md +1 -1
- package/lib/{content → templates/content}/product-features/collaboration-tools.md +8 -0
- package/lib/{content → templates/content}/product-features/conversation-features.md +6 -0
- package/lib/{content → templates/content}/product-features/export-features.md +8 -0
- package/lib/{content → templates/content}/product-features/follow-up-questions.md +8 -0
- package/lib/{content → templates/content}/product-features/real-time-search.md +8 -0
- package/lib/{content → templates/content}/product-features/saved-searches.md +8 -0
- package/lib/{content → templates/content}/product-features/search-features.md +1 -1
- package/lib/{content → templates/content}/product-features/search-history.md +8 -0
- package/lib/{content → templates/content}/product-features/source-citations.md +8 -0
- package/lib/{content → templates/content}/scope-api/api-overview.md +8 -0
- package/lib/{content → templates/content}/search-modes/deep-research.md +8 -0
- package/lib/{content → templates/content}/search-modes/labs-features.md +10 -0
- package/lib/{content → templates/content}/search-modes/pro-search.md +8 -0
- package/lib/{content → templates/content}/search-modes/regular-search.md +8 -0
- package/lib/{content → templates/content}/spaces-library/spaces-overview.md +8 -0
- package/lib/{content → templates/content}/student-hub/academic-research.md +8 -0
- package/lib/{content → templates/content}/student-hub/student-discounts.md +10 -0
- package/lib/{content → templates/content}/student-hub/student-overview.md +8 -0
- package/lib/{content → templates/content}/student-hub/study-tools.md +8 -0
- package/lib/{content → templates/content}/subscription-billing/billing-cycle.md +8 -0
- package/lib/{content → templates/content}/subscription-billing/billing-overview.md +6 -0
- package/lib/{content → templates/content}/subscription-billing/billing-support.md +8 -0
- package/lib/{content → templates/content}/subscription-billing/currency-support.md +10 -0
- package/lib/{content → templates/content}/subscription-billing/enterprise-pricing.md +8 -0
- package/lib/{content → templates/content}/subscription-billing/invoice-management.md +8 -0
- package/lib/{content → templates/content}/subscription-billing/payment-methods.md +9 -0
- package/lib/{content → templates/content}/subscription-billing/promotional-offers.md +8 -0
- package/lib/{content → templates/content}/subscription-billing/refund-policy.md +10 -0
- package/lib/{content → templates/content}/subscription-billing/student-discounts.md +10 -0
- package/lib/{content → templates/content}/subscription-billing/tax-information.md +8 -0
- package/lib/{content → templates/content}/technical-questions/ai-models-technical.md +10 -0
- package/lib/{content → templates/content}/technical-questions/api-technical.md +10 -0
- package/lib/{content → templates/content}/technical-questions/data-processing.md +10 -0
- package/lib/{content → templates/content}/technical-questions/database-architecture.md +10 -0
- package/lib/{content → templates/content}/technical-questions/infrastructure.md +10 -0
- package/lib/{content → templates/content}/technical-questions/performance-optimization.md +10 -0
- package/lib/{content → templates/content}/technical-questions/search-algorithms.md +10 -0
- package/lib/{content → templates/content}/technical-questions/technical-overview.md +10 -0
- package/lib/{content → templates/content}/threads/conversation-management.md +8 -0
- package/lib/{content → templates/content}/threads/threads-overview.md +8 -0
- package/lib/{content → templates/content}/troubleshooting/common-issues.md +8 -0
- package/lib/{content → templates/content}/what-is-yantra/getting-started-yantra.md +1 -1
- package/lib/{content → templates/content}/what-is-yantra/how-yantra-works.md +1 -1
- package/lib/{content → templates/content}/what-is-yantra/practical-tips-yantra.md +2 -1
- package/lib/{content → templates/content}/what-is-yantra/what-is-yantra-intro.md +1 -1
- package/lib/{content → templates/content}/what-is-yantra/yantra-discord-community.md +4 -1
- package/lib/{content → templates/content}/yantra-assistant/android-app.md +10 -0
- package/lib/{content → templates/content}/yantra-assistant/ios-app.md +10 -0
- package/lib/{content → templates/content}/yantra-assistant/mobile-app-overview.md +8 -0
- package/lib/{content → templates/content}/yantra-assistant/voice-assistant.md +10 -0
- package/lib/{content → templates/content}/yantra-enterprise/admin-dashboard.md +10 -0
- package/lib/{content → templates/content}/yantra-enterprise/custom-branding.md +10 -0
- package/lib/{content → templates/content}/yantra-enterprise/dedicated-support.md +10 -0
- package/lib/{content → templates/content}/yantra-enterprise/enterprise-overview.md +8 -0
- package/lib/{content → templates/content}/yantra-enterprise/sso-integration.md +10 -0
- package/lib/{content → templates/content}/yantra-enterprise/user-management.md +10 -0
- package/lib/{content → templates/content}/yantra-pro-max/billing-management.md +13 -0
- package/lib/{content → templates/content}/yantra-pro-max/cancellation-refund.md +13 -0
- package/lib/{content → templates/content}/yantra-pro-max/pro-pricing.md +13 -9
- package/lib/{content → templates/content}/yantra-pro-max/subscription-benefits.md +8 -0
- package/lib/{content → templates/content}/yantra-pro-max/upgrade-process.md +13 -0
- package/lib/{content → templates/content}/yantra-pro-max/yantra-max-features.md +8 -8
- package/lib/{content → templates/content}/yantra-pro-max/yantra-pro-overview.md +8 -8
- package/lib/utils/docsNavigation.d.ts +9 -0
- package/lib/utils/docsNavigation.d.ts.map +1 -0
- package/lib/utils/docsNavigation.js +37 -0
- package/lib/utils/docsNavigation.js.map +1 -0
- package/lib/utils/markdownLoader.d.ts +4 -0
- package/lib/utils/markdownLoader.d.ts.map +1 -1
- package/lib/utils/markdownLoader.js +110 -327
- package/lib/utils/markdownLoader.js.map +1 -1
- package/package.json +14 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpCenterHeader.d.ts","sourceRoot":"","sources":["../../src/components/HelpCenterHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"HelpCenterHeader.d.ts","sourceRoot":"","sources":["../../src/components/HelpCenterHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAK3D,UAAU,qBAAqB;IAC3B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAoS5D,CAAC"}
|
|
@@ -1,15 +1,121 @@
|
|
|
1
|
-
import {jsxs,jsx}from'react/jsx-runtime';import {useState}from'react';const HelpCenterHeader = ({
|
|
2
|
-
onSearch
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useState,useRef,useEffect}from'react';import {createPortal}from'react-dom';import {useNavigate}from'@remix-run/react';import {searchArticles,getCategoryById}from'../utils/markdownLoader.js';const HelpCenterHeader = ({
|
|
2
|
+
onSearch,
|
|
3
|
+
initialSearchQuery = ''
|
|
3
4
|
}) => {
|
|
4
|
-
const
|
|
5
|
+
const navigate = useNavigate();
|
|
6
|
+
const [searchQuery, setSearchQuery] = useState(initialSearchQuery);
|
|
7
|
+
const [searchResults, setSearchResults] = useState([]);
|
|
8
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
9
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
10
|
+
const [dropdownPosition, setDropdownPosition] = useState({
|
|
11
|
+
top: 0,
|
|
12
|
+
left: 0,
|
|
13
|
+
width: 0
|
|
14
|
+
});
|
|
15
|
+
const searchContainerRef = useRef(null);
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
// Update search query when initialSearchQuery changes
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setSearchQuery(initialSearchQuery);
|
|
20
|
+
}, [initialSearchQuery]);
|
|
21
|
+
// Calculate dropdown position
|
|
22
|
+
const updateDropdownPosition = useRef(() => {
|
|
23
|
+
if (searchContainerRef.current) {
|
|
24
|
+
const rect = searchContainerRef.current.getBoundingClientRect();
|
|
25
|
+
setDropdownPosition({
|
|
26
|
+
top: rect.bottom + window.scrollY + 4,
|
|
27
|
+
left: rect.left + window.scrollX,
|
|
28
|
+
width: rect.width
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
// Perform search as user types
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (searchQuery.trim().length > 0) {
|
|
35
|
+
const results = searchArticles(searchQuery);
|
|
36
|
+
setSearchResults(results.slice(0, 10)); // Limit to 10 results
|
|
37
|
+
setShowDropdown(true);
|
|
38
|
+
setSelectedIndex(-1);
|
|
39
|
+
// Use setTimeout to ensure DOM is updated
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
updateDropdownPosition.current();
|
|
42
|
+
}, 0);
|
|
43
|
+
} else {
|
|
44
|
+
setSearchResults([]);
|
|
45
|
+
setShowDropdown(false);
|
|
46
|
+
}
|
|
47
|
+
}, [searchQuery]);
|
|
48
|
+
// Update position on scroll/resize
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (showDropdown) {
|
|
51
|
+
updateDropdownPosition.current();
|
|
52
|
+
const handleScroll = () => updateDropdownPosition.current();
|
|
53
|
+
const handleResize = () => updateDropdownPosition.current();
|
|
54
|
+
window.addEventListener('scroll', handleScroll, true);
|
|
55
|
+
window.addEventListener('resize', handleResize);
|
|
56
|
+
return () => {
|
|
57
|
+
window.removeEventListener('scroll', handleScroll, true);
|
|
58
|
+
window.removeEventListener('resize', handleResize);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}, [showDropdown]);
|
|
62
|
+
// Close dropdown when clicking outside
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const handleClickOutside = event => {
|
|
65
|
+
const target = event.target;
|
|
66
|
+
// Check if click is outside search container AND not on dropdown
|
|
67
|
+
if (searchContainerRef.current && !searchContainerRef.current.contains(target)) {
|
|
68
|
+
// Check if click is on the dropdown (which is in a portal)
|
|
69
|
+
const dropdown = document.querySelector('[data-search-dropdown]');
|
|
70
|
+
if (!dropdown || !dropdown.contains(target)) {
|
|
71
|
+
setShowDropdown(false);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
76
|
+
return () => {
|
|
77
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
78
|
+
};
|
|
79
|
+
}, []);
|
|
5
80
|
const handleSearch = e => {
|
|
6
81
|
e.preventDefault();
|
|
7
82
|
if (onSearch && searchQuery.trim()) {
|
|
8
83
|
onSearch(searchQuery);
|
|
9
84
|
}
|
|
85
|
+
// If there are results and user presses enter, navigate to first result
|
|
86
|
+
if (searchResults.length > 0) {
|
|
87
|
+
const firstResult = searchResults[0];
|
|
88
|
+
navigate(`/help-center/${firstResult.categoryId}/${firstResult.slug}`);
|
|
89
|
+
setShowDropdown(false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const handleInputChange = e => {
|
|
93
|
+
setSearchQuery(e.target.value);
|
|
94
|
+
};
|
|
95
|
+
const handleInputFocus = () => {
|
|
96
|
+
if (searchResults.length > 0) {
|
|
97
|
+
setShowDropdown(true);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const handleResultClick = (article, e) => {
|
|
101
|
+
if (e) {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
e.stopPropagation();
|
|
104
|
+
}
|
|
105
|
+
// Verify article has required fields
|
|
106
|
+
if (!article || !article.categoryId || !article.slug) {
|
|
107
|
+
console.error('Article missing required fields:', article);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
// Close dropdown
|
|
111
|
+
setShowDropdown(false);
|
|
112
|
+
setSearchQuery('');
|
|
113
|
+
// Navigate to the article using Remix navigate
|
|
114
|
+
const path = `/help-center/${article.categoryId}/${article.slug}`;
|
|
115
|
+
navigate(path);
|
|
10
116
|
};
|
|
11
117
|
return jsxs("div", {
|
|
12
|
-
className: "relative overflow-
|
|
118
|
+
className: "relative overflow-visible w-full",
|
|
13
119
|
children: [jsx("div", {
|
|
14
120
|
className: "absolute inset-0 bg-[#057d78]",
|
|
15
121
|
children: jsx("div", {
|
|
@@ -21,47 +127,62 @@ import {jsxs,jsx}from'react/jsx-runtime';import {useState}from'react';const Help
|
|
|
21
127
|
})
|
|
22
128
|
}), jsx("div", {
|
|
23
129
|
className: "relative z-10 mx-auto flex min-h-[500px] max-w-7xl flex-col items-center justify-center px-6 pt-20 text-center lg:px-16",
|
|
130
|
+
style: {
|
|
131
|
+
overflow: 'visible'
|
|
132
|
+
},
|
|
24
133
|
children: jsxs("div", {
|
|
25
|
-
className: "max-w-4xl",
|
|
134
|
+
className: "max-w-4xl w-full",
|
|
135
|
+
style: {
|
|
136
|
+
overflow: 'visible'
|
|
137
|
+
},
|
|
26
138
|
children: [jsx("h1", {
|
|
27
139
|
className: "mb-6 text-5xl font-light leading-[1.1] tracking-tight text-white lg:text-7xl",
|
|
28
140
|
children: "How can we help?"
|
|
29
141
|
}), jsx("p", {
|
|
30
142
|
className: "mb-12 text-xl font-normal text-white/80 lg:text-2xl",
|
|
31
|
-
children: "Get answers to all things
|
|
143
|
+
children: "Get answers to all things Clockbook."
|
|
32
144
|
}), jsx("form", {
|
|
33
145
|
onSubmit: handleSearch,
|
|
34
146
|
className: "relative w-full max-w-2xl mx-auto",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
147
|
+
style: {
|
|
148
|
+
zIndex: 50
|
|
149
|
+
},
|
|
150
|
+
children: jsx("div", {
|
|
151
|
+
ref: searchContainerRef,
|
|
152
|
+
className: "relative w-full",
|
|
153
|
+
children: jsxs("div", {
|
|
154
|
+
className: "flex w-full rounded-2xl bg-white shadow-2xl",
|
|
155
|
+
children: [jsxs("div", {
|
|
156
|
+
className: "relative flex-1",
|
|
157
|
+
children: [jsx("div", {
|
|
158
|
+
className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-6 z-10",
|
|
159
|
+
children: jsx("svg", {
|
|
160
|
+
className: "h-6 w-6 text-gray-400",
|
|
161
|
+
fill: "none",
|
|
162
|
+
viewBox: "0 0 24 24",
|
|
163
|
+
stroke: "currentColor",
|
|
164
|
+
children: jsx("path", {
|
|
165
|
+
strokeLinecap: "round",
|
|
166
|
+
strokeLinejoin: "round",
|
|
167
|
+
strokeWidth: 2,
|
|
168
|
+
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
169
|
+
})
|
|
51
170
|
})
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
171
|
+
}), jsx("input", {
|
|
172
|
+
ref: inputRef,
|
|
173
|
+
type: "text",
|
|
174
|
+
className: "h-16 w-full bg-transparent py-6 pl-16 pr-6 text-lg text-gray-900 placeholder-gray-500 outline-none relative z-10",
|
|
175
|
+
placeholder: "Search help center...",
|
|
176
|
+
value: searchQuery,
|
|
177
|
+
onChange: handleInputChange,
|
|
178
|
+
onFocus: handleInputFocus
|
|
179
|
+
})]
|
|
180
|
+
}), jsx("button", {
|
|
181
|
+
type: "submit",
|
|
182
|
+
className: "flex items-center justify-center rounded-r-2xl bg-gray-900 px-8 text-lg font-medium text-white transition-colors hover:bg-gray-800 relative z-10",
|
|
183
|
+
children: "Search"
|
|
59
184
|
})]
|
|
60
|
-
})
|
|
61
|
-
type: "submit",
|
|
62
|
-
className: "flex items-center justify-center rounded-r-2xl bg-gray-900 px-8 text-lg font-medium text-white transition-colors hover:bg-gray-800",
|
|
63
|
-
children: "Search"
|
|
64
|
-
})]
|
|
185
|
+
})
|
|
65
186
|
})
|
|
66
187
|
}), jsxs("div", {
|
|
67
188
|
className: "mt-8 flex flex-wrap justify-center gap-3",
|
|
@@ -69,12 +190,77 @@ import {jsxs,jsx}from'react/jsx-runtime';import {useState}from'react';const Help
|
|
|
69
190
|
className: "text-sm text-white/60",
|
|
70
191
|
children: "Popular:"
|
|
71
192
|
}), ['Getting started', 'Account setup', 'API documentation', 'Troubleshooting'].map(term => jsx("button", {
|
|
72
|
-
onClick: () =>
|
|
193
|
+
onClick: () => {
|
|
194
|
+
setSearchQuery(term);
|
|
195
|
+
setShowDropdown(true);
|
|
196
|
+
},
|
|
73
197
|
className: "rounded-full bg-white/10 px-4 py-2 text-sm text-white/80 transition-colors hover:bg-white/20 hover:text-white",
|
|
74
198
|
children: term
|
|
75
199
|
}, term))]
|
|
76
200
|
})]
|
|
77
201
|
})
|
|
78
|
-
})
|
|
202
|
+
}), showDropdown && typeof document !== 'undefined' && createPortal(jsx(Fragment, {
|
|
203
|
+
children: searchResults.length > 0 ? jsx("div", {
|
|
204
|
+
"data-search-dropdown": true,
|
|
205
|
+
className: "fixed bg-white rounded-lg shadow-2xl border border-gray-200 max-h-96 overflow-y-auto z-[9999]",
|
|
206
|
+
style: {
|
|
207
|
+
top: `${dropdownPosition.top}px`,
|
|
208
|
+
left: `${dropdownPosition.left}px`,
|
|
209
|
+
width: `${dropdownPosition.width}px`
|
|
210
|
+
},
|
|
211
|
+
onClick: e => e.stopPropagation(),
|
|
212
|
+
children: jsx("div", {
|
|
213
|
+
className: "py-1",
|
|
214
|
+
children: searchResults.map((article, index) => {
|
|
215
|
+
const category = getCategoryById(article.categoryId);
|
|
216
|
+
`/help-center/${article.categoryId}/${article.slug}`;
|
|
217
|
+
return jsx("div", {
|
|
218
|
+
onClick: e => {
|
|
219
|
+
console.log('Click event fired on article:', article.title);
|
|
220
|
+
e.preventDefault();
|
|
221
|
+
e.stopPropagation();
|
|
222
|
+
handleResultClick(article, e);
|
|
223
|
+
},
|
|
224
|
+
className: `block px-4 py-3 hover:bg-blue-50 transition-colors cursor-pointer border-b border-gray-100 last:border-b-0 ${selectedIndex === index ? 'bg-blue-50' : ''}`,
|
|
225
|
+
role: "button",
|
|
226
|
+
tabIndex: 0,
|
|
227
|
+
onKeyDown: e => {
|
|
228
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
229
|
+
e.preventDefault();
|
|
230
|
+
handleResultClick(article);
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
children: jsxs("div", {
|
|
234
|
+
className: "flex flex-col",
|
|
235
|
+
children: [jsx("div", {
|
|
236
|
+
className: "text-base font-semibold text-gray-900",
|
|
237
|
+
children: article.title
|
|
238
|
+
}), article.description && jsx("div", {
|
|
239
|
+
className: "text-sm text-gray-600 mt-0.5",
|
|
240
|
+
children: article.description
|
|
241
|
+
}), category && jsx("div", {
|
|
242
|
+
className: "text-xs text-blue-600 mt-1 font-medium",
|
|
243
|
+
children: category.title
|
|
244
|
+
})]
|
|
245
|
+
})
|
|
246
|
+
}, article.id);
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
}) : searchQuery.trim().length > 0 ? jsx("div", {
|
|
250
|
+
className: "fixed bg-white rounded-lg shadow-2xl border border-gray-200 z-[9999]",
|
|
251
|
+
style: {
|
|
252
|
+
top: `${dropdownPosition.top}px`,
|
|
253
|
+
left: `${dropdownPosition.left}px`,
|
|
254
|
+
width: `${dropdownPosition.width}px`
|
|
255
|
+
},
|
|
256
|
+
onClick: e => e.stopPropagation(),
|
|
257
|
+
children: jsx("div", {
|
|
258
|
+
className: "px-4 py-6 text-center text-gray-500",
|
|
259
|
+
children: jsxs("p", {
|
|
260
|
+
children: ["No results found for \"", searchQuery, "\""]
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
}) : null
|
|
264
|
+
}), document.body)]
|
|
79
265
|
});
|
|
80
266
|
};export{HelpCenterHeader};//# sourceMappingURL=HelpCenterHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpCenterHeader.js","sources":["../../src/components/HelpCenterHeader.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HelpCenterHeader.js","sources":["../../src/components/HelpCenterHeader.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":"wPAUO,MAAM,gBAAgB,GAAoC,CAAC;AAC9D,EAAA,QAAM;oBACY,GAAA;MACZ;QACA,QAAa,GAAA,WAAiB,EAAA;QAC9B,CAAA,WAAc,EAAA,cAAkB,CAAA,GAAA,QAAI,CAAA,kBAAa,CAAA;QACjD,CAAA,+BAAmB,CAAA,GAAA,QAAu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AACH,SAAA,CAAA,EAAAA,GAAA,CAAA,GAAA,EAAA;AAajC,UAAE,SAAA,EAAA,qDAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarSearch.d.ts","sourceRoot":"","sources":["../../src/components/SidebarSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAK3D,UAAU,kBAAkB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwHtD,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {useState,useRef,useEffect}from'react';import {useNavigate}from'@remix-run/react';import {FiSearch}from'@react-icons/all-files/fi/FiSearch.js';import {searchArticles,getCategoryById}from'../utils/markdownLoader.js';const SidebarSearch = ({
|
|
2
|
+
className = '',
|
|
3
|
+
placeholder = 'Search...'
|
|
4
|
+
}) => {
|
|
5
|
+
const navigate = useNavigate();
|
|
6
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
7
|
+
const [searchResults, setSearchResults] = useState([]);
|
|
8
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
9
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
10
|
+
const searchContainerRef = useRef(null);
|
|
11
|
+
const inputRef = useRef(null);
|
|
12
|
+
// Perform search as user types
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (searchQuery.trim().length > 0) {
|
|
15
|
+
const results = searchArticles(searchQuery);
|
|
16
|
+
setSearchResults(results.slice(0, 5)); // Limit to 5 results for sidebar
|
|
17
|
+
setShowDropdown(true);
|
|
18
|
+
setSelectedIndex(-1);
|
|
19
|
+
} else {
|
|
20
|
+
setSearchResults([]);
|
|
21
|
+
setShowDropdown(false);
|
|
22
|
+
}
|
|
23
|
+
}, [searchQuery]);
|
|
24
|
+
// Close dropdown when clicking outside
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const handleClickOutside = event => {
|
|
27
|
+
const target = event.target;
|
|
28
|
+
if (searchContainerRef.current && !searchContainerRef.current.contains(target)) {
|
|
29
|
+
const dropdown = document.querySelector('[data-sidebar-search-dropdown]');
|
|
30
|
+
if (!dropdown || !dropdown.contains(target)) {
|
|
31
|
+
setShowDropdown(false);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
36
|
+
return () => {
|
|
37
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
const handleSearch = e => {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
if (searchResults.length > 0) {
|
|
43
|
+
const firstResult = searchResults[0];
|
|
44
|
+
navigate(`/help-center/${firstResult.categoryId}/${firstResult.slug}`);
|
|
45
|
+
setShowDropdown(false);
|
|
46
|
+
setSearchQuery('');
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const handleInputChange = e => {
|
|
50
|
+
setSearchQuery(e.target.value);
|
|
51
|
+
};
|
|
52
|
+
const handleInputFocus = () => {
|
|
53
|
+
if (searchResults.length > 0) {
|
|
54
|
+
setShowDropdown(true);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleResultClick = article => {
|
|
58
|
+
if (!article || !article.categoryId || !article.slug) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setShowDropdown(false);
|
|
62
|
+
setSearchQuery('');
|
|
63
|
+
navigate(`/help-center/${article.categoryId}/${article.slug}`);
|
|
64
|
+
};
|
|
65
|
+
return jsxs("div", {
|
|
66
|
+
className: `relative w-full ${className}`,
|
|
67
|
+
ref: searchContainerRef,
|
|
68
|
+
children: [jsx("form", {
|
|
69
|
+
onSubmit: handleSearch,
|
|
70
|
+
className: "relative",
|
|
71
|
+
children: jsxs("div", {
|
|
72
|
+
className: "relative",
|
|
73
|
+
children: [jsx("div", {
|
|
74
|
+
className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",
|
|
75
|
+
children: jsx(FiSearch, {
|
|
76
|
+
className: "h-4 w-4 text-gray-400",
|
|
77
|
+
"aria-hidden": "true"
|
|
78
|
+
})
|
|
79
|
+
}), jsx("input", {
|
|
80
|
+
ref: inputRef,
|
|
81
|
+
type: "text",
|
|
82
|
+
className: "block w-full rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 py-2 pl-10 pr-3 text-sm text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",
|
|
83
|
+
placeholder: placeholder,
|
|
84
|
+
value: searchQuery,
|
|
85
|
+
onChange: handleInputChange,
|
|
86
|
+
onFocus: handleInputFocus
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
}), showDropdown && searchResults.length > 0 && jsx("div", {
|
|
90
|
+
"data-sidebar-search-dropdown": true,
|
|
91
|
+
className: "absolute z-50 mt-1 w-full bg-white dark:bg-gray-800 rounded-md shadow-lg border border-gray-200 dark:border-gray-700 max-h-64 overflow-y-auto",
|
|
92
|
+
children: jsx("div", {
|
|
93
|
+
className: "py-1",
|
|
94
|
+
children: searchResults.map((article, index) => {
|
|
95
|
+
const category = getCategoryById(article.categoryId);
|
|
96
|
+
return jsxs("div", {
|
|
97
|
+
onClick: () => handleResultClick(article),
|
|
98
|
+
className: `block px-4 py-2 text-sm hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer ${selectedIndex === index ? 'bg-gray-50 dark:bg-gray-700' : ''}`,
|
|
99
|
+
children: [jsx("div", {
|
|
100
|
+
className: "font-medium text-gray-900 dark:text-gray-100",
|
|
101
|
+
children: article.title
|
|
102
|
+
}), category && jsx("div", {
|
|
103
|
+
className: "text-xs text-gray-500 dark:text-gray-400 mt-0.5",
|
|
104
|
+
children: category.title
|
|
105
|
+
})]
|
|
106
|
+
}, article.id);
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
};export{SidebarSearch};//# sourceMappingURL=SidebarSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarSearch.js","sources":["../../src/components/SidebarSearch.tsx"],"sourcesContent":[null],"names":[],"mappings":"uQAUO,MAAM,aAAa,GAAiC,CAAC;AACxD,EAAA,SAAc,GAAA,EAAA;aACI,GAAA;MACZ;QACA,QAAa,GAAA,WAAiB,EAAA;QAC9B,CAAA,WAAc,EAAA,cAAkB,CAAA,GAAA,QAAI,CAAA,EAAA,CAAA;AAC1C,EAAA,MAAA,CAAA,+BAAkD,CAAA,GAAM,QAAA,CAAA,EAAA,CAAA;AACxD,EAAA,MAAA,CAAA,YAAiB,EAAA,eAA+B,CAAA,GAAA,QAAA,CAAA,KAAA,CAAA;QAEjB,CAAA,aAAA,EAAA,gBAAA,CAAA,GAAA,QAAA,CAAA,EAAA,CAAA;QACtB,kBAAM,GAAA,MAAA,CAAA,IAAA,CAAA;QACX,QAAI,GAAA,MAAgB,CAAA,IAAE,CAAC;AACnB;AACA,EAAA,SAAA,CAAA,MAAA;mBACe,CAAA,IAAA,EAAA,CAAA,MAAM,GAAC,CAAA,EAAA;AACtB,MAAA,MAAA,OAAA,GAAA,cAAqB,CAAA,WAAA,CAAA;sBACxB,CAAA,OAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA;qBAAO,CAAA,IAAA,CAAA;sBACY,CAAA,EAAA,CAAA;;sBAEnB,CAAA,EAAA,CAAA;AACL,MAAG,eAAc,CAAC,KAAA,CAAA;;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