add umami analytics integration

This commit is contained in:
jeffvli
2025-11-26 01:16:17 -08:00
parent c77d38fca0
commit 778d878349
13 changed files with 594 additions and 19 deletions
@@ -0,0 +1,27 @@
import { matchPath } from 'react-router';
import { AppRoute } from '/@/renderer/router/routes';
export const getRoutePattern = (pathname: string): string => {
const routePatterns = Object.values(AppRoute);
const sortedRoutes = routePatterns.sort((a, b) => b.split('/').length - a.split('/').length);
for (const pattern of sortedRoutes) {
const match = matchPath(
{
caseSensitive: false,
end: true,
path: pattern,
},
pathname,
);
if (match) {
return pattern;
}
}
// Fallback to the default route if no pattern matches
return '/';
};