mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-17 21:40:30 +00:00
ajout bouton annuler
This commit is contained in:
parent
96a4407ecf
commit
3e40eb7b25
@ -3,7 +3,7 @@ import styles from './CreateServer.module.scss';
|
||||
import { getUserSubdomain } from "../../service/firebase";
|
||||
import serviiApi from "../../service/api.tsx";
|
||||
|
||||
const CreateServer = ({ user, onCreateServer, onSubdomainUpdate }) => {
|
||||
const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel }) => {
|
||||
const [subdomain, setSubdomain] = useState(null);
|
||||
const [subdomainInput, setSubdomainInput] = useState('');
|
||||
const [serverName, setServerName] = useState('');
|
||||
@ -71,6 +71,9 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate }) => {
|
||||
<button className={styles.btnSubCreate} onClick={handleSaveSubdomain}>
|
||||
Envoyer
|
||||
</button>
|
||||
<button className={styles.btnCancel} onClick={onCancel}>
|
||||
Annuler
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@ -98,6 +101,9 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate }) => {
|
||||
<button className={styles.btnServCreate} onClick={handleCreateServer}>
|
||||
Créer
|
||||
</button>
|
||||
<button className={styles.btnServCreate} onClick={onCancel}>
|
||||
Annuler
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -54,6 +54,10 @@ const DashboardPage = ({ user }) => {
|
||||
setShowCreateServer(true);
|
||||
};
|
||||
|
||||
const handleCancelCreateServer = () => {
|
||||
setShowCreateServer(false);
|
||||
};
|
||||
|
||||
const handleRunServer = async (serverName) => {
|
||||
try {
|
||||
await serviiApi.serverRun(serverName);
|
||||
@ -94,7 +98,12 @@ const DashboardPage = ({ user }) => {
|
||||
<div className={styles.dashboardContainer}>
|
||||
<Navbar user={user} />
|
||||
{showCreateServer ? (
|
||||
<CreateServer user={user} onCreateServer={handleCreateServer} onSubdomainUpdate={setSubdomain} />
|
||||
<CreateServer
|
||||
user={user}
|
||||
onCreateServer={handleCreateServer}
|
||||
onSubdomainUpdate={setSubdomain}
|
||||
onCancel={handleCancelCreateServer}
|
||||
/>
|
||||
) : (
|
||||
<div className={styles.cardsContainer}>
|
||||
{servers.length === 0 ? (
|
||||
|
Loading…
Reference in New Issue
Block a user