update frontend
This commit is contained in:
parent
57d2949130
commit
8a954a2ff9
|
|
@ -3,9 +3,6 @@ import { useAuth } from "../../auth/AuthContext";
|
||||||
import { registerUser } from "../../api/client";
|
import { registerUser } from "../../api/client";
|
||||||
import AuthToast from "../Auth/AuthToast";
|
import AuthToast from "../Auth/AuthToast";
|
||||||
|
|
||||||
// Import pour le bouton PWA
|
|
||||||
import { addPwaInstallButton } from '../../pwaInstall';
|
|
||||||
|
|
||||||
const THEME_LABELS = { dark: "Dark", blue: "Blue", light: "Light" };
|
const THEME_LABELS = { dark: "Dark", blue: "Blue", light: "Light" };
|
||||||
const LAST_SIGNUP_KEY = "sociowire:lastSignup";
|
const LAST_SIGNUP_KEY = "sociowire:lastSignup";
|
||||||
|
|
||||||
|
|
@ -165,14 +162,6 @@ export default function TopBar({ theme = "dark", onChangeTheme }) {
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Ajoute le bouton PWA "Installer" en haut à côté des thèmes
|
|
||||||
useEffect(() => {
|
|
||||||
const container = document.getElementById('pwa-install-container');
|
|
||||||
if (container) {
|
|
||||||
addPwaInstallButton(container);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleLoginSubmit = async (e) => {
|
const handleLoginSubmit = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
await login(loginUser, loginPass);
|
await login(loginUser, loginPass);
|
||||||
|
|
@ -257,7 +246,7 @@ export default function TopBar({ theme = "dark", onChangeTheme }) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Theme dots + BOUTON INSTALL PWA */}
|
{/* Theme dots */}
|
||||||
<div className="brand-under">
|
<div className="brand-under">
|
||||||
<div className="theme-switch">
|
<div className="theme-switch">
|
||||||
{["dark", "blue", "light"].map((t) => (
|
{["dark", "blue", "light"].map((t) => (
|
||||||
|
|
@ -272,9 +261,6 @@ export default function TopBar({ theme = "dark", onChangeTheme }) {
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* BOUTON INSTALL PWA ici en haut */}
|
|
||||||
<div id="pwa-install-container"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
51
src/main.jsx
51
src/main.jsx
|
|
@ -1,51 +0,0 @@
|
||||||
import "@fortawesome/fontawesome-free/css/all.min.css"; // local via npm (no CDN)
|
|
||||||
|
|
||||||
import React from "react";
|
|
||||||
import ReactDOM from "react-dom/client";
|
|
||||||
import App from "./App.jsx";
|
|
||||||
|
|
||||||
import "./styles/base.css";
|
|
||||||
import "./styles/layout.css";
|
|
||||||
import "./styles/topbar.css";
|
|
||||||
import "./styles/map.css";
|
|
||||||
import "./styles/posts.css";
|
|
||||||
import "./styles/theme.css";
|
|
||||||
import "./styles/auth-modal.css";
|
|
||||||
import "./styles/auth-toast.css";
|
|
||||||
import "./styles/filters.css";
|
|
||||||
import "./styles/mapMarkers.css";
|
|
||||||
import "./styles/maps.css"; // ✅ pour la barre de recherche (taille + couleurs)
|
|
||||||
|
|
||||||
import { AuthProvider } from "./auth/AuthContext.jsx";
|
|
||||||
|
|
||||||
// Import pour PWA install prompt
|
|
||||||
import { promptInstall, addPwaInstallButton } from './pwaInstall';
|
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById("root")).render(
|
|
||||||
<React.StrictMode>
|
|
||||||
<AuthProvider>
|
|
||||||
<App />
|
|
||||||
</AuthProvider>
|
|
||||||
</React.StrictMode>
|
|
||||||
);
|
|
||||||
|
|
||||||
// Enregistre le service worker pour PWA (offline + install)
|
|
||||||
if ('serviceWorker' in navigator) {
|
|
||||||
window.addEventListener('load', () => {
|
|
||||||
navigator.serviceWorker.register('/service-worker.js')
|
|
||||||
.then(reg => {
|
|
||||||
console.log('Service Worker registered:', reg);
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.error('Service Worker registration failed:', err);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Affiche le bouton "Installer" (optionnel - commente si tu veux pas)
|
|
||||||
addPwaInstallButton(document.body);
|
|
||||||
|
|
||||||
// Force le prompt d’installation après 5 secondes (optionnel - commente si tu veux pas)
|
|
||||||
setTimeout(() => {
|
|
||||||
promptInstall();
|
|
||||||
}, 5000);
|
|
||||||
Loading…
Reference in New Issue