45 lines
967 B
TypeScript
45 lines
967 B
TypeScript
export function getHelpSlugForPathname(pathname: string): string | null {
|
|
if (!pathname) {
|
|
return null;
|
|
}
|
|
|
|
const normalized = pathname
|
|
.replace(/^\/e\/[^/]+/, '')
|
|
.replace(/\/+$/g, '')
|
|
.toLowerCase();
|
|
|
|
if (!normalized || normalized === '/') {
|
|
return 'getting-started';
|
|
}
|
|
|
|
if (normalized.startsWith('/help')) {
|
|
return null;
|
|
}
|
|
|
|
if (normalized.startsWith('/gallery') || normalized.startsWith('/photo') || normalized.startsWith('/slideshow')) {
|
|
return 'gallery-and-sharing';
|
|
}
|
|
|
|
if (normalized.startsWith('/upload')) {
|
|
return 'uploading-photos';
|
|
}
|
|
|
|
if (normalized.startsWith('/queue')) {
|
|
return 'upload-troubleshooting';
|
|
}
|
|
|
|
if (normalized.startsWith('/tasks')) {
|
|
return 'tasks-and-missions';
|
|
}
|
|
|
|
if (normalized.startsWith('/achievements')) {
|
|
return 'achievements-and-badges';
|
|
}
|
|
|
|
if (normalized.startsWith('/settings')) {
|
|
return 'settings-and-cache';
|
|
}
|
|
|
|
return 'how-fotospiel-works';
|
|
}
|