chore: shorten verbose block comments across SaaS branch

This commit is contained in:
Anthony Stirling
2026-06-08 18:38:00 +01:00
parent 8b2baaf0a0
commit 1d5ce8a1d2
12 changed files with 24 additions and 159 deletions
@@ -1,53 +1,21 @@
import { NavKey } from "@app/components/shared/config/types";
import { stripBasePath, withBasePath } from "@app/constants/app";
/**
* Navigate to a specific settings section
*
* @param section - The settings section key to navigate to
*
* @example
* // Navigate to People section
* navigateToSettings('people');
*
* // Navigate to Admin Premium section
* navigateToSettings('adminPremium');
*/
/** Push the URL for a settings section and notify listeners. */
export function navigateToSettings(section: NavKey) {
const newPath = withBasePath(`/settings/${section}`);
window.history.pushState({}, "", newPath);
// Trigger a popstate event to notify components
window.dispatchEvent(new PopStateEvent("popstate"));
}
/**
* Get the URL path for a settings section
* Useful for creating links
*
* @param section - The settings section key
* @returns The URL path for the settings section
*
* @example
* <a href={getSettingsUrl('people')}>Go to People Settings</a>
* // Returns: "/settings/people" (or "/bpp/settings/people" under subpath)
*/
/** URL for a settings section (subpath-aware). */
export function getSettingsUrl(section: NavKey): string {
return withBasePath(`/settings/${section}`);
}
/**
* Check if currently viewing a settings section
*
* @param section - Optional section key to check for specific section
* @returns True if in settings (and matching specific section if provided)
*/
/** Whether the current URL is in /settings (optionally a specific section). */
export function isInSettings(section?: NavKey): boolean {
const pathname = stripBasePath(window.location.pathname);
if (!section) {
return pathname.startsWith("/settings");
}
if (!section) return pathname.startsWith("/settings");
return pathname === `/settings/${section}`;
}