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(wordpress): create a site from the same drawer as everything else

Juan Denis5b26e427a1ce
diff --git a/docs/screenshots/wordpress-create-drawer.png b/docs/screenshots/wordpress-create-drawer.png
new file mode 100644
index 00000000..a4f27059
Binary files /dev/null and b/docs/screenshots/wordpress-create-drawer.png differ
diff --git a/frontend/src/pages/Templates.jsx b/frontend/src/pages/Templates.jsx
index ec2df5e4..2b140b3c 100644
--- a/frontend/src/pages/Templates.jsx
+++ b/frontend/src/pages/Templates.jsx
@@ -839,10 +839,10 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
subtitle={[`v${template.version}`, ...(template.categories || []).slice(0, 3)].join(' · ')}
icon={renderIcon(template, 20)}
width={560}
- className="tpl-deploy-drawer"
+ className="sk-formdrawer"
>
- <form onSubmit={handleInstall} className="tpl-deploy-drawer__form">
- <div className="tpl-deploy-drawer__body">
+ <form onSubmit={handleInstall} className="sk-formdrawer__form">
+ <div className="sk-formdrawer__body">
{errors.length > 0 && (
<div className="alert alert-danger">
<ul>
@@ -851,11 +851,11 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
</div>
)}
- <p className="tpl-deploy-drawer__desc">{template.description}</p>
+ <p className="sk-formdrawer__desc">{template.description}</p>
- <div className="tpl-deploy-drawer__field">
+ <div className="sk-formdrawer__field">
<label htmlFor="tpl-deploy-name">Service name</label>
- <div className="tpl-deploy-drawer__input">
+ <div className="sk-formdrawer__input">
<Box size={15} />
<input
id="tpl-deploy-name"
@@ -867,7 +867,7 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
required
/>
</div>
- <span className="tpl-deploy-drawer__hint">
+ <span className="sk-formdrawer__hint">
Lowercase letters, numbers, and hyphens only (min 2 chars)
</span>
</div>
@@ -875,9 +875,9 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
{/* Repo templates build from source, so the branch is the one
thing the template cannot decide for you. */}
{isRepo && (
- <div className="tpl-deploy-drawer__field">
+ <div className="sk-formdrawer__field">
<label htmlFor="tpl-deploy-branch">Branch</label>
- <div className="tpl-deploy-drawer__input">
+ <div className="sk-formdrawer__input">
<GitBranch size={15} />
<input
id="tpl-deploy-branch"
@@ -887,7 +887,7 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
placeholder="main"
/>
</div>
- <span className="tpl-deploy-drawer__hint">
+ <span className="sk-formdrawer__hint">
{template.repo?.url || 'Builds from the template repository'}
</span>
</div>
@@ -897,13 +897,13 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
no base there is no subdomain to promise, and a dead
field would be worse than none. */}
{domainPreview && (
- <div className="tpl-deploy-drawer__field">
- <span className="tpl-deploy-drawer__label">Domain</span>
- <div className="tpl-deploy-drawer__input tpl-deploy-drawer__input--readonly">
+ <div className="sk-formdrawer__field">
+ <span className="sk-formdrawer__label">Domain</span>
+ <div className="sk-formdrawer__input sk-formdrawer__input--readonly">
<Globe size={15} />
- <span className="tpl-deploy-drawer__domain">{domainPreview}</span>
+ <span className="sk-formdrawer__domain">{domainPreview}</span>
</div>
- <span className="tpl-deploy-drawer__hint">
+ <span className="sk-formdrawer__hint">
{httpsBase
? 'Published automatically with HTTPS once the deploy finishes'
: 'Published automatically once the deploy finishes'}
@@ -911,8 +911,8 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
</div>
)}
- <div className="tpl-deploy-drawer__field">
- <span className="tpl-deploy-drawer__label">Deploy to server</span>
+ <div className="sk-formdrawer__field">
+ <span className="sk-formdrawer__label">Deploy to server</span>
<ServerPicker
servers={servers}
value={selectedServerId}
@@ -921,8 +921,8 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
</div>
{visibleVars.length > 0 && (
- <div className="tpl-deploy-drawer__field">
- <span className="tpl-deploy-drawer__label">Configuration</span>
+ <div className="sk-formdrawer__field">
+ <span className="sk-formdrawer__label">Configuration</span>
{visibleVars.map(variable => (
<div key={variable.name} className="form-group">
<label>
@@ -966,7 +966,7 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
)}
</div>
- <div className="tpl-deploy-drawer__foot">
+ <div className="sk-formdrawer__foot">
<Button type="button" variant="outline" onClick={onClose} disabled={installing}>
Cancel
</Button>
diff --git a/frontend/src/pages/WordPress.jsx b/frontend/src/pages/WordPress.jsx
index f1572ef8..6a215e56 100644
--- a/frontend/src/pages/WordPress.jsx
+++ b/frontend/src/pages/WordPress.jsx
@@ -7,7 +7,7 @@ import ResourceGate from '../components/ResourceGate';
import Spinner from '../components/Spinner';
import ResourceListPage from '../components/layouts/ResourceListPage';
import { Globe, ChevronRight } from 'lucide-react';
-import { Pill, ServiceTile } from '@/components/ds';
+import { Pill, ServiceTile, Drawer } from '@/components/ds';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
@@ -529,15 +529,21 @@ function WordPress() {
</div>
</Modal>
- {/* Create Site Modal */}
- <Modal
+ {/* Create Site — the same drawer shape the templates catalog uses, so
+ creating a WordPress site and deploying a template feel like one
+ product rather than two. */}
+ <Drawer
open={showCreateModal}
- onClose={() => !createLoading && setShowCreateModal(false)}
+ onOpenChange={(next) => { if (!next && !createLoading) setShowCreateModal(false); }}
title="Create WordPress Site"
- size="lg"
+ subtitle="WordPress + MySQL on an isolated Docker network"
+ icon={<Globe size={20} />}
+ width={560}
+ className="sk-formdrawer"
>
- <div className="modal-body">
- <div className="install-warning">
+ <div className="sk-formdrawer__form">
+ <div className="sk-formdrawer__body">
+ <div className="sk-formdrawer__callout">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="12" r="10"/><path d="M12 8v4M12 16h.01"/></svg>
<div>
<strong>This will create:</strong>
@@ -549,7 +555,7 @@ function WordPress() {
</div>
</div>
- <div className="form-group">
+ <div className="sk-formdrawer__field">
<Label>
Site Name <span className="required">*</span>
</Label>
@@ -560,11 +566,11 @@ function WordPress() {
placeholder="my-wordpress-site"
disabled={createLoading}
/>
- <span className="form-hint">Used as the Docker project name. Letters, numbers, and hyphens only.</span>
+ <span className="sk-formdrawer__hint">Used as the Docker project name. Letters, numbers, and hyphens only.</span>
</div>
{baseDomains.length > 0 ? (
- <div className="form-group">
+ <div className="sk-formdrawer__field">
<Label>Publish under</Label>
<select
value={createForm.baseDomain}
@@ -577,20 +583,20 @@ function WordPress() {
</option>
))}
</select>
- <span className="form-hint">
+ <span className="sk-formdrawer__hint">
{createForm.name
? <>The site will be live at <code>{slugifyPreview(createForm.name)}.{createForm.baseDomain}</code>.</>
: <>Which base domain to publish this site under.</>}
</span>
</div>
) : (
- <div className="form-group">
+ <div className="sk-formdrawer__field">
<Label>Publish under</Label>
- <span className="form-hint">No base domain configured — the site will be reachable at <code>localhost:&lt;port&gt;</code>. Add a managed-sites base domain in Settings to publish it at a real subdomain.</span>
+ <span className="sk-formdrawer__hint">No base domain configured — the site will be reachable at <code>localhost:&lt;port&gt;</code>. Add a managed-sites base domain in Settings to publish it at a real subdomain.</span>
</div>
)}
- <div className="form-group">
+ <div className="sk-formdrawer__field">
<Label>Custom Domain</Label>
<Input
type="text"
@@ -599,10 +605,10 @@ function WordPress() {
placeholder="example.com"
disabled={createLoading}
/>
- <span className="form-hint">Optional. Overrides the base domain above — the site is created and migrated to this domain.</span>
+ <span className="sk-formdrawer__hint">Optional. Overrides the base domain above — the site is created and migrated to this domain.</span>
</div>
- <div className="form-group">
+ <div className="sk-formdrawer__field">
<Label>Admin Email</Label>
<Input
type="email"
@@ -613,7 +619,7 @@ function WordPress() {
/>
</div>
- <div className="form-group">
+ <div className="sk-formdrawer__field">
<Label>PHP Version</Label>
<select
value={createForm.phpVersion}
@@ -625,10 +631,10 @@ function WordPress() {
<option value="8.2">PHP 8.2</option>
<option value="8.3">PHP 8.3</option>
</select>
- <span className="form-hint">Baked into the container image at creation. Changeable later from the PHP tab.</span>
+ <span className="sk-formdrawer__hint">Baked into the container image at creation. Changeable later from the PHP tab.</span>
</div>
- <div className="form-group">
+ <div className="sk-formdrawer__field">
<label className="checkbox-label">
<input
type="checkbox"
@@ -638,10 +644,10 @@ function WordPress() {
/>
Enable full-page cache
</label>
- <span className="form-hint">Disk page cache with WordPress-aware skip rules (admin, login, cart, checkout).</span>
+ <span className="sk-formdrawer__hint">Disk page cache with WordPress-aware skip rules (admin, login, cart, checkout).</span>
</div>
- <div className="form-group">
+ <div className="sk-formdrawer__field">
<label className="checkbox-label">
<input
type="checkbox"
@@ -651,25 +657,26 @@ function WordPress() {
/>
Enable Redis object cache
</label>
- <span className="form-hint">Uses the bundled Redis container with the redis-cache drop-in.</span>
+ <span className="sk-formdrawer__hint">Uses the bundled Redis container with the redis-cache drop-in.</span>
</div>
- </div>
- <div className="modal-footer">
- <Button
- variant="outline"
- onClick={() => setShowCreateModal(false)}
- disabled={createLoading}
- >
- Cancel
- </Button>
- <Button
- onClick={handleCreate}
- disabled={createLoading || !createForm.name}
- >
- {createLoading ? <><Spinner size="sm" /> Creating...</> : 'Create Site'}
- </Button>
- </div>
- </Modal>
+ </div>
+ <div className="sk-formdrawer__foot">
+ <Button
+ variant="outline"
+ onClick={() => setShowCreateModal(false)}
+ disabled={createLoading}
+ >
+ Cancel
+ </Button>
+ <Button
+ onClick={handleCreate}
+ disabled={createLoading || !createForm.name}
+ >
+ {createLoading ? <><Spinner size="sm" /> Creating...</> : 'Create Site'}
+ </Button>
+ </div>
+ </div>
+ </Drawer>
</ResourceListPage>
);
}
diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scss
index 29dae046..86919ad9 100644
--- a/frontend/src/styles/components/_design-system.scss
+++ b/frontend/src/styles/components/_design-system.scss
@@ -764,3 +764,199 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
&.is-copied { color: var(--green); }
&__label { margin-left: 6px; }
}
+
+// ============================================
+// FORM DRAWER (shared right slide-over that collects a form)
+// Name → domain → placement → the rest, in that order: everything the action
+// commits you to, visible before you commit to it. Shared rather than
+// page-scoped because drawers render in a portal — styles nested under a
+// page class simply never reach them.
+// ============================================
+.sk-formdrawer {
+ &__form {
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+ height: 100%;
+ }
+
+ &__body {
+ flex: 1;
+ overflow-y: auto;
+ min-height: 0;
+ padding: $space-4 $space-5 $space-6;
+ }
+
+ &__desc {
+ margin: 0 0 $space-4;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ line-height: 1.5;
+ }
+
+ &__field {
+ margin-bottom: $space-4;
+
+ &:last-child { margin-bottom: 0; }
+ }
+
+ label,
+ &__label {
+ display: block;
+ margin-bottom: 7px;
+ color: $text-secondary;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-medium;
+ }
+
+ // Bare <select> and <input type=checkbox> inside a drawer would otherwise
+ // render with the browser's own chrome — a white box on a dark panel. Styled
+ // here rather than at each call site so any form moved into a drawer looks
+ // like the rest of it without the page having to remember.
+ select {
+ width: 100%;
+ padding: 8px 11px;
+ background: var(--surface-2);
+ border: 1px solid var(--border);
+ border-radius: $radius-md;
+ color: $text-primary;
+ font-family: inherit;
+ font-size: $font-size-sm;
+ cursor: pointer;
+ transition: border-color $transition-fast, box-shadow $transition-fast;
+
+ &:focus {
+ outline: none;
+ border-color: $accent-primary;
+ box-shadow: 0 0 0 3px $accent-glow;
+ }
+
+ &:disabled { opacity: 0.6; cursor: default; }
+ }
+
+ // A checkbox row reads as one control: the box and its wording sit on a
+ // line together, and the label is not indented away from the field above.
+ .checkbox-label {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ margin-bottom: 0;
+ color: $text-primary;
+ font-size: $font-size-sm;
+ cursor: pointer;
+
+ input[type='checkbox'] {
+ width: 16px;
+ height: 16px;
+ flex-shrink: 0;
+ accent-color: var(--accent-primary);
+ cursor: pointer;
+ }
+ }
+
+ code {
+ padding: 1px 5px;
+ border-radius: $radius-sm;
+ background: var(--surface-3);
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: $text-primary;
+ }
+
+ &__input {
+ display: flex;
+ align-items: center;
+ gap: 9px;
+ padding: 8px 11px;
+ background: var(--surface-2);
+ border: 1px solid var(--border);
+ border-radius: $radius-md;
+ transition: border-color $transition-fast, box-shadow $transition-fast;
+
+ &:focus-within {
+ border-color: $accent-primary;
+ box-shadow: 0 0 0 3px $accent-glow;
+ }
+
+ // The domain is derived from the service name + base domain, so it is
+ // shown rather than typed — editing it here would silently diverge from
+ // what the finalizer actually publishes.
+ &--readonly {
+ background: $bg-elevated;
+ &:focus-within { border-color: var(--border); box-shadow: none; }
+ }
+
+ svg { flex-shrink: 0; color: $text-tertiary; }
+
+ input {
+ flex: 1;
+ min-width: 0;
+ background: none;
+ border: none;
+ outline: none;
+ color: $text-primary;
+ font-size: $font-size-sm;
+
+ &::placeholder { color: $text-tertiary; }
+ }
+ }
+
+ &__domain {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ color: $text-primary;
+ font-family: var(--mono);
+ font-size: 12.5px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ &__hint {
+ display: block;
+ margin-top: 6px;
+ color: $text-tertiary;
+ font-family: var(--mono);
+ font-size: 11.5px;
+ }
+
+ &__foot {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-2;
+ flex-shrink: 0;
+ padding: $space-3 $space-5;
+ border-top: 1px solid $border-subtle;
+ background: $bg-elevated;
+ }
+
+ // Lead callout ("this will create ..."). Lives here, not under a page
+ // class: a portalled drawer is not a descendant of the page that opened it.
+ &__callout {
+ display: flex;
+ gap: $space-3;
+ margin-bottom: $space-4;
+ padding: $space-3 $space-4;
+ background: rgba($warning-raw, 0.08);
+ border: 1px solid rgba($warning-raw, 0.2);
+ border-radius: $radius-md;
+
+ > svg { flex-shrink: 0; margin-top: 2px; color: $warning; }
+
+ strong {
+ display: block;
+ margin-bottom: $space-2;
+ color: $text-primary;
+ font-size: $font-size-sm;
+ }
+
+ ul {
+ margin: 0;
+ padding-left: $space-4;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ line-height: 1.6;
+ }
+ }
+}
diff --git a/frontend/src/styles/pages/_templates.scss b/frontend/src/styles/pages/_templates.scss
index a03515d8..a20cd3d6 100644
--- a/frontend/src/styles/pages/_templates.scss
+++ b/frontend/src/styles/pages/_templates.scss
@@ -893,116 +893,6 @@
}
}
-// ============================================
-// TEMPLATE DEPLOY DRAWER (right slide-over from a catalog card)
-// Name → domain → placement → template config, in that order: everything the
-// deploy commits you to, visible before you commit to it.
-// ============================================
-.tpl-deploy-drawer {
- &__form {
- display: flex;
- flex-direction: column;
- min-height: 0;
- height: 100%;
- }
-
- &__body {
- flex: 1;
- overflow-y: auto;
- min-height: 0;
- padding: $space-4 $space-5 $space-6;
- }
-
- &__desc {
- margin: 0 0 $space-4;
- color: $text-tertiary;
- font-size: $font-size-sm;
- line-height: 1.5;
- }
-
- &__field {
- margin-bottom: $space-4;
-
- &:last-child { margin-bottom: 0; }
- }
-
- label,
- &__label {
- display: block;
- margin-bottom: 7px;
- color: $text-secondary;
- font-size: $font-size-xs;
- font-weight: $font-weight-medium;
- }
-
- &__input {
- display: flex;
- align-items: center;
- gap: 9px;
- padding: 8px 11px;
- background: var(--surface-2);
- border: 1px solid var(--border);
- border-radius: $radius-md;
- transition: border-color $transition-fast, box-shadow $transition-fast;
-
- &:focus-within {
- border-color: $accent-primary;
- box-shadow: 0 0 0 3px $accent-glow;
- }
-
- // The domain is derived from the service name + base domain, so it is
- // shown rather than typed — editing it here would silently diverge from
- // what the finalizer actually publishes.
- &--readonly {
- background: $bg-elevated;
- &:focus-within { border-color: var(--border); box-shadow: none; }
- }
-
- svg { flex-shrink: 0; color: $text-tertiary; }
-
- input {
- flex: 1;
- min-width: 0;
- background: none;
- border: none;
- outline: none;
- color: $text-primary;
- font-size: $font-size-sm;
-
- &::placeholder { color: $text-tertiary; }
- }
- }
-
- &__domain {
- flex: 1;
- min-width: 0;
- overflow: hidden;
- color: $text-primary;
- font-family: var(--mono);
- font-size: 12.5px;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- &__hint {
- display: block;
- margin-top: 6px;
- color: $text-tertiary;
- font-family: var(--mono);
- font-size: 11.5px;
- }
-
- &__foot {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: $space-2;
- flex-shrink: 0;
- padding: $space-3 $space-5;
- border-top: 1px solid $border-subtle;
- background: $bg-elevated;
- }
-}
// ---- server picker (shared: template deploy, and any future placement UI) ---
.sk-srvpick {