Improve guest help routing and loading
This commit is contained in:
44
resources/js/guest/lib/helpRouting.ts
Normal file
44
resources/js/guest/lib/helpRouting.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
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';
|
||||
}
|
||||
Reference in New Issue
Block a user