diff --git a/package-lock.json b/package-lock.json index de4af1b..1bac75b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "react-hook-form": "^7.41.0", "react-router-dom": "^6.6.1", "react-scripts": "5.0.1", + "sass": "^1.60.0", "sort-by": "^1.2.0", "web-vitals": "^2.1.4" } @@ -10000,6 +10001,11 @@ "url": "https://opencollective.com/immer" } }, + "node_modules/immutable": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz", + "integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==" + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -16044,6 +16050,22 @@ "resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-13.0.0.tgz", "integrity": "sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA==" }, + "node_modules/sass": { + "version": "1.60.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.60.0.tgz", + "integrity": "sha512-updbwW6fNb5gGm8qMXzVO7V4sWf7LMXnMly/JEyfbfERbVH46Fn6q02BX7/eHTdKpE7d+oTkMMQpFWNUMfFbgQ==", + "dependencies": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/sass-loader": { "version": "12.6.0", "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-12.6.0.tgz", @@ -25566,6 +25588,11 @@ "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.16.tgz", "integrity": "sha512-qenGE7CstVm1NrHQbMh8YaSzTZTFNP3zPqr3YU0S0UY441j4bJTg4A2Hh5KAhwgaiU6ZZ1Ar6y/2f4TblnMReQ==" }, + "immutable": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz", + "integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==" + }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -29737,6 +29764,16 @@ "resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-13.0.0.tgz", "integrity": "sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA==" }, + "sass": { + "version": "1.60.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.60.0.tgz", + "integrity": "sha512-updbwW6fNb5gGm8qMXzVO7V4sWf7LMXnMly/JEyfbfERbVH46Fn6q02BX7/eHTdKpE7d+oTkMMQpFWNUMfFbgQ==", + "requires": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + } + }, "sass-loader": { "version": "12.6.0", "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-12.6.0.tgz", diff --git a/package.json b/package.json index bfe50b2..96aea3d 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "react-hook-form": "^7.41.0", "react-router-dom": "^6.6.1", "react-scripts": "5.0.1", + "sass": "^1.60.0", "sort-by": "^1.2.0", "web-vitals": "^2.1.4" }, diff --git a/src/Buttons.js b/src/Buttons.js new file mode 100644 index 0000000..ed032e6 --- /dev/null +++ b/src/Buttons.js @@ -0,0 +1,43 @@ +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 { Stack } from "@mui/system"; + +export function Buttons(indiceCorrente, cambiaindiceCorrente, messaggi) { + return ( + + + {indiceCorrente > 0 && ( + cambiaindiceCorrente(indiceCorrente - 1)}> + + + )} + {indiceCorrente < messaggi.length - 1 && ( + cambiaindiceCorrente(indiceCorrente + 1)}> + + + )} + + + ); +} diff --git a/src/Galleria.js b/src/Galleria.js index 99bc8d9..97027e6 100644 --- a/src/Galleria.js +++ b/src/Galleria.js @@ -3,13 +3,11 @@ import React, { useEffect, useState } from "react"; import { useParams } from "react-router-dom"; import firebase from "firebase/compat/app"; -import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; -import ArrowBackIcon from "@mui/icons-material/ArrowBack"; -import IconButton from "@mui/material/IconButton"; import { Stack } from "@mui/system"; import logoSrc from "./logo_chat.svg"; -import { Fade, LinearProgress } from "@mui/material"; +import { Box, CircularProgress, Fade, LinearProgress } from "@mui/material"; import { VideoComponent } from "./Proiezione"; +import { Buttons } from "./Buttons"; export const Galleria = () => { const { evento } = useParams(); @@ -31,13 +29,13 @@ export const Galleria = () => { setMessages(messaggi); - setImages( - messaggi - .filter((d) => d.immagineURL != null) - .map((d) => { - return d.immagineURL; - }) - ); + // setImages( + // messaggi + // .filter((d) => d.immagineURL != null) + // .map((d) => { + // return d.immagineURL; + // }) + // ); }); }, [evento]); @@ -84,7 +82,7 @@ export const Galleria = () => { }} > - + {messages.length && } { return ( - {messaggioDaMostrare && ( - - )} - - - - - {indiceCorrente > 0 && ( - cambiaindiceCorrente(indiceCorrente - 1)} - > - - - )} - {indiceCorrente < messaggi.length - 1 && ( - cambiaindiceCorrente(indiceCorrente + 1)} - > - - + + {messaggioDaMostrare.immagineURL && ( + )} + - + + + {Buttons(indiceCorrente, cambiaindiceCorrente, messaggi)} ); }; @@ -164,6 +129,9 @@ function ImagePlaceholder({ messaggioDaMostrare }) { const [imageLoaded, setImageLoaded] = useState(false); useEffect(() => { + console.log("go"); + setImageLoaded(false); + if (messaggioDaMostrare.immagineURL) { const image = new Image(); image.onload = () => { @@ -175,8 +143,8 @@ function ImagePlaceholder({ messaggioDaMostrare }) { } }, [messaggioDaMostrare.immagineURL]); - return ( - + if (imageLoaded) { + return ( {messaggioDaMostrare.immagineURL && ( )} - - - ); + ); + } else { + return ( + + + + ); + } } const Messaggio = ({ messaggioDaMostrare }) => { diff --git a/src/index.js b/src/index.js index e869191..15916be 100644 --- a/src/index.js +++ b/src/index.js @@ -9,14 +9,8 @@ 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"; +import { Container, Stack, Typography } from "@mui/material"; +import logoSrc from "./logo_chat.svg"; const firebaseConfig = { apiKey: "AIzaSyBWE1l8WV_7eyKT-PMu0Kq2w_WiV0SUhJw", @@ -41,22 +35,23 @@ const ListaEventi = () => { messagesRef.once("value", function (snapshot) { const eventiObject = snapshot.val(); - const e = Object.keys(eventiObject).map((d) => { - console.log(eventiObject[d]); + const e = Object.keys(eventiObject).map((d, i) => { + const color = `hsl(${i * 10}, 75%, 70%`; return ( - - {/* - - - - */} - - - - + + + {eventiObject[d]} + + ); }); cambiaEventi(e); @@ -65,20 +60,34 @@ const ListaEventi = () => { if (!eventi) return ; return ( - - - - - I nostri eventi - - + + + + + I nostri eventi + {eventi} - + ); };