Skip to content

Commit 97ef9ba

Browse files
committed
fix(ServiceCard): Improves Service Card layout
Improves the layout of the Service Card component for better responsiveness and information presentation. - Changes the flex direction to column on smaller screens and row on larger screens. - Wraps the process name and status indicator in a flex container for better alignment. - Adds `min-w-0` to elements containing text that can overflow. - Moves the restart badge and geek metrics into a single flex container, allowing them to wrap. - Aligns action buttons to the end on small screens and center on larger screens.
1 parent 5ba3534 commit 97ef9ba

1 file changed

Lines changed: 36 additions & 29 deletions

File tree

components/ServiceCard.vue

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -216,43 +216,50 @@ watch(() => props.process?.process_name, () => {
216216
</script>
217217
218218
<template>
219-
<button class="bg-gray-800 rounded-lg shadow-md p-2 md:p-4 flex items-center justify-between hover:bg-gray-800/70" @click="goToService">
220-
<span class="flex items-center gap-1.5 md:gap-2">
221-
<span
222-
:class="statusDotClass"
223-
:title="statusTitle"
224-
class="w-3 h-3 md:w-4 md:h-4 rounded-full flex-none"
225-
/>
226-
<span class="text-sm md:text-lg font-bold">{{ process.process_name }}</span>
227-
<span
228-
v-if="showRestartBadge"
229-
class="text-[10px] md:text-[11px] px-1.5 py-0.5 rounded-full border border-slate-600/60 bg-slate-700/40 text-slate-200"
230-
:title="restartTitle || ''"
231-
>
232-
R {{ restartCount }}
233-
</span>
234-
<template v-if="geekMetrics">
219+
<button
220+
class="bg-gray-800 rounded-lg shadow-md p-2 md:p-4 flex flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between hover:bg-gray-800/70 min-w-0"
221+
@click="goToService"
222+
>
223+
<span class="flex flex-col gap-1 min-w-0 flex-1">
224+
<span class="flex items-center gap-1.5 md:gap-2 min-w-0">
235225
<span
236-
class="text-[10px] font-mono px-1.5 py-0.5 rounded-full border"
237-
:class="cpuBadgeClass"
238-
:title="`CPU: ${geekMetrics.cpu_percent?.toFixed(1) ?? '-'}%`"
239-
>
240-
{{ Math.round(geekMetrics.cpu_percent ?? 0) }}%
241-
</span>
226+
:class="statusDotClass"
227+
:title="statusTitle"
228+
class="w-3 h-3 md:w-4 md:h-4 rounded-full flex-none"
229+
/>
230+
<span class="text-sm md:text-lg font-bold leading-tight break-words min-w-0">{{ process.process_name }}</span>
231+
<span v-if="loading" class="material-symbols-rounded !text-[22px] animate-spin shrink-0">cached</span>
232+
</span>
233+
<span class="flex items-center gap-1.5 flex-wrap min-w-0">
242234
<span
243-
v-if="geekMetrics.rss != null"
244-
class="text-[10px] font-mono px-1.5 py-0.5 rounded-full border border-slate-600/60 bg-slate-700/40 text-slate-200"
245-
:title="`Memory RSS: ${formatBytes(geekMetrics.rss)}`"
235+
v-if="showRestartBadge"
236+
class="text-[10px] md:text-[11px] px-1.5 py-0.5 rounded-full border border-slate-600/60 bg-slate-700/40 text-slate-200 shrink-0"
237+
:title="restartTitle || ''"
246238
>
247-
{{ formatBytes(geekMetrics.rss) }}
239+
R {{ restartCount }}
248240
</span>
249-
</template>
250-
<span v-if="loading" class="material-symbols-rounded !text-[22px] animate-spin">cached</span>
241+
<template v-if="geekMetrics">
242+
<span
243+
class="text-[10px] font-mono px-1.5 py-0.5 rounded-full border"
244+
:class="cpuBadgeClass"
245+
:title="`CPU: ${geekMetrics.cpu_percent?.toFixed(1) ?? '-'}%`"
246+
>
247+
{{ Math.round(geekMetrics.cpu_percent ?? 0) }}%
248+
</span>
249+
<span
250+
v-if="geekMetrics.rss != null"
251+
class="text-[10px] font-mono px-1.5 py-0.5 rounded-full border border-slate-600/60 bg-slate-700/40 text-slate-200 shrink-0"
252+
:title="`Memory RSS: ${formatBytes(geekMetrics.rss)}`"
253+
>
254+
{{ formatBytes(geekMetrics.rss) }}
255+
</span>
256+
</template>
257+
</span>
251258
</span>
252259
253260
254261
<!--ACTION BUTTONS-->
255-
<span v-if="showServiceControls" class="flex items-center gap-4">
262+
<span v-if="showServiceControls" class="flex items-center gap-2 self-end sm:self-center shrink-0">
256263
<VTooltip>
257264
<button class="px-2 py-1.5 rounded bg-white/10 hover:bg-white/20" :disabled="displayStatus === PROCESS_STATUS.RUNNING || loading" @click.stop="executeAction(SERVICE_ACTIONS.START)">
258265
<span class="material-symbols-rounded !text-[22px] font-fill">play_arrow</span>

0 commit comments

Comments
 (0)