-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
591 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.file-info { | ||
background-color: rgba(199, 198, 198, 0.076) ; | ||
width:300px; | ||
padding : 0.5em 1em; | ||
border-radius: 10px; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: self-end; | ||
justify-content: space-between; | ||
align-items:center; | ||
} | ||
|
||
.file-info>button{ | ||
text-align: center; | ||
width: 40px; | ||
height: 40px; | ||
padding-top: 5px; | ||
border:none; | ||
background-color: var(--light-grey); | ||
border-radius: 10px; | ||
color:white; | ||
} | ||
.file-info>button:hover{ | ||
background-color: var(--pink); | ||
cursor: pointer; | ||
} | ||
|
||
.label-choose-file { | ||
color:var(--light-grey); | ||
font-style: italic; | ||
} | ||
|
||
.label-filename { | ||
color: var(--pink); | ||
font-weight: 800; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { FC, MouseEventHandler } from 'react'; | ||
import './ButtonAddFile.css'; | ||
interface ButtonAddFileProps { | ||
title: string; | ||
action: MouseEventHandler; | ||
fileName: string; | ||
} | ||
export const ButtonAddFile: FC<ButtonAddFileProps> = ({ | ||
title, | ||
action, | ||
fileName, | ||
}) => { | ||
return ( | ||
<div className="file-info"> | ||
<div className="name"> | ||
<p>{title}</p> | ||
<p className={fileName ? 'label-filename' : 'label-choose-file'}> | ||
{fileName ? fileName : 'Aucun fichier sélectionné'} | ||
</p> | ||
</div> | ||
<button onClick={action} className="add"> | ||
<link | ||
rel="stylesheet" | ||
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" | ||
/> | ||
<span className="material-symbols-outlined">add</span> | ||
</button> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.new-prez { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
color: white; | ||
margin:100px; | ||
} | ||
|
||
.principal-infos { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap:50px; | ||
justify-content: center; | ||
align-items:last baseline; | ||
} | ||
|
||
.principal-infos>.info { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 5px; | ||
} | ||
|
||
.principal-infos>.info>input{ | ||
-webkit-appearance: none; | ||
padding: 10px 10px 10px 10px; | ||
border:none; | ||
color:white; | ||
background-color: #5F5F5F; | ||
border-radius: 5px; | ||
} | ||
|
||
.block-files{ | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
flex-wrap: wrap; | ||
gap: 2em; | ||
margin: 1em 0; | ||
} | ||
|
||
|
||
|
||
|
||
.sendingButton{ | ||
cursor: pointer; | ||
border:none; | ||
border-radius: 10px; | ||
padding: 1em 2em; | ||
background-color: var(--pink); | ||
} | ||
|
||
.error{ | ||
margin:1em; | ||
color:red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { useState } from 'react'; | ||
import React from 'react'; | ||
import './NewPrez.css'; | ||
import { ButtonAddFile } from './ButtonAddFile'; | ||
|
||
export const NewPrez = () => { | ||
const [title, setTitle] = useState(''); | ||
const [duration, setDuration] = useState(''); | ||
const [participants, setParticipants] = useState(''); | ||
|
||
const [markdownFile, setMarkdownFile] = useState<string>(''); | ||
const [cssFile, setCssFile] = useState<string>(''); | ||
const [assetsFile, setAssetsFile] = useState<string>(''); | ||
const [envFile, setEnvFile] = useState<string>(''); | ||
|
||
const [error, setError] = useState<boolean>(false); | ||
|
||
const getFileName = (filePath: string) => { | ||
const arrayString = filePath.split('/'); | ||
return arrayString[arrayString.length - 1]; | ||
}; | ||
|
||
const openMarkdownFile = () => { | ||
window.api.openFileDialog('md', setMarkdownFile); | ||
}; | ||
|
||
const openCssFile = () => { | ||
window.api.openFileDialog('css', setCssFile); | ||
}; | ||
|
||
const openEnvFile = () => { | ||
window.api.openFileDialog('env', setEnvFile); | ||
}; | ||
|
||
const openAssetsFile = () => { | ||
window.api.openFileDialog('assets', setAssetsFile); | ||
}; | ||
|
||
const createCodePrez = () => { | ||
if (!cssFile || !markdownFile || !title) { | ||
setError(true); | ||
return; | ||
} | ||
window.api.createCodePrez({ | ||
assetsDirectoryPath: assetsFile, | ||
cssFilePath: cssFile, | ||
duration, | ||
envDirectoryPath: envFile, | ||
mdFilePath: markdownFile, | ||
participants, | ||
title, | ||
}); | ||
}; | ||
return ( | ||
<div className="new-prez"> | ||
<h1>Nouvelle Présentation</h1> | ||
|
||
<div className="principal-infos"> | ||
<div className="info"> | ||
<label>Titre de la présentation *</label> | ||
<input | ||
type="text" | ||
placeholder="Titre..." | ||
value={title} | ||
onChange={(e) => setTitle(e.target.value)} | ||
/> | ||
</div> | ||
<div className="info"> | ||
<label>Durée</label> | ||
<input | ||
type="text" | ||
placeholder="Durée..." | ||
value={duration} | ||
onChange={(e) => setDuration(e.target.value)} | ||
/> | ||
</div> | ||
<div className="info"> | ||
<label>Participants</label> | ||
<input | ||
type="text" | ||
placeholder="Participants..." | ||
value={participants} | ||
onChange={(e) => setParticipants(e.target.value)} | ||
/> | ||
</div> | ||
</div> | ||
<div className="block-files"> | ||
<ButtonAddFile | ||
title="Fichier Markdown (.md) *" | ||
action={openMarkdownFile} | ||
fileName={markdownFile ? getFileName(markdownFile) : ''} | ||
></ButtonAddFile> | ||
<ButtonAddFile | ||
title="Fichier CSS (.css) *" | ||
action={openCssFile} | ||
fileName={cssFile ? getFileName(cssFile) : ''} | ||
></ButtonAddFile> | ||
<ButtonAddFile | ||
title="Dossier Assets (images, etc.)" | ||
action={openAssetsFile} | ||
fileName={assetsFile ? getFileName(assetsFile) : ''} | ||
></ButtonAddFile> | ||
<ButtonAddFile | ||
title="Dossier Env" | ||
action={openEnvFile} | ||
fileName={envFile ? getFileName(envFile) : ''} | ||
></ButtonAddFile> | ||
</div> | ||
<p>* Champs requis</p> | ||
{error && ( | ||
<span className="error">Merci de remplir tous les champs requis</span> | ||
)} | ||
<button className="sendingButton" onClick={createCodePrez}> | ||
Générer la présentation | ||
</button> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.