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.

fix(new-service): center the stepper, richer template step + bring-your-own

Juan Denis48cdd159f37e
diff --git a/frontend/src/pages/new-service/ConnectStep.jsx b/frontend/src/pages/new-service/ConnectStep.jsx
index 5a7bf7a3..c9fa904c 100644
--- a/frontend/src/pages/new-service/ConnectStep.jsx
+++ b/frontend/src/pages/new-service/ConnectStep.jsx
@@ -1,19 +1,34 @@
+import { useState } from 'react';
import { Link } from 'react-router-dom';
import {
- ArrowRight, CheckCircle2, FileArchive, FolderOpen, GitBranch, Info,
+ ArrowRight, CheckCircle2, FileArchive, GitBranch, Info,
Package, RefreshCw, Search, Settings2,
} from 'lucide-react';
import { SiGithub } from 'react-icons/si';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
import { SOURCE_NEEDS } from './useNewServiceForm';
+// Templates flagged as featured get a badge in the picker.
+const FEATURED_TEMPLATES = ['agentsite'];
+
+// Template icon with a graceful fallback to a Package glyph if the inline/URL
+// icon is missing or fails to load.
+const TemplateIcon = ({ template }) => {
+ const [failed, setFailed] = useState(false);
+ if (template.icon && !failed) {
+ return <img src={template.icon} alt="" onError={() => setFailed(true)} />;
+ }
+ return <Package size={22} />;
+};
+
// Step 2 — Connect. Only the source-specific input, plus the editable detected
// service name + branch shown inline (not buried in Advanced).
const ConnectStep = ({ form }) => {
const {
- sourceMode, githubConnection, githubConfigured, reposLoading, repos, repoSearch,
+ sourceMode, selectSource, githubConnection, githubConfigured, reposLoading, repos, repoSearch,
setRepoSearch, selectedRepo, setSelectedRepo, loadGithubRepos, handleConnectGithub,
templates, templatesLoading, selectedTemplate, selectTemplateById,
manualRepoUrl, handleManualRepoChange, localPath, setLocalPath, composeFile,
@@ -121,35 +136,61 @@ const ConnectStep = ({ form }) => {
{sourceMode === 'template' && (
<div className="new-service-page__pane">
- <div className="new-service-page__template-list">
- {templatesLoading && <div className="new-service-page__repo-state">Loading templates…</div>}
- {!templatesLoading && templates.length === 0 && (
- <div className="new-service-page__repo-state">No deploy templates available yet.</div>
- )}
- {!templatesLoading && templates.map(template => (
+ {templatesLoading && <div className="new-service-page__repo-state">Loading templates…</div>}
+ {!templatesLoading && templates.length === 0 && (
+ <div className="new-service-page__repo-state">No deploy templates available yet.</div>
+ )}
+ {!templatesLoading && templates.map(template => {
+ const active = selectedTemplate?.id === template.id;
+ return (
<button
key={template.id}
type="button"
- className={`new-service-page__template-row ${selectedTemplate?.id === template.id ? 'new-service-page__template-row--active' : ''}`}
+ className={`new-service-page__template-card ${active ? 'new-service-page__template-card--active' : ''}`}
onClick={() => selectTemplateById(template.id)}
>
- <span className="new-service-page__template-main">
- <strong>{template.name}</strong>
- <small>{template.description}</small>
- {template.repo?.url && <em>{template.repo.url}</em>}
+ <span className="new-service-page__template-card-icon">
+ <TemplateIcon template={template} />
</span>
- {selectedTemplate?.id === template.id ? <CheckCircle2 size={18} /> : <ArrowRight size={18} />}
+ <span className="new-service-page__template-card-body">
+ <span className="new-service-page__template-card-head">
+ <strong>{template.name}</strong>
+ {FEATURED_TEMPLATES.includes(template.id) && (
+ <Badge variant="info">Featured</Badge>
+ )}
+ {template.version && <Badge variant="outline">v{template.version}</Badge>}
+ </span>
+ <span className="new-service-page__template-card-desc">{template.description}</span>
+ <span className="new-service-page__template-card-meta">
+ {(template.categories || []).slice(0, 3).map(cat => (
+ <span key={cat} className="tg">{cat}</span>
+ ))}
+ {template.repo?.url && <em>{template.repo.url}</em>}
+ </span>
+ </span>
+ {active ? <CheckCircle2 size={20} /> : <ArrowRight size={20} />}
</button>
- ))}
- </div>
- <div className="new-service-page__pane-actions">
- <Button type="button" variant="outline" asChild>
- <Link to="/templates?kind=repo">
- <Package size={16} />
- Browse all templates
- </Link>
+ );
+ })}
+
+ {/* Bring your own — no curated entry needed. Any repo with a
+ serverkit.yml / Docker Compose / Dockerfile deploys the same
+ way; this switches to the Git-remote input in place. */}
+ <div className="new-service-page__byo">
+ <div>
+ <strong>Bring your own manifest</strong>
+ <span>Deploy any Git repo that ships a serverkit.yml, Docker Compose, or Dockerfile — we detect it for you.</span>
+ </div>
+ <Button type="button" variant="outline" onClick={() => selectSource('manual')}>
+ <GitBranch size={16} />
+ Use a repo URL
</Button>
</div>
+
+ <Link to="/templates?kind=repo" className="new-service-page__pane-link">
+ <Package size={14} />
+ Open the full template library
+ </Link>
</div>
)}
diff --git a/frontend/src/styles/pages/_new-service.scss b/frontend/src/styles/pages/_new-service.scss
index 2a04a37b..e2a6a65d 100644
--- a/frontend/src/styles/pages/_new-service.scss
+++ b/frontend/src/styles/pages/_new-service.scss
@@ -14,6 +14,7 @@
&__stepper {
display: flex;
align-items: center;
+ justify-content: center;
gap: $space-2;
margin-bottom: $space-5;
}
@@ -459,6 +460,151 @@
}
}
+ // Richer featured template card (icon + name + preview + categories).
+ &__template-card {
+ display: grid;
+ grid-template-columns: auto minmax(0, 1fr) auto;
+ align-items: center;
+ gap: $space-4;
+ width: 100%;
+ padding: $space-4;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-lg;
+ color: $text-primary;
+ font: inherit;
+ text-align: left;
+ cursor: pointer;
+ transition: border-color $transition-fast, background $transition-fast, transform $transition-fast;
+
+ &:hover {
+ background: $bg-hover;
+ border-color: $border-hover;
+ transform: translateY(-1px);
+ }
+
+ &--active {
+ border-color: rgba(20, 184, 166, 0.55);
+ box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.18);
+
+ > svg { color: $success; }
+ }
+ }
+
+ &__template-card-icon {
+ display: grid;
+ place-items: center;
+ width: 48px;
+ height: 48px;
+ flex-shrink: 0;
+ border-radius: $radius-lg;
+ background: var(--surface-2);
+ color: var(--accent-bright);
+ overflow: hidden;
+
+ img {
+ width: 100%;
+ height: 100%;
+ object-fit: contain;
+ padding: 8px;
+ }
+
+ svg { display: block; }
+ }
+
+ &__template-card-body {
+ display: grid;
+ gap: 4px;
+ min-width: 0;
+ }
+
+ &__template-card-head {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+
+ strong {
+ color: $text-primary;
+ font-size: $font-size-base;
+ font-weight: $font-weight-semibold;
+ }
+ }
+
+ &__template-card-desc {
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ line-height: 1.4;
+ overflow-wrap: anywhere;
+ }
+
+ &__template-card-meta {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ flex-wrap: wrap;
+ margin-top: 2px;
+
+ .tg {
+ padding: 1px 7px;
+ border-radius: $radius-sm;
+ background: var(--surface-2);
+ color: var(--text-dim);
+ font-size: 10.5px;
+ font-family: $font-mono;
+ text-transform: capitalize;
+ }
+
+ em {
+ color: var(--text-faint);
+ font-size: $font-size-xs;
+ font-family: $font-mono;
+ font-style: normal;
+ overflow-wrap: anywhere;
+ }
+ }
+
+ // "Bring your own" — deploy any repo with a serverkit.yml / compose file.
+ &__byo {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-3;
+ padding: $space-4;
+ background: $bg-elevated;
+ border: 1px dashed $border-subtle;
+ border-radius: $radius-md;
+
+ div {
+ min-width: 0;
+ }
+
+ strong {
+ display: block;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-semibold;
+ }
+
+ span {
+ display: block;
+ margin-top: 2px;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ line-height: 1.4;
+ }
+ }
+
+ &__pane-link {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ text-decoration: none;
+
+ &:hover { color: $accent-primary; }
+ }
+
// ── Fields (shared) ─────────────────────────────────────
&__field {
display: grid;