Skip to content

Commit 5bcc4cd

Browse files
authored
refactor: 💡 use web hosting term instead of "hosting" (#704)
## Why? The term hosting can be confusing in the context of AI Agents ## How? - Rename category hosting as web hosting ## Tickets? - [PLAT-2924](https://linear.app/fleekxyz/issue/PLAT-2924/website-docs-category-term-for-hosting-must-be-web-hosting) ## Contribution checklist? - [ ] The commit messages are detailed - [ ] The `build` command runs locally - [ ] Assets or static content are linked and stored in the project - [ ] Document filename is named after the slug - [ ] You've reviewed spelling using a grammar checker - [ ] For documentation, guides or references, you've tested the commands and steps - [ ] You've done enough research before writing ## Security checklist? - [ ] Sensitive data has been identified and is being protected properly - [ ] Injection has been prevented (parameterized queries, no eval or system calls) - [ ] The Components are escaping output (to prevent XSS) ## References? Optionally, provide references such as links ## Preview? Optionally, provide the preview url here
1 parent 4cb6f51 commit 5bcc4cd

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

src/components/Sidebar.tsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,23 @@ const findBase = (splitted: string[]) => {
3030
return splitted[1];
3131
};
3232

33+
enum ViewCategory {
34+
aiAgents = 'ai-agents',
35+
webHosting = 'web-hosting',
36+
}
37+
3338
const SidebarMenu: React.FC<Props> = ({ data, pathname, indexNameDocs }) => {
34-
const [currentView, setCurrentView] = useState<'ai-agents' | 'hosting'>(
35-
() => {
36-
if (pathname === '/docs/' || pathname.includes('/docs/ai-agents/')) {
37-
return 'ai-agents';
38-
}
39-
return 'hosting';
40-
},
41-
);
39+
const [currentView, setCurrentView] = useState<ViewCategory>(() => {
40+
if (
41+
pathname === '/docs/' ||
42+
pathname === '/docs' ||
43+
pathname.includes('/docs/ai-agents/') ||
44+
pathname.includes('/docs/ai-agents')
45+
) {
46+
return ViewCategory.aiAgents;
47+
}
48+
return ViewCategory.webHosting;
49+
});
4250

4351
useEffect(() => {
4452
if (isClient) {
@@ -48,9 +56,9 @@ const SidebarMenu: React.FC<Props> = ({ data, pathname, indexNameDocs }) => {
4856
currentPath === '/docs/' ||
4957
currentPath.includes('/docs/ai-agents/')
5058
) {
51-
setCurrentView('ai-agents');
59+
setCurrentView(ViewCategory.aiAgents);
5260
} else {
53-
setCurrentView('hosting');
61+
setCurrentView(ViewCategory.webHosting);
5462
}
5563
};
5664

@@ -65,9 +73,9 @@ const SidebarMenu: React.FC<Props> = ({ data, pathname, indexNameDocs }) => {
6573
const filteredData = useMemo(() => {
6674
return data.filter((item) => {
6775
if (currentView === 'ai-agents') {
68-
return item.category === 'ai-agents';
76+
return item.category === ViewCategory.aiAgents;
6977
}
70-
return item.category !== 'ai-agents';
78+
return item.category !== ViewCategory.aiAgents;
7179
});
7280
}, [data, currentView]);
7381

@@ -139,24 +147,24 @@ const SidebarMenu: React.FC<Props> = ({ data, pathname, indexNameDocs }) => {
139147
}
140148
size="sm"
141149
onClick={() => {
142-
setCurrentView('ai-agents');
150+
setCurrentView(ViewCategory.aiAgents);
143151
}}
144152
>
145153
AI Agents
146154
</Button>,
147155
<Button
148156
key="hosting"
149157
variant={
150-
currentView === 'hosting'
158+
currentView === ViewCategory.webHosting
151159
? 'primary-ghost'
152160
: 'secondary-ghost'
153161
}
154162
size="sm"
155163
onClick={() => {
156-
setCurrentView('hosting');
164+
setCurrentView(ViewCategory.webHosting);
157165
}}
158166
>
159-
Hosting
167+
Web Hosting
160168
</Button>,
161169
]}
162170
/>

0 commit comments

Comments
 (0)