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.9 KB
Raw Blame
// ============================================
// SHARED RESOURCES — tags + shared variable groups (facade layer)
// ============================================

// ---------- Tags panel ----------

.shared-tags {
    display: flex;
    flex-direction: column;
    gap: $space-3;

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

    &__hint {
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__add {
        display: flex;
        gap: $space-2;
        align-items: center;
    }

    &__input {
        max-width: 220px;
    }
}

.shared-tag {
    display: inline-flex;
    align-items: center;
    gap: $space-1;
    background: $bg-hover;
    border: 1px solid $border-subtle;
    border-radius: $radius-badge;
    padding: $space-1 $space-2;
    font-size: $text-xs;
    color: $text-secondary;

    &__label {
    }

    &__remove {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        background: transparent;
        border: none;
        border-radius: $radius-badge;
        color: $text-tertiary;
        cursor: pointer;
        font-size: $text-md;
        line-height: 1;
        transition: color 0.15s, background 0.15s;

        &:hover {
            color: $danger;
            background: fade($danger-raw, 18%);
        }
    }
}

// ---------- Resolved variables panel (read-mostly facade) ----------

.shared-vars-panel {
    display: flex;
    flex-direction: column;
    gap: $space-3;

    &--loading {
        color: $text-tertiary;
        font-size: $text-xs;
        padding: $space-6;
    }

    &__header {
        display: flex;
        justify-content: space-between;
        align-items: baseline;

        h3 {
            margin: 0;
        }
    }

    &__count {
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__hint {
        color: $text-tertiary;
        font-size: $text-xs;
        margin: 0;
    }

    &__filter input {
        width: 100%;
        padding: $space-2 $space-3;
        background: $bg-body;
        border: 1px solid $border-subtle;
        border-radius: $radius-badge;
        color: $text-primary;
        font-size: $text-xs;

        &::placeholder {
            color: $text-tertiary;
        }
    }

    &__empty {
        text-align: center;
        padding: $space-8;
        color: $text-tertiary;
        background: $bg-card;
        border: 1px dashed $border-subtle;
        border-radius: $radius-control;
        font-size: $text-xs;
    }

    &__hint--note {
        color: $text-secondary;
        border-left: 2px solid $warning-border;
        background: $warning-bg;
        padding: $space-2 $space-3;
        border-radius: $radius-badge;
    }
}

// ---------- Provenance / precedence ----------
// A compact legend (workspace < project < environment < direct) plus a small
// per-variable scope badge so users can see where each value comes from.

.shared-vars-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: $space-2;
    font-size: $text-xs;
    color: $text-tertiary;

    &__label {
        font-weight: $font-weight-semibold;
    }

    &__item {
        display: inline-flex;
        align-items: center;
        gap: $space-2;
    }

    &__lt {
        color: $text-tertiary;
        font-family: $font-mono;
    }

    &__note {
        color: $text-tertiary;
    }
}

// Scope badge — one per provenance source. Colors map to the design-system
// status tokens so they read consistently across themes.
.scope-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px $space-2;
    border-radius: $radius-badge;
    font-size: $text-xs;
    font-weight: $font-weight-semibold;
    line-height: 1.5;
    border: 1px solid transparent;
    text-transform: capitalize;

    &--workspace {
        color: $text-secondary;
        background: $bg-hover;
        border-color: $border-subtle;
    }

    &--project {
        @include status-variant($info, $info-bg);
        border-color: $info-border;
    }

    &--environment {
        @include status-variant($success, $success-bg);
        border-color: $success-border;
    }

    &--direct,
    &--resource {
        color: $accent-primary;
        background: rgba($accent-primary-raw, 0.12);
        border-color: rgba($accent-primary-raw, 0.22);
    }
}

// Conflict badge — the resolved shared variable shares a key with the app's own
// local env var, so the local value is what the container actually uses.
.conflict-badge {
    display: inline-flex;
    align-items: center;
    margin-left: $space-2;
    padding: 1px $space-2;
    border-radius: $radius-badge;
    font-family: $font-main;
    font-size: $text-xs;
    font-weight: $font-weight-semibold;
    line-height: 1.5;
    @include status-variant($warning, $warning-bg);
    border: 1px solid $warning-border;
    white-space: nowrap;
    cursor: help;
}

// Shared variables table (used in the resolved panel and the group detail).
// The table is .sk-dtable; only cell content is styled here.

.shared-vars-table {
    &__key {
        font-family: $font-mono;
        font-weight: $font-weight-semibold;
        color: $text-primary;
    }

    &__value {
        font-family: $font-mono;
        color: $text-secondary;
        word-break: break-all;
    }

    &__target {
        white-space: nowrap;
    }

    &__target-all {
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__group {
        color: $text-tertiary;
        white-space: nowrap;

        .scope-badge {
            margin-right: $space-2;
        }
    }

    &__group-name {
        color: $text-tertiary;
    }

    .is-secret &__key {
        border-left: 2px solid $warning;
        padding-left: $space-2;
    }

    // Row whose shared value is overridden by a local env var — dim the value
    // since it is not the effective one for the container.
    .has-conflict &__value {
        color: $text-tertiary;
        text-decoration: line-through;
        text-decoration-color: $warning-border;
    }
}

// ---------- Shared variable groups manager ----------

.shared-groups {
    &__layout {
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: $space-4;
        align-items: start;

        @media (max-width: 720px) {
            grid-template-columns: 1fr;
        }
    }

    &__sidebar {
        display: flex;
        flex-direction: column;
        gap: $space-4;
    }

    &__create {
        display: flex;
        flex-direction: column;
        gap: $space-2;
        padding: $space-3;
        background: $bg-card;
        border: 1px solid $border-subtle;
        border-radius: $radius-control;
    }

    &__list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: $space-2;
    }

    &__hint {
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__item {
        padding: $space-3;
        background: $bg-card;
        border: 1px solid $border-subtle;
        border-radius: $radius-control;
        cursor: pointer;
        transition: border-color 0.15s;

        &:hover {
            border-color: $border-active;
        }

        &.is-active {
            border-color: $accent-primary;
        }

        &-name {
            font-weight: $font-weight-semibold;
            color: $text-primary;
        }

        &-meta {
            color: $text-tertiary;
            font-size: $text-xs;
            margin-top: $space-1;
        }
    }

    &__detail {
        display: flex;
        flex-direction: column;
        gap: $space-4;

        &-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: $space-3;
        }
    }

    &__desc {
        color: $text-tertiary;
        font-size: $text-xs;
        margin: 0;
    }
}