mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +09:00
feat(ui): compact page actions and context-aware header +
This commit is contained in:
1 parent
6bdfce036f
commit
cf5eaf02c9
36 files changed
+379
-102
No files matched your search
@@ -1,16 +1,18 @@
|
||||
import { Menu, X } from 'lucide-react';
|
||||
import { Menu, Plus, X } from 'lucide-react';
|
||||
import { t } from '../i18n/t';
|
||||
import { useTheme } from '../contexts/useTheme.js';
|
||||
import ServerKitLogo from './ServerKitLogo';
|
||||
import NotificationBell from './NotificationBell';
|
||||
import QuickCreate from './QuickCreate';
|
||||
import { Button as SharedButton } from '@/components/ui/button';
|
||||
import { useRegisteredPrimaryAction } from '../contexts/pagePrimaryAction.js';
|
||||
|
||||
// Fixed header shown only on narrow viewports (< 768px). Houses the
|
||||
// hamburger toggle that opens the sidebar as an off-canvas drawer, since
|
||||
// the persistent sidebar is hidden at this width. Hidden on desktop via CSS.
|
||||
const MobileTopBar = ({ navOpen, onToggle }) => {
|
||||
const { whiteLabel } = useTheme();
|
||||
const primary = useRegisteredPrimaryAction();
|
||||
const branded = whiteLabel?.enabled;
|
||||
const brandName = branded ? (whiteLabel.brandName || 'Brand') : 'ServerKit';
|
||||
const showCustomLogo = branded && whiteLabel.logoData && whiteLabel.mode !== 'text_only';
|
||||
@@ -43,7 +45,18 @@ const MobileTopBar = ({ navOpen, onToggle }) => {
|
||||
<span className="mobile-topbar__name">{brandName}</span>
|
||||
</div>
|
||||
<div className="mobile-topbar__actions">
|
||||
<QuickCreate />
|
||||
{primary ? (
|
||||
<SharedButton variant="unstyled"
|
||||
type="button"
|
||||
className="quick-create"
|
||||
title={primary.label}
|
||||
aria-label={primary.label}
|
||||
disabled={primary.disabled}
|
||||
onClick={primary.run}
|
||||
>
|
||||
<Plus size={16} />
|
||||
</SharedButton>
|
||||
) : <QuickCreate />}
|
||||
<NotificationBell />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { usePagePrimaryAction } from '../contexts/pagePrimaryAction.js';
|
||||
|
||||
// A page's primary create button: compact icon + short label on desktop (the
|
||||
// full text rides in title/aria-label), and it registers the same action with
|
||||
// the mobile header "+", which takes over at the width where this button hides
|
||||
// (.sk-topbar__primary). Pass `to` instead of onClick to navigate.
|
||||
// `iconOnly` drops the visible label, e.g. for pages with a tight icon bar.
|
||||
export function PagePrimaryButton({ id, label, shortLabel, icon: Icon = Plus, onClick, to, disabled = false, iconOnly = false }) {
|
||||
const navigate = useNavigate();
|
||||
const run = to ? () => navigate(to) : onClick;
|
||||
usePagePrimaryAction({ id, label, onClick: run, disabled });
|
||||
|
||||
return (
|
||||
<Button
|
||||
size={iconOnly ? 'icon' : 'sm'}
|
||||
variant={iconOnly ? 'ghost' : 'default'}
|
||||
className="sk-topbar__primary"
|
||||
title={label}
|
||||
aria-label={label}
|
||||
disabled={disabled}
|
||||
onClick={run}
|
||||
>
|
||||
<Icon size={15} aria-hidden="true" />
|
||||
{!iconOnly && (shortLabel || label)}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
export default PagePrimaryButton;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
import { createPrimaryActionStore } from './pagePrimaryActionStore.js';
|
||||
import { PagePrimaryActionContext } from './pagePrimaryAction.js';
|
||||
|
||||
export function PagePrimaryActionProvider({ children }) {
|
||||
const [store] = useState(createPrimaryActionStore);
|
||||
return (
|
||||
<PagePrimaryActionContext.Provider value={store}>
|
||||
{children}
|
||||
</PagePrimaryActionContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export default PagePrimaryActionProvider;
|
||||
@@ -0,0 +1,27 @@
|
||||
import { createContext, useContext, useEffect, useRef, useSyncExternalStore } from 'react';
|
||||
|
||||
export const PagePrimaryActionContext = createContext(null);
|
||||
|
||||
const noopSubscribe = () => () => {};
|
||||
const none = () => null;
|
||||
|
||||
// The action currently registered by the page, or null. Read by MobileTopBar.
|
||||
export function useRegisteredPrimaryAction() {
|
||||
const store = useContext(PagePrimaryActionContext);
|
||||
return useSyncExternalStore(store ? store.subscribe : noopSubscribe, store ? store.get : none);
|
||||
}
|
||||
|
||||
// A page registers its ONE primary create action; the mobile header "+" runs
|
||||
// it. Cleared on unmount. onClick is kept in a ref so a new closure every
|
||||
// render does not re-register (and so cannot loop); only id/label/disabled do.
|
||||
// No-op outside the provider.
|
||||
export function usePagePrimaryAction({ id, label, onClick, disabled = false }) {
|
||||
const store = useContext(PagePrimaryActionContext);
|
||||
const latest = useRef(onClick);
|
||||
latest.current = onClick;
|
||||
|
||||
useEffect(() => {
|
||||
if (!store) return undefined;
|
||||
return store.register({ id, label, disabled, run: () => latest.current?.() });
|
||||
}, [store, id, label, disabled]);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Holds the create action the current page registered for the mobile header
|
||||
// "+". Plain store (no React) so the claim/release rules are testable.
|
||||
// Claims are kept in registration order: the newest live claim wins, and a
|
||||
// release removes only its own, so the earlier one takes over again.
|
||||
export function createPrimaryActionStore() {
|
||||
let claims = [];
|
||||
let current = null;
|
||||
const listeners = new Set();
|
||||
const update = (next) => {
|
||||
claims = next;
|
||||
current = claims.length ? claims[claims.length - 1] : null;
|
||||
listeners.forEach((fn) => fn());
|
||||
};
|
||||
|
||||
return {
|
||||
get: () => current,
|
||||
subscribe(fn) {
|
||||
listeners.add(fn);
|
||||
return () => listeners.delete(fn);
|
||||
},
|
||||
register(action) {
|
||||
const claim = { ...action };
|
||||
update([...claims, claim]);
|
||||
return () => {
|
||||
if (claims.includes(claim)) update(claims.filter((c) => c !== claim));
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { createPrimaryActionStore } from './pagePrimaryActionStore.js';
|
||||
|
||||
test('register publishes the action and release clears it', () => {
|
||||
const store = createPrimaryActionStore();
|
||||
let notified = 0;
|
||||
store.subscribe(() => { notified += 1; });
|
||||
|
||||
const release = store.register({ id: 'a', label: 'Add' });
|
||||
assert.equal(store.get().label, 'Add');
|
||||
release();
|
||||
assert.equal(store.get(), null);
|
||||
assert.equal(notified, 2);
|
||||
});
|
||||
|
||||
test('a stale release does not clear a newer registration', () => {
|
||||
const store = createPrimaryActionStore();
|
||||
const first = store.register({ id: 'a', label: 'One' });
|
||||
store.register({ id: 'a', label: 'Two' });
|
||||
first();
|
||||
assert.equal(store.get().label, 'Two');
|
||||
});
|
||||
|
||||
test('releasing the later claim restores the earlier one', () => {
|
||||
const store = createPrimaryActionStore();
|
||||
store.register({ id: 'a', label: 'One' });
|
||||
const second = store.register({ id: 'b', label: 'Two' });
|
||||
assert.equal(store.get().label, 'Two');
|
||||
second();
|
||||
assert.equal(store.get().label, 'One');
|
||||
});
|
||||
|
||||
test('releasing the earlier claim keeps the later one', () => {
|
||||
const store = createPrimaryActionStore();
|
||||
const first = store.register({ id: 'a', label: 'One' });
|
||||
store.register({ id: 'b', label: 'Two' });
|
||||
first();
|
||||
assert.equal(store.get().label, 'Two');
|
||||
assert.equal(store.get(), store.get());
|
||||
});
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "قم بتحميل {{name}} إلى وحدة التخزين البعيدة",
|
||||
"uploadToRemoteStorageAfterBackup": "تحميل إلى التخزين البعيد بعد النسخ الاحتياطي",
|
||||
"warning": "تحذير:",
|
||||
"yourServerDiskUsuallyFree": "قرص الخادم الخاص بك — عادةً ما يكون مجانيًا"
|
||||
"yourServerDiskUsuallyFree": "قرص الخادم الخاص بك — عادةً ما يكون مجانيًا",
|
||||
"backUpShort": "نسخ احتياطي"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "جميع اللقطات",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "يؤدي هذا إلى إزالة نفق WireGuard",
|
||||
"thisServer": "هذا الخادم",
|
||||
"toAPublicHostnameOverA": "إلى اسم مضيف عام عبر نفق WireGuard. يقوم ServerKit بإقران هذا المضيف بخادم طرفي له عنوان IP عام.",
|
||||
"tunnelTornDown": "النفق هدم"
|
||||
"tunnelTornDown": "النفق هدم",
|
||||
"exposeShort": "كشف"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "إغلاق المحطة",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "قف",
|
||||
"test": "امتحان",
|
||||
"tryAgain": "حاول ثانية",
|
||||
"uninstall": "إلغاء التثبيت"
|
||||
"uninstall": "إلغاء التثبيت",
|
||||
"new": "جديد"
|
||||
},
|
||||
"checking": "جارٍ التحقق...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "দূরবর্তী সঞ্চয়স্থানে {{name}} আপলোড করুন",
|
||||
"uploadToRemoteStorageAfterBackup": "ব্যাকআপের পরে দূরবর্তী সঞ্চয়স্থানে আপলোড করুন",
|
||||
"warning": "সতর্কতা:",
|
||||
"yourServerDiskUsuallyFree": "আপনার সার্ভার ডিস্ক - সাধারণত বিনামূল্যে"
|
||||
"yourServerDiskUsuallyFree": "আপনার সার্ভার ডিস্ক - সাধারণত বিনামূল্যে",
|
||||
"backUpShort": "ব্যাকআপ"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "সব স্ন্যাপশট",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "এটি ওয়্যারগার্ড টানেলটি সরিয়ে দেয়",
|
||||
"thisServer": "এই সার্ভার",
|
||||
"toAPublicHostnameOverA": "একটি ওয়্যারগার্ড টানেলের উপরে একটি সর্বজনীন হোস্টনামে। ServerKit এই হোস্টটিকে একটি প্রান্ত সার্ভারের সাথে যুক্ত করে যার একটি পাবলিক আইপি রয়েছে।",
|
||||
"tunnelTornDown": "টানেল ভেঙে গেছে"
|
||||
"tunnelTornDown": "টানেল ভেঙে গেছে",
|
||||
"exposeShort": "এক্সপোজ"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "টার্মিনাল বন্ধ করুন",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "থামো",
|
||||
"test": "পরীক্ষা",
|
||||
"tryAgain": "আবার চেষ্টা করুন",
|
||||
"uninstall": "আনইনস্টল করুন"
|
||||
"uninstall": "আনইনস্টল করুন",
|
||||
"new": "নতুন"
|
||||
},
|
||||
"checking": "পরীক্ষা করা হচ্ছে...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Laden Sie {{name}} in den Remote-Speicher hoch",
|
||||
"uploadToRemoteStorageAfterBackup": "Nach der Sicherung in den Remote-Speicher hochladen",
|
||||
"warning": "Warnung:",
|
||||
"yourServerDiskUsuallyFree": "Ihre Serverfestplatte – normalerweise kostenlos"
|
||||
"yourServerDiskUsuallyFree": "Ihre Serverfestplatte – normalerweise kostenlos",
|
||||
"backUpShort": "Sichern"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Alles Schnappschüsse",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Dadurch wird der WireGuard-Tunnel entfernt",
|
||||
"thisServer": "diesen Server",
|
||||
"toAPublicHostnameOverA": "an einen öffentlichen Hostnamen über einen WireGuard-Tunnel. ServerKit koppelt diesen Host mit einem Edge-Server, der über eine öffentliche IP verfügt.",
|
||||
"tunnelTornDown": "Tunnel abgerissen"
|
||||
"tunnelTornDown": "Tunnel abgerissen",
|
||||
"exposeShort": "Freigeben"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Terminal schließen",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Stopp",
|
||||
"test": "Testen",
|
||||
"tryAgain": "Versuchen Sie es erneut",
|
||||
"uninstall": "Deinstallieren"
|
||||
"uninstall": "Deinstallieren",
|
||||
"new": "Neu"
|
||||
},
|
||||
"checking": "Überprüfen...",
|
||||
"confirm": {
|
||||
|
||||
@@ -652,6 +652,7 @@
|
||||
"autoUploadNewBackupsToRemote": "Auto-upload new backups to remote storage",
|
||||
"b2GbMonth": "B2 ($/GB/month)",
|
||||
"backUpNow": "Back up now",
|
||||
"backUpShort": "Back up",
|
||||
"backblazeB2": "Backblaze B2",
|
||||
"backupDeleted": "Backup deleted",
|
||||
"backupName": "Backup name",
|
||||
@@ -4924,6 +4925,7 @@
|
||||
"exposeService": "Expose service",
|
||||
"exposeServicesOn": "Expose services on",
|
||||
"exposeServicesRunningOn": "Expose services running on",
|
||||
"exposeShort": "Expose",
|
||||
"exposed": "Exposed {{hostname}}",
|
||||
"failedToExposeService": "Couldn't expose the service.",
|
||||
"failedToLoadTunnels": "Couldn't load tunnels.",
|
||||
@@ -8370,6 +8372,7 @@
|
||||
"logOut": "Sign out",
|
||||
"moveDown": "Move down",
|
||||
"moveUp": "Move up",
|
||||
"new": "New",
|
||||
"next": "Next",
|
||||
"open": "Open",
|
||||
"publish": "Publish",
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Subir {{name}} al almacenamiento remoto",
|
||||
"uploadToRemoteStorageAfterBackup": "Subir al almacenamiento remoto después de la copia",
|
||||
"warning": "Advertencia:",
|
||||
"yourServerDiskUsuallyFree": "El disco de tu servidor: normalmente gratis"
|
||||
"yourServerDiskUsuallyFree": "El disco de tu servidor: normalmente gratis",
|
||||
"backUpShort": "Respaldar"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Todas las instantáneas",
|
||||
@@ -4809,7 +4810,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Esto elimina el túnel WireGuard",
|
||||
"thisServer": "este servidor",
|
||||
"toAPublicHostnameOverA": "hacia un hostname público mediante un túnel WireGuard. ServerKit empareja este host con un servidor de borde que tiene IP pública.",
|
||||
"tunnelTornDown": "Túnel desmontado"
|
||||
"tunnelTornDown": "Túnel desmontado",
|
||||
"exposeShort": "Exponer"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Cerrar terminal",
|
||||
@@ -7991,7 +7993,8 @@
|
||||
"stop": "Detener",
|
||||
"test": "Probar",
|
||||
"tryAgain": "Reintentar",
|
||||
"uninstall": "Desinstalar"
|
||||
"uninstall": "Desinstalar",
|
||||
"new": "Nuevo"
|
||||
},
|
||||
"checking": "Comprobando...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Télécharger {{name}} sur le stockage distant",
|
||||
"uploadToRemoteStorageAfterBackup": "Télécharger sur le stockage distant après la sauvegarde",
|
||||
"warning": "Avertissement:",
|
||||
"yourServerDiskUsuallyFree": "Le disque de votre serveur – généralement gratuit"
|
||||
"yourServerDiskUsuallyFree": "Le disque de votre serveur – généralement gratuit",
|
||||
"backUpShort": "Sauvegarder"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Tous les instantanés",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Cela supprime le tunnel WireGuard",
|
||||
"thisServer": "ce serveur",
|
||||
"toAPublicHostnameOverA": "à un nom d'hôte public via un tunnel WireGuard. ServerKit associe cet hôte à un serveur Edge doté d'une adresse IP publique.",
|
||||
"tunnelTornDown": "Tunnel démoli"
|
||||
"tunnelTornDown": "Tunnel démoli",
|
||||
"exposeShort": "Exposer"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Fermer le terminal",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Arrêt",
|
||||
"test": "Test",
|
||||
"tryAgain": "Essayer à nouveau",
|
||||
"uninstall": "Désinstaller"
|
||||
"uninstall": "Désinstaller",
|
||||
"new": "Nouveau"
|
||||
},
|
||||
"checking": "Vérification...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Unggah {{name}} ke penyimpanan jarak jauh",
|
||||
"uploadToRemoteStorageAfterBackup": "Unggah ke penyimpanan jarak jauh setelah pencadangan",
|
||||
"warning": "Peringatan:",
|
||||
"yourServerDiskUsuallyFree": "Disk server Anda — biasanya gratis"
|
||||
"yourServerDiskUsuallyFree": "Disk server Anda — biasanya gratis",
|
||||
"backUpShort": "Cadangkan"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Semua cuplikan",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Ini menghilangkan terowongan WireGuard",
|
||||
"thisServer": "server ini",
|
||||
"toAPublicHostnameOverA": "ke nama host publik melalui terowongan WireGuard. ServerKit memasangkan host ini dengan server edge yang memiliki IP publik.",
|
||||
"tunnelTornDown": "Terowongan dirobohkan"
|
||||
"tunnelTornDown": "Terowongan dirobohkan",
|
||||
"exposeShort": "Ekspos"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Tutup terminalnya",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Berhenti",
|
||||
"test": "Tes",
|
||||
"tryAgain": "Coba lagi",
|
||||
"uninstall": "Hapus instalasi"
|
||||
"uninstall": "Hapus instalasi",
|
||||
"new": "Baru"
|
||||
},
|
||||
"checking": "Memeriksa...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Carica {{name}} nell'archivio remoto",
|
||||
"uploadToRemoteStorageAfterBackup": "Carica nell'archivio remoto dopo il backup",
|
||||
"warning": "Avvertimento:",
|
||||
"yourServerDiskUsuallyFree": "Il disco del tuo server, solitamente gratuito"
|
||||
"yourServerDiskUsuallyFree": "Il disco del tuo server, solitamente gratuito",
|
||||
"backUpShort": "Backup"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Tutte le istantanee",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Questo rimuove il tunnel WireGuard",
|
||||
"thisServer": "questo server",
|
||||
"toAPublicHostnameOverA": "a un nome host pubblico su un tunnel WireGuard. ServerKit associa questo host a un server periferico con un IP pubblico.",
|
||||
"tunnelTornDown": "Tunnel demolito"
|
||||
"tunnelTornDown": "Tunnel demolito",
|
||||
"exposeShort": "Esponi"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Chiudi il terminale",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Fermare",
|
||||
"test": "Test",
|
||||
"tryAgain": "Riprova",
|
||||
"uninstall": "Disinstalla"
|
||||
"uninstall": "Disinstalla",
|
||||
"new": "Nuovo"
|
||||
},
|
||||
"checking": "Controllo...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "원격 저장소에 {{name}} 업로드",
|
||||
"uploadToRemoteStorageAfterBackup": "백업 후 원격 저장소에 업로드",
|
||||
"warning": "경고:",
|
||||
"yourServerDiskUsuallyFree": "서버 디스크 – 일반적으로 무료"
|
||||
"yourServerDiskUsuallyFree": "서버 디스크 – 일반적으로 무료",
|
||||
"backUpShort": "백업"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "모든 스냅샷",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "WireGuard 터널이 제거됩니다.",
|
||||
"thisServer": "이 서버",
|
||||
"toAPublicHostnameOverA": "WireGuard 터널을 통해 공개 호스트 이름으로. ServerKit은 이 호스트를 공용 IP가 있는 에지 서버와 연결합니다.",
|
||||
"tunnelTornDown": "터널이 철거됨"
|
||||
"tunnelTornDown": "터널이 철거됨",
|
||||
"exposeShort": "노출"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "터미널 닫기",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "중지",
|
||||
"test": "테스트",
|
||||
"tryAgain": "다시 시도하세요",
|
||||
"uninstall": "제거"
|
||||
"uninstall": "제거",
|
||||
"new": "새로 만들기"
|
||||
},
|
||||
"checking": "확인 중...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Prześlij {{name}} do zdalnej pamięci masowej",
|
||||
"uploadToRemoteStorageAfterBackup": "Prześlij do magazynu zdalnego po utworzeniu kopii zapasowej",
|
||||
"warning": "Ostrzeżenie:",
|
||||
"yourServerDiskUsuallyFree": "Dysk Twojego serwera — zazwyczaj bezpłatny"
|
||||
"yourServerDiskUsuallyFree": "Dysk Twojego serwera — zazwyczaj bezpłatny",
|
||||
"backUpShort": "Kopia"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Wszystkie migawki",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Spowoduje to usunięcie tunelu WireGuard",
|
||||
"thisServer": "ten serwer",
|
||||
"toAPublicHostnameOverA": "do publicznej nazwy hosta przez tunel WireGuard. ServerKit łączy ten host z serwerem brzegowym mającym publiczny adres IP.",
|
||||
"tunnelTornDown": "Tunel rozebrany"
|
||||
"tunnelTornDown": "Tunel rozebrany",
|
||||
"exposeShort": "Udostępnij"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Zamknij terminal",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Zatrzymywać się",
|
||||
"test": "Test",
|
||||
"tryAgain": "Spróbuj ponownie",
|
||||
"uninstall": "Odinstaluj"
|
||||
"uninstall": "Odinstaluj",
|
||||
"new": "Nowy"
|
||||
},
|
||||
"checking": "Kontrola...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Carregar {{name}} para armazenamento remoto",
|
||||
"uploadToRemoteStorageAfterBackup": "Fazer upload para armazenamento remoto após backup",
|
||||
"warning": "Aviso:",
|
||||
"yourServerDiskUsuallyFree": "O disco do seu servidor — geralmente gratuito"
|
||||
"yourServerDiskUsuallyFree": "O disco do seu servidor — geralmente gratuito",
|
||||
"backUpShort": "Backup"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Todos os instantâneos",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Isso remove o túnel WireGuard",
|
||||
"thisServer": "este servidor",
|
||||
"toAPublicHostnameOverA": "para um nome de host público em um túnel WireGuard. O ServerKit emparelha esse host com um servidor de borda que possui um IP público.",
|
||||
"tunnelTornDown": "Túnel demolido"
|
||||
"tunnelTornDown": "Túnel demolido",
|
||||
"exposeShort": "Expor"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Fechar terminal",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Pare",
|
||||
"test": "Teste",
|
||||
"tryAgain": "Tente novamente",
|
||||
"uninstall": "Desinstalar"
|
||||
"uninstall": "Desinstalar",
|
||||
"new": "Novo"
|
||||
},
|
||||
"checking": "Verificando...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Загрузите {{name}} в удаленное хранилище.",
|
||||
"uploadToRemoteStorageAfterBackup": "Загрузка в удаленное хранилище после резервного копирования",
|
||||
"warning": "Предупреждение:",
|
||||
"yourServerDiskUsuallyFree": "Диск вашего сервера — обычно бесплатно"
|
||||
"yourServerDiskUsuallyFree": "Диск вашего сервера — обычно бесплатно",
|
||||
"backUpShort": "Бэкап"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Все снимки",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Это удалит туннель WireGuard.",
|
||||
"thisServer": "этот сервер",
|
||||
"toAPublicHostnameOverA": "к общедоступному имени хоста через туннель WireGuard. ServerKit соединяет этот хост с пограничным сервером, имеющим общедоступный IP-адрес.",
|
||||
"tunnelTornDown": "Туннель снесен"
|
||||
"tunnelTornDown": "Туннель снесен",
|
||||
"exposeShort": "Открыть"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Закрыть терминал",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Остановить",
|
||||
"test": "Проверить",
|
||||
"tryAgain": "Попробуйте еще раз",
|
||||
"uninstall": "Удалить"
|
||||
"uninstall": "Удалить",
|
||||
"new": "Создать"
|
||||
},
|
||||
"checking": "Проверка...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "อัปโหลด {{name}} ไปยังที่จัดเก็บข้อมูลระยะไกล",
|
||||
"uploadToRemoteStorageAfterBackup": "อัปโหลดไปยังที่จัดเก็บข้อมูลระยะไกลหลังการสำรองข้อมูล",
|
||||
"warning": "คำเตือน:",
|
||||
"yourServerDiskUsuallyFree": "ดิสก์เซิร์ฟเวอร์ของคุณ — ปกติจะฟรี"
|
||||
"yourServerDiskUsuallyFree": "ดิสก์เซิร์ฟเวอร์ของคุณ — ปกติจะฟรี",
|
||||
"backUpShort": "สำรอง"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "สแนปชอตทั้งหมด",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "การดำเนินการนี้จะลบอุโมงค์ WireGuard",
|
||||
"thisServer": "เซิร์ฟเวอร์นี้",
|
||||
"toAPublicHostnameOverA": "ไปยังชื่อโฮสต์สาธารณะผ่านอุโมงค์ WireGuard ServerKit จับคู่โฮสต์นี้กับเซิร์ฟเวอร์ Edge ที่มี IP สาธารณะ",
|
||||
"tunnelTornDown": "อุโมงค์ถูกรื้อลง"
|
||||
"tunnelTornDown": "อุโมงค์ถูกรื้อลง",
|
||||
"exposeShort": "เปิดเผย"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "ปิดเทอร์มินัล",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "หยุด",
|
||||
"test": "ทดสอบ",
|
||||
"tryAgain": "ลองอีกครั้ง",
|
||||
"uninstall": "ถอนการติดตั้ง"
|
||||
"uninstall": "ถอนการติดตั้ง",
|
||||
"new": "ใหม่"
|
||||
},
|
||||
"checking": "กำลังตรวจสอบ...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "{{name}}'yi uzak depolama birimine yükleyin",
|
||||
"uploadToRemoteStorageAfterBackup": "Yedeklemeden sonra uzak depolama birimine yükleyin",
|
||||
"warning": "Uyarı:",
|
||||
"yourServerDiskUsuallyFree": "Sunucu diskiniz — genellikle ücretsizdir"
|
||||
"yourServerDiskUsuallyFree": "Sunucu diskiniz — genellikle ücretsizdir",
|
||||
"backUpShort": "Yedekle"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Tüm anlık görüntüler",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Bu, WireGuard tünelini kaldırır",
|
||||
"thisServer": "bu sunucu",
|
||||
"toAPublicHostnameOverA": "WireGuard tüneli üzerinden genel bir ana bilgisayar adına. ServerKit, bu ana bilgisayarı genel IP'ye sahip bir uç sunucuyla eşleştirir.",
|
||||
"tunnelTornDown": "Tünel yıkıldı"
|
||||
"tunnelTornDown": "Tünel yıkıldı",
|
||||
"exposeShort": "Aç"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Terminali kapat",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Durmak",
|
||||
"test": "Test",
|
||||
"tryAgain": "Tekrar deneyin",
|
||||
"uninstall": "Kaldır"
|
||||
"uninstall": "Kaldır",
|
||||
"new": "Yeni"
|
||||
},
|
||||
"checking": "Kontrol ediliyor...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "Tải {{name}} lên bộ nhớ từ xa",
|
||||
"uploadToRemoteStorageAfterBackup": "Tải lên bộ nhớ từ xa sau khi sao lưu",
|
||||
"warning": "Cảnh báo:",
|
||||
"yourServerDiskUsuallyFree": "Đĩa máy chủ của bạn - thường miễn phí"
|
||||
"yourServerDiskUsuallyFree": "Đĩa máy chủ của bạn - thường miễn phí",
|
||||
"backUpShort": "Sao lưu"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "Tất cả ảnh chụp nhanh",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "Thao tác này sẽ xóa đường hầm WireGuard",
|
||||
"thisServer": "máy chủ này",
|
||||
"toAPublicHostnameOverA": "tới tên máy chủ công cộng qua đường hầm WireGuard. ServerKit ghép nối máy chủ này với máy chủ biên có IP công cộng.",
|
||||
"tunnelTornDown": "Đường hầm bị phá bỏ"
|
||||
"tunnelTornDown": "Đường hầm bị phá bỏ",
|
||||
"exposeShort": "Mở"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "Đóng thiết bị đầu cuối",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "Dừng lại",
|
||||
"test": "Bài kiểm tra",
|
||||
"tryAgain": "Thử lại",
|
||||
"uninstall": "Gỡ cài đặt"
|
||||
"uninstall": "Gỡ cài đặt",
|
||||
"new": "Mới"
|
||||
},
|
||||
"checking": "Đang kiểm tra...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "将 {{name}} 上传到远程存储",
|
||||
"uploadToRemoteStorageAfterBackup": "备份后上传至远程存储",
|
||||
"warning": "警告:",
|
||||
"yourServerDiskUsuallyFree": "您的服务器磁盘 — 通常是免费的"
|
||||
"yourServerDiskUsuallyFree": "您的服务器磁盘 — 通常是免费的",
|
||||
"backUpShort": "备份"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "所有快照",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "这将删除 WireGuard 隧道",
|
||||
"thisServer": "该服务器",
|
||||
"toAPublicHostnameOverA": "通过 WireGuard 隧道到公共主机名。 ServerKit 将此主机与具有公共 IP 的边缘服务器配对。",
|
||||
"tunnelTornDown": "隧道被拆除"
|
||||
"tunnelTornDown": "隧道被拆除",
|
||||
"exposeShort": "公开"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "关闭终端",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "停止",
|
||||
"test": "测试",
|
||||
"tryAgain": "重试",
|
||||
"uninstall": "卸载"
|
||||
"uninstall": "卸载",
|
||||
"new": "新建"
|
||||
},
|
||||
"checking": "检查...",
|
||||
"confirm": {
|
||||
|
||||
@@ -730,7 +730,8 @@
|
||||
"uploadToRemoteStorage": "上傳{{name}}到遠端儲存",
|
||||
"uploadToRemoteStorageAfterBackup": "備份後上傳至遠端儲存",
|
||||
"warning": "警告:",
|
||||
"yourServerDiskUsuallyFree": "您的伺服器磁碟 — 通常是免費的"
|
||||
"yourServerDiskUsuallyFree": "您的伺服器磁碟 — 通常是免費的",
|
||||
"backUpShort": "備份"
|
||||
},
|
||||
"backupsOverview": {
|
||||
"allSnapshots": "所有快照",
|
||||
@@ -4808,7 +4809,8 @@
|
||||
"thisRemovesTheWireguardTunnel": "這將刪除 WireGuard 隧道",
|
||||
"thisServer": "該伺服器",
|
||||
"toAPublicHostnameOverA": "上執行的服務透過 WireGuard 隧道公開至對外可存取的主機名稱。ServerKit 會將此主機與具有公用 IP 位址的邊緣伺服器配對。",
|
||||
"tunnelTornDown": "隧道被拆除"
|
||||
"tunnelTornDown": "隧道被拆除",
|
||||
"exposeShort": "公開"
|
||||
},
|
||||
"remoteTerminal": {
|
||||
"closeTerminal": "關閉終端機",
|
||||
@@ -7990,7 +7992,8 @@
|
||||
"stop": "停止",
|
||||
"test": "測試",
|
||||
"tryAgain": "再試一次",
|
||||
"uninstall": "解除安裝"
|
||||
"uninstall": "解除安裝",
|
||||
"new": "新增"
|
||||
},
|
||||
"checking": "檢查中…",
|
||||
"confirm": {
|
||||
|
||||
@@ -18,6 +18,7 @@ import OperationsDock from '../components/OperationsDock';
|
||||
import ErrorBoundary from '../components/ErrorBoundary';
|
||||
import { useShortcut } from '../hooks/useShortcut';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { PagePrimaryActionProvider } from '../contexts/PagePrimaryActionProvider';
|
||||
import { OperationsProvider } from '../contexts/OperationsContext';
|
||||
import { ManagedProfileProvider } from '../contexts/ManagedProfileContext';
|
||||
import { useManagedProfile } from '../contexts/useManagedProfile';
|
||||
@@ -114,6 +115,7 @@ const DashboardLayout = () => {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<PagePrimaryActionProvider>
|
||||
<OperationsProvider>
|
||||
<LogsDrawerProvider>
|
||||
<AIProvider>
|
||||
@@ -154,6 +156,7 @@ const DashboardLayout = () => {
|
||||
</AIProvider>
|
||||
</LogsDrawerProvider>
|
||||
</OperationsProvider>
|
||||
</PagePrimaryActionProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useCallback, useMemo, useId } from 'react';
|
||||
import useTabParam from '../hooks/useTabParam';
|
||||
import { Upload, Check, AlertTriangle, Archive, Clock, Database, Package, FolderArchive, HardDrive, History, Cloud, RefreshCw, Trash2, Plus, FileArchive, DollarSign } from 'lucide-react';
|
||||
import { Upload, Check, AlertTriangle, Archive, Clock, Database, Package, FolderArchive, HardDrive, History, Cloud, RefreshCw, Trash2, FileArchive, DollarSign } from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import { formatBytes } from '@/utils/formatBytes';
|
||||
import { scrollBehavior } from '@/utils/reducedMotion';
|
||||
@@ -10,6 +10,7 @@ import EmptyState from '../components/EmptyState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { FormField, FormRow } from '../components/FormField';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
|
||||
@@ -688,15 +689,20 @@ const Backups = () => {
|
||||
useTopbarActions(() => (
|
||||
<>
|
||||
{activeTab === 'schedules' && !backupsManaged ? (
|
||||
<Button size="sm" onClick={() => setShowScheduleModal(true)}>
|
||||
<Plus size={16} />
|
||||
{t('app.backups.newSchedule', 'New schedule')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="backups-new-schedule"
|
||||
label={t('app.backups.newSchedule', 'New schedule')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={() => setShowScheduleModal(true)}
|
||||
/>
|
||||
) : (
|
||||
<Button size="sm" onClick={() => setShowBackupModal(true)}>
|
||||
<Archive size={16} />
|
||||
{t('app.backups.backUpNow', 'Back up now')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="backups-back-up"
|
||||
icon={Archive}
|
||||
label={t('app.backups.backUpNow', 'Back up now')}
|
||||
shortLabel={t('app.backups.backUpShort', 'Back up')}
|
||||
onClick={() => setShowBackupModal(true)}
|
||||
/>
|
||||
)}
|
||||
{activeTab === 'snapshots' && (
|
||||
<SearchField
|
||||
|
||||
@@ -14,6 +14,7 @@ import Modal from '@/components/Modal';
|
||||
import DomainField from '@/components/DomainField';
|
||||
import { attachDomain } from '@/services/attachDomain';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
@@ -619,9 +620,12 @@ const Domains = () => {
|
||||
// two fixed-width icon buttons.
|
||||
useTopbarActions(() => (
|
||||
<>
|
||||
<Button size="sm" onClick={() => setShowAddModal(true)}>
|
||||
<Plus size={15} /> {t('app.domains.addDomain', 'Add domain')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="domains-add"
|
||||
label={t('app.domains.addDomain', 'Add domain')}
|
||||
shortLabel={t('common.actions.add', 'Add')}
|
||||
onClick={() => setShowAddModal(true)}
|
||||
/>
|
||||
<Button variant="outline" size="sm" onClick={loadData}>
|
||||
<RefreshCw size={15} /> {t('app.domains.checkDns', 'Check DNS')}
|
||||
</Button>
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridToolsMenu,
|
||||
} from '@/components/ds/grid';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
@@ -264,9 +265,12 @@ export default function Monitors() {
|
||||
<Button variant="outline" size="sm" onClick={load}>
|
||||
<RefreshCw size={14} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
<Button size="sm" onClick={openCreate}>
|
||||
<Plus size={14} /> {t('app.monitors.addMonitor', 'New monitor')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="monitors-new"
|
||||
label={t('app.monitors.addMonitor', 'New monitor')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={openCreate}
|
||||
/>
|
||||
</>
|
||||
), [q, activeFilterCount, load]);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import useFocusParam from '@/hooks/useFocusParam';
|
||||
import { SearchField, ServiceTile } from '@/components/ds';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
@@ -80,9 +81,12 @@ const Projects = () => {
|
||||
|
||||
useTopbarActions(() => (
|
||||
<>
|
||||
<Button size="sm" onClick={() => setShowCreate(true)}>
|
||||
<Plus size={16} /> {t('app.projects.newProject', 'New project')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="projects-new"
|
||||
label={t('app.projects.newProject', 'New project')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={() => setShowCreate(true)}
|
||||
/>
|
||||
<SearchField value={search} onSearch={setSearch} placeholder={t('app.projects.searchProjects', 'Search projects…')} />
|
||||
</>
|
||||
), [search]);
|
||||
|
||||
@@ -19,6 +19,7 @@ import EmptyState from '../components/EmptyState';
|
||||
import InfoTip from '@/components/InfoTip';
|
||||
import Modal from '@/components/Modal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Tip } from '@/components/ui/tooltip';
|
||||
import PageLayout from '../layouts/PageLayout';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -470,11 +471,12 @@ const QueueOperations = () => {
|
||||
<Folder size={16} />
|
||||
</Button>
|
||||
</Tip>
|
||||
<Tip content={t('app.queueOperations.queue', 'Queue')}>
|
||||
<Button variant="ghost" size="icon" aria-label={t('app.queueOperations.queue', 'Queue')} onClick={() => setShowQueueModal(true)}>
|
||||
<Plus size={16} />
|
||||
</Button>
|
||||
</Tip>
|
||||
<PagePrimaryButton
|
||||
id="queue-new"
|
||||
iconOnly
|
||||
label={t('app.queueOperations.newQueue', 'New queue')}
|
||||
onClick={() => setShowQueueModal(true)}
|
||||
/>
|
||||
<Tip content={t('common.actions.refresh', 'Refresh')}>
|
||||
<Button variant="ghost" size="icon" aria-label={t('common.actions.refresh', 'Refresh')} onClick={() => { loadData(); loadQueues(selectedGroup); }}>
|
||||
<RefreshCw size={16} />
|
||||
|
||||
@@ -16,6 +16,7 @@ import PortField from '../components/PortField';
|
||||
import { Pill } from '@/components/ds';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
@@ -195,16 +196,26 @@ const RemoteAccess = ({ serverId }) => {
|
||||
}
|
||||
};
|
||||
|
||||
// Plain copy for page-body placements: stays visible on phones, full label.
|
||||
const exposeButton = (
|
||||
<Button size="sm" onClick={() => openWizard(null)} disabled={loading}>
|
||||
<Plus size={15} /> {t('app.remoteAccess.exposeALocalService', 'Expose a local service')}
|
||||
<Plus size={15} aria-hidden="true" />
|
||||
{t('app.remoteAccess.exposeALocalService', 'Expose a local service')}
|
||||
</Button>
|
||||
);
|
||||
|
||||
// Header action lives in the shared Servers top bar when this page is used
|
||||
// as a tab in the Servers group. When embedded inside a single server's
|
||||
// detail page we render the action inline instead.
|
||||
useTopbarActions(() => exposeButton, [loading]);
|
||||
useTopbarActions(() => (
|
||||
<PagePrimaryButton
|
||||
id="remote-access-expose"
|
||||
label={t('app.remoteAccess.exposeALocalService', 'Expose a local service')}
|
||||
shortLabel={t('app.remoteAccess.exposeShort', 'Expose')}
|
||||
onClick={() => openWizard(null)}
|
||||
disabled={loading}
|
||||
/>
|
||||
), [loading]);
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner ra-page">
|
||||
|
||||
@@ -11,6 +11,7 @@ import EmptyState from '../components/EmptyState';
|
||||
import ErrorState from '../components/ErrorState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import {
|
||||
Select, SelectTrigger, SelectContent, SelectItem, SelectValue,
|
||||
@@ -387,9 +388,12 @@ const Servers = () => {
|
||||
<Button variant="outline" size="sm" onClick={loadData} disabled={loading}>
|
||||
<RefreshCw size={16} className={loading ? 'spin' : ''} /> {t('app.servers.sync', 'Sync')}
|
||||
</Button>
|
||||
<Button size="sm" onClick={() => setShowAddModal(true)}>
|
||||
<Plus size={16} /> {t('app.servers.addServer', 'Add server')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="servers-add"
|
||||
label={t('app.servers.addServer', 'Add server')}
|
||||
shortLabel={t('common.actions.add', 'Add')}
|
||||
onClick={() => setShowAddModal(true)}
|
||||
/>
|
||||
<SearchField
|
||||
value={searchTerm}
|
||||
onSearch={setSearchTerm}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { formatBytes } from '../utils/formatBytes';
|
||||
import { Pill, ServiceTile, EnvTag, SearchField, serviceStatusKind } from '@/components/ds';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import {
|
||||
Select,
|
||||
@@ -202,18 +203,18 @@ const Services = () => {
|
||||
|
||||
useTopbarActions(() =>
|
||||
<>
|
||||
<Button variant="outline" size="sm" asChild>
|
||||
<Link to="/imports">
|
||||
<Button variant="outline" size="sm" asChild title={t('app.services.importASite', 'Import a site')}>
|
||||
<Link to="/imports" aria-label={t('app.services.importASite', 'Import a site')}>
|
||||
<ArrowDownToLine size={16} />
|
||||
{t('app.services.importASite', 'Import a site')}
|
||||
</Link>
|
||||
</Button>
|
||||
<Button size="sm" asChild>
|
||||
<Link to="/services/new">
|
||||
<Plus size={16} />
|
||||
{t('app.services.newService', 'New service')}
|
||||
{t('common.actions.import', 'Import')}
|
||||
</Link>
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="services-new"
|
||||
label={t('app.services.newService', 'New service')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
to="/services/new"
|
||||
/>
|
||||
<SearchField
|
||||
value={searchTerm}
|
||||
onSearch={setSearchTerm}
|
||||
|
||||
@@ -7,6 +7,7 @@ import ConfirmDialog from '../components/ConfirmDialog';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import {
|
||||
@@ -337,10 +338,12 @@ const StatusPages = () => {
|
||||
{t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
{isAdmin && (
|
||||
<Button size="sm" onClick={() => setShowCreatePage(true)}>
|
||||
<Plus size={16} />
|
||||
{t('app.statusPages.createPage', 'Create page')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="status-pages-create"
|
||||
label={t('app.statusPages.createPage', 'Create page')}
|
||||
shortLabel={t('common.actions.create', 'Create')}
|
||||
onClick={() => setShowCreatePage(true)}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
),
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import InfoTip from '@/components/InfoTip';
|
||||
import api from '../services/api';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
@@ -178,16 +179,22 @@ export default function Vaults() {
|
||||
<Button variant="outline" size="sm" onClick={() => setSelectedVault(null)}>
|
||||
<ArrowLeft size={15} /> {t('app.vaults.allVaults', 'All vaults')}
|
||||
</Button>
|
||||
<Button size="sm" onClick={() => setSecretForm({ open: true, name: '', value: '', description: '' })}>
|
||||
<Plus size={15} /> {t('app.vaults.addSecret', 'Add secret')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="vaults-add-secret"
|
||||
label={t('app.vaults.addSecret', 'Add secret')}
|
||||
shortLabel={t('common.actions.add', 'Add')}
|
||||
onClick={() => setSecretForm({ open: true, name: '', value: '', description: '' })}
|
||||
/>
|
||||
<SearchField value={search} onSearch={setSearch} placeholder={t('app.vaults.searchSecrets', 'Search secrets…')} />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button size="sm" onClick={() => setVaultForm({ open: true, name: '', description: '', workspace_id: activeWorkspaceId })}>
|
||||
<Plus size={15} /> {t('app.vaults.newVault', 'New vault')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="vaults-new"
|
||||
label={t('app.vaults.newVault', 'New vault')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={() => setVaultForm({ open: true, name: '', description: '', workspace_id: activeWorkspaceId })}
|
||||
/>
|
||||
<SearchField value={search} onSearch={setSearch} placeholder={t('app.vaults.searchVaults', 'Search vaults…')} />
|
||||
</>
|
||||
)), [selectedVault, search, activeWorkspaceId]);
|
||||
|
||||
@@ -4,11 +4,12 @@ import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
import Modal from '@/components/Modal';
|
||||
import ResourceListPage from '../components/layouts/ResourceListPage';
|
||||
import { LayoutGrid, Plus, ChevronRight } from 'lucide-react';
|
||||
import { LayoutGrid, ChevronRight } from 'lucide-react';
|
||||
import { Pill, ServiceTile, SearchField } from '@/components/ds';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import useFocusParam from '@/hooks/useFocusParam';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { useWorkspace } from '../contexts/useWorkspace.js';
|
||||
@@ -120,10 +121,12 @@ const Workspaces = () => {
|
||||
useTopbarActions(() => (
|
||||
<>
|
||||
{isAdmin && (
|
||||
<Button size="sm" onClick={() => setShowCreateModal(true)}>
|
||||
<Plus size={16} />
|
||||
{t('app.workspaces.newWorkspace', 'New workspace')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="workspaces-new"
|
||||
label={t('app.workspaces.newWorkspace', 'New workspace')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
/>
|
||||
)}
|
||||
<SearchField
|
||||
value={search}
|
||||
|
||||
@@ -1358,6 +1358,14 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
|
||||
&__title { margin: 0; font-size: $text-md; font-weight: $font-weight-semibold; letter-spacing: -0.01em; color: var(--text); }
|
||||
&__meta { font-size: $text-xs; color: var(--text-faint); }
|
||||
&__spacer { flex: 1; }
|
||||
// A page's compact create button. Never grows with a long label; below the
|
||||
// width where the mobile header shows, that header "+" runs the same action.
|
||||
&__primary {
|
||||
max-inline-size: 14rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
&__actions {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -1388,6 +1396,14 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
|
||||
> .sk-topbar__chrome > .sk-gridicon { order: 2; }
|
||||
}
|
||||
|
||||
// Primary is hidden here, so a strip holding only it (and an empty chrome
|
||||
// slot) is a 0-height flex item that still costs the topbar a row-gap.
|
||||
@media (max-width: $breakpoint-md) {
|
||||
// Only the topbar copy hides; the same button in a page body stays.
|
||||
&__actions > &__primary { display: none; }
|
||||
&__actions:has(> .sk-topbar__primary):not(:has(> :not(.sk-topbar__primary, .sk-topbar__chrome), > .sk-topbar__chrome > *)) { display: none; }
|
||||
}
|
||||
|
||||
// The portal target a table's chrome renders into. It must not become a box
|
||||
// of its own, or the whole chrome would be one order:0 blob.
|
||||
&__chrome { display: contents; }
|
||||
|
||||
Reference in new issue
Block a user