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.

14.9 KB
Raw Blame
// ============================================
// CONNECT A REPOSITORY — shared visual language
// Used by the service connect modal (GitConnectModal) and the WordPress Git tab
// (GitConnectForm). Intentionally mirrors _new-service.scss so all three
// "connect a repo" surfaces read as one product. Brand provider marks come from
// components/git/GitProviders.jsx.
// ============================================

.git-connect {
    display: grid;
    gap: $space-4;

    // Card variant — for surfaces that sit inline on a page (the WP Git tab),
    // not inside a Modal (which supplies its own chrome).
    &--card {
        max-width: 640px;
        padding: $space-5;
        background: var(--surface);
        border: 1px solid var(--border-soft);
        border-radius: var(--radius);
    }

    &__intro {
        display: flex;
        align-items: flex-start;
        gap: $space-3;
    }

    &__intro-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 38px;
        height: 38px; // geometry: icon tile
        border-radius: $radius-card;
        @include status-variant(var(--accent-bright), var(--accent-bg));
    }

    &__intro-text {
        strong {
            display: block;
            color: $text-primary;
            font-size: $text-base;
            font-weight: $font-weight-semibold;
        }

        span {
            display: block;
            margin-top: $space-hair;
            color: $text-tertiary;
            font-size: $text-xs;
            line-height: 1.5;
        }
    }

    // The "explains the others" provider strip — styled like the new-service
    // method cards (icon tile dim by default, accent when active).
    &__providers {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
        gap: $space-2;
    }

    &__provider {
        display: grid;
        gap: $space-1;
        padding: $space-3;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        transition: border-color $transition-fast, background $transition-fast;

        &--active {
            border-color: var(--accent-dim);
            background: var(--accent-bg);
        }

        // When `onSelect` is passed the chips render as <button>s — make them
        // read and behave like real, clickable options.
        &--btn {
            font: inherit;
            text-align: left;
            cursor: pointer;
            width: 100%;

            &:hover { border-color: var(--border-strong); }
            &:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
        }
    }

    &__provider-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px; // geometry: icon tile
        border-radius: $radius-control;
        background: var(--surface-2);
        color: var(--text-dim);
        transition: background $transition-fast, color $transition-fast;
    }
    &__provider--active &__provider-icon {
        @include status-variant(var(--accent-bright), var(--accent-bg));
    }

    &__provider-label {
        color: $text-primary;
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
    }

    &__provider-hint {
        color: var(--text-faint);
        font-size: $text-xs;
        line-height: 1.4;
    }

    // Inline "detected provider" pill beneath the URL input.
    &__detected {
        display: inline-flex;
        align-items: center;
        gap: $space-tight;
        width: max-content;
        margin-top: $space-1;
        padding: $space-1 $space-2;
        border: 1px solid var(--accent-dim);
        border-radius: $radius-full;
        @include status-variant(var(--accent-bright), var(--accent-bg));
        font-size: $text-xs;
        font-weight: $font-weight-medium;
        line-height: 1;
    }

    &__field {
        display: grid;
        gap: $space-2;

        label {
            color: $text-secondary;
            font-size: $text-xs;
            font-weight: $font-weight-medium;
        }
    }

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

    &__toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: $space-4;
        padding: $space-3;
        background: var(--surface);
        border: 1px solid var(--border-soft);
        border-radius: $radius-control;

        strong,
        span {
            display: block;
        }

        strong {
            color: $text-primary;
            font-size: $text-xs;
            font-weight: $font-weight-medium;
        }

        span {
            margin-top: $space-hair;
            color: $text-tertiary;
            font-size: $text-xs;
            line-height: 1.4;
        }
    }

    // Disclosure for secondary fields (deploy scripts) — mirrors the new-service
    // "Advanced settings" toggle.
    &__advanced-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: $space-3;
        min-height: $control-md;
        padding: 0 $space-3;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: $radius-control;
        color: $text-secondary;
        cursor: pointer;
        transition: border-color $transition-fast, background $transition-fast;

        &:hover {
            background: var(--surface-2);
            border-color: var(--border-strong);
        }

        > span {
            display: flex;
            align-items: center;
            gap: $space-2;
            font-size: $text-xs;
            font-weight: $font-weight-medium;
        }

        &[aria-expanded='true'] > svg {
            transform: rotate(180deg);
        }

        > svg {
            transition: transform $transition-fast;
        }
    }

    &__advanced {
        display: grid;
        gap: $space-4;
    }

    &__actions {
        display: flex;
        justify-content: flex-end;
        gap: $space-2;
        margin-top: $space-2;
        padding-top: $space-4;
        border-top: 1px solid var(--border-soft);
    }

    &__actions-spacer {
        margin-right: auto;
    }
}

// Connected-state card — shown on the WordPress Git tab once a repo is linked.
.git-connect-status {
    display: grid;
    gap: $space-4;
    max-width: 640px;
    padding: $space-5;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);

    &__header {
        display: flex;
        align-items: flex-start;
        gap: $space-3;
    }

    &__icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 38px;
        height: 38px; // geometry: icon tile
        border-radius: $radius-card;
        @include status-variant(var(--green), var(--green-bg));
    }

    &__title {
        min-width: 0;

        strong {
            display: block;
            color: $text-primary;
            font-size: $text-base;
            font-weight: $font-weight-semibold;
        }
    }

    &__url {
        font-family: var(--mono);
        font-size: $text-sm;
        color: var(--accent-bright);
        text-decoration: none;
        overflow-wrap: anywhere;

        &:hover {
            text-decoration: underline;
        }
    }

    &__meta {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: $space-3;
        padding: $space-4;
        background: var(--surface-2);
        border: 1px solid var(--border-soft);
        border-radius: $radius-control;
    }

    &__meta-item {
        span {
            display: block;
            margin-bottom: $space-1;
            font-size: $text-xs;
            color: var(--text-faint);
        }

        strong {
            color: $text-primary;
            font-size: $text-sm;
            font-weight: $font-weight-normal;

            &.mono {
                font-family: var(--mono);
                font-size: $text-xs;
            }
        }
    }

    &__actions {
        display: flex;
        justify-content: flex-end;
    }
}

