Skip to content

Commit

Permalink
add options to sponsor + link to donate
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas40510 committed Mar 17, 2022
1 parent 96e2184 commit 05c6143
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!--
The One And Only PS Generator !
::author:: PRV @ ENSTA Bretagne
::version:: v1.1.1
::version:: v1.1.2
-->
<html lang="fr-fr">
<head>
Expand Down
32 changes: 16 additions & 16 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
PS Generator
@author: PRV
@version: 1.1.1
@version: 1.1.2
*/

import React from 'react';
Expand Down Expand Up @@ -69,13 +69,18 @@ const styles = theme => ({
copy: {
margin: theme.spacing(3, 6, 2),
//width: '100pt',
},
link: {
margin: theme.spacing(6, 6, 2),
color: theme.palette.secondary.light,
}
});

class PsGenerator extends React.Component {
handleFocus = (event) => event.target.select();
placeholderText = 'Ceci est un texte random \nsans contenu particulier \npermettant d\'illustrer \ncomment ça marche \nen vrai...'
versionTxt = '1.1.1';
versionTxt = '1.1.2';
donate = 'https://www.leetchi.com/c/don-au-profit-des-blesses-de-guerre-miliste-2022'

render() {
const { classes } = this.props;
Expand All @@ -94,6 +99,10 @@ class PsGenerator extends React.Component {
For polyvalent engineers @ ENSTA Breton
</Typography>

<Typography variant="body2" component="div">
Sponsored by [votre nom de liste ici !]
</Typography>

<form className={classes.form} noValidate>
<TextField
width="20%"
Expand Down Expand Up @@ -127,19 +136,9 @@ class PsGenerator extends React.Component {
id="txtresult"
multiline
onFocus={this.handleFocus}
InputLabelProps={{shrink: true,}}
InputProps={{
readOnly: true,

/*
endAdornment:(
<InputAdornment position="end">
<FileCopy
aria-label="copy to clipboard"
onClick={() => {navigator.clipboard.writeText(this.state.textToCopy)}}
edge="end"
/>
</InputAdornment>),
*/
}}
/>
<Grid container>
Expand All @@ -156,14 +155,15 @@ class PsGenerator extends React.Component {
>
Ça part !
</Button><Button className={classes.copy}>
<FileCopyRounded
onClick={() => {navigator.clipboard.writeText(document.getElementById('txtresult').value); alert("Copié !");}}/>
<FileCopyRounded id="copyBtn"/>
</Button>
</div>

</div>
<footer style={{color: "gray", position: "fixed", bottom: 0}}>
<center>Made with ☕️ by Gustave — version {this.versionTxt}</center>
<center>Made with ☕️ by Gustave — version {this.versionTxt}
<a href={this.donate} className={classes.link} target="_blank">Faire un don à la miliste</a>
</center>
</footer>
</Container>

Expand Down
18 changes: 14 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/*
PS Generator
@author: PRV
@version: 1.1.2
*/

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import Button from '@mui/material/Button';


ReactDOM.render(
<React.StrictMode>
Expand All @@ -13,6 +16,7 @@ ReactDOM.render(
document.getElementById('root')
);
document.getElementById("btn").addEventListener("click", gen);
document.getElementById('copyBtn').addEventListener('click', cpText);

function gen(){
let s = document.getElementById("usrinput").value.toString();
Expand Down Expand Up @@ -92,7 +96,13 @@ function chunkify(L, n, balanced) {
return out;
}


function cpText(){
let txt = document.getElementById('txtresult').value;
setTimeout(async()=>console.log(
await window.navigator.clipboard.writeText(txt)), 3000)
//navigator.clipboard.writeText(txt);
alert("Copié !");
}
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
Expand Down

0 comments on commit 05c6143

Please sign in to comment.