From c29e38d2dc3939441121deee2ac000cf758ca69f Mon Sep 17 00:00:00 2001 From: Nell Date: Mon, 27 Jul 2026 10:47:27 +0200 Subject: [PATCH] init --- frontend/src/layouts/AppLayout.vue | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/frontend/src/layouts/AppLayout.vue b/frontend/src/layouts/AppLayout.vue index 67a32af..97ebf63 100644 --- a/frontend/src/layouts/AppLayout.vue +++ b/frontend/src/layouts/AppLayout.vue @@ -52,6 +52,25 @@ const handleCancel = () => { showDialog.value = false; resetForm(); } + +const getServerInitials = (name: string): string => { + if (!name) return '' + const words = name.trim().split(/\s+/) + if (words.length >= 2) { + return (words[0][0] + words[1][0]).toUpperCase() + } + return name.slice(0, 2).toUpperCase() +} + +const getServerColor = (str: string): string => { + if (!str) return 'hsl(0, 0%, 50%)' + let hash = 0 + for (let i = 0; i < str.length; i++) { + hash = str.charCodeAt(i) + ((hash << 5) - hash) + } + const hue = Math.abs(hash) % 360 + return `hsl(${hue}, 60%, 45%)` +}