// ---- GitHub one-click picker (GithubRepoPicker) ----------------------------
// The "connect with GitHub" fast path that sits above the paste-a-URL field in
// RepoConnectForm. Reuses the same OAuth as /services/new.
.git-connect__or {
    display: flex;
    align-items: center;
    gap: $space-3;
    color: var(--text-faint);
    font-size: $text-xs;

    &::before,
    &::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--border-soft);
    }
}

.git-connect__gh {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--surface-2);

    &--hint {
        display: flex;
        align-items: center;
        gap: $space-2;
        padding: $space-3 $space-3;
        font-size: $text-sm;
        color: var(--text-dim);

        a { color: var(--accent-bright); }
        svg { color: var(--text-faint); flex-shrink: 0; }
    }

    &--connect {
        display: flex;
        align-items: center;
        gap: $space-3;
        padding: $space-4 $space-4;

        > svg { color: var(--text); flex-shrink: 0; }
    }

    &-text {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;

        strong { font-size: $text-sm; }
        span { font-size: $text-xs; color: var(--text-faint); }
    }

    &--picker { padding: 12px; display: grid; gap: 10px; }

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

        img { width: 26px; height: 26px; border-radius: 50%; }
        .git-connect__gh-account-name {
            display: flex;
            flex-direction: column;
            line-height: 1.25;
            strong { font-size: $text-sm; }
            small { font-size: $text-xs; color: var(--text-faint); }
        }
        > .ui-button { margin-left: auto; }
    }

    &-search {
        display: flex;
        align-items: center;
        gap: $space-2;
        padding: 0 $space-3;
        background: var(--surface);
        border: 1px solid var(--border-soft);
        border-radius: $radius-card;

        svg { color: var(--text-faint); flex-shrink: 0; }
        .ui-input { border: none; background: none; padding-left: 0; height: 34px; }
    }

    &-list {
        display: flex;
        flex-direction: column;
        gap: $space-1;
        max-height: 240px;
        overflow-y: auto;
    }

    &-state { padding: 12px; font-size: $text-sm; color: var(--text-faint); text-align: center; }

    &-repo {
        display: flex;
        align-items: center;
        gap: $space-3;
        padding: $space-2 $space-3;
        border: 1px solid var(--border-soft);
        border-radius: $radius-card;
        background: var(--surface);
        text-align: left;
        cursor: pointer;
        transition: border-color 0.14s, background 0.14s;

        &:hover { border-color: var(--border-strong); }
        &.is-active {
            border-color: var(--accent-bright);
            background: var(--accent-bg);
            svg { color: var(--accent-bright); margin-left: auto; flex-shrink: 0; }
        }
    }

    &-repo-main {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;

        strong { font-size: $text-sm; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        small { font-size: $text-xs; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    }

    &-repo-vis {
        font-size: $text-xs;
        color: var(--text-faint);
        flex-shrink: 0;
    }

    &-branch {
        display: flex;
        align-items: center;
        gap: $space-3;
        font-size: $text-sm;

        label { color: var(--text-dim); }
        select {
            flex: 1;
            height: $control-md;
            padding: 0 $space-3;
            background: var(--surface);
            border: 1px solid var(--border-soft);
            border-radius: $radius-control;
            color: var(--text);
        }
    }
}

// Provider card with a detected local service running.
.git-connect__provider--live {
    border-color: var(--green-dim, rgba(74, 222, 128, 0.35));
    background: var(--green-bg);

    .git-connect__provider-icon {
        @include status-variant(var(--green), var(--green-bg));
    }

    .git-connect__provider-hint {
        color: var(--green);
    }
}

// Tracked-path selector (replaces the raw textarea).
.git-path-selector {
    display: grid;
    gap: $space-3;

    &__label {
        color: $text-secondary;
        font-size: $text-xs;
        font-weight: $font-weight-medium;
    }

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

    &__chip {
        display: inline-flex;
        align-items: center;
        gap: $space-tight;
        padding: $space-tight $space-3;
        border: 1px solid var(--border);
        border-radius: $radius-full;
        background: var(--surface);
        color: $text-secondary;
        font-size: $text-xs;
        cursor: pointer;
        transition: border-color $transition-fast, background $transition-fast, color $transition-fast;

        &:hover {
            border-color: var(--border-strong);
            background: var(--surface-2);
        }

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

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

        .ui-input {
            flex: 1;
            min-width: 0;
        }
    }

    &__add-icon {
        display: inline-flex;
        color: var(--text-faint);
        flex-shrink: 0;
    }

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

    &__item {
        display: inline-flex;
        align-items: center;
        gap: $space-1;
        padding: $space-1 $space-2 $space-1 $space-3;
        background: var(--bg-code);
        border: 1px solid var(--border-soft);
        border-radius: $radius-control;
        font-size: $text-sm;

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

    &__remove {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        padding: 0;
        border: none;
        border-radius: $radius-badge;
        background: transparent;
        color: var(--text-faint);
        cursor: pointer;

        &:hover {
            @include status-variant(var(--red), var(--red-bg));
        }
    }

    &__empty {
        margin: 0;
        color: var(--text-faint);
        font-size: $text-xs;
    }
}