Add Prettier for TypeScript formatting

- Install prettier
- Configure .prettierrc.json and .prettierignore
- Add npm scripts: format, format:check
- Add Makefile target: format-frontend
- Format all frontend files
This commit is contained in:
counterweight 2025-12-21 21:59:26 +01:00
parent 4b394b0698
commit 37de6f70e0
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
44 changed files with 906 additions and 856 deletions

View file

@ -25,7 +25,7 @@ export const Permission = {
CANCEL_ANY_APPOINTMENT: "cancel_any_appointment",
} as const;
export type PermissionType = typeof Permission[keyof typeof Permission];
export type PermissionType = (typeof Permission)[keyof typeof Permission];
// Use generated type from OpenAPI schema
type User = components["schemas"]["UserResponse"];
@ -100,13 +100,19 @@ export function AuthProvider({ children }: { children: ReactNode }) {
setUser(null);
};
const hasPermission = useCallback((permission: PermissionType): boolean => {
return user?.permissions.includes(permission) ?? false;
}, [user]);
const hasPermission = useCallback(
(permission: PermissionType): boolean => {
return user?.permissions.includes(permission) ?? false;
},
[user]
);
const hasRole = useCallback((role: string): boolean => {
return user?.roles.includes(role) ?? false;
}, [user]);
const hasRole = useCallback(
(role: string): boolean => {
return user?.roles.includes(role) ?? false;
},
[user]
);
return (
<AuthContext.Provider