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.

13.2 KB
Raw Blame
// ============================================
// TEMPLATES PAGE. Cards are the shared CatalogCard (_design-system.scss);
// this file holds the quickstart row and the detail/install modal styles.
// ============================================

.templates-page {
    .empty-state {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: $space-4;
        padding: $space-12;
        color: $text-tertiary;

        svg {
            opacity: 0.5;
        }

        p {
            margin: 0;
            font-size: $text-lg;
        }
    }
}

// The result count, the removable filter chips and the two-button sort toggle
// that used to sit above the grid are gone: DataTableFooter counts under the
// cards, the FilterDrawer's badge reports what is filtering, and the sort orders
// are built-in saved views on the GridViewPicker row.

// ---- quick-start import banner -------------------------------------------
// Repo / archive imports sit above the catalog: they are the two ways in that
// no template can cover.
.tpl-quickstart {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: $space-3;
    margin-bottom: $space-5;

    @media (max-width: $breakpoint-md) {
        grid-template-columns: 1fr;
    }

    &__card {
        display: flex;
        align-items: center;
        gap: $space-3;
        padding: $space-4 $space-4;
        background: $bg-card;
        border: 1px solid $border-subtle;
        border-radius: $radius-card;
        text-align: left;
        cursor: pointer;
        transition: background $transition-fast, border-color $transition-fast;

        &:hover {
            background: $bg-hover;
            border-color: var(--border);

            .tpl-quickstart__arrow { color: $text-secondary; transform: translateX(2px); }
        }
    }

    &__ico {
        display: grid;
        place-items: center;
        flex-shrink: 0;
        width: 36px;
        height: 36px; // geometry: icon tile
        border-radius: $radius-control;
        background: var(--surface-2);
        border: 1px solid $border-subtle;
        color: var(--accent-bright);
    }

    &__body { flex: 1; min-width: 0; }

    &__title {
        display: block;
        color: $text-primary;
        font-size: $text-sm;
        font-weight: $font-weight-semibold;
    }

    &__sub {
        display: block;
        margin-top: $space-hair;
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__arrow {
        flex-shrink: 0;
        color: var(--text-ghost);
        transition: color $transition-fast, transform $transition-fast;
    }
}

// Repo-template detail body
.repo-detail {
    display: flex;
    flex-direction: column;
    gap: $space-2;

    &__url {
        font-family: var(--mono);
        font-size: $text-xs;
        color: var(--accent-bright);
        word-break: break-all;
    }

    &__meta {
        display: flex;
        flex-wrap: wrap;
        gap: $space-3;
        font-size: $text-xs;
        color: $text-tertiary;

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

.detail-source-tag {
    display: inline-flex;
    align-items: center;
    height: 20px; // geometry: badge height (20px badge spec)
    margin-left: auto;
    font-size: $text-xs;
    text-transform: none;
    color: var(--text-faint);
    background: var(--surface-2);
    padding: 0 $space-tight;
    border-radius: $radius-badge;
}

.manifest-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: $space-2;
}

.manifest-file {
    display: inline-flex;
    align-items: center;
    gap: $space-1;
    padding: $space-hair $space-2;
    font-family: var(--mono);
    font-size: $text-xs;
    @include status-variant(var(--green), var(--green-bg));
    border-radius: $radius-badge;
}

.env-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: $space-2;
}

.env-preview-chip {
    display: inline-flex;
    align-items: center;
    height: 20px; // geometry: badge height (20px badge spec)
    padding: 0 $space-tight;
    font-family: var(--mono);
    font-size: $text-xs;
    color: var(--text-dim);
    background: var(--surface-2);
    border-radius: $radius-badge;

    &--secret {
        color: var(--amber);
        background: rgba($accent-primary-raw, 0.1);
    }
}

.env-preview-note {
    margin: $space-2 0 0;
    font-size: $text-xs;
}

// Template icon (detail modal header)
.template-icon-large {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border-radius: $radius-card;
    overflow: hidden;
    color: var(--accent-bright);

    img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        padding: $space-2;
    }

    .template-icon-placeholder {
        font-size: $text-2xl;
    }
}

