Center it

This commit is contained in:
dvirlabs 2025-06-10 20:46:34 +03:00
parent afbc630d48
commit ff18c5d6d7
8 changed files with 1063 additions and 98 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,11 @@
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/base": "^5.0.0-beta.70",
"@mui/material": "^7.1.1",
"@mui/styled-engine": "^7.1.1",
"axios": "^1.9.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"

View File

@ -1,42 +1,36 @@
#root {
max-width: 1280px;
margin: 0 auto;
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
/* Top-level layout container */
.snapix-container {
display: flex;
flex-direction: column;
align-items: center; /* horizontal center */
justify-content: center; /* vertical center */
min-height: 100vh;
color: white;
padding: 2rem;
box-sizing: border-box;
}
/* Title styling */
.snapix-title {
text-align: center;
color: white;
margin-bottom: 2rem;
font-size: 2rem;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
/* Dashboard: backup + restore side by side */
.snapix-dashboard {
display: flex;
justify-content: center;
align-items: flex-start;
gap: 30px;
flex-wrap: wrap;
margin: auto;
}

View File

@ -1,13 +1,16 @@
import BackupForm from './components/BackupForm';
import RestoreForm from './components/RestoreForm';
import './App.css';
function App() {
return (
<div style={{ padding: "2rem" }}>
<h1>🚀 Snapix Dashboard</h1>
<BackupForm />
<hr />
<RestoreForm />
<div className="snapix-container">
<h1 className="snapix-title">🚀 Snapix Dashboard</h1>
<div className="snapix-dashboard">
<BackupForm />
<RestoreForm />
</div>
</div>
);
}

View File

@ -1,5 +1,6 @@
import { useEffect, useState } from 'react';
import { getNamespaces, getPVCs, createBackup } from '../api/snapix';
import { Button, Select, Option, Input } from '@mui/base'
export default function BackupForm() {
const [namespaces, setNamespaces] = useState([]);
@ -34,34 +35,40 @@ export default function BackupForm() {
};
return (
<div>
<div className='form-group'>
<h2>📦 Backup PVC</h2>
<label>Namespace:</label>
<select onChange={e => setSelectedNs(e.target.value)} value={selectedNs}>
<option value="">-- Select Namespace --</option>
{namespaces.map(ns => <option key={ns}>{ns}</option>)}
</select>
<div className='form-content'>
<label>Namespace:</label>
<Select onChange={e => setSelectedNs(e.target.value)} value={selectedNs}>
<Option value="">-- Select Namespace --</Option>
{namespaces.map(ns => <Option key={ns}>{ns}</Option>)}
</Select>
</div>
<label>PVC:</label>
<select
onChange={e => setSelectedPvc(e.target.value)}
value={selectedPvc}
disabled={!selectedNs}
>
<option value="">-- Select PVC --</option>
{pvcs.map(pvc => <option key={pvc}>{pvc}</option>)}
</select>
<div className='form-content'>
<label>PVC:</label>
<Select
onChange={e => setSelectedPvc(e.target.value)}
value={selectedPvc}
disabled={!selectedNs}
>
<Option value="">-- Select PVC --</Option>
{pvcs.map(pvc => <Option key={pvc}>{pvc}</Option>)}
</Select>
</div>
<label>Backup Name:</label>
<input
type="text"
value={backupName}
onChange={e => setBackupName(e.target.value)}
placeholder="e.g. git-bkp"
/>
<button onClick={handleSubmit}>Create Backup</button>
<div className='form-content'>
<label>Backup Name:</label>
<Input
type="text"
value={backupName}
onChange={e => setBackupName(e.target.value)}
placeholder="e.g. git-bkp"
/>
</div>
<Button className='btn' onClick={handleSubmit}>Create Backup</Button>
</div>
);
}

View File

@ -1,5 +1,6 @@
import { useState } from 'react';
import { restoreBackup } from '../api/snapix';
import { Button, Input } from '@mui/base'
export default function RestoreForm() {
const [backupName, setBackupName] = useState('');
@ -19,31 +20,39 @@ export default function RestoreForm() {
};
return (
<div>
<div className='form-group'>
<h2>🔁 Restore PVC</h2>
<div className='form-content'>
<label>Backup Name:</label>
<input
type="text"
value={backupName}
onChange={e => setBackupName(e.target.value)}
/>
<Input
type="text"
value={backupName}
onChange={e => setBackupName(e.target.value)}
className='restore-input'
/>
</div>
<label>Target Namespace:</label>
<input
type="text"
value={targetNs}
onChange={e => setTargetNs(e.target.value)}
/>
<div className='form-content'>
<label>Target Namespace:</label>
<Input
type="text"
value={targetNs}
onChange={e => setTargetNs(e.target.value)}
className='restore-input'
/>
</div>
<div className='form-content'>
<label>Target PVC:</label>
<input
type="text"
value={targetPvc}
onChange={e => setTargetPvc(e.target.value)}
/>
<Input
type="text"
value={targetPvc}
onChange={e => setTargetPvc(e.target.value)}
className='restore-input'
/>
</div>
<button onClick={handleRestore}>Restore</button>
<Button className='btn' onClick={handleRestore}>Restore</Button>
</div>
);
}

View File

@ -1,6 +1,7 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import './style/global.css'
import App from './App.jsx'
createRoot(document.getElementById('root')).render(

View File

@ -0,0 +1,41 @@
h2 {
text-align: center;
}
.form-group {
border: 2px solid #ccc;
border-radius: 8px;
padding: 13px;
margin: 10px;
height: 400px;
width: 500px;
flex: 1;
max-width: 500px;
min-width: 500px;
}
.form-content {
display: flex;
flex-direction: column;
padding: 10px;
}
input {
width: 100%;
padding: 10px;
background-color: #1a1a1a;
border: 1px solid #444;
border-radius: 8px;
color: white;
font-size: 1rem;
box-sizing: border-box;
}
input:hover {
border-color: #1a73e8;
}
.btn {
background-color: #4CAF50;
margin-top: 30px;
}