Merge branch 'master' into beta

This commit is contained in:
Martin Quarda 2024-10-09 19:08:38 +02:00
commit ccf234444b
4 changed files with 31 additions and 18 deletions

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -16,7 +16,7 @@ class Main extends Component {
constructor(props) {
super(props);
this.state = {
text: "",
status_text: "",
status: "",
faq: false,
results: [],
@ -43,7 +43,7 @@ class Main extends Component {
for(const [key, value] of searchParams){
if (key == "refId"){
fetch(addr_prefix + "/api/payment_state?refId=" + value).then(resp => resp.json()).then(json =>{
this.setState({status: json.status, text: json.reason})
this.setState({status: json.status, status_text: json.reason})
})
}
}
@ -85,7 +85,7 @@ class Main extends Component {
this.setState({progress:false, uploadProgress: 1.0});
if(data.reason){
this.setState({
text: data.reason,
status_text: data.reason,
status: "failed",
})
} else {
@ -95,13 +95,19 @@ class Main extends Component {
})
}
this.setState({
text: data.success,
status_text: data.success,
status: "success",
})
if (data.redirect){
window.open(data.redirect ,"_self")
}
}
}).catch((error) => {
this.setState({
progress: false,
status_text: "Chyba: " + error.response.status +", " + error.response.data,
status: "failed",
})
});
}
togglefaq(){
@ -167,12 +173,12 @@ class Main extends Component {
</div>
</nav>
{this.state.status == "success" &&
<div class="absolute container-fluid alert alert-success">
{this.state.text}
<div class="absolute container-fluid alert alert-success" onClick={(e) => {this.setState({status: "", status_text:""})}}>
{this.state.status_text}
</div>}
{this.state.status == "failed" &&
<div class="absolute container-fluid alert alert-danger">
{this.state.text}
<div class="absolute container-fluid alert alert-danger" onClick={(e) => {this.setState({status: "", status_text:""})}}>
{this.state.status_text}
</div>}
{this.state.page == "#login" &&
<div>
@ -186,8 +192,9 @@ class Main extends Component {
{this.state.page == "#upload_files" &&
<div>
<form id="form" action="/api/upload_files" class="container" onSubmit={(e) => this.onSubmit(e)}>
<label>Zvolte soubory <input type="file" name="files" accept=".jpg,.png,.webp,.webm,.avi,.mkv,.mp4" multiple={true}/></label>
<button type="submit" class="btn btn-primary">Nahrát</button> <b>progress: {(this.state.uploadProgress * 100).toFixed(1)}%</b>
<label>Zvolte soubory <input type="file" name="files" accept=".jpg,.png,.webp,.webm,.avi,.mkv,.mp4" multiple={true} onChange={(e)=> this.handleChangeFiles.bind(this)(e)}/></label>
<button type="submit" class="btn btn-primary">Nahrát</button><b>progress: {(this.state.uploadProgress * 100).toFixed(1)}%</b><br />
Nahráním fotek/videí nám dávate souhlas s použitím vaších fotek k propagaci a zvěřejněním na stránkách.
</form>
</div>}
{this.state.page == "#payment" &&
@ -320,9 +327,10 @@ class Main extends Component {
<p>Rozhodně se podívej na FAQ sekci, zde na stránce, kde najdeš důležité informace týkající se závodu ALKÁTOR RACE.</p>
<p>Sportem ku chlastu!</p>
<iframe width="100%" height="500px" src="https://www.youtube.com/embed/INYakiBnVNk?si=Nx9QtADyt_4XI5BC" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="true" />
</div>
<div class="col-xl-6">
<h1 class="text">Výsledky 1. ročníku</h1>
<h1 class="text">Výsledky 2. ročníku (Podzim 2024)</h1>
{this.state.results &&
<table class="table results">
<thead>
@ -346,7 +354,6 @@ class Main extends Component {
{/*
<img src="/public/trasa.png" style={{'width': '100%', 'height': 'auto'}}/>
*/}
<iframe width="100%" height="500px" src="https://www.youtube.com/embed/INYakiBnVNk?si=Nx9QtADyt_4XI5BC" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="true" />
</div>
</div>
</div>
@ -354,7 +361,7 @@ class Main extends Component {
<h2>Stále nevíš, jestli se zúčastníš? Přečti si náš <button type="button" class="btn btn-warning" onClick={(e) => this.togglefaq()}>FAQ</button></h2>
</div>
<div class="container text text-center">
<h1>Kapacita je aktuálně naplněna, budem se těšit u dalšího ročníku.</h1>
<h1>Další ročník bude na jaře 2025.</h1>
</div>
{/*
<form id="form" class="container" action="/api/register" onSubmit={(e) => this.onSubmit(e)}>

BIN
photos/plakat_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

View File

@ -1,13 +1,19 @@
import glob
import PIL.Image
photos = glob.glob('photos/2/*.jpg')
import os
x = 2
photos = glob.glob(f'photos/{x}/*.jpg')
for image in photos:
print(image)
img = PIL.Image.open(image)
img.save(image.replace('.jpg', '.webp'))
big_image = image.replace('.jpg', '.webp')
if os.path.exists(big_image):
continue
img.save(big_image)
ratio = 400/max(img.height, img.width)
img = img.resize((int(img.width * ratio), int(img.height * ratio)))
image = image.replace('photos/', 'photos/thumbnail/').replace('.jpg', '.webp')
img.save(image, quality=50, subsampling=2)
small_image = image.replace(f'photos/{x}/', f'photos/{x}/thumbnail/').replace('.jpg', '.webp')
if os.path.exists(small_image):
continue
img.save(small_image, quality=50, subsampling=2)