.template-icon-placeholder {
    font-size: $text-xl;
    font-weight: $font-weight-semibold;
    color: var(--accent-bright);
}

.template-full-description {
    margin-bottom: $space-4;
    color: $text-secondary;
    line-height: $line-height-relaxed;
}

.template-version {
    font-family: var(--mono);
    font-size: $text-xs;
    font-weight: $font-weight-medium;
    color: var(--accent-bright);
    padding: $space-1 $space-2;
    background: var(--accent-bg);
    border-radius: $radius-badge;
}

.template-categories {
    display: flex;
    flex-wrap: wrap;
    gap: $space-1;
}

.category-badge {
    height: 20px; // geometry: badge height (20px badge spec)
    display: inline-flex;
    align-items: center;
    gap: $space-1;
    padding: 0 $space-tight;
    font-size: $text-xs;
    color: var(--text-dim);
    background: var(--surface-2);
    border-radius: $radius-badge;
    text-transform: capitalize;
}

// Template Detail Drawer
.template-detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 520px;
    max-width: 100vw;
    max-height: none;
    border-radius: $radius-overlay 0 0 $radius-overlay;
    border-left: 1px solid var(--border-soft);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: $shadow-overlay;
    animation: drawer-slide-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);

    .modal-header {
        flex-shrink: 0;
        align-items: flex-start;
        padding: $space-6;
        border-bottom: 1px solid var(--border-soft);
        background: var(--surface-2);
    }

    .modal-body {
        flex: 1;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        @include custom-scrollbar();
    }

    .modal-footer {
        flex-shrink: 0;
    }
}

@keyframes drawer-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

// Template Detail Modal
.template-detail-header {
    display: flex;
    align-items: center;
    gap: $space-4;

    h2 {
        margin: 0;
    }
}

.template-links {
    display: flex;
    gap: $space-2;
    margin-bottom: $space-6;

    .btn {
        display: inline-flex;
        align-items: center;
        gap: $space-2;
    }
}

.template-details-grid {
    display: flex;
    flex-direction: column;
    gap: $space-6;
}

.detail-section {
    h4 {
        display: flex;
        align-items: center;
        gap: $space-2;
        margin: 0 0 $space-3 0;
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
        color: var(--text-faint);

        svg {
            flex-shrink: 0;
        }

        .copy-btn {
            margin-left: auto;
            padding: $space-1;
            background: transparent;
            border: none;
            color: $text-tertiary;
            cursor: pointer;
            border-radius: $radius-badge;
            display: flex;
            align-items: center;
            transition: all $transition-fast;

            &:hover {
                color: var(--accent-bright);
                background: var(--surface-hover);
            }
        }
    }
}

// Requirements
.requirements-list {
    display: flex;
    flex-wrap: wrap;
    gap: $space-3;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: $space-2;
    padding: $space-2 $space-3;
    background: var(--surface-2);
    border-radius: $radius-control;

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

    .requirement-value {
        font-size: $text-xs;
        font-weight: $font-weight-medium;
        color: $text-primary;
    }
}

// Variables
.variables-list {
    display: flex;
    flex-direction: column;
    gap: $space-3;
}

.variable-item {
    display: flex;
    flex-direction: column;
    gap: $space-1;
    padding: $space-3;
    background: var(--surface-2);
    border-radius: $radius-control;
    border: 1px solid var(--border-soft);

    &.required {
        border-color: fade($accent-primary-raw, 45%);
        background: var(--accent-bg-soft);
    }

    .variable-header {
        display: flex;
        align-items: center;
        gap: $space-2;
    }
}

.variable-name {
    font-family: var(--mono);
    font-size: $text-xs;
    font-weight: $font-weight-medium;
    color: var(--accent-bright);
}

.required-badge {
    display: inline-flex;
    align-items: center;
    height: 20px; // geometry: badge height (20px badge spec)
    font-size: $text-xs;
    padding: 0 $space-tight;
    @include status-variant(var(--accent-bright), var(--accent-bg));
    border-radius: $radius-badge;
    font-weight: $font-weight-medium;
}

.auto-badge {
    display: inline-flex;
    align-items: center;
    height: 20px; // geometry: badge height (20px badge spec)
    font-size: $text-xs;
    padding: 0 $space-tight;
    @include status-variant(var(--green), var(--green-bg));
    border-radius: $radius-badge;
    font-weight: $font-weight-medium;
}

.variable-description {
    font-size: $text-xs;
    color: $text-secondary;
}

.variable-default {
    font-size: $text-xs;
    color: var(--text-faint);
    font-family: var(--mono);
}

// Ports
.ports-list {
    display: flex;
    flex-wrap: wrap;
    gap: $space-2;
}

.port-item {
    display: flex;
    align-items: center;
    gap: $space-2;
    padding: $space-2 $space-3;
    background: var(--surface-2);
    border-radius: $radius-control;
}

.port-number {
    font-family: var(--mono);
    font-weight: $font-weight-medium;
    color: $text-primary;
}

.port-protocol {
    font-size: $text-xs;
    padding: $space-1;
    background: var(--surface-3);
    border-radius: $radius-badge;
    color: $text-secondary;
}

.port-description {
    font-size: $text-xs;
    color: $text-secondary;
}

// Compose Preview
.compose-preview {
    padding: $space-4;
    background: var(--bg-code);
    border-radius: $radius-control;
    border: 1px solid var(--border-soft);

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

// Install Modal
.install-modal {
    h4 {
        margin: $space-4 0 $space-3 0;
        font-size: $text-base;
        font-weight: $font-weight-semibold;
        padding-top: $space-4;
        border-top: 1px solid var(--border-soft);
    }
}

.deployment-progress {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: $space-3;
    margin-bottom: $space-3;

    span {
        font-size: $text-xs;
        color: $text-secondary;
        text-transform: capitalize;
        white-space: nowrap;
    }
}

.deployment-progress-track {
    height: 5px;
    background: var(--surface-3);
    border-radius: $radius-badge;
    overflow: hidden;
}

.deployment-progress-fill {
    height: 100%;
    border-radius: $radius-badge;
    background: var(--accent-primary);
    transition: width 180ms ease;
}

// Responsive

// Capacity note in the deploy drawer — does this template fit the server the
// operator just picked. Toned by verdict, but deliberately quiet: it sits under
// the server picker as a sentence, not an alert box, because it never blocks
// the deploy.
.tpl-capacity {
    display: flex;
    gap: $space-2;
    align-items: flex-start;
    margin-top: $space-2;
    padding: $space-3 $space-3;
    border: 1px solid var(--surface-3);
    border-radius: $radius-control;
    background: var(--surface-2);
    transition: opacity 0.15s ease;

    // Dimmed while re-asking after a server switch, so the old answer never
    // looks like the new one.
    &[data-loading='true'] { opacity: 0.55; }

    &__icon { flex-shrink: 0; margin-top: 1px; }

    &__text {
        display: flex;
        flex-direction: column;
        gap: $space-hair;
        min-width: 0;
    }

    &__headline {
        color: $text-primary;
        font-size: $text-sm;
        font-weight: $font-weight-semibold;
    }

    &__detail {
        color: $text-tertiary;
        font-size: $text-xs;
        line-height: 1.45;
    }

    &--ok {
        .tpl-capacity__icon { color: $success; }
    }

    // -raw variants because $warning/$danger resolve to CSS var()s, which
    // rgba() cannot take at build time.
    &--tight {
        border-color: rgba($warning-raw, 0.35);
        .tpl-capacity__icon { color: $warning; }
    }

    &--insufficient {
        border-color: rgba($danger-raw, 0.35);
        .tpl-capacity__icon { color: $danger; }
    }

    &--unknown {
        .tpl-capacity__icon { color: $text-tertiary; }
    }
}