diff --git a/src/Galleria.js b/src/Galleria.js
index 9fa8a15..99bc8d9 100644
--- a/src/Galleria.js
+++ b/src/Galleria.js
@@ -35,70 +35,69 @@ export const Galleria = () => {
messaggi
.filter((d) => d.immagineURL != null)
.map((d) => {
- console.log(d.immagineURL);
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]);
+ // 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 (
- {imgIndex !== images.length && (
+ {/* {imgIndex !== images.length && (
)}
- {imgIndex === images.length && (
-
+
+
+
+

-
-
-
-

-
- )}
+ />
+
+ {/* )} */}
);
};
diff --git a/src/ImageUpload.js b/src/ImageUpload.js
index 3539c75..2c25696 100644
--- a/src/ImageUpload.js
+++ b/src/ImageUpload.js
@@ -1,6 +1,6 @@
import React, { useState } from "react";
import firebase from "firebase/compat/app";
-import "firebase/storage";
+import "firebase/compat/storage";
import { Stack } from "@mui/system";
import { Button } from "@mui/material";
diff --git a/src/MyForm.js b/src/MyForm.js
index ad74e2b..a2de7c1 100644
--- a/src/MyForm.js
+++ b/src/MyForm.js
@@ -14,8 +14,11 @@ export const MyForm = () => {
const [mandato, setMandato] = useState(false);
const [imageUploading, setImageUploading] = useState(false);
const [immagineURL, cambiaimmagineURL] = useState(null);
- const { register, handleSubmit } = useForm();
- const onSubmit = ({ testo, autore }) => {
+ const { register, handleSubmit, reset } = useForm();
+ const onSubmit = ({ testo, autore }, e) => {
+ reset("", {
+ keepValues: false,
+ });
setMandato(true);
var postListRef = firebase.database().ref(`messaggi/${evento}`);
var newPostRef = postListRef.push();
@@ -54,7 +57,7 @@ export const MyForm = () => {
puoi rimandere un altro messaggio in...
- setMandato(false)} duration={10} />
+ setMandato(false)} duration={5} />
);
diff --git a/src/index.js b/src/index.js
index 86a612f..e869191 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,7 +1,7 @@
import "./App.css";
-import React from "react";
+import React, { useEffect, useState } from "react";
import ReactDOM from "react-dom/client";
-import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
+import { BrowserRouter as Router, Routes, Route, Link } from "react-router-dom";
import firebase from "firebase/compat/app";
import "firebase/compat/database";
import "firebase/compat/analytics";
@@ -9,6 +9,14 @@ import { Proiezione } from "./Proiezione";
import { MyForm } from "./MyForm";
import { Admin } from "./Admin";
import { Galleria } from "./Galleria";
+import { Stack } from "@mui/system";
+import { Container, Typography } from "@mui/material";
+import List from "@mui/material/List";
+import ListItem from "@mui/material/ListItem";
+import ListItemText from "@mui/material/ListItemText";
+import ListItemAvatar from "@mui/material/ListItemAvatar";
+import Avatar from "@mui/material/Avatar";
+import BeachAccessIcon from "@mui/icons-material/BeachAccess";
const firebaseConfig = {
apiKey: "AIzaSyBWE1l8WV_7eyKT-PMu0Kq2w_WiV0SUhJw",
@@ -25,10 +33,60 @@ const firebaseConfig = {
firebase.initializeApp(firebaseConfig);
firebase.analytics();
+const ListaEventi = () => {
+ const [eventi, cambiaEventi] = useState([]);
+
+ useEffect(() => {
+ var messagesRef = firebase.database().ref(`/eventi`);
+
+ messagesRef.once("value", function (snapshot) {
+ const eventiObject = snapshot.val();
+ const e = Object.keys(eventiObject).map((d) => {
+ console.log(eventiObject[d]);
+ return (
+
+ {/*
+
+
+
+ */}
+
+
+
+
+ );
+ });
+ cambiaEventi(e);
+ });
+ }, []);
+
+ if (!eventi) return ;
+ return (
+
+
+
+
+ I nostri eventi
+
+
+
+ {eventi}
+
+
+ );
+};
+
ReactDOM.createRoot(document.getElementById("root")).render(
- } />
+ } />
} />
} />
} />