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.

4.5 KB
Raw Blame
// ------------------------------------------------------------
// SchedulePicker — one friendly cron schedule picker (Presets / Builder /
// Advanced) with a shared server-computed preview footer. Used by CronJobs,
// Backups ScheduleCard, and the server-detail Cron tab.
// ------------------------------------------------------------
.schedule-picker {
    display: flex;
    flex-direction: column;
    gap: $space-4;

    &--compact {
        gap: $space-3;
        font-size: $text-sm;
    }

    // --- Presets: chip grid ---
    &__presets {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: $space-2;
    }

    &__preset {
        display: flex;
        flex-direction: column;
        gap: $space-hair;
        text-align: left;
        padding: $space-2 $space-3;
        border-radius: var(--radius, $radius-card);
        border: 1px solid var(--border);
        background: var(--surface-2);
        color: var(--text-dim);
        cursor: pointer;
        transition: 0.14s;

        &:hover { border-color: var(--border-strong); color: var(--text); }

        &.is-active {
            border-color: var(--accent-bright);
            @include status-variant(var(--text), var(--accent-bg));
        }
    }

    &__preset-label { font-weight: $font-weight-semibold; font-size: $text-sm; }
    &__preset-desc { font-size: $text-xs; color: var(--text-faint); }

    // --- Builder ---
    &__builder {
        display: flex;
        flex-direction: column;
        gap: $space-3;
    }

    &__row {
        display: flex;
        align-items: center;
        gap: $space-3;
        flex-wrap: wrap;

        > label {
            min-width: 74px;
            font-size: $text-xs;
            font-weight: $font-weight-medium;
            color: var(--text-faint);
        }

        input { max-width: 160px; }
    }

    &__days {
        display: inline-flex;
        gap: $space-1;
        flex-wrap: wrap;
    }

    &__day {
        min-width: 40px;
        padding: $space-tight $space-2;
        border-radius: $radius-control;
        border: 1px solid var(--border);
        background: var(--surface-2);
        color: var(--text-faint);
        font-size: $text-xs;
        font-weight: $font-weight-medium;
        cursor: pointer;
        transition: 0.14s;

        &:hover { color: var(--text-dim); }
        &.is-active {
            border-color: var(--accent-bright);
            @include status-variant(var(--text), var(--accent-bg));
        }
    }

    // --- Advanced ---
    &__advanced {
        display: flex;
        flex-direction: column;
        gap: $space-2;
    }

    &__cron-input {
        font-family: var(--mono);
    }

    &__fieldhints {
        display: flex;
        gap: $space-2;
        flex-wrap: wrap;
    }

    &__fieldhint {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1px;
        min-width: 48px;

        code {
            font-family: var(--mono);
            font-size: $text-xs;
            color: var(--text);
            background: var(--surface-2);
            border: 1px solid var(--border);
            border-radius: $radius-control;
            padding: $space-hair $space-2;
            min-width: 34px;
            text-align: center;
        }
        em { font-style: normal; font-size: $text-xs; color: var(--text-faint); }
    }

    // --- Shared preview footer ---
    &__footer {
        display: flex;
        flex-direction: column;
        gap: $space-tight;
        padding: $space-3 $space-3;
        border-radius: var(--radius, $radius-card);
        border: 1px solid var(--border-soft);
        background: var(--surface);
    }

    &__cronline {
        display: flex;
        align-items: center;
        gap: $space-2;
        flex-wrap: wrap;

        code {
            font-family: var(--mono);
            font-size: $text-sm;
            color: var(--text);
        }
    }

    &__human {
        font-size: $text-sm;
        color: var(--text-dim);
    }

    &__icon {
        flex-shrink: 0;
        &--ok { color: var(--green); }
        &--error { color: var(--red); }
    }

    &__nextruns {
        display: flex;
        align-items: center;
        gap: $space-2;
        flex-wrap: wrap;
        font-size: $text-xs;
        color: var(--text-faint);
    }

    &__nextruns-label { color: var(--text-faint); }

    &__nextrun {
        color: var(--text-dim);
        background: var(--surface-2);
        border-radius: $radius-control;
        padding: 1px $space-2;
    }
}