Bug Fixed: #34,#28,#48,#46,#2,#15

This commit is contained in:
2024-05-29 12:41:55 -05:00
parent 24a3d210f0
commit 044f8efa0f
18 changed files with 247 additions and 203 deletions

View File

@@ -87,7 +87,14 @@ export function createLogger(name: string, level: number = INFO, options: any =
...options,
});
}
export function formatPhoneNumber(phone: string): string {
const cleaned = ('' + phone).replace(/\D/g, '');
const match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
if (match) {
return '(' + match[1] + ') ' + match[2] + '-' + match[3];
}
return phone;
}
export const getSessionStorageHandler = function (path, value, previous, applyData) {
sessionStorage.setItem('criteria', JSON.stringify(this));
};
@@ -130,3 +137,25 @@ export function map2User(jwt: string): KeycloakUser {
return null;
}
}
export function getImageDimensions(imageUrl: string): Promise<{ width: number; height: number }> {
return new Promise(resolve => {
const img = new Image();
img.onload = () => {
resolve({ width: img.width, height: img.height });
};
img.src = imageUrl;
});
}
export function getDialogWidth(dimensions): string {
const aspectRatio = dimensions.width / dimensions.height;
let dialogWidth = '50vw'; // Standardbreite
// Passen Sie die Breite basierend auf dem Seitenverhältnis an
if (aspectRatio < 1) {
dialogWidth = '30vw'; // Hochformat
} else if (aspectRatio > 1) {
dialogWidth = '50vw'; // Querformat
}
return dialogWidth;
}