Browse Source

lots of fixes

master
Danilo Di Cuia 2 years ago
parent
commit
27e0427e96
  1. 46
      package-lock.json
  2. 2
      package.json
  3. 4
      src/App.css
  4. 18
      src/Buttons.js
  5. 213
      src/Galleria.js
  6. 16
      src/ImageUpload.js
  7. 0
      src/assets/logo.svg
  8. 22
      src/assets/logo_chat.svg
  9. 0
      src/assets/logo_p.svg
  10. 47
      src/index.js
  11. 24
      src/logo_chat.svg
  12. 4
      src/routes/AdminPage.js
  13. 268
      src/routes/GalleryPage.js
  14. 4
      src/routes/HomePage.1.js
  15. 86
      src/routes/HomePage.js
  16. 10
      src/routes/MyFormPage.js
  17. 19
      src/routes/ProjectionPage.js

46
package-lock.json generated

@ -19,6 +19,7 @@
"firebase": "^9.17.2",
"localforage": "^1.10.0",
"match-sorter": "^6.3.1",
"moment": "^2.30.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.41.0",
@ -26,6 +27,7 @@
"react-scripts": "5.0.1",
"sass": "^1.60.0",
"sort-by": "^1.2.0",
"uuid": "^9.0.1",
"web-vitals": "^2.1.4"
}
},
@ -13144,6 +13146,14 @@
"mkdirp": "bin/cmd.js"
}
},
"node_modules/moment": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
"engines": {
"node": "*"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -16402,6 +16412,14 @@
"websocket-driver": "^0.7.4"
}
},
"node_modules/sockjs/node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/sort-by": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/sort-by/-/sort-by-1.2.0.tgz",
@ -17420,9 +17438,13 @@
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"bin": {
"uuid": "dist/bin/uuid"
}
@ -27873,6 +27895,11 @@
"minimist": "^1.2.6"
}
},
"moment": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how=="
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -30038,6 +30065,13 @@
"faye-websocket": "^0.11.3",
"uuid": "^8.3.2",
"websocket-driver": "^0.7.4"
},
"dependencies": {
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
},
"sort-by": {
@ -30798,9 +30832,9 @@
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA=="
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="
},
"v8-to-istanbul": {
"version": "8.1.1",

2
package.json

@ -15,6 +15,7 @@
"firebase": "^9.17.2",
"localforage": "^1.10.0",
"match-sorter": "^6.3.1",
"moment": "^2.30.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.41.0",
@ -22,6 +23,7 @@
"react-scripts": "5.0.1",
"sass": "^1.60.0",
"sort-by": "^1.2.0",
"uuid": "^9.0.1",
"web-vitals": "^2.1.4"
},
"eslintConfig": {

4
src/App.css

@ -14,6 +14,10 @@
font-style: normal;
}
html {
background: black;
}
#myVideo {
position: fixed;
left: 50%;

18
src/Buttons.js

@ -2,19 +2,20 @@ import React from "react";
import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import IconButton from "@mui/material/IconButton";
import CloseIcon from "@mui/icons-material/Close";
import { Stack } from "@mui/system";
export function Buttons(indiceCorrente, cambiaindiceCorrente, messaggi) {
export function Buttons(
indiceCorrente,
cambiaindiceCorrente,
messaggi,
setMainMessage
) {
return (
<Stack
style={{
display: "flex",
width: "100vw",
position: "absolute",
bottom: 20,
left: 0,
padding: 10,
boxSizing: "border-box",
}}
direction="row"
>
@ -32,6 +33,11 @@ export function Buttons(indiceCorrente, cambiaindiceCorrente, messaggi) {
<ArrowBackIcon style={{ fontSize: "3rem", color: "#ddd" }} />
</IconButton>
)}
<IconButton onClick={() => setMainMessage(null)}>
<CloseIcon style={{ fontSize: "3rem", color: "#ddd" }} />
</IconButton>
{indiceCorrente < messaggi.length - 1 && (
<IconButton onClick={() => cambiaindiceCorrente(indiceCorrente + 1)}>
<ArrowForwardIcon style={{ fontSize: "3rem", color: "#ddd" }} />

213
src/Galleria.js

@ -1,213 +0,0 @@
import React, { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import firebase from "firebase/compat/app";
import { Stack } from "@mui/system";
import logoSrc from "./logo_chat.svg";
import { Box, CircularProgress, Fade, LinearProgress } from "@mui/material";
import { VideoComponent } from "./Proiezione";
import { Buttons } from "./Buttons";
export const Galleria = () => {
const { evento } = useParams();
const [messages, setMessages] = useState([]);
const [imgIndex, cambiaimgIndex] = useState(0);
const [images, setImages] = useState([]);
useEffect(() => {
var messagesRef = firebase.database().ref(`/messaggi/${evento}`);
console.log(`/messaggi/${evento}`);
messagesRef.once("value", function (snapshot) {
const messaggiObject = snapshot.val();
const messaggi = Object.keys(messaggiObject)
.map((d) => {
return messaggiObject[d];
})
.filter((d) => d.approvato)
.sort((a, b) => a.timestamp - b.timestamp);
setMessages(messaggi);
// setImages(
// messaggi
// .filter((d) => d.immagineURL != null)
// .map((d) => {
// return d.immagineURL;
// })
// );
});
}, [evento]);
// useEffect(() => {
// if (images) {
// function loadImage() {
// const img = new Image();
// img.src = images[imgIndex];
// img.onload = () => {
// if (imgIndex < images.length) {
// cambiaimgIndex((i) => {
// return i + 1;
// });
// }
// };
// }
// loadImage();
// }
// }, [imgIndex, images]);
return (
<div>
{/* {imgIndex !== images.length && (
<LinearProgress
variant="determinate"
value={(imgIndex / images.length) * 100}
style={{ position: "absolute", width: "100vw", top: "50%" }}
/>
)}
{imgIndex === images.length && ( */}
<div
style={{
margin: "0 auto",
fontFamily: "Lineatura",
width: "90vw",
height: "100vh",
fontWeight: "bold",
color: "white",
display: "flex",
justifyContent: "space-around",
alignContent: "center",
alignItems: "center",
textAlign: "center",
}}
>
<VideoComponent />
{messages.length && <ContenitoreMessaggio messaggi={messages} />}
<img
src={logoSrc}
alt=""
style={{
width: 120,
position: "absolute",
top: 20,
right: 20,
}}
/>
</div>
{/* )} */}
</div>
);
};
const ContenitoreMessaggio = ({ messaggi }) => {
const [indiceCorrente, cambiaindiceCorrente] = useState(0);
const messaggioDaMostrare = messaggi[indiceCorrente];
return (
<Stack sx={{ zIndex: 1 }}>
<div>
<Stack>
{messaggioDaMostrare.immagineURL && (
<ImagePlaceholder
messaggioDaMostrare={messaggioDaMostrare}
style={{
maxWidth: "100%",
maxHeight: "80vh",
}}
/>
)}
<Messaggio messaggioDaMostrare={messaggioDaMostrare} />
</Stack>
</div>
{Buttons(indiceCorrente, cambiaindiceCorrente, messaggi)}
</Stack>
);
};
function ImagePlaceholder({ messaggioDaMostrare }) {
const [imageLoaded, setImageLoaded] = useState(false);
useEffect(() => {
console.log("go");
setImageLoaded(false);
if (messaggioDaMostrare.immagineURL) {
const image = new Image();
image.onload = () => {
setImageLoaded(true);
};
image.src = messaggioDaMostrare.immagineURL;
} else {
setImageLoaded(true);
}
}, [messaggioDaMostrare.immagineURL]);
if (imageLoaded) {
return (
<div>
{messaggioDaMostrare.immagineURL && (
<img
alt=""
src={messaggioDaMostrare.immagineURL}
style={{
maxWidth: "100%",
maxHeight: "65vh",
}}
/>
)}
</div>
);
} else {
return (
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "space-around",
width: "100%",
}}
>
<CircularProgress />
</Box>
);
}
}
const Messaggio = ({ messaggioDaMostrare }) => {
const date = new Date(messaggioDaMostrare.timestamp);
return (
<>
<h1
style={{
fontSize: messaggioDaMostrare.immagineURL ? 20 : 50,
textShadow:
"0px 0px 10px rgba(0,0,0,100), 0px 0px 10px rgba(0,0,0,100), 0px 0px 10px rgba(0,0,0,100)",
}}
>
{messaggioDaMostrare.testo}
</h1>
{messaggioDaMostrare.autore && (
<p
style={{
fontSize: 20,
margin: 0,
display: "inline-block",
background: "black",
padding: "0px 6px",
paddingBottom: "4px",
}}
>
da {messaggioDaMostrare.autore}
</p>
)}
<p style={{ fontFamily: "sans-serif", fontSize: ".8rem", color: "#ddd" }}>
{date.toLocaleString("it-IT", {
timeStyle: "short",
dateStyle: "short",
})}
</p>
</>
);
};

16
src/ImageUpload.js

@ -4,6 +4,7 @@ import "firebase/compat/storage";
import { Stack } from "@mui/system";
import { Button } from "@mui/material";
import { useParams } from "react-router-dom";
import { v4 as uuidv4 } from "uuid";
const IDLE = 0;
const IMAGE_SET = 1;
@ -18,17 +19,15 @@ function ImageUpload({ onImageURLSet, onImageUploading }) {
const [progress, setProgress] = useState(0);
const handleChange = (e) => {
const imgRef = `images/${evento}/${uuidv4()}_${image.name}`;
if (e.target.files[0]) {
// setState(1);
let image = e.target.files[0];
onImageUploading(true);
const uploadTask = firebase
.storage()
.ref(`images/${evento}/${image.name}`)
.put(image, {
cacheControl: "public,max-age=3000000",
contentType: "image/jpeg",
});
const uploadTask = firebase.storage(imgRef).ref().put(image, {
cacheControl: "public,max-age=3000000",
contentType: "image/jpeg",
});
setState(UPLOADING);
@ -46,8 +45,7 @@ function ImageUpload({ onImageURLSet, onImageUploading }) {
() => {
firebase
.storage()
.ref(`images/${evento}/`)
.child(image.name)
.ref(imgRef)
.getDownloadURL()
.then((url) => {
setImageUrl(url);

0
src/logo.svg → src/assets/logo.svg

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

22
src/assets/logo_chat.svg

@ -0,0 +1,22 @@
<svg width="730" height="729" viewBox="0 0 730 729" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="364.753" cy="364.384" r="364.306" fill="black" style="fill:black;fill-opacity:1;"/>
<path d="M315.856 615.891L304.136 619.566C303.414 617.285 302.185 615.314 300.451 613.653C298.776 611.958 296.759 610.79 294.4 610.151C290.654 609.136 287.105 609.589 283.754 611.511C280.404 613.433 278.221 616.267 277.206 620.013C276.19 623.76 276.644 627.308 278.566 630.659C280.487 634.009 283.322 636.192 287.068 637.208C289.427 637.847 291.751 637.881 294.04 637.31C296.389 636.705 298.45 635.601 300.226 633.996L308.486 643.086C305.137 646.101 301.307 648.141 296.997 649.207C292.687 650.273 288.312 650.205 283.872 649.001C276.842 647.096 271.54 643.028 267.966 636.797C264.358 630.507 263.507 623.847 265.412 616.817C267.304 609.833 271.396 604.538 277.685 600.93C283.975 597.322 290.612 596.465 297.596 598.357C302.036 599.561 305.847 601.71 309.029 604.807C312.212 607.903 314.487 611.598 315.856 615.891Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path d="M370.024 609.813L365.76 659.946L353.585 658.911L355.199 639.932L330.849 637.861L329.235 656.84L317.059 655.804L321.323 605.671L333.499 606.706L331.884 625.685L356.235 627.756L357.849 608.777L370.024 609.813Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path d="M392.075 650.333L389.502 658.913L376.206 660.302L392.782 607.982L406.793 606.518L433.825 654.282L420.528 655.671L416.238 647.808L392.075 650.333ZM409.893 636.186L401.139 620.189L395.881 637.65L409.893 636.186Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path d="M440.765 612.639L431.042 615.234L427.891 603.428L459.142 595.087L462.293 606.892L452.57 609.488L462.395 646.294L450.589 649.445L440.765 612.639Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M261.583 172.438L271.016 318.929L305.085 300.156L310.518 310.015L260.922 337.344L250.35 173.161L261.583 172.438Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M458.473 134.822L464.078 134.591L463.615 123.344C462.971 123.37 462.326 123.391 461.681 123.413C460.26 123.46 458.837 123.506 457.42 123.61C457.1 123.633 456.653 123.671 456.086 123.732C454.951 123.853 453.335 124.064 451.297 124.431C447.222 125.166 441.456 126.522 434.471 129.021C422.249 133.394 406.335 141.251 389.26 155.335L384.83 125.403L373.694 127.051L379.187 164.166C361.692 179.37 344.787 185.69 332.191 188.223C325.559 189.557 320.093 189.846 316.338 189.809C314.461 189.791 313.014 189.692 312.068 189.602C311.594 189.557 311.246 189.515 311.032 189.487C310.925 189.472 310.852 189.462 310.813 189.456L310.786 189.452L310.785 189.451L310.781 189.451L305.252 188.514L303.371 199.612C304.008 199.72 304.645 199.834 305.282 199.948C306.7 200.201 308.118 200.455 309.545 200.645C309.896 200.692 310.386 200.75 311.006 200.809C312.247 200.927 314.012 201.044 316.229 201.066C320.662 201.109 326.916 200.766 334.411 199.259C347.358 196.655 363.925 190.589 381.111 177.165L399.788 303.365L410.923 301.717L391.208 168.499C409.198 152.421 425.98 144.015 438.263 139.62C444.614 137.348 449.775 136.144 453.293 135.51C455.052 135.193 456.4 135.019 457.28 134.925C457.719 134.878 458.042 134.852 458.24 134.837C458.339 134.83 458.407 134.826 458.443 134.824L458.468 134.822L458.469 134.822L458.473 134.822Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M510.375 185.602L516.478 361.734L505.228 362.124L499.125 185.991L510.375 185.602Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path d="M520.859 385.824C520.859 390.724 516.887 394.695 511.987 394.695C507.087 394.695 503.115 390.724 503.115 385.824C503.115 380.925 507.087 376.953 511.987 376.953C516.887 376.953 520.859 380.925 520.859 385.824Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M511.987 386.514C512.369 386.514 512.677 386.204 512.677 385.824C512.677 385.444 512.369 385.135 511.987 385.135C511.605 385.135 511.297 385.444 511.297 385.824C511.297 386.204 511.605 386.514 511.987 386.514ZM511.987 394.695C516.887 394.695 520.859 390.724 520.859 385.824C520.859 380.925 516.887 376.953 511.987 376.953C507.087 376.953 503.115 380.925 503.115 385.824C503.115 390.724 507.087 394.695 511.987 394.695Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M438.197 171.433L419.807 190.057L411.797 182.147L430.187 163.523L438.197 171.433Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M310.528 361.492L325.303 449.189L314.941 453.044L285.323 404.219L295.469 456.504L285.12 460.477L232.182 372.442L241.829 366.641L278.349 427.373L268.271 375.437L278.609 371.446L309.319 422.071L299.427 363.362L310.528 361.492Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M396.841 349.907C396.521 349.708 396.266 349.616 395.633 349.803C395.588 349.817 394.914 350.073 393.786 351.539C392.704 352.945 391.532 355.042 390.358 357.86C388.014 363.482 385.984 371.183 384.5 379.91C381.773 395.941 381.055 414.412 383.078 428.171L383.737 432.007L372.668 434.053C372.407 432.731 372.172 431.366 371.964 429.965L357.232 344.231L368.327 342.324L373.943 375.006C375.461 366.952 377.486 359.482 379.967 353.53C381.358 350.192 382.974 347.131 384.864 344.675C386.707 342.279 389.189 339.968 392.445 339.007C396.117 337.923 399.701 338.429 402.787 340.349C405.651 342.131 407.722 344.894 409.255 347.761C412.311 353.473 414.199 361.44 415.348 369.761C417.668 386.564 417.276 407.225 415.278 420.64L414.449 426.207L403.315 424.549L404.144 418.982C405.987 406.609 406.368 387.026 404.197 371.301C403.1 363.359 401.427 356.992 399.329 353.071C398.286 351.122 397.383 350.244 396.841 349.907Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M340.519 364.5L353.389 441.44L342.286 443.297L329.416 366.357L340.519 364.5Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path d="M340.615 343.332C340.615 348.232 336.643 352.203 331.743 352.203C326.843 352.203 322.871 348.232 322.871 343.332C322.871 338.433 326.843 334.461 331.743 334.461C336.643 334.461 340.615 338.433 340.615 343.332Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M331.743 344.021C332.125 344.021 332.433 343.712 332.433 343.332C332.433 342.952 332.125 342.643 331.743 342.643C331.361 342.643 331.053 342.952 331.053 343.332C331.053 343.712 331.361 344.021 331.743 344.021ZM331.743 352.203C336.643 352.203 340.615 348.232 340.615 343.332C340.615 338.433 336.643 334.461 331.743 334.461C326.843 334.461 322.871 338.433 322.871 343.332C322.871 348.232 326.843 352.203 331.743 352.203Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M478.038 314.564L477.501 308.961L466.295 310.036L466.833 315.638C467.143 318.878 467.487 322.549 467.852 326.561C466.346 325.48 464.618 324.667 462.657 324.26C458.455 323.388 454.491 324.651 451.202 326.765C447.944 328.86 445.016 331.98 442.473 335.606C437.374 342.876 433.171 353.108 430.79 364.578C428.408 376.047 428.191 387.107 429.973 395.805C430.863 400.144 432.306 404.172 434.462 407.391C436.637 410.639 439.771 413.375 443.973 414.248C448.175 415.12 452.139 413.857 455.428 411.743C458.687 409.648 461.614 406.528 464.157 402.901C467.446 398.212 470.363 392.289 472.658 385.598C473.879 402.855 474.883 419.814 475.297 433.263C451.929 439.713 424.961 447.271 394.91 456.074C370.881 463.112 353.015 470.625 340.93 478.088C334.889 481.818 330.101 485.653 326.71 489.572C323.335 493.473 321.054 497.802 320.752 502.43C320.104 512.402 328.389 518.966 338.367 522.752C348.792 526.707 363.738 528.847 382.297 528.847C435.424 528.847 462.646 519.175 475.871 502.269C482.487 493.81 485.127 484.104 486.18 474.346C486.974 466.984 486.889 459.159 486.807 451.644V451.644V451.643C486.783 449.385 486.759 447.156 486.759 444.975C486.759 443.95 486.752 442.886 486.741 441.787C493.851 439.832 500.596 437.986 506.965 436.244L506.969 436.242C521.892 432.159 534.75 428.64 545.398 425.611L550.812 424.071L547.732 413.244L542.318 414.784C531.868 417.756 519.108 421.248 504.249 425.315C498.616 426.857 492.682 428.481 486.457 430.19C485.228 395.35 480.537 340.624 478.038 314.564ZM398.074 466.877C426.962 458.415 452.874 451.138 475.501 444.885L475.501 444.975C475.501 447.452 475.527 449.874 475.552 452.246C475.631 459.61 475.704 466.504 474.988 473.139C474.061 481.727 471.855 489.132 467.004 495.333C457.295 507.745 435.1 517.59 382.297 517.59C364.381 517.59 350.975 515.495 342.36 512.227C333.298 508.789 331.857 505.142 331.986 503.161C332.074 501.812 332.807 499.73 335.222 496.938C337.62 494.167 341.397 491.03 346.845 487.666C357.737 480.94 374.544 473.769 398.074 466.877ZM460.369 335.282C460.865 335.385 461.748 335.788 462.815 337.38C463.901 339.002 464.923 341.518 465.629 344.963C467.037 351.833 466.965 361.305 464.818 371.642C462.672 381.978 458.967 390.697 454.941 396.438C452.922 399.318 450.982 401.219 449.34 402.274C447.728 403.311 446.758 403.329 446.261 403.226C445.765 403.123 444.882 402.72 443.816 401.127C442.73 399.506 441.707 396.99 441.001 393.545C439.593 386.675 439.666 377.202 441.812 366.866C443.958 356.53 447.663 347.811 451.689 342.069C453.709 339.19 455.648 337.289 457.29 336.233C458.902 335.197 459.873 335.179 460.369 335.282Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M196.279 311.836C192.967 314.797 189.941 320.573 189.941 330.659C189.941 339.127 193.054 347.837 198.236 357.05C203.425 366.275 210.393 375.508 217.658 385.104L217.907 385.432C224.991 394.788 232.344 404.5 237.91 414.336C243.547 424.299 247.658 434.902 247.658 446.004C247.658 470.846 230.858 484.893 213.082 484.612C204.352 484.475 195.64 480.839 189.152 473.652C182.65 466.448 178.684 456.032 178.684 442.788V437.16H189.941V442.788C189.941 453.756 193.189 461.324 197.508 466.109C201.843 470.91 207.561 473.267 213.26 473.357C224.342 473.531 236.401 464.975 236.401 446.004C236.401 437.662 233.297 429.043 228.112 419.88C222.921 410.706 215.953 401.5 208.683 391.899L208.671 391.882C201.51 382.425 194.054 372.577 188.425 362.569C182.785 352.542 178.684 341.86 178.684 330.659C178.684 318.377 182.415 309.132 188.776 303.444C195.156 297.74 203.452 296.295 210.944 298.301C226.321 302.418 237.161 320.125 228.828 343.489L226.937 348.791L216.334 345.009L218.225 339.708C224.743 321.432 215.976 311.302 208.033 309.175C203.864 308.059 199.573 308.891 196.279 311.836Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M366.577 249.756C362.674 260.903 351.965 273.467 337.17 273.467L333.61 273.467C333.805 276.602 334.261 279.643 334.991 282.485C336.755 289.347 339.977 294.568 344.478 297.558C346.566 298.945 350.399 299.837 354.373 299.022C358.117 298.253 361.638 296.046 363.718 291.628L366.115 286.536L376.3 291.332L373.902 296.424C370.127 304.441 363.409 308.659 356.636 310.049C350.093 311.392 343.131 310.178 338.249 306.935C330.703 301.922 326.29 293.854 324.088 285.286C321.881 276.695 321.754 267.116 323.17 258.213C324.583 249.337 327.597 240.714 332.054 234.15C336.459 227.661 342.93 222.325 351.264 222.325C354.918 222.325 358.262 223.136 361.074 224.898C363.913 226.678 365.862 229.213 367.022 232.061C369.261 237.553 368.568 244.068 366.577 249.756ZM333.973 262.21C334.065 261.465 334.17 260.722 334.288 259.982C335.512 252.286 338.065 245.336 341.367 240.472C344.721 235.532 348.198 233.582 351.264 233.582C353.26 233.582 354.427 234.017 355.095 234.436C355.735 234.837 356.235 235.418 356.598 236.31C357.407 238.296 357.451 241.753 355.952 246.036C352.873 254.831 345.236 262.21 337.17 262.21L333.973 262.21Z" fill="white" style="fill:white;fill-opacity:1;"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M424.361 223.617C423.309 209.869 434.19 201.624 445.094 200.851C456.912 200.013 464.245 208.776 466.558 212.575L469.484 217.383L459.868 223.236L456.941 218.428C455.41 215.91 451.354 211.692 445.89 212.08C439.512 212.532 435.13 216.808 435.586 222.759C435.721 224.527 436.88 226.603 440.312 229.352C443.212 231.675 446.883 233.828 451.126 236.318C451.915 236.781 452.725 237.256 453.553 237.746C458.572 240.715 464.161 244.178 468.586 248.525C473.11 252.968 476.737 258.645 477.26 266.013C477.77 273.211 475.31 279.22 470.969 283.514C466.744 287.694 461.044 289.967 455.323 290.569C444.059 291.755 430.595 286.499 425.958 272.946L424.136 267.621L434.787 263.977L436.609 269.303C439.105 276.598 446.614 280.167 454.145 279.374C457.821 278.987 460.973 277.569 463.052 275.512C465.016 273.568 466.313 270.791 466.031 266.809C465.76 262.997 463.94 259.74 460.698 256.555C457.358 253.275 452.864 250.417 447.821 247.434C447.096 247.005 446.353 246.57 445.601 246.13C441.392 243.666 436.874 241.021 433.275 238.138C429.023 234.732 424.856 230.083 424.361 223.617Z" fill="white" style="fill:white;fill-opacity:1;"/>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

0
src/logo_p.svg → src/assets/logo_p.svg

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

47
src/index.js

@ -11,26 +11,25 @@ import {
import firebase from "firebase/compat/app";
import "firebase/compat/database";
import "firebase/compat/analytics";
import { Proiezione } from "./Proiezione";
import { MyForm } from "./MyForm";
import { Admin } from "./Admin";
import { Galleria } from "./Galleria";
import { ListaEventi } from "./ListaEventi";
import { Button } from "@mui/material";
import { ProjectionPage } from "./routes/ProjectionPage";
import { MyFormPage } from "./routes/MyFormPage";
import { AdminPage } from "./routes/AdminPage";
import { GalleryPage } from "./routes/GalleryPage";
import { HomePage } from "./routes/HomePage";
import { Button, CssBaseline, ThemeProvider, createTheme } from "@mui/material";
import EXIF from "exif-js";
const firebaseConfig = {
apiKey: "AIzaSyBWE1l8WV_7eyKT-PMu0Kq2w_WiV0SUhJw",
authDomain: "messaggiswing.firebaseapp.com",
databaseURL:
"https://messaggiswing-default-rtdb.europe-west1.firebasedatabase.app",
projectId: "messaggiswing",
storageBucket: "messaggiswing.appspot.com",
messagingSenderId: "983131964310",
appId: "1:983131964310:web:5ef430e42c42d2dfe253b7",
measurementId: "G-1CBJZ3B48E",
databaseURL:
"https://messaggiswing-default-rtdb.europe-west1.firebasedatabase.app",
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
@ -39,6 +38,13 @@ function parseDate(s) {
return new Date(b[0], b[1] - 1, b[2], b[3], b[4], b[5]);
}
const darkTheme = createTheme({
palette: {
mode: "dark",
background: "black",
},
});
const Upload = () => {
const { evento } = useParams();
const [uploadedFiles, setUploadedFiles] = useState([]);
@ -124,14 +130,17 @@ const Upload = () => {
};
ReactDOM.createRoot(document.getElementById("root")).render(
<Router>
<Routes>
<Route path="/" element={<ListaEventi />} />
<Route path="/:evento" element={<MyForm />} />
<Route path="/eventi/:evento" element={<Galleria />} />
<Route path="proiezione/:evento" element={<Proiezione />} />
<Route path="admin/:evento" element={<Admin />} />
<Route path="upload/:evento" element={<Upload />} />
</Routes>
</Router>
<ThemeProvider theme={darkTheme}>
<CssBaseline />
<Router>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/:evento" element={<MyFormPage />} />
<Route path="/eventi/:evento" element={<GalleryPage />} />
<Route path="proiezione/:evento" element={<ProjectionPage />} />
<Route path="admin/:evento" element={<AdminPage />} />
<Route path="upload/:evento" element={<Upload />} />
</Routes>
</Router>
</ThemeProvider>
);

24
src/logo_chat.svg

@ -1,24 +0,0 @@
<svg width="1382" height="1382" viewBox="0 0 1382 1382" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="690.606" cy="690.606" r="690.606" fill="black"/>
<path d="M597.208 1167.07L574.992 1174.04C573.622 1169.71 571.294 1165.98 568.007 1162.83C564.83 1159.61 561.007 1157.4 556.535 1156.19C549.434 1154.27 542.707 1155.12 536.355 1158.77C530.003 1162.41 525.865 1167.78 523.941 1174.88C522.016 1181.99 522.875 1188.71 526.519 1195.07C530.162 1201.42 535.534 1205.56 542.636 1207.48C547.107 1208.69 551.513 1208.76 555.854 1207.67C560.305 1206.53 564.214 1204.43 567.579 1201.39L583.238 1218.62C576.889 1224.34 569.63 1228.21 561.459 1230.23C553.288 1232.25 544.994 1232.12 536.577 1229.84C523.251 1226.23 513.2 1218.51 506.425 1206.7C499.586 1194.78 497.972 1182.15 501.583 1168.83C505.171 1155.59 512.927 1145.55 524.85 1138.71C536.774 1131.87 549.355 1130.24 562.594 1133.83C571.011 1136.11 578.235 1140.19 584.268 1146.06C590.301 1151.93 594.614 1158.93 597.208 1167.07Z" fill="white"/>
<path d="M700.462 1155.72L692.378 1250.75L669.298 1248.79L672.358 1212.81L626.198 1208.88L623.138 1244.86L600.057 1242.9L608.14 1147.86L631.221 1149.83L628.161 1185.8L674.321 1189.73L677.381 1153.75L700.462 1155.72Z" fill="white"/>
<path d="M742.001 1232.59L737.124 1248.86L711.918 1251.49L743.341 1152.31L769.902 1149.53L821.146 1240.08L795.94 1242.71L787.807 1227.81L742.001 1232.59ZM775.778 1205.77L759.184 1175.45L749.216 1208.55L775.778 1205.77Z" fill="white"/>
<path d="M834.048 1161.25L815.617 1166.17L809.643 1143.79L868.884 1127.97L874.858 1150.35L856.428 1155.27L875.052 1225.05L852.672 1231.02L834.048 1161.25Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M465.684 281.082L472.237 600.897L574.318 556.234L576.414 586.376L449.089 642.734L441.689 281.574L465.684 281.082Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M965.216 211.019L539.648 336.564L532.857 313.545L958.426 188L965.216 211.019Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M751.071 191.75L760.694 542.982L737.531 551.499L727.908 200.266L751.071 191.75Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M1008.52 322.766L1021.53 698.28L997.549 699.111L984.537 323.597L1008.52 322.766Z" fill="white"/>
<path d="M1030.87 749.634C1030.87 760.08 1022.4 768.547 1011.96 768.547C1001.51 768.547 993.041 760.08 993.041 749.634C993.041 739.188 1001.51 730.721 1011.96 730.721C1022.4 730.721 1030.87 739.188 1030.87 749.634Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M1011.96 751.104C1012.77 751.104 1013.43 750.444 1013.43 749.634C1013.43 748.824 1012.77 748.164 1011.96 748.164C1011.14 748.164 1010.48 748.824 1010.48 749.634C1010.48 750.444 1011.14 751.104 1011.96 751.104ZM1011.96 768.547C1022.4 768.547 1030.87 760.08 1030.87 749.634C1030.87 739.188 1022.4 730.721 1011.96 730.721C1001.51 730.721 993.041 739.188 993.041 749.634C993.041 760.08 1001.51 768.547 1011.96 768.547Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M830.702 288.172L827.523 299.744C824.292 311.504 817.824 325.946 808.631 336.818L800.883 345.981L782.557 330.484L790.305 321.321C796.702 313.756 801.819 302.71 804.381 293.386L807.56 281.814L830.702 288.172Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M564.198 691.104L595.699 878.074L573.606 886.291L510.461 782.197L532.092 893.669L510.028 902.139L397.164 714.448L417.732 702.08L495.593 831.562L474.107 720.834L496.147 712.324L561.62 820.258L540.532 695.091L564.198 691.104Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M681.17 627.342L698.273 723.522C698.464 722.393 698.659 721.27 698.857 720.152C702.598 699.049 707.713 679.249 713.916 663.923C717.008 656.284 720.543 649.321 724.6 643.776C728.496 638.452 733.87 633.063 741.078 630.935C749.233 628.528 757.11 629.974 763.603 634.785C769.463 639.126 773.411 645.606 776.225 652.086C781.878 665.101 785.082 683.216 787.047 702.032C790.271 732.893 790.466 769.306 790.611 796.31C790.644 802.517 790.674 808.227 790.738 813.258L790.891 825.257L766.893 825.563L766.74 813.564C766.672 808.218 766.639 802.266 766.604 795.88C766.455 768.855 766.262 734.062 763.177 704.526C761.253 686.107 758.316 671.095 754.212 661.647C752.148 656.894 750.314 654.809 749.316 654.069C749.284 654.045 749.254 654.022 749.226 654.001C748.935 653.777 748.806 653.678 747.874 653.953C747.894 653.947 747.891 653.948 747.868 653.961C747.69 654.053 746.284 654.784 743.969 657.948C741.511 661.307 738.847 666.296 736.163 672.928C730.813 686.145 726.065 704.168 722.489 724.341C715.705 762.605 713.55 806.173 718.262 835.934L719.23 841.378L695.644 845.808C695.269 843.911 694.922 841.963 694.604 839.97L657.541 631.544L681.17 627.342Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M922.287 579.098L923.433 591.043C928.761 646.602 938.76 763.278 941.382 837.559C954.652 833.914 967.304 830.451 979.313 827.165C1010.99 818.494 1038.2 811.049 1060.48 804.712L1072.02 801.429L1078.59 824.513L1067.04 827.796C1044.34 834.254 1016.92 841.757 985.105 850.464C971.526 854.18 957.145 858.115 941.986 862.282C942.011 864.627 942.024 866.894 942.024 869.079C942.024 873.729 942.076 878.483 942.128 883.297C942.302 899.318 942.484 916.003 940.79 931.699C938.546 952.503 932.917 973.196 918.812 991.229C890.616 1027.27 832.58 1047.89 719.312 1047.89C679.744 1047.89 647.879 1043.33 625.653 1034.9C604.381 1026.83 586.716 1012.83 588.099 991.573C588.741 981.706 593.605 972.476 600.8 964.161C608.031 955.804 618.239 947.629 631.118 939.676C656.884 923.766 694.974 907.748 746.202 892.742C810.273 873.974 867.768 857.86 917.588 844.109C915.349 771.428 905.04 650.665 899.542 593.334L898.397 581.389L922.287 579.098ZM918.024 868.887C869.783 882.22 814.537 897.734 752.949 915.774C702.782 930.469 666.951 945.756 643.728 960.097C632.114 967.269 624.062 973.956 618.949 979.865C613.8 985.816 612.236 990.256 612.049 993.131C611.774 997.354 614.846 1005.13 634.167 1012.46C652.533 1019.43 681.116 1023.89 719.312 1023.89C831.889 1023.89 879.208 1002.91 899.908 976.442C910.249 963.221 914.953 947.435 916.929 929.124C918.455 914.979 918.299 900.282 918.133 884.581C918.079 879.523 918.024 874.361 918.024 869.079C918.024 869.015 918.024 868.951 918.024 868.887Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M632.148 697.4L661.032 857.414L637.414 861.677L608.529 701.664L632.148 697.4Z" fill="white"/>
<path d="M631.004 656.273C631.004 666.718 622.535 675.186 612.089 675.186C601.642 675.186 593.174 666.718 593.174 656.273C593.174 645.827 601.642 637.359 612.089 637.359C622.535 637.359 631.004 645.827 631.004 656.273Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M612.089 657.742C612.903 657.742 613.56 657.083 613.56 656.273C613.56 655.462 612.903 654.803 612.089 654.803C611.275 654.803 610.617 655.462 610.617 656.273C610.617 657.083 611.275 657.742 612.089 657.742ZM612.089 675.186C622.535 675.186 631.004 666.718 631.004 656.273C631.004 645.827 622.535 637.359 612.089 637.359C601.642 637.359 593.174 645.827 593.174 656.273C593.174 666.718 601.642 675.186 612.089 675.186Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M897.581 638.713C895.622 635.065 893.798 633.997 892.725 633.662C891.651 633.328 889.543 633.172 885.86 635.062C882.11 636.987 877.552 640.661 872.625 646.408C862.798 657.868 853.044 675.767 846.29 697.449C839.537 719.132 837.402 739.404 838.983 754.417C839.776 761.945 841.441 767.557 843.435 771.27C845.394 774.917 847.218 775.986 848.291 776.32C849.365 776.655 851.473 776.81 855.157 774.92C858.906 772.996 863.464 769.322 868.392 763.575C878.218 752.115 887.972 734.216 894.726 712.533C901.479 690.85 903.614 670.579 902.033 655.566C901.24 648.037 899.575 642.426 897.581 638.713ZM925.901 653.051C927.899 672.022 925.128 695.63 917.64 719.669C910.153 743.708 899.029 764.715 886.611 779.196C880.417 786.42 873.51 792.476 866.114 796.272C858.652 800.102 849.932 801.968 841.154 799.235C832.377 796.501 826.259 790.014 822.29 782.625C818.358 775.301 816.112 766.395 815.115 756.932C813.117 737.961 815.888 714.352 823.376 690.314C830.863 666.275 841.988 645.268 854.405 630.786C860.599 623.562 867.506 617.506 874.902 613.711C882.364 609.881 891.084 608.014 899.862 610.748C908.64 613.482 914.758 619.969 918.726 627.358C922.658 634.682 924.904 643.588 925.901 653.051Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M317.143 562.078C311.403 569.04 306 581.797 306 604.065C306 655.085 335.131 707.181 366.552 757.403C370.01 762.93 373.5 768.444 376.968 773.923C388.902 792.777 400.58 811.226 409.836 828.463C421.681 850.521 430.757 872.659 430.757 893.209C430.757 904.295 427.94 913.519 422.801 920.865C417.714 928.137 410.934 932.744 404.31 935.647C391.74 941.158 378.188 941.152 373.131 941.15L372.843 941.15C357.898 941.15 335.538 932.526 317.144 916.945C298.24 900.933 282 876.301 282 843.125V831.125H306V843.125C306 867.685 317.819 886.065 332.655 898.632C348.001 911.629 365.062 917.15 372.843 917.15C377.876 917.15 386.996 917.033 394.674 913.667C398.298 912.078 401.151 909.945 403.135 907.109C405.066 904.348 406.757 900.094 406.757 893.209C406.757 878.979 400.239 861.322 388.692 839.817C379.882 823.411 368.843 805.969 357.008 787.267C353.466 781.67 349.852 775.96 346.206 770.132C315.247 720.649 282 662.953 282 604.065C282 578.104 288.307 559.326 298.626 546.811C309.021 534.202 322.672 528.996 334.813 528.996C345.945 528.996 361.72 534.254 374.396 548.413C387.285 562.809 396.155 585.423 395.313 618.852C395.217 622.647 394.997 626.582 394.644 630.663L393.61 642.619L369.699 640.551L370.733 628.595C371.046 624.979 371.237 621.532 371.32 618.248C372.047 589.394 364.402 573.23 356.515 564.421C348.415 555.374 339.154 552.996 334.813 552.996C329.562 552.996 322.806 555.21 317.143 562.078Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M675.926 370.816C680.492 372.801 684.015 376.151 686.689 379.971C702.742 402.914 691.283 428.634 677.351 446.91C662.785 466.017 641.45 482.907 625.119 492.791L622.594 494.319C621.972 499.695 621.643 504.913 621.647 509.873C621.667 529.339 626.709 540.926 634.298 545.763C636.286 547.031 637.719 547.09 639.564 546.472C642.02 545.65 645.406 543.424 649.501 539.074C657.666 530.402 665.478 516.746 671.574 503.802L676.686 492.945L698.399 503.169L693.287 514.026C686.899 527.592 677.795 544.034 666.975 555.526C661.579 561.257 654.956 566.629 647.183 569.231C638.799 572.038 629.782 571.347 621.396 566.001C602.984 554.263 597.669 531.454 597.648 509.896C597.626 487.61 603.156 462.382 611.09 439.992C618.975 417.74 629.73 396.892 641.098 383.897C646.583 377.627 653.606 371.553 661.908 369.629C666.397 368.589 671.245 368.781 675.926 370.816ZM629.673 460.473C639.988 452.428 650.448 442.613 658.264 432.36C665.798 422.477 676.387 405.226 666.665 393.252C665.392 393.835 662.817 395.521 659.161 399.699C650.602 409.484 641.096 427.167 633.712 448.008C632.258 452.109 630.907 456.278 629.673 460.473Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M825.215 377.598C825.052 348.201 849.434 332.309 872.74 332.309C898 332.309 912.273 352.05 916.618 360.479L922.116 371.146L900.783 382.142L895.285 371.475C892.407 365.891 884.417 356.309 872.74 356.309C859.107 356.309 849.144 364.74 849.215 377.465C849.236 381.245 851.387 385.835 858.272 392.199C864.09 397.577 871.571 402.71 880.218 408.644C881.828 409.748 883.477 410.88 885.164 412.047C895.391 419.118 906.754 427.326 915.51 437.238C924.459 447.369 931.317 459.99 931.317 475.738C931.317 491.859 923.77 504.186 912.62 511.932C901.886 519.389 888.31 522.339 875.476 521.799C862.612 521.258 849.238 517.165 838.794 508.998C828.06 500.605 820.643 487.997 820.643 471.89V459.89H844.643V471.89C844.643 479.882 848.06 485.778 853.577 490.092C859.384 494.633 867.679 497.45 876.484 497.821C885.318 498.192 893.411 496.054 898.928 492.221C904.03 488.677 907.317 483.512 907.317 475.738C907.317 467.589 903.936 460.387 897.522 453.127C890.914 445.646 881.788 438.891 871.514 431.787C870.036 430.765 868.523 429.728 866.989 428.678C858.41 422.803 849.201 416.497 841.98 409.822C833.452 401.939 825.292 391.423 825.215 377.598Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 12 KiB

4
src/Admin.js → src/routes/AdminPage.js

@ -8,7 +8,7 @@ import { Checkbox } from "@mui/material";
function CheckboxListSecondary({ messaggi, evento, onChecked }) {
return (
<Stack spacing={4}>
<Stack sx={{ background: "white" }} spacing={4}>
{messaggi.map((m) => {
const labelId = `checkbox-list-secondary-label-${m.timestamp}`;
return (
@ -49,7 +49,7 @@ function CheckboxListSecondary({ messaggi, evento, onChecked }) {
);
}
export const Admin = () => {
export const AdminPage = () => {
const [messaggi, cambiaMessaggi] = useState([]);
const { evento } = useParams();

268
src/routes/GalleryPage.js

@ -0,0 +1,268 @@
import React, { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import firebase from "firebase/compat/app";
import { Stack } from "@mui/system";
import logoSrc from "../assets/logo_chat.svg";
import { Box, Button, CircularProgress, Container, Grid } from "@mui/material";
import { VideoComponent } from "./ProjectionPage";
import { Buttons } from "../Buttons";
import moment from "moment";
import { Logo } from "./HomePage";
export const GalleryPage = () => {
const { evento } = useParams();
const [mainMessage, setMainMessage] = useState(null);
const [messages, setMessages] = useState([]);
const [eventDetails, setEventDetails] = useState(null);
useEffect(() => {
const eventRef = firebase.database().ref(`/eventi/${evento}`);
eventRef.once("value", function (s) {
setEventDetails(s.val());
});
const messagesRef = firebase.database().ref(`/messaggi/${evento}`);
messagesRef.once("value", function (snapshot) {
const messaggiObject = snapshot.val();
const messaggi = Object.keys(messaggiObject)
.map((d) => {
return messaggiObject[d];
})
.filter((d) => d.approvato)
.sort((a, b) => a.timestamp - b.timestamp);
setMessages(messaggi);
});
}, [evento]);
if (!eventDetails) return <></>;
return (
<div style={{ background: "black" }}>
<Logo />
<Container
style={{
fontFamily: "Lineatura",
fontWeight: "bold",
color: "white",
zIndex: 1,
position: "relative",
top: 0,
}}
>
{mainMessage == null ? (
<GridView
eventDetails={eventDetails}
setMainMessage={setMainMessage}
messages={messages}
/>
) : (
<ContenitoreMessaggio
messages={messages}
setMainMessage={setMainMessage}
mainMessage={mainMessage}
/>
)}
</Container>
</div>
);
};
const GridView = ({ eventDetails, messages, setMainMessage }) => {
return (
<>
<h1
style={{
fontSize: "4.6rem",
}}
>
{eventDetails.title}
</h1>
{messages.length && (
<GridThumbs messages={messages} setMainMessage={setMainMessage} />
)}
</>
);
};
const Timestamp = ({ message }) => {
return <p>alle {moment(message.timestamp).format("HH:MM")}</p>;
};
const GridThumbs = ({ messages, setMainMessage }) => {
const getElement = (message) => {
let element;
if (message.immagineURL) {
element = (
<img
onClick={() => {
setMainMessage(message);
}}
width="100%"
height="auto"
sx={{ border: "4px solid white" }}
src={message.immagineURL}
alt={message.message}
/>
);
} else {
element = (
<h1
style={{
fontSize: "1.2rem",
textAlign: "center",
textShadow:
"0px 0px 10px rgba(0,0,0,100), 0px 0px 10px rgba(0,0,0,100), 0px 0px 10px rgba(0,0,0,100)",
}}
>
{message.testo}
</h1>
);
}
return (
<div style={{ textAlign: "center" }}>
{element}
{message.autore && (
<div>
<p
style={{
fontSize: 20,
margin: 0,
display: "inline-block",
background: "black",
padding: "0px 6px",
paddingBottom: "4px",
}}
>
da {message.autore}
</p>
</div>
)}
<Timestamp message={message} />
</div>
);
};
return (
<Grid xs={12} sm={12} container spacing={2}>
{messages.map((message, index) => (
<Grid item xs={6} sm={4} key={index}>
<Box
my={4}
p={2}
sx={{ overflow: "hidden", height: "100%" }}
display="flex"
alignItems="center"
justifyContent="center"
>
{getElement(message)}
</Box>
</Grid>
))}
</Grid>
);
};
const ContenitoreMessaggio = ({ messages, setMainMessage, mainMessage }) => {
const [indiceCorrente, cambiaindiceCorrente] = useState(
messages.findIndex((d) => d === mainMessage)
);
const messaggioDaMostrare = messages[indiceCorrente];
return (
<Stack sx={{ zIndex: 1 }} alignItems={"center"} justifyContent={"center"}>
{messaggioDaMostrare.immagineURL && (
<ImagePlaceholder
messaggioDaMostrare={messaggioDaMostrare}
style={{
maxWidth: "100%",
maxHeight: "80vh",
}}
/>
)}
<Messaggio messaggioDaMostrare={messaggioDaMostrare} />
{Buttons(indiceCorrente, cambiaindiceCorrente, messages, setMainMessage)}
</Stack>
);
};
function ImagePlaceholder({ messaggioDaMostrare }) {
const [imageLoaded, setImageLoaded] = useState(false);
useEffect(() => {
console.log("go");
setImageLoaded(false);
if (messaggioDaMostrare.immagineURL) {
const image = new Image();
image.onload = () => {
setImageLoaded(true);
};
image.src = messaggioDaMostrare.immagineURL;
} else {
setImageLoaded(true);
}
}, [messaggioDaMostrare.immagineURL]);
if (imageLoaded) {
return (
<div>
{messaggioDaMostrare.immagineURL && (
<img
alt=""
src={messaggioDaMostrare.immagineURL}
style={{
maxWidth: "100%",
maxHeight: "65vh",
}}
/>
)}
</div>
);
} else {
return (
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "space-around",
width: "100%",
}}
>
<CircularProgress />
</Box>
);
}
}
const Messaggio = ({ messaggioDaMostrare }) => {
return (
<>
<h1
style={{
fontSize: messaggioDaMostrare.immagineURL ? 20 : 50,
textShadow:
"0px 0px 10px rgba(0,0,0,100), 0px 0px 10px rgba(0,0,0,100), 0px 0px 10px rgba(0,0,0,100)",
}}
>
{messaggioDaMostrare.testo}
</h1>
{messaggioDaMostrare.autore && (
<div>
<p
style={{
fontSize: 20,
margin: 0,
display: "inline-block",
background: "black",
padding: "0px 6px",
paddingBottom: "4px",
}}
>
da {messaggioDaMostrare.autore}
</p>
</div>
)}
<Timestamp message={messaggioDaMostrare} />
</>
);
};

4
src/ListaEventi.js → src/routes/HomePage.1.js

@ -1,9 +1,9 @@
import React, { useEffect, useState } from "react";
import firebase from "firebase/compat/app";
import { CircularProgress, Container, Stack, Typography } from "@mui/material";
import logoSrc from "./logo_chat.svg";
import logoSrc from "../assets/logo_chat.svg";
export const ListaEventi = () => {
export const HomePage = () => {
const [eventi, cambiaEventi] = useState([]);
useEffect(() => {

86
src/routes/HomePage.js

@ -0,0 +1,86 @@
import React, { useEffect, useState } from "react";
import firebase from "firebase/compat/app";
import { CircularProgress, Container, Stack, Typography } from "@mui/material";
import logoSrc from "../assets/logo_chat.svg";
export const HomePage = () => {
const [eventi, cambiaEventi] = useState([]);
useEffect(() => {
var messagesRef = firebase.database().ref(`/eventi`);
messagesRef.once("value", function (snapshot) {
const eventiObject = snapshot.val();
console.log(eventiObject);
const e = Object.keys(eventiObject)
.map((d) => {
return { key: d, ...eventiObject[d] };
})
.sort((a, b) => {
return parseInt(a.timestamp) - parseInt(b.timestamp);
})
.map((d, i) => {
const color = `hsl(${i * 10}, 75%, 70%`;
return (
<div key={d.key}>
<a
style={{
textDecoration: "none",
display: "inline-block",
color,
fontSize: "1.5rem",
fontFamily: "Lineatura",
borderBottom: `2px solid ${color}`,
}}
href={`/eventi/${d.key}`}
>
{d.title}
</a>
</div>
);
});
cambiaEventi(e);
});
}, []);
if (!eventi) return <div></div>;
return (
<Container maxWidth="md">
<Logo />
<Stack
spacing={2}
sx={{
paddingTop: 20,
}}
>
<Typography
variant="p"
style={{
color: "white",
fontFamily: "Lineatura",
}}
>
I nostri eventi
</Typography>
{eventi.length === 0 && <CircularProgress size={20} />}
{eventi}
</Stack>
</Container>
);
};
export const Logo = () => {
return (
<img
alt="logo"
src={logoSrc}
style={{
width: 120,
position: "absolute",
zIndex: 2,
top: 20,
right: 20,
}}
/>
);
};

10
src/MyForm.js → src/routes/MyFormPage.js

@ -1,15 +1,15 @@
import logoSrc from "./logo_chat.svg";
import logoSrc from "../assets/logo_chat.svg";
import React, { useState } from "react";
import firebase from "firebase/compat/app";
import TextField from "@mui/material/TextField";
import { Container, Stack } from "@mui/system";
import { Button, Typography } from "@mui/material";
import { useForm } from "react-hook-form";
import Countdown from "./Countdown";
import ImageUpload from "./ImageUpload";
import Countdown from "../Countdown";
import ImageUpload from "../ImageUpload";
import { useParams } from "react-router-dom";
export const MyForm = () => {
export const MyFormPage = () => {
const { evento } = useParams();
const [mandato, setMandato] = useState(false);
const [imageUploading, setImageUploading] = useState(false);
@ -64,7 +64,7 @@ export const MyForm = () => {
);
}
return (
<Container maxWidth="sm" style={{ marginTop: 20 }}>
<Container maxWidth="sm" style={{ color: "white", marginTop: 20 }}>
<div style={{ textAlign: "center" }}>
<img
alt="logo"

19
src/Proiezione.js → src/routes/ProjectionPage.js

@ -1,13 +1,13 @@
import React, { useEffect, useState } from "react";
import firebase from "firebase/compat/app";
import logoSrc from "./logo_chat.svg";
import logoSrc from "../assets/logo_chat.svg";
import { useParams } from "react-router-dom";
const SHOW_MESSAGE_TIME = 6000;
window.debug = false;
export const Proiezione = () => {
export const ProjectionPage = () => {
const { evento } = useParams();
const [messaggi, cambiaMessaggi] = useState([]);
const [messaggiApprovati, cambiaMessaggiApprovati] = useState([]);
@ -89,9 +89,9 @@ const Messaggio = ({ messaggiApprovati }) => {
const [messaggioDaMostrare, setMessaggioDaMostrare] = useState(null);
const [indiceCorrente, cambiaindiceCorrente] = useState(0);
const [imageWidth, setImageWidth] = useState(0);
const [rotation, setRotation] = useState(0);
const nextMessage = () => {
const newIndice = (indiceCorrente + 1) % messaggiApprovati.length;
console.log("newIndice", newIndice);
cambiaindiceCorrente(newIndice);
};
@ -99,7 +99,6 @@ const Messaggio = ({ messaggiApprovati }) => {
setFadeProp("in");
setMessaggioDaMostrare(newMessage);
setTimeout(() => {
console.log("ready for next");
nextMessage();
}, SHOW_MESSAGE_TIME);
};
@ -113,16 +112,15 @@ const Messaggio = ({ messaggiApprovati }) => {
if (newMessage.immagineURL) {
const img = new Image();
img.onload = (i) => {
console.log("loaded");
console.log(img.width, img.height);
setImageWidth(img.width > img.height ? 600 : 400);
setImageWidth(img.width > img.height ? 800 : 400);
setRotation(Math.random() * 10 - 5);
showNextMessage(newMessage);
};
img.src = newMessage.immagineURL;
} else {
showNextMessage(newMessage);
}
}, 1000);
}, 3000);
return () => clearTimeout(timeout);
}
}, [indiceCorrente]);
@ -150,7 +148,10 @@ const Messaggio = ({ messaggiApprovati }) => {
<img
src={messaggioDaMostrare.immagineURL}
style={{
border: "10px solid #ccc",
width: imageWidth,
transformOrigin: "50% 50%",
transform: `rotate(${rotation}deg)`,
}}
/>
)}
@ -186,7 +187,7 @@ const Messaggio = ({ messaggiApprovati }) => {
export const VideoComponent = React.memo(() => {
return (
<video autoPlay muted loop id="myVideo">
<source src={"/video.mp4"} type="video/mp4" />
<source src={"https://letsswing.it/video.mp4"} type="video/mp4" />
</video>
);
});
Loading…
Cancel
Save