Skip to content

Commit

Permalink
Include tailwind bg-black/white, greedy ping regex, adjust position
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon committed Oct 5, 2023
1 parent b765330 commit 4f41be5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/services/item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function Item({ service, group }) {
</div>
)}

<div className={`absolute top-0 right-0 flex flex-row justify-end ${statusStyle === 'dot' ? 'gap-0' : 'gap-2'} mr-2 z-30 service-tags`}>
<div className={`absolute top-0 right-0 flex flex-row justify-end ${statusStyle === 'dot' ? 'gap-0' : 'gap-2 mr-2'} z-30 service-tags`}>
{service.ping && (
<div className="flex-shrink-0 flex items-center justify-center service-tag service-ping">
<Ping group={group} service={service.name} style={statusStyle} />
Expand Down
6 changes: 3 additions & 3 deletions src/components/services/kubernetes-status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function KubernetesStatus({ service, style }) {
let statusLabel = t("docker.unknown");
let statusTitle = "";
let backgroundClass = "px-1.5 py-0.5 bg-theme-500/10 dark:bg-theme-900/50";
let colorClass = "text-black/20 dark:text-white/40 ";
let colorClass = "text-black/20 dark:text-white/40 opacity-20";

if (error) {
statusTitle = t("docker.error");
Expand All @@ -29,8 +29,8 @@ export default function KubernetesStatus({ service, style }) {
}

if (style === 'dot') {
colorClass = colorClass.replace('text-', 'bg-').replace(/\/\d\d/, '');
backgroundClass = "p-3 hover:bg-theme-500/10 dark:hover:bg-theme-900/20";
colorClass = colorClass.replace(/text-/g, 'bg-').replace(/\/\d\d/g, '');
backgroundClass = "p-4 hover:bg-theme-500/10 dark:hover:bg-theme-900/20";
}

return (
Expand Down
8 changes: 4 additions & 4 deletions src/components/services/ping.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Ping({ group, service, style }) {
refreshInterval: 30000
});

let colorClass = "text-black/20 dark:text-white/40";
let colorClass = "text-black/20 dark:text-white/40 opacity-20";
let backgroundClass = "bg-theme-500/10 dark:bg-theme-900/50 px-1.5 py-0.5";
let statusTitle = t("ping.http_status");
let statusText = "";
Expand All @@ -28,7 +28,7 @@ export default function Ping({ group, service, style }) {
} else {
statusText = data.status;
}
} else {
} else if (data) {
const ping = t("common.ms", { value: data.latency, style: "unit", unit: "millisecond", maximumFractionDigits: 0 })
statusTitle += ` ${data.status} (${ping})`;
colorClass = "text-emerald-500/80";
Expand All @@ -42,8 +42,8 @@ export default function Ping({ group, service, style }) {
}

if (style === "dot") {
backgroundClass = 'p-3';
colorClass = colorClass.replace('text-', 'bg-').replace(/\/\d\d/, '');
backgroundClass = 'p-4';
colorClass = colorClass.replace(/text-/g, 'bg-').replace(/\/\d\d/g, '');
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/services/status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function Status({ service, style }) {

if (style === 'dot') {
colorClass = colorClass.replace('text-', 'bg-').replace(/\/\d\d$/, '');
backgroundClass = "p-3 hover:bg-theme-500/10 dark:hover:bg-theme-900/20";
backgroundClass = "p-4 hover:bg-theme-500/10 dark:hover:bg-theme-900/20";
}

return (
Expand Down
3 changes: 3 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,8 @@ module.exports = {
'lg:grid-cols-6',
'lg:grid-cols-7',
'lg:grid-cols-8',
'bg-white',
'bg-black',
'dark:bg-white',
],
}

0 comments on commit 4f41be5

Please sign in to comment.