84 lines
3 KiB
TypeScript
84 lines
3 KiB
TypeScript
|
|
export type HelpArticle = {
|
||
|
|
id: string;
|
||
|
|
slug: string;
|
||
|
|
title: string;
|
||
|
|
summary: string;
|
||
|
|
categoryKey: string;
|
||
|
|
role: 'ALL' | 'company' | 'jobSeeker' | 'professional' | 'customer' | 'platform';
|
||
|
|
tags: string[];
|
||
|
|
updatedAt: string;
|
||
|
|
content: string;
|
||
|
|
};
|
||
|
|
|
||
|
|
export const HELP_ARTICLES: HelpArticle[] = [
|
||
|
|
{
|
||
|
|
id: 'hc-1',
|
||
|
|
slug: 'how-verification-works',
|
||
|
|
title: 'How verification works',
|
||
|
|
summary: 'Understand document review steps, approval outcomes, and timeline.',
|
||
|
|
categoryKey: 'verification',
|
||
|
|
role: 'ALL',
|
||
|
|
tags: ['verification', 'documents', 'approval'],
|
||
|
|
updatedAt: '2026-03-17T00:00:00Z',
|
||
|
|
content: 'After signup, complete onboarding for one path and submit required documents. Admin review updates your status as pending, document required, approved, or rejected.',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: 'hc-2',
|
||
|
|
slug: 'customer-post-requirement',
|
||
|
|
title: 'How customers post requirements',
|
||
|
|
summary: 'Choose profession intent, add requirements, and track verified responses.',
|
||
|
|
categoryKey: 'requirements',
|
||
|
|
role: 'customer',
|
||
|
|
tags: ['customer', 'requirements'],
|
||
|
|
updatedAt: '2026-03-17T00:00:00Z',
|
||
|
|
content: 'Customer flow starts with selecting the professional category, then requirement details, budget, and timeline. After review, qualified professionals can respond.',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: 'hc-3',
|
||
|
|
slug: 'professional-onboarding-guide',
|
||
|
|
title: 'Professional onboarding guide',
|
||
|
|
summary: 'Choose your profession, upload portfolio, submit PDF ID documents, and wait for approval.',
|
||
|
|
categoryKey: 'onboarding',
|
||
|
|
role: 'professional',
|
||
|
|
tags: ['professional', 'onboarding', 'portfolio'],
|
||
|
|
updatedAt: '2026-03-17T00:00:00Z',
|
||
|
|
content: 'Each profession in Solid has its own onboarding and service configuration. Complete all steps and verification to unlock your full dashboard.',
|
||
|
|
},
|
||
|
|
];
|
||
|
|
|
||
|
|
export function listHelpCenterArticles(input: { role?: string; categoryKey?: string; q?: string }) {
|
||
|
|
const role = String(input.role || 'ALL');
|
||
|
|
const categoryKey = String(input.categoryKey || '').trim();
|
||
|
|
const q = String(input.q || '').trim().toLowerCase();
|
||
|
|
|
||
|
|
return HELP_ARTICLES.filter((article) => {
|
||
|
|
const roleOk = role === 'ALL' || article.role === 'ALL' || article.role === role;
|
||
|
|
const categoryOk = !categoryKey || article.categoryKey === categoryKey;
|
||
|
|
const queryOk = !q || `${article.title} ${article.summary} ${article.tags.join(' ')}`.toLowerCase().includes(q);
|
||
|
|
return roleOk && categoryOk && queryOk;
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
export function listHelpCenterCategories() {
|
||
|
|
const keys = new Map<string, string>();
|
||
|
|
for (const article of HELP_ARTICLES) {
|
||
|
|
if (!keys.has(article.categoryKey)) {
|
||
|
|
const title = article.categoryKey
|
||
|
|
.split('-')
|
||
|
|
.map((chunk) => chunk.charAt(0).toUpperCase() + chunk.slice(1))
|
||
|
|
.join(' ');
|
||
|
|
keys.set(article.categoryKey, title);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return Array.from(keys.entries()).map(([key, title], idx) => ({
|
||
|
|
id: `cat-${idx + 1}`,
|
||
|
|
key,
|
||
|
|
title,
|
||
|
|
}));
|
||
|
|
}
|
||
|
|
|
||
|
|
export function getArticleBySlug(slug: string) {
|
||
|
|
return HELP_ARTICLES.find((article) => article.slug === slug) || null;
|
||
|
|
}
|