|
1 | | -export class DocLinkCreator { |
2 | | - private baseUrl: string; |
| 1 | +import { useFrontendConfig } from '../../context/FrontendConfigContext'; |
3 | 2 |
|
4 | | - constructor(baseUrl: string) { |
5 | | - this.baseUrl = baseUrl; |
6 | | - } |
7 | | - private createLink(path: string) { |
8 | | - return `${this.baseUrl}${path}`; |
9 | | - } |
| 3 | +export function useLink() { |
| 4 | + const { documentationBaseUrl } = useFrontendConfig(); |
10 | 5 |
|
11 | | - public get COMMUNITY_PAGE(): string { |
12 | | - return this.createLink('/'); |
| 6 | + if (!documentationBaseUrl) { |
| 7 | + throw new Error('useLink must be used within a FrontendConfigProvider'); |
13 | 8 | } |
14 | | - public get COM_PAGE_GETTING_STARTED(): string { |
15 | | - return this.createLink( |
| 9 | + |
| 10 | + const createLink = (path: string) => `${documentationBaseUrl}${path}`; |
| 11 | + |
| 12 | + return { |
| 13 | + documentationHomepage: createLink('/'), |
| 14 | + gettingStartedGuide: createLink( |
16 | 15 | '/docs/managed-control-planes/get-started/get-started-mcp', |
17 | | - ); |
18 | | - } |
19 | | - public get COM_PAGE_GETTING_STARTED_WORKSPACE(): string { |
20 | | - return this.createLink( |
| 16 | + ), |
| 17 | + workspaceCreationGuide: createLink( |
21 | 18 | '/docs/managed-control-planes/get-started/get-started-mcp#4-create-workspace', |
22 | | - ); |
23 | | - } |
24 | | - public get COM_PAGE_GETTING_STARTED_MCP(): string { |
25 | | - return this.createLink( |
| 19 | + ), |
| 20 | + mcpCreationGuide: createLink( |
26 | 21 | '/docs/managed-control-planes/get-started/get-started-mcp#5-create-managedcontrolplane', |
27 | | - ); |
28 | | - } |
| 22 | + ), |
| 23 | + }; |
29 | 24 | } |
0 commit comments