|
|
|
|
@ -12,9 +12,9 @@ import { Fade, LinearProgress } from "@mui/material";
|
|
|
|
|
|
|
|
|
|
export const Galleria = () => { |
|
|
|
|
const { evento } = useParams(); |
|
|
|
|
const [messaggi, cambiaMessaggi] = useState([]); |
|
|
|
|
const [messages, setMessages] = useState([]); |
|
|
|
|
const [imgIndex, cambiaimgIndex] = useState(0); |
|
|
|
|
const [images, cambiaimmagini] = useState([]); |
|
|
|
|
const [images, setImages] = useState([]); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
var messagesRef = firebase.database().ref(`/messaggi/${evento}`); |
|
|
|
|
@ -27,8 +27,10 @@ export const Galleria = () => {
|
|
|
|
|
}) |
|
|
|
|
.filter((d) => d.approvato) |
|
|
|
|
.sort((a, b) => a.timestamp - b.timestamp); |
|
|
|
|
cambiaMessaggi(messaggi); |
|
|
|
|
cambiaimmagini( |
|
|
|
|
|
|
|
|
|
setMessages(messaggi); |
|
|
|
|
|
|
|
|
|
setImages( |
|
|
|
|
messaggi |
|
|
|
|
.filter((d) => d.immagineURL != null) |
|
|
|
|
.map((d) => { |
|
|
|
|
@ -80,7 +82,7 @@ export const Galleria = () => {
|
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{imgIndex === images.length && ( |
|
|
|
|
<ContenitoreMessaggio messaggi={messaggi} /> |
|
|
|
|
<ContenitoreMessaggio messaggi={messages} /> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
<img |
|
|
|
|
@ -121,27 +123,39 @@ const ContenitoreMessaggio = ({ messaggi }) => {
|
|
|
|
|
display: "flex", |
|
|
|
|
width: "100vw", |
|
|
|
|
position: "absolute", |
|
|
|
|
top: "90%", |
|
|
|
|
bottom: 20, |
|
|
|
|
left: 0, |
|
|
|
|
alignItems: "center", |
|
|
|
|
justifyContent: "space-between", |
|
|
|
|
padding: 10, |
|
|
|
|
boxSizing: "border-box", |
|
|
|
|
}} |
|
|
|
|
direction="row" |
|
|
|
|
> |
|
|
|
|
<Stack |
|
|
|
|
style={{ |
|
|
|
|
display: "flex", |
|
|
|
|
width: "70vw", |
|
|
|
|
margin: "0 auto", |
|
|
|
|
justifyContent: "space-between", |
|
|
|
|
}} |
|
|
|
|
direction="row" |
|
|
|
|
> |
|
|
|
|
{indiceCorrente > 0 && ( |
|
|
|
|
<IconButton onClick={() => cambiaindiceCorrente(indiceCorrente - 1)}> |
|
|
|
|
<IconButton |
|
|
|
|
onClick={() => cambiaindiceCorrente(indiceCorrente - 1)} |
|
|
|
|
> |
|
|
|
|
<ArrowBackIcon style={{ fontSize: "3rem" }} /> |
|
|
|
|
</IconButton> |
|
|
|
|
)} |
|
|
|
|
{indiceCorrente < messaggi.length - 1 && ( |
|
|
|
|
<IconButton onClick={() => cambiaindiceCorrente(indiceCorrente + 1)}> |
|
|
|
|
<IconButton |
|
|
|
|
onClick={() => cambiaindiceCorrente(indiceCorrente + 1)} |
|
|
|
|
> |
|
|
|
|
<ArrowForwardIcon style={{ fontSize: "3rem" }} /> |
|
|
|
|
</IconButton> |
|
|
|
|
)} |
|
|
|
|
</Stack> |
|
|
|
|
</Stack> |
|
|
|
|
</Stack> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|