Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

7.8 KB
Raw Blame
// ============================================
// UPTIME GRAPH COMPONENT
// ============================================

.uptime-card {
    background: $bg-card;
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
    padding: $space-4;

    &.loading,
    &.error {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: $space-3;
        min-height: 200px;
        color: $text-tertiary;
    }

    &.error {
        color: $danger;
    }
}

.uptime-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: $space-6;
}

.uptime-title {
    display: flex;
    align-items: center;
    gap: $space-3;

    .uptime-icon {
        color: $success;
    }

    h3 {
        font-size: $text-lg;
        font-weight: $font-weight-semibold;
        color: $text-primary;
        margin: 0 0 $space-1 0;
    }
}

.uptime-status {
    display: inline-flex;
    align-items: center;
    gap: $space-2;
    font-size: $text-xs;
    color: $text-secondary;

    .status-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: $text-tertiary;
    }

    &.online {
        color: $success;

        .status-dot {
            background: $success;
            box-shadow: none;
            animation: uptime-pulse-dot 2s ease-in-out infinite;
        }
    }

    &.degraded {
        color: $warning;

        .status-dot {
            background: $warning;
        }
    }

    &.offline {
        color: $danger;

        .status-dot {
            background: $danger;
        }
    }
}

// Scoped: the panel-wide `pulse-dot` (pages/_services) is opacity-only,
// and being imported later it silently replaced this one for every user
// of the name. This dot wants the scale too.
@keyframes uptime-pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

.uptime-percentage {
    text-align: right;

    .percentage-value {
        display: block;
        font-size: $text-xl;
        font-weight: $font-weight-semibold;
        color: $text-primary;

        &.excellent {
            color: $success;
        }

        &.good {
            color: $success;
        }

        &.fair {
            color: $warning;
        }

        &.poor {
            color: $danger;
        }
    }

    .percentage-label {
        font-size: $text-xs;
        color: $text-tertiary;
    }
}

// Uptime Counter
.uptime-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: $space-2;
    padding: $space-5;
    background: linear-gradient(135deg, fade($accent-primary-raw, 5%), fade($success-raw, 5%));
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
    margin-bottom: $space-6;
}

.uptime-counter-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;

    .counter-value {
        font-size: $text-2xl;
        font-weight: $font-weight-semibold;
        color: $text-primary;
        line-height: 1;
    }

    .counter-label {
        font-size: $text-xs;
        color: $text-tertiary;
        margin-top: $space-1;
    }
}

.counter-separator {
    font-size: $text-2xl;
    font-weight: $font-weight-semibold;
    color: $text-tertiary;
    margin: 0 $space-1;
    margin-bottom: $space-4;
}

// Graph Section
.uptime-graph-section {
    margin-bottom: $space-5;
}

.uptime-graph-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: $space-3;

    .graph-title {
        font-size: $text-xs;
        font-weight: $font-weight-medium;
        color: $text-secondary;
    }
}

.period-selector {
    display: flex;
    gap: $space-1;
    background: $bg-hover;
    padding: $space-1;
    border-radius: $radius-control;
}

.period-btn {
    padding: $space-1 $space-3;
    font-size: $text-xs;
    font-weight: $font-weight-medium;
    color: $text-tertiary;
    background: transparent;
    border: none;
    border-radius: $radius-badge;
    cursor: pointer;
    transition: all $transition-fast;

    &:hover {
        color: $text-primary;
    }

    &.active {
        background: $accent-primary;
        color: white;
    }
}

.uptime-graph {
    display: flex;
    gap: $space-hair;
    height: 32px; // geometry: uptime bar strip (chart)
    background: $bg-hover;
    border-radius: $radius-control;
    overflow: hidden;
    padding: $space-1;
}

.graph-bar {
    flex: 1;
    border-radius: $radius-badge;
    transition: transform $transition-fast, opacity $transition-fast;
    cursor: pointer;
    min-width: 4px;

    &:hover {
        transform: scaleY(1.1);
        opacity: 0.8;
    }

    &.up {
        background: $success;
    }

    &.degraded {
        background: $warning;
    }

    &.down {
        background: $danger;
    }

    &.no_data,
    &.no-data {
        background: $border-subtle;
    }
}

.uptime-graph-labels {
    display: flex;
    justify-content: space-between;
    margin-top: $space-2;
    font-size: $text-xs;
    color: $text-tertiary;
}

// Legend
.uptime-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: $space-5;
    padding: $space-3 0;
    border-top: 1px solid $border-subtle;
    border-bottom: 1px solid $border-subtle;
    margin-bottom: $space-5;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: $radius-badge;

    &.up {
        background: $success;
    }

    &.degraded {
        background: $warning;
    }

    &.down {
        background: $danger;
    }

    &.no-data {
        background: $border-subtle;
    }
}

// Legacy `.uptime-stats-grid` (double-defined) removed — unused;
// summary metric grids use the KpiBand primitive (`.sk-kpiband`).
.uptime-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: $space-3;
    background: $bg-hover;
    border-radius: $radius-control;

    .stat-period {
        font-size: $text-xs;
        color: $text-tertiary;
        margin-bottom: $space-1;
    }

    .stat-value {
        font-size: $text-md;
        font-weight: $font-weight-semibold;
        color: $text-primary;

        &.excellent,
        &.good {
            color: $success;
        }

        &.fair {
            color: $warning;
        }

        &.poor {
            color: $danger;
        }
    }
}

// Compact Version
.uptime-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: $space-4 $space-5;
    background: $bg-card;
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
}

.uptime-compact-status {
    display: flex;
    align-items: center;
    gap: $space-3;

    .uptime-compact-label {
        font-size: $text-xs;
        color: $text-secondary;
    }

    .uptime-compact-percent {
        font-size: $text-base;
        font-weight: $font-weight-semibold;
        padding: $space-1 $space-2;
        border-radius: $radius-badge;
        @include status-variant($success, $success-bg);

        &.fair {
            @include status-variant($warning, $warning-bg);
        }

        &.poor {
            @include status-variant($danger, $danger-bg);
        }
    }
}

.uptime-compact-time {
    display: flex;
    align-items: baseline;
    gap: $space-hair;

    .value {
        font-size: $text-lg;
        font-weight: $font-weight-semibold;
        color: $text-primary;
    }

    .unit {
        font-size: $text-xs;
        color: $text-tertiary;
        margin-right: $space-1;
    }
}

// Responsive
@media (max-width: $breakpoint-md) {
    .uptime-counter-item {
        min-width: 50px;

        .counter-value {
            font-size: $text-xl;
        }
    }

    .counter-separator {
        font-size: $text-xl;
    }

    .uptime-legend {
        flex-wrap: wrap;
        gap: $space-3;
    }
}