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.

feat(ui): move env var creation into a modal, always store as secret

Juan Denis7d22c2cbcf39
diff --git a/frontend/src/components/EnvironmentVariables.jsx b/frontend/src/components/EnvironmentVariables.jsx
index 617b1278..f2a018f6 100644
--- a/frontend/src/components/EnvironmentVariables.jsx
+++ b/frontend/src/components/EnvironmentVariables.jsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useRef } from 'react';
+import { Plus } from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { Button } from '@/components/ui/button';
@@ -6,6 +7,7 @@ import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
import { Checkbox } from '@/components/ui/checkbox';
import { Badge } from '@/components/ui/badge';
+import { Label } from '@/components/ui/label';
import Modal from './Modal';
import EmptyState from './EmptyState';
@@ -15,10 +17,10 @@ const EnvironmentVariables = ({ appId }) => {
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
- // Form state
+ // Form state (add modal). Env vars are always stored as secrets — there is
+ // no "make this one public" choice, so no is_secret toggle here.
const [newKey, setNewKey] = useState('');
const [newValue, setNewValue] = useState('');
- const [newIsSecret, setNewIsSecret] = useState(false);
const [newDescription, setNewDescription] = useState('');
const [newTargetService, setNewTargetService] = useState('');
@@ -31,6 +33,7 @@ const EnvironmentVariables = ({ appId }) => {
const [editingId, setEditingId] = useState(null);
const [editValue, setEditValue] = useState('');
const [editTargetService, setEditTargetService] = useState('');
+ const [showAddModal, setShowAddModal] = useState(false);
const [showImportModal, setShowImportModal] = useState(false);
const [showHistoryModal, setShowHistoryModal] = useState(false);
const [importContent, setImportContent] = useState('');
@@ -68,6 +71,14 @@ const EnvironmentVariables = ({ appId }) => {
}
}
+ function openAddModal() {
+ setNewKey('');
+ setNewValue('');
+ setNewDescription('');
+ setNewTargetService('');
+ setShowAddModal(true);
+ }
+
async function handleAdd(e) {
e.preventDefault();
if (!newKey.trim()) {
@@ -77,13 +88,15 @@ const EnvironmentVariables = ({ appId }) => {
setSaving(true);
try {
- await api.createEnvVar(appId, newKey.trim(), newValue, newIsSecret, newDescription || null, newTargetService || null);
+ // Always stored as a secret — env vars are treated as sensitive by
+ // default, so we never ask the user to opt out of masking.
+ await api.createEnvVar(appId, newKey.trim(), newValue, true, newDescription || null, newTargetService || null);
toast.success('Environment variable added');
setNewKey('');
setNewValue('');
- setNewIsSecret(false);
setNewDescription('');
setNewTargetService('');
+ setShowAddModal(false);
loadEnvVars();
} catch (err) {
toast.error(err.message || 'Failed to add environment variable');
@@ -128,15 +141,6 @@ const EnvironmentVariables = ({ appId }) => {
}
}
- async function handleToggleSecret(envVar) {
- try {
- await api.updateEnvVar(appId, envVar.key, { is_secret: !envVar.is_secret });
- loadEnvVars();
- } catch (err) {
- toast.error('Failed to update');
- }
- }
-
function toggleShowValue(id) {
setShowValues(prev => {
const next = { ...prev, [id]: !prev[id] };
@@ -264,6 +268,10 @@ const EnvironmentVariables = ({ appId }) => {
<div className="section-header">
<h3>Environment Variables</h3>
<div className="header-actions">
+ <Button size="sm" onClick={openAddModal}>
+ <Plus size={15} />
+ Add Variable
+ </Button>
{envVars.length > 0 && (
<Button variant="outline" size="sm" onClick={toggleShowAll} title={allVisible ? 'Hide all values' : 'Show all values'}>
{allVisible ? (
@@ -303,52 +311,208 @@ const EnvironmentVariables = ({ appId }) => {
</div>
<p className="hint">
- Environment variables are encrypted at rest. Changes require app restart to take effect.
+ Environment variables are encrypted at rest and masked by default. Changes require an app restart to take effect.
</p>
- {/* Add new variable form */}
- <form className="env-add-form" onSubmit={handleAdd}>
- <div className="env-form-row">
- <Input
- type="text"
- value={newKey}
- onChange={(e) => setNewKey(e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g, ''))}
- placeholder="KEY_NAME"
- className="env-key-input"
- />
- <Input
- type={newIsSecret ? 'password' : 'text'}
- value={newValue}
- onChange={(e) => setNewValue(e.target.value)}
- placeholder="value"
- className="env-value-input"
- />
- <label className="env-secret-toggle" title="Mark as secret">
- <Checkbox
- checked={newIsSecret}
- onCheckedChange={setNewIsSecret}
- />
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
- <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
- </svg>
- </label>
- <Button type="submit" disabled={saving}>
- Add
- </Button>
+ {/* Variables — bordered panel with a titled head + count */}
+ <section className="env-panel">
+ <div className="env-panel__head">
+ <span className="env-panel__title">
+ Variables
+ {envVars.length > 0 && (
+ <span className="env-panel__count">{envVars.length}</span>
+ )}
+ </span>
+ {envVars.length > 5 && (
+ <div className="env-panel__filter">
+ <Input
+ type="text"
+ value={filter}
+ onChange={(e) => setFilter(e.target.value)}
+ placeholder="Filter variables..."
+ />
+ {filter && (
+ <button type="button" className="filter-clear" onClick={() => setFilter('')}>&times;</button>
+ )}
+ </div>
+ )}
</div>
- <div className="env-form-meta-row">
- <Input
- type="text"
- value={newDescription}
- onChange={(e) => setNewDescription(e.target.value)}
- placeholder="Optional description..."
- className="env-description-input"
- />
+ <div className="env-panel__body">
+ {filteredEnvVars.length === 0 ? (
+ <div className="env-empty">
+ <p>{filter ? 'No matching variables' : 'No environment variables defined yet'}</p>
+ {!filter && (
+ <Button size="sm" onClick={openAddModal}>
+ <Plus size={15} />
+ Add Variable
+ </Button>
+ )}
+ </div>
+ ) : (
+ <div className="env-list">
+ {filteredEnvVars.map(envVar => (
+ <div key={envVar.id} className="env-item">
+ <div className="env-item-header">
+ <span className="env-key">
+ {envVar.key}
+ {envVar.target_service && (
+ <span
+ className="env-target-chip"
+ title={`Applies only to the "${envVar.target_service}" service`}
+ >
+ &rarr; {envVar.target_service}
+ </span>
+ )}
+ </span>
+ <div className="env-item-actions">
+ <button type="button"
+ className="btn-icon"
+ onClick={() => toggleShowValue(envVar.id)}
+ title={showValues[envVar.id] ? 'Hide value' : 'Show value'}
+ >
+ {showValues[envVar.id] ? (
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>
+ <line x1="1" y1="1" x2="23" y2="23"/>
+ </svg>
+ ) : (
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
+ <circle cx="12" cy="12" r="3"/>
+ </svg>
+ )}
+ </button>
+ <button type="button"
+ className="btn-icon"
+ onClick={() => copyToClipboard(envVar.value)}
+ title="Copy value"
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
+ </svg>
+ </button>
+ <button type="button"
+ className="btn-icon"
+ onClick={() => startEditing(envVar)}
+ title="Edit"
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
+ <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
+ </svg>
+ </button>
+ <button type="button"
+ className="btn-icon btn-danger"
+ onClick={() => handleDelete(envVar.key)}
+ title="Delete"
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <polyline points="3 6 5 6 21 6"/>
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
+ </svg>
+ </button>
+ </div>
+ </div>
+
+ {editingId === envVar.id ? (
+ <div className="env-edit-row">
+ <Input
+ type="text"
+ value={editValue}
+ onChange={(e) => setEditValue(e.target.value)}
+ autoFocus
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') handleUpdate(envVar.key);
+ if (e.key === 'Escape') cancelEditing();
+ }}
+ />
+ {composeServices.length > 0 && (
+ <select
+ className="env-target-select__control"
+ value={editTargetService}
+ onChange={(e) => setEditTargetService(e.target.value)}
+ title="Inject this variable into a single compose service"
+ >
+ <option value="">All services</option>
+ {composeServices.map((svc) => (
+ <option key={svc} value={svc}>{svc}</option>
+ ))}
+ </select>
+ )}
+ <Button size="sm" onClick={() => handleUpdate(envVar.key)}>
+ Save
+ </Button>
+ <Button variant="outline" size="sm" onClick={cancelEditing}>
+ Cancel
+ </Button>
+ </div>
+ ) : (
+ <div className="env-value">
+ {showValues[envVar.id] ? envVar.value : '••••••••••••'}
+ </div>
+ )}
+
+ {envVar.description && (
+ <div className="env-description">{envVar.description}</div>
+ )}
+ </div>
+ ))}
+ </div>
+ )}
+
+ {/* Footer actions */}
+ {envVars.length > 0 && (
+ <div className="env-footer">
+ <Button variant="outline" size="sm" className="env-clear-btn" onClick={handleClearAll}>
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <polyline points="3 6 5 6 21 6"/>
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
+ </svg>
+ Clear All
+ </Button>
+ </div>
+ )}
+ </div>
+ </section>
+
+ {/* Add Variable Modal */}
+ <Modal open={showAddModal} onClose={() => setShowAddModal(false)} title="Add Environment Variable">
+ <form onSubmit={handleAdd}>
+ <div className="form-group">
+ <Label>Key</Label>
+ <Input
+ type="text"
+ value={newKey}
+ onChange={(e) => setNewKey(e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g, ''))}
+ placeholder="KEY_NAME"
+ className="env-key-input"
+ autoFocus
+ />
+ </div>
+ <div className="form-group">
+ <Label>Value</Label>
+ <Input
+ type="text"
+ value={newValue}
+ onChange={(e) => setNewValue(e.target.value)}
+ placeholder="value"
+ />
+ </div>
+ <div className="form-group">
+ <Label>Description <span className="env-optional">(optional)</span></Label>
+ <Input
+ type="text"
+ value={newDescription}
+ onChange={(e) => setNewDescription(e.target.value)}
+ placeholder="What is this variable for?"
+ />
+ </div>
{composeServices.length > 0 && (
- <label className="env-target-select" title="Inject this variable into a single compose service">
- <span className="env-target-select__label">Applies to</span>
+ <div className="form-group">
+ <Label>Applies to</Label>
<select
+ className="env-target-select__control"
value={newTargetService}
onChange={(e) => setNewTargetService(e.target.value)}
>
@@ -357,178 +521,21 @@ const EnvironmentVariables = ({ appId }) => {
<option key={svc} value={svc}>{svc}</option>
))}
</select>
- </label>
- )}
- </div>
- </form>
-
- {/* Filter */}
- {envVars.length > 5 && (
- <div className="env-filter">
- <Input
- type="text"
- value={filter}
- onChange={(e) => setFilter(e.target.value)}
- placeholder="Filter variables..."
- />
- {filter && (
- <button type="button" className="filter-clear" onClick={() => setFilter('')}>&times;</button>
- )}
- </div>
- )}
-
- {/* Variables list */}
- {filteredEnvVars.length === 0 ? (
- <div className="env-empty">
- {filter ? 'No matching variables' : 'No environment variables defined yet'}
- </div>
- ) : (
- <div className="env-list">
- {filteredEnvVars.map(envVar => (
- <div key={envVar.id} className={`env-item ${envVar.is_secret ? 'is-secret' : ''}`}>
- <div className="env-item-header">
- <span className="env-key">
- {envVar.key}
- {envVar.is_secret && (
- <span className="secret-badge" title="Secret value">
- <svg viewBox="0 0 24 24" width="12" height="12" stroke="currentColor" fill="none" strokeWidth="2">
- <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
- <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
- </svg>
- </span>
- )}
- {envVar.target_service && (
- <span
- className="env-target-chip"
- title={`Applies only to the "${envVar.target_service}" service`}
- >
- &rarr; {envVar.target_service}
- </span>
- )}
- </span>
- <div className="env-item-actions">
- <button type="button"
- className="btn-icon"
- onClick={() => toggleShowValue(envVar.id)}
- title={showValues[envVar.id] ? 'Hide value' : 'Show value'}
- >
- {showValues[envVar.id] ? (
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>
- <line x1="1" y1="1" x2="23" y2="23"/>
- </svg>
- ) : (
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
- <circle cx="12" cy="12" r="3"/>
- </svg>
- )}
- </button>
- <button type="button"
- className="btn-icon"
- onClick={() => copyToClipboard(envVar.value)}
- title="Copy value"
- >
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
- <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
- </svg>
- </button>
- <button type="button"
- className="btn-icon"
- onClick={() => startEditing(envVar)}
- title="Edit"
- >
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
- <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
- </svg>
- </button>
- <button type="button"
- className="btn-icon"
- onClick={() => handleToggleSecret(envVar)}
- title={envVar.is_secret ? 'Mark as non-secret' : 'Mark as secret'}
- >
- {envVar.is_secret ? (
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
- <path d="M7 11V7a5 5 0 0 1 9.9-1"/>
- </svg>
- ) : (
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
- <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
- </svg>
- )}
- </button>
- <button type="button"
- className="btn-icon btn-danger"
- onClick={() => handleDelete(envVar.key)}
- title="Delete"
- >
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <polyline points="3 6 5 6 21 6"/>
- <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
- </svg>
- </button>
- </div>
- </div>
-
- {editingId === envVar.id ? (
- <div className="env-edit-row">
- <Input
- type="text"
- value={editValue}
- onChange={(e) => setEditValue(e.target.value)}
- autoFocus
- onKeyDown={(e) => {
- if (e.key === 'Enter') handleUpdate(envVar.key);
- if (e.key === 'Escape') cancelEditing();
- }}
- />
- {composeServices.length > 0 && (
- <select
- className="env-target-select__control"
- value={editTargetService}
- onChange={(e) => setEditTargetService(e.target.value)}
- title="Inject this variable into a single compose service"
- >
- <option value="">All services</option>
- {composeServices.map((svc) => (
- <option key={svc} value={svc}>{svc}</option>
- ))}
- </select>
- )}
- <Button size="sm" onClick={() => handleUpdate(envVar.key)}>
- Save
- </Button>
- <Button variant="outline" size="sm" onClick={cancelEditing}>
- Cancel
- </Button>
- </div>
- ) : (
- <div className="env-value">
- {showValues[envVar.id] ? envVar.value : '••••••••••••'}
- </div>
- )}
-
- {envVar.description && (
- <div className="env-description">{envVar.description}</div>
- )}
</div>
- ))}
- </div>
- )}
-
- {/* Footer actions */}
- {envVars.length > 0 && (
- <div className="env-footer">
- <span className="env-count">{envVars.length} variable{envVars.length !== 1 ? 's' : ''}</span>
- <Button variant="destructive" size="sm" onClick={handleClearAll}>
- Clear All
- </Button>
- </div>
- )}
+ )}
+ <p className="hint env-modal-hint">
+ Stored encrypted and masked by default. Reveal it any time with the eye icon.
+ </p>
+ <div className="modal-footer">
+ <Button type="button" variant="outline" onClick={() => setShowAddModal(false)}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={saving}>
+ {saving ? 'Adding...' : 'Add Variable'}
+ </Button>
+ </div>
+ </form>
+ </Modal>
{/* Import Modal */}
<Modal open={showImportModal} onClose={() => setShowImportModal(false)} title="Import Environment Variables">
diff --git a/frontend/src/styles/components/_env-vars.scss b/frontend/src/styles/components/_env-vars.scss
index 893d0e12..85774259 100644
--- a/frontend/src/styles/components/_env-vars.scss
+++ b/frontend/src/styles/components/_env-vars.scss
@@ -20,109 +20,72 @@
}
.hint {
- color: $text-tertiary;
+ color: $text-secondary;
font-size: $font-size-sm;
- margin-bottom: $space-6;
+ margin-bottom: $space-5;
}
}
-// Add new variable form
-.env-add-form {
- background: $bg-card;
- border: 1px solid $border-subtle;
- border-radius: $radius-md;
- padding: $space-4;
- margin-bottom: $space-6;
+// ── Panels ──────────────────────────────────────────────────────────────
+// Each logical group (Add / Variables) is a bordered surface that lifts off
+// the page body, so sections read as sections instead of dissolving into the
+// background. Uses --border (not --border-soft) + a soft shadow because on the
+// dark theme --surface sits only a hair above --bg-body.
+.env-panel {
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ box-shadow: var(--shadow-sm);
+ overflow: hidden;
+ margin-bottom: $space-4;
- .env-form-row {
+ &__head {
display: flex;
- gap: $space-2;
- margin-bottom: $space-2;
- }
-
- .env-key-input {
- width: 200px;
- flex-shrink: 0;
- font-family: $font-mono;
- text-transform: uppercase;
- }
-
- .env-value-input {
- flex: 1;
+ align-items: center;
+ gap: $space-3;
+ padding: 11px $space-4;
+ background: var(--surface-2);
+ border-bottom: 1px solid var(--border-soft);
}
- .env-secret-toggle {
- display: flex;
+ &__title {
+ display: inline-flex;
align-items: center;
- justify-content: center;
- width: 40px;
- height: 40px;
- background: $bg-hover;
- border: 1px solid $border-subtle;
- border-radius: $radius-sm;
- cursor: pointer;
- color: $text-tertiary;
- transition: all 0.2s;
-
- input {
- display: none;
- }
-
- &:hover {
- border-color: $accent-primary;
- color: $accent-primary;
- }
-
- &:has(input:checked) {
- background: fade($accent-primary-raw, 20%);
- border-color: $accent-primary;
- color: $accent-primary;
- }
+ gap: 8px;
+ font-family: var(--mono);
+ font-size: 10.5px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-faint);
}
- .env-description-input {
- flex: 1;
- font-size: $font-size-sm;
- color: $text-secondary;
+ // Count chip beside the "Variables" title
+ &__count {
+ font-family: var(--mono);
+ font-size: 10.5px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0;
+ color: var(--accent-bright);
+ background: var(--accent-bg);
+ padding: 1px 7px;
+ border-radius: $radius-full;
}
- // Second form row: description + optional compose-service target
- .env-form-meta-row {
- display: flex;
- gap: $space-2;
- align-items: stretch;
+ &__body {
+ padding: $space-4;
}
}
-// "Applies to" selector — compose-service targeting (add form)
-.env-target-select {
- display: flex;
- align-items: center;
- gap: $space-2;
- flex-shrink: 0;
- color: $text-tertiary;
- font-size: $font-size-sm;
-
- &__label {
- white-space: nowrap;
- }
-
- select,
- &__control {
- padding: $space-2 $space-3;
- background: $bg-body;
- border: 1px solid $border-subtle;
- border-radius: $radius-sm;
- color: $text-primary;
- font-size: $font-size-sm;
-
- &:hover {
- border-color: $border-active;
- }
- }
+// Key input — mono, uppercase (used inside the Add Variable modal)
+.env-key-input {
+ width: 100%;
+ font-family: $font-mono;
+ text-transform: uppercase;
}
-// Standalone select control used in the inline edit row
+// "Applies to" compose-service select — used in the Add modal and the inline
+// edit row. Full-width inside a modal .form-group; intrinsic in the edit row.
.env-target-select__control {
padding: $space-2 $space-3;
background: $bg-body;
@@ -137,19 +100,36 @@
}
}
-// Filter
-.env-filter {
+.form-group .env-target-select__control {
+ width: 100%;
+}
+
+// Small "(optional)" tag + reassurance hint inside the Add Variable modal
+.env-optional {
+ color: $text-tertiary;
+ font-weight: $font-weight-normal;
+}
+
+.env-modal-hint {
+ margin: $space-1 0 $space-4;
+}
+
+// Filter — compact search sitting in the Variables panel head, right-aligned
+.env-panel__filter {
position: relative;
- margin-bottom: $space-4;
+ margin-left: auto;
input {
- width: 100%;
- padding-right: 36px;
+ width: 220px;
+ max-width: 46vw;
+ height: 32px;
+ padding-right: 30px;
+ font-size: $font-size-sm;
}
.filter-clear {
position: absolute;
- right: 8px;
+ right: 6px;
top: 50%;
transform: translateY(-50%);
background: none;
@@ -157,7 +137,8 @@
color: $text-tertiary;
cursor: pointer;
font-size: 18px;
- padding: 4px 8px;
+ line-height: 1;
+ padding: 2px 6px;
&:hover {
color: $text-primary;
@@ -173,18 +154,17 @@
}
.env-item {
- background: $bg-card;
- border: 1px solid $border-subtle;
+ // One tier brighter than the panel surface it sits on, so rows have depth
+ // (body < panel --surface < row --surface-2) instead of blending together.
+ background: var(--surface-2);
+ border: 1px solid var(--border-soft);
border-radius: $radius-md;
- padding: $space-4;
- transition: border-color 0.2s;
+ padding: $space-3 $space-4;
+ transition: border-color 0.15s, background 0.15s;
&:hover {
- border-color: $border-active;
- }
-
- &.is-secret {
- border-left: 3px solid $warning;
+ border-color: var(--border-strong);
+ background: var(--surface-3);
}
.env-item-header {
@@ -201,10 +181,6 @@
display: flex;
align-items: center;
gap: $space-1;
-
- .secret-badge {
- color: $warning;
- }
}
.env-item-actions {
@@ -288,28 +264,38 @@
}
}
-// Empty state
+// Empty state — centered inside .env-panel__body, with a primary Add action
.env-empty {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: $space-4;
+ padding: $space-10 $space-6;
text-align: center;
- padding: $space-8;
- color: $text-tertiary;
- background: $bg-card;
- border: 1px dashed $border-subtle;
- border-radius: $radius-md;
+ color: var(--text-faint);
+ font-size: $font-size-sm;
+
+ p { margin: 0; }
}
-// Footer
+// Footer — Clear-all lives here, right-aligned under the list
.env-footer {
display: flex;
- justify-content: space-between;
+ justify-content: flex-end;
align-items: center;
- margin-top: $space-6;
+ margin-top: $space-4;
padding-top: $space-4;
- border-top: 1px solid $border-subtle;
+ border-top: 1px solid var(--border-soft);
+}
- .env-count {
- color: $text-tertiary;
- font-size: $font-size-sm;
+// Clear-all: quiet by default, danger only on hover (no alarming red slab)
+.env-clear-btn.ui-button {
+ color: var(--text-dim);
+
+ &:hover {
+ color: var(--red);
+ border-color: rgba(251, 111, 111, 0.4);
+ background: var(--red-bg);
}
}