mapa e definições

This commit is contained in:
2026-05-12 17:18:05 +01:00
parent ce3e22e39b
commit 194c46ba32
2 changed files with 212 additions and 57 deletions

View File

@@ -1,4 +1,5 @@
test_nif.js,1777390754764,b50e0b4fe7732186ea056d183a0f2bbe7026cf79d384ce66391f746fe6969af6
temp_script.jsx,1778515975081,55db2d141363815c1a6850325fffea1772f799d98a70d6ed650c83986adbac54
sw.js,1778230406112,5d7efd8fe9879b039b8a39bdf56cc6b7486b7fc4e27776aba134972a26de2523
style.css,1770114976862,4c2e2686b637f6f2f060298dfbabf690219284ff4c5c027711c5b443dde07332
script.js,1776937115126,4b08e5f41663ef287d352039798448e36a3c52c60014d58f7ed31471dab4066d
@@ -9,22 +10,24 @@ diff.txt,1778227426505,5c43e21897b2247e203b29b2a1322bb7e4e24ffb53ffa8c233ced1a00
RELATORIO_TECNICO.md,1778058174796,fad35f12b1f2d062f72e7a448bb643fd3cfdd24423eaacc14cbbb20172ead7be
README.md,1778057411525,cc32fa073114e014f06988652ebe4c6af9ba3dbf913b9f25d38a16ce3d700605
.vscode/settings.json,1778056161665,3a247752ccf28f259e2e604bf44311ab91b6db3864b120e08f2823951d1c55d8
.git/index,1778233262846,3d97d152b6cd66313163d0320e64794682d3fee811f0336d8b49d506d3f867a4
.git/index,1778516388440,1dd0fe33b2308f133b66c40bc496d91e8b88852fda86af44c9990be6af6d58f5
.git/description,1773160274654,3cdc7b6a29de07f63b76d16b9911d93468000346945f759d4f6456660b5c113b
.git/config,1773914677241,cb4cd1c7c28ac13d2dccf79f667245402cf551c998ba1f6b58abc28f3ae11e7f
.git/ORIG_HEAD,1777392979044,2612c449de4f930bfb197ddb13780ca77cbb7bf6db7e91493d412b634ddcdebd
.git/HEAD,1773160809135,a39dc51e21d1523cdef2091e7c7ab30a33ad42a7cd5da1f45139746e5c24b667
.git/COMMIT_EDITMSG,1778233262846,41c29203575dc78117a18c63a35900560c3beac36c324fc4df70167abc0b3019
.git/refs/remotes/origin/main,1778233263214,4e12a5ab5d391dd0a2dd6df79a94de3b2f5c3f748fa0eb035c5a84ac71380687
.git/COMMIT_EDITMSG,1778516388441,d851f9a1aa14ceb104fb94c2b62f79bf571f16dc4037a971981c974cf2544871
.git/refs/remotes/origin/main,1778516388821,5f72c10484d02ba7d310f27fcea67e0c6f0484e9abb47fc0f1c402dac667db16
.git/refs/remotes/origin/HEAD,1773830493701,0f5d56efe56c5dcabb387d965aad58d0f60a3b7485cb9b04bef04b93bebf911e
.git/refs/heads/main,1778233262847,4e12a5ab5d391dd0a2dd6df79a94de3b2f5c3f748fa0eb035c5a84ac71380687
.git/refs/heads/main,1778516388441,5f72c10484d02ba7d310f27fcea67e0c6f0484e9abb47fc0f1c402dac667db16
.git/objects/fd/3d3838a9118dc446e6ab65d38a5ce1747fd0d6,1777393032091,b7fcc251a3edcfc6eb1d7a0ea70a10d16f297520eb5e95c822ab5f754da8dc4a
.git/objects/fc/3334e86913c8a6ff57c39457be3cd0c5be4b2e,1778516388439,ccd8bf302c93bd96f148757f0b93813fe9da96f598efe03b54bf5d0c4fbdbc40
.git/objects/f7/30f952945d24a8d4137d1c591d7477ee96c1bd,1778142319279,13078d7dc1d56d7c137032550b76a68b209b664f988963a49b18b4d6226fe3c0
.git/objects/f6/b7a98471bb9c718c8091a62fa65243aceb92b7,1778067817140,12c318e32181abf048c4811d48552676bff899b5172e58d11fd9136ae98c2c71
.git/objects/f6/73a71b7a275609030462c0278586d61e5f3a00,1773830457776,6ef355c279049956337049bd863d18f205f75ec1bcaee8c82bf26a7d2a65af72
.git/objects/f4/577dec9e03ee9efa3af7ee05d60576b07f8d99,1773161014724,c78b5a6ceff9eb62984db81b7041efbdcac774d45a96d7536ede20a9a6ba10c5
.git/objects/f3/90a9352918931eb316b140a5e6b79d6e5e9f87,1778067817118,2e6f72a24865e145527ca0c1716eb17beb1e68a28b1e8472564d06d30d5a2a5f
.git/objects/f3/7d7211c51f051db56b0e67a1bfca55f649e1e5,1773161195360,a0961540cd8d800dd424b0eb7d503bb35012ad90477c1ec10b9e4b34e1102027
.git/objects/f0/1daec128180f68edd1230e4a8a3e278969055b,1778516388427,c373a067c41dba841599f5671641ea58eb585dd81561fc3262e425146ba0ed31
.git/objects/ed/cc9b9ffb9c172f4579f71d3e10414f58ea26d0,1777997762125,439ee4c3ff19456eafa85052089df8c4ea4c00c1c293fd4c639377d8d125ebb9
.git/objects/ea/2dee2f517449595d633889a410cc2aefa2b513,1776937200147,9392a6f5dd0687166fd9b60a4f28176604046d293196fe53038e9d2e456d5336
.git/objects/e9/78ed3d2aa5d35e562ff0b8b62be183757e7147,1778233262824,9f94195a7eb18a88ead30e511d59ef339ebd937f93c28788c2eec6ea54ab82c3
@@ -36,6 +39,7 @@ README.md,1778057411525,cc32fa073114e014f06988652ebe4c6af9ba3dbf913b9f25d38a16ce
.git/objects/d8/ad43562f86956e101ce3c351a509b411b3f02c,1778233262827,9624a603cfd390b390eea159ff57d9c59c729c8d16a0f58967b9e923fa01225a
.git/objects/d3/f58873ab4f70d24d92349c7e85c7df5c7bb7c2,1776937200165,ca8deaee745fd2e87b4804183acc8c484a36b88db729b2c4cb52f17f99ffb747
.git/objects/d0/ca0c1d5c7b38b5a5ec040918ce8ece33dfe52c,1776937200149,9d98989471faf7b255a3da69495d5ff5cfe01302e1626558a570e33a74b8c716
.git/objects/ce/3e22e39bef672fa5e890bd17d7ac19c6221dea,1778516388441,eeb52e4ebcbbbb5c7584e70233e8cc4d9189b34e80680b7f931a1769ce0e8248
.git/objects/cc/46b618bf0eacaf883f41f13760dee9a3e2e408,1778233262830,73b67ba6a9f36e7e1d5328ea4227caa4c18721f962fc0b02cf1a2a2a6ca66838
.git/objects/c2/51549f632caf9449f632743316c3cf728fffc8,1776937257099,1f81e188648ae90999de0d723593b312ae205c183aa0bfd8562ffc83742a85ab
.git/objects/c1/6fda3fe042e26ed584698bee899b4891224311,1778233262846,980353eb83917bde2933913ef1ea9436872ebc11e5fe2944b4c95bb0c70b0a6a
@@ -93,6 +97,7 @@ README.md,1778057411525,cc32fa073114e014f06988652ebe4c6af9ba3dbf913b9f25d38a16ce
.git/objects/28/dcc7b83036ea820a36dda70f67349a85dfe366,1778067817121,c5a8aea02acc65aa912914bd67c064da24f8b64a707f2e2999044931d81de173
.git/objects/27/85c3386d34cce3cafd66e5892675c61548c3df,1777997762124,9362c43fef34a74a522bf592f011f778c530bba1edbf624926f84d7f9bf54183
.git/objects/25/b0e88e2c1a6db6b52948a4d2fc649e06de8cb2,1776957069549,67160c871e47bc652ab9b8a11b65efe4a559f4dc7a84c16e9aeed10cd44d41b0
.git/objects/25/5f37b9c7c87602795abe000a89ee6e34937c2b,1778516388440,65344d61875d2debdcd44806edd586d4849490270bdaf3e2eca028e98c78b449
.git/objects/25/5c1a39f46ad00812b25cf59858aabb19ebfa18,1776957069566,c328ecb00d90ba099ec4534307c0f3177478656f0fc2d21b4e02f6e743cf1773
.git/objects/23/cec1dc9936a6d9be11078377c6a7685b26373f,1776183305295,d709b165a1199d66da18ba51afe1471aa7b068d4066284bf28d333f09e0c9670
.git/objects/1f/96a9bfae61d4e97fc9f0375975e89f031ce971,1777542176253,10e365b22153e0f123b7086751a36b6779ce2368f721a3edffed8be8b92c4dba
@@ -104,14 +109,16 @@ README.md,1778057411525,cc32fa073114e014f06988652ebe4c6af9ba3dbf913b9f25d38a16ce
.git/objects/15/5422b0a09c128c529df656111fa3bf4a810999,1776183305292,f3973efacb5d450d6636f40464edc7361a5367cf15fa47ec6f6fdc0958b1548b
.git/objects/11/0a88a7582625e48e2eddd5e18dfc7e2f6ecbd7,1778067817118,039e21f346feb3301f5fffb0ec308a4d5f5e4a2cc1a39563e59e12ea0b57a74c
.git/objects/0f/e52b062580722aedaf1e72d0873dfcd52ae1d0,1777393032092,cda51340d22051dc215c44006c12ac911bfac5c0a0e9535fb2f5acb8fd2a62e5
.git/objects/0e/2d16307175c36e2bf125b77ce939633528134b,1778516388423,50dba7487ec973de4cb8b45608432185a98de45d511d41d0e7a695c4e0097f81
.git/objects/0d/982210a52ba6078db202a8b2ac2d04e8d4ac41,1776326595581,c4c80ce646b15b1aa2e9811149739253f98987c4eb84bdf21d21410d902b2ee4
.git/objects/0b/fc5efae1d163add058f1940feea6649f5da1b1,1777393032074,f19ecb9e3799eb6cd2f62e145b429f8c7c48fe8ffda704c49d6d925e9818c000
.git/objects/04/11accbb7c7608ce7cc7a296cdaaaf9c611fd28,1778067817122,106c0ea1a1d8ee8d73a0e48241240894ee4cd3269e40c191b8821a897d3a4a25
.git/objects/02/c8c97556db1468f6ac333a0ae1b6410a23919b,1778516388425,0e1955e937a2b98dedcf5f403c0c26ce77a40aa00d4462e80f43a6e7f78d7289
.git/objects/00/0c1cd721b99d14281c3724f5488b040c152515,1777997762142,7d131dd9c4c33d6e017428809d3b927f369ee8fa38c7d6ae79d01bc10561e22b
.git/logs/HEAD,1778233262847,773a20f4b758ec133fee18b4ad4676f06a1b4ec38ef42ebbc87e4b4cf3586feb
.git/logs/refs/remotes/origin/main,1778233263215,21f6bfeb5ec12772be4cec727816b90484b6efa600a0e5367327c750fd82ccde
.git/logs/HEAD,1778516388441,e4ca899b86f653c8a5147aac5bc48b8ae4aa81f020e4c4b59b6ed7c87df0edc5
.git/logs/refs/remotes/origin/main,1778516388822,e3e68b1446256f1203298cbf7ce267f03cf5eaf5c46b3c39a5b3a8d262831471
.git/logs/refs/remotes/origin/HEAD,1773830493702,1eba2cff5035849e216a15d3b6013593fa5ef345a8d76bb2881d83b3cb247576
.git/logs/refs/heads/main,1778233262847,773a20f4b758ec133fee18b4ad4676f06a1b4ec38ef42ebbc87e4b4cf3586feb
.git/logs/refs/heads/main,1778516388441,e4ca899b86f653c8a5147aac5bc48b8ae4aa81f020e4c4b59b6ed7c87df0edc5
.git/info/exclude,1773160274653,a362e375cc3330f10d115cfeb0f90a325219d80a764d57e2c4873f78d1d0b4f5
.git/hooks/update.sample,1773160274656,2b0a4f42fa30a128b46ad80e89c1f73b89d58b8abb9e92aee1c35625baccb584
.git/hooks/sendemail-validate.sample,1773160274654,4d0768bc11017be6b99d4bb4d34b4c8b2fd7ae8a93d42727591afb6737577db2
@@ -127,6 +134,5 @@ README.md,1778057411525,cc32fa073114e014f06988652ebe4c6af9ba3dbf913b9f25d38a16ce
.git/hooks/fsmonitor-watchman.sample,1773160274655,d366d691e33458260d77c44be36050a3faf0aa12760955cc8ca85ee88389c400
.git/hooks/commit-msg.sample,1773160274654,4df962ba3955944bec38b211351c73f083d7b0e5360a5d3d76a49548e7314f9e
.git/hooks/applypatch-msg.sample,1773160274655,91b94f5feaf0e4d2e6e7808a9188384a4300adf024fa24c48547ee87c64d6558
.git/FETCH_HEAD,1778516078096,558029542eb68ba97a8b683052b7acd2d555f2341856002d3713806b561a3e3f
temp_script.jsx,1778515975081,55db2d141363815c1a6850325fffea1772f799d98a70d6ed650c83986adbac54
index.html,1778515901440,79fcfa64424023b80204064ff6127a1a110fb4e043526807f61fe931368780a1
.git/FETCH_HEAD,1778601610957,201f3562c86bfaace7e8c78f4afcc04c8a8eb8fde9745055c749e49a5dcff3a9
index.html,1778600761797,adc3edf30e5fd3b3cdd0d7897a753e3f3607dba87bc5e9dff515bac1a6c36ccd

View File

@@ -115,7 +115,7 @@
TrendingUp, TrendingDown, CheckCircle, AlertCircle, Clock, LogOut,
Edit2, Trash2, Save, Filter, MoreVertical, FileText,
Dumbbell, PartyPopper, Trophy, Map, Calendar, MapPin, Info,
MessageCircle, Paperclip, Send, Store, HeartPulse, Waves, ShoppingCart, Navigation, Car
MessageCircle, Paperclip, Send, Store, HeartPulse, Waves, ShoppingCart, Navigation, Car, Home, Anchor, Fuel
} from 'lucide-react';
import { app } from './firebase.js';
@@ -533,7 +533,7 @@
};
const handleLogout = () => {
if (window.confirm('Tem a certeza que deseja terminar sessão?')) {
openConfirm('Tem a certeza que deseja terminar sessão?', () => {
sessionStorage.removeItem('condo_auth');
sessionStorage.removeItem('condo_role');
sessionStorage.removeItem('condo_user_name');
@@ -545,7 +545,7 @@
setCurrentUserId('0');
setUserStatus('aprovado');
setActiveTab('dashboard');
}
});
};
const [residents, setResidents] = useState([]);
@@ -558,6 +558,7 @@
const [newMessageText, setNewMessageText] = useState('');
const [activeChat, setActiveChat] = useState({ type: 'global', id: 'global', name: 'Fórum do Condomínio' });
const [chatGroups, setChatGroups] = useState([]);
const [adminProfile, setAdminProfile] = useState({});
const [isCreateGroupModalOpen, setIsCreateGroupModalOpen] = useState(false);
const [newGroupName, setNewGroupName] = useState('');
const [newGroupMembers, setNewGroupMembers] = useState([]);
@@ -593,6 +594,9 @@
const unsubInvoices = loadData('faturacao', setInvoices, (a,b) => new Date(b.date) - new Date(a.date));
const unsubFaturas = loadData('faturas', setFaturas, (a,b) => new Date(b.dataVencimento) - new Date(a.dataVencimento));
const unsubGroups = loadData('grupos_chat', setChatGroups);
const unsubAdmin = onValue(ref(db, 'configuracoes/admin_profile'), (snapshot) => {
if (snapshot.exists()) setAdminProfile(snapshot.val());
});
return () => {
unsubResidents();
@@ -602,6 +606,7 @@
unsubInvoices();
unsubFaturas();
unsubGroups();
unsubAdmin();
};
}, []);
@@ -679,6 +684,9 @@
const [activeModal, setActiveModal] = useState(null);
const [editingItem, setEditingItem] = useState(null);
const [confirmDialog, setConfirmDialog] = useState({ isOpen: false, message: '', onConfirm: null });
const openConfirm = (message, onConfirm) => setConfirmDialog({ isOpen: true, message, onConfirm });
const [notification, setNotification] = useState(null);
const notificationRef = useRef(null);
@@ -864,7 +872,7 @@
};
const handleDeleteResident = async (id) => {
if (window.confirm('Tem a certeza que deseja eliminar este condómino?')) {
openConfirm('Tem a certeza que deseja eliminar este condómino?', async () => {
try {
const residentRef = ref(db, `condominos/${id}`);
await remove(residentRef);
@@ -873,7 +881,7 @@
console.error("Erro ao eliminar no Firebase:", error);
showNotification("Erro ao eliminar.", "error");
}
}
});
};
const handleSaveFinance = async (e) => {
@@ -1217,29 +1225,44 @@
const [route, setRoute] = useState(null);
const [isLocating, setIsLocating] = useState(false);
const IconMap = { Building2, ShoppingCart, Store, HeartPulse, Info, MapPin, Trophy, Dumbbell, PartyPopper, Waves };
const IconMap = { Building2, ShoppingCart, Store, HeartPulse, Info, MapPin, Trophy, Dumbbell, PartyPopper, Waves, Home, Anchor, Fuel };
useEffect(() => {
const defaultEspacos = {
'bloco-a': { nome: 'Bloco A', tipo: 'Residencial', descricao: '10 andares • 20 Frações', icone: 'Building2', color: 'text-orange-500', bg: 'bg-orange-100 dark:bg-orange-900/40', border: 'border-orange-300 dark:border-orange-700/50', x: 8, y: 15, w: 20, h: 28, canBook: false, latitude: 38.7225, longitude: -9.1398 },
'bloco-b': { nome: 'Bloco B', tipo: 'Residencial', descricao: '8 andares • 16 Frações', icone: 'Building2', color: 'text-orange-500', bg: 'bg-orange-100 dark:bg-orange-900/40', border: 'border-orange-300 dark:border-orange-700/50', x: 8, y: 55, w: 20, h: 28, canBook: false, latitude: 38.7215, longitude: -9.1398 },
'mercado-1': { nome: 'Mini Mercado 1', tipo: 'Comércio', descricao: 'Bens de primeira necessidade', icone: 'ShoppingCart', color: 'text-amber-600', bg: 'bg-amber-100 dark:bg-amber-900/40', border: 'border-amber-300 dark:border-amber-700/50', x: 32, y: 20, w: 12, h: 15, canBook: false, latitude: 38.7228, longitude: -9.1390 },
'mercado-2': { nome: 'Mini Mercado 2', tipo: 'Comércio', descricao: 'Mercearia e cafetaria', icone: 'Store', color: 'text-amber-600', bg: 'bg-amber-100 dark:bg-amber-900/40', border: 'border-amber-300 dark:border-amber-700/50', x: 32, y: 65, w: 12, h: 15, canBook: false, latitude: 38.7212, longitude: -9.1390 },
'medico': { nome: 'Posto Médico', tipo: 'Serviços', descricao: 'Primeiros socorros e saúde', icone: 'HeartPulse', color: 'text-red-600', bg: 'bg-red-100 dark:bg-red-900/40', border: 'border-red-300 dark:border-red-700/50', x: 48, y: 20, w: 12, h: 15, canBook: false, latitude: 38.7228, longitude: -9.1385 },
'reception': { nome: 'Recepção', tipo: 'Serviços', descricao: 'Segurança 24h e Encomendas', icone: 'Info', color: 'text-slate-700 dark:text-slate-300', bg: 'bg-slate-200 dark:bg-slate-700', border: 'border-slate-400 dark:border-slate-500', x: 48, y: 45, w: 8, h: 12, isRound: true, canBook: false, latitude: 38.7220, longitude: -9.1385 },
'pool': { nome: 'Piscina', tipo: 'Lazer', descricao: 'Piscina exterior aquecida', icone: 'MapPin', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', x: 48, y: 65, w: 14, h: 18, canBook: false, latitude: 38.7212, longitude: -9.1385 },
'park': { nome: 'Parque de Jogos', tipo: 'Lazer', descricao: 'Campo Polidesportivo', icone: 'Trophy', color: 'text-green-600', bg: 'bg-green-100 dark:bg-green-900/40', border: 'border-green-300 dark:border-green-700/50', x: 65, y: 15, w: 18, h: 25, canBook: true, bookId: 'park', latitude: 38.7225, longitude: -9.1375 },
'gym': { nome: 'Ginásio', tipo: 'Lazer', descricao: 'Equipamento Cardio e Força', icone: 'Dumbbell', color: 'text-blue-600', bg: 'bg-blue-100 dark:bg-blue-900/40', border: 'border-blue-300 dark:border-blue-700/50', x: 65, y: 48, w: 14, h: 18, canBook: true, bookId: 'gym', latitude: 38.7218, longitude: -9.1375 },
'hall': { nome: 'Salão Festas', type: 'Lazer', descricao: 'Capacidade 50 px', icone: 'PartyPopper', color: 'text-purple-600', bg: 'bg-purple-100 dark:bg-purple-900/40', border: 'border-purple-300 dark:border-purple-700/50', x: 65, y: 72, w: 14, h: 18, canBook: true, bookId: 'hall', latitude: 38.7210, longitude: -9.1375 },
'deck': { nome: 'Deque do Rio', tipo: 'Lazer', descricao: 'Zona de relaxamento à beira rio', icone: 'Waves', color: 'text-cyan-700 dark:text-cyan-300', bg: 'bg-cyan-100 dark:bg-cyan-900/40', border: 'border-cyan-300 dark:border-cyan-700/50', x: 85, y: 40, w: 8, h: 30, canBook: false, latitude: 38.7220, longitude: -9.1360 },
'bloco-a': { nome: 'Bloco A', tipo: 'Residencial', descricao: '10 andares • 20 Frações', icone: 'Building2', color: 'text-orange-500', bg: 'bg-orange-100 dark:bg-orange-900/40', border: 'border-orange-300 dark:border-orange-700/50', cx: 15, cy: 15, w: 20, h: 28, canBook: false, latitude: 38.7225, longitude: -9.1398 },
'moradia-1': { nome: 'Moradia 1', tipo: 'Residencial', descricao: 'Moradia T3', icone: 'Home', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 12, cy: 40, w: 12, h: 14, canBook: false, latitude: 38.7220, longitude: -9.1396 },
'moradia-2': { nome: 'Moradia 2', tipo: 'Residencial', descricao: 'Moradia T4', icone: 'Home', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 35, cy: 10, w: 12, h: 14, canBook: false, latitude: 38.7228, longitude: -9.1392 },
'moradia-3': { nome: 'Moradia 3', tipo: 'Residencial', descricao: 'Moradia T3', icone: 'Home', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 45, cy: 35, w: 12, h: 14, canBook: false, latitude: 38.7222, longitude: -9.1388 },
'moradia-4': { nome: 'Moradia 4', tipo: 'Residencial', descricao: 'Moradia T4', icone: 'Home', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 55, cy: 80, w: 12, h: 14, canBook: false, latitude: 38.7210, longitude: -9.1382 },
'moradia-5': { nome: 'Moradia 5', tipo: 'Residencial', descricao: 'Moradia T3', icone: 'Home', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 25, cy: 60, w: 12, h: 14, canBook: false, latitude: 38.7214, longitude: -9.1394 },
'moradia-6': { nome: 'Moradia 6', tipo: 'Residencial', descricao: 'Moradia T4', icone: 'Home', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 65, cy: 30, w: 12, h: 14, canBook: false, latitude: 38.7224, longitude: -9.1378 },
'moradia-7': { nome: 'Moradia 7', tipo: 'Residencial', descricao: 'Moradia T3', icone: 'Home', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 8, cy: 80, w: 12, h: 14, canBook: false, latitude: 38.7216, longitude: -9.1399 },
'moradia-8': { nome: 'Moradia 8', tipo: 'Residencial', descricao: 'Moradia T4', icone: 'Home', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 20, cy: 90, w: 12, h: 14, canBook: false, latitude: 38.7214, longitude: -9.1396 },
'mercado-1': { nome: 'Supermercado', tipo: 'Comércio', descricao: 'Bens primeira necessidade', icone: 'ShoppingCart', color: 'text-amber-600', bg: 'bg-amber-100 dark:bg-amber-900/40', border: 'border-amber-300 dark:border-amber-700/50', cx: 40, cy: 50, w: 14, h: 16, canBook: false, latitude: 38.7218, longitude: -9.1389 },
'mercado-2': { nome: 'Cafetaria', tipo: 'Comércio', descricao: 'Mercearia e cafetaria', icone: 'Store', color: 'text-amber-600', bg: 'bg-amber-100 dark:bg-amber-900/40', border: 'border-amber-300 dark:border-amber-700/50', cx: 75, cy: 65, w: 12, h: 14, canBook: false, latitude: 38.7213, longitude: -9.1372 },
'medico': { nome: 'Clínica', tipo: 'Serviços', descricao: 'Saúde e Bem-estar', icone: 'HeartPulse', color: 'text-red-600', bg: 'bg-red-100 dark:bg-red-900/40', border: 'border-red-300 dark:border-red-700/50', cx: 35, cy: 90, w: 14, h: 16, canBook: false, latitude: 38.7208, longitude: -9.1392 },
'reception': { nome: 'Portaria Principal', tipo: 'Serviços', descricao: 'Segurança 24h', icone: 'Info', color: 'text-slate-700 dark:text-slate-300', bg: 'bg-slate-200 dark:bg-slate-700', border: 'border-slate-400 dark:border-slate-500', cx: 8, cy: 50, w: 10, h: 10, isRound: true, canBook: false, latitude: 38.7219, longitude: -9.1400 },
'pool': { nome: 'Piscina', tipo: 'Lazer', descricao: 'Piscina exterior', icone: 'MapPin', color: 'text-teal-600', bg: 'bg-teal-100 dark:bg-teal-900/40', border: 'border-teal-300 dark:border-teal-700/50', cx: 60, cy: 55, w: 16, h: 18, canBook: false, latitude: 38.7215, longitude: -9.1380 },
'park': { nome: 'Parque', tipo: 'Lazer', descricao: 'Parque de jogos', icone: 'Trophy', color: 'text-green-600', bg: 'bg-green-100 dark:bg-green-900/40', border: 'border-green-300 dark:border-green-700/50', cx: 50, cy: 15, w: 18, h: 22, canBook: true, bookId: 'park', latitude: 38.7228, longitude: -9.1385 },
'gym': { nome: 'Ginásio', tipo: 'Lazer', descricao: 'Cardio e Força', icone: 'Dumbbell', color: 'text-blue-600', bg: 'bg-blue-100 dark:bg-blue-900/40', border: 'border-blue-300 dark:border-blue-700/50', cx: 75, cy: 85, w: 14, h: 16, canBook: true, bookId: 'gym', latitude: 38.7209, longitude: -9.1374 },
'hall': { nome: 'Salão Festas', type: 'Lazer', descricao: 'Capacidade 50 px', icone: 'PartyPopper', color: 'text-purple-600', bg: 'bg-purple-100 dark:bg-purple-900/40', border: 'border-purple-300 dark:border-purple-700/50', cx: 65, cy: 15, w: 14, h: 16, canBook: true, bookId: 'hall', latitude: 38.7205, longitude: -9.1398 },
'marina': { nome: 'Aluguer Barcos', tipo: 'Náutica', descricao: 'Barcos e motas de água', icone: 'Anchor', color: 'text-cyan-700 dark:text-cyan-300', bg: 'bg-cyan-100 dark:bg-cyan-900/40', border: 'border-cyan-300 dark:border-cyan-700/50', cx: 86, cy: 35, w: 12, h: 14, canBook: true, bookId: 'marina', latitude: 38.7222, longitude: -9.1355 },
'fuel': { nome: 'Bomba Náutica', tipo: 'Náutica', descricao: 'Abastecimento', icone: 'Fuel', color: 'text-red-500', bg: 'bg-red-100 dark:bg-red-900/40', border: 'border-red-300 dark:border-red-700/50', cx: 86, cy: 50, w: 10, h: 10, isRound: true, canBook: false, latitude: 38.7219, longitude: -9.1355 },
'deck': { nome: 'Deque', tipo: 'Lazer', descricao: 'Lazer', icone: 'Waves', color: 'text-cyan-700 dark:text-cyan-300', bg: 'bg-cyan-100 dark:bg-cyan-900/40', border: 'border-cyan-300 dark:border-cyan-700/50', cx: 88, cy: 75, w: 10, h: 25, canBook: false, latitude: 38.7212, longitude: -9.1350 },
};
const espacosRef = ref(db, 'espacos');
const unsub = onValue(espacosRef, (snapshot) => {
if (snapshot.exists()) {
const data = snapshot.val();
const loadedEspacos = Object.keys(data).map(key => ({ id: key, ...data[key] }));
setEspacos(loadedEspacos);
if (!data['moradia-8']) {
set(ref(db, 'espacos'), defaultEspacos).catch(console.error);
const loadedEspacos = Object.keys(defaultEspacos).map(key => ({ id: key, ...defaultEspacos[key] }));
setEspacos(loadedEspacos);
} else {
const loadedEspacos = Object.keys(data).map(key => ({ id: key, ...data[key] }));
setEspacos(loadedEspacos);
}
} else {
// Seed inicial da base de dados se estiver vazia
set(ref(db, 'espacos'), defaultEspacos).catch(console.error);
@@ -1297,12 +1320,12 @@
},
(error) => {
console.error("Erro de geolocalização:", error);
alert("Não foi possível obter a sua localização. Verifique as permissões do browser.");
showNotification("Não foi possível obter a sua localização. Verifique as permissões do browser.", "error");
setIsLocating(false);
}
);
} else {
alert("Geolocalização não é suportada por este browser.");
showNotification("Geolocalização não é suportada por este browser.", "error");
setIsLocating(false);
}
};
@@ -1322,18 +1345,71 @@
</div>
</div>
<div className="flex flex-col lg:flex-row flex-1 min-h-[500px]">
<div className="flex flex-col lg:flex-row flex-1 min-h-[700px]">
{/* Área do Mapa */}
<div className="flex-1 p-6 bg-slate-50 dark:bg-dark-bg flex items-center justify-center relative overflow-hidden">
<div className="relative w-full max-w-[800px] aspect-[16/10] bg-white dark:bg-dark-surface border-2 border-slate-300 dark:border-dark-border rounded-xl shadow-xl p-4 transition-all duration-500 overflow-hidden">
<div className="absolute inset-0 opacity-5 bg-[linear-gradient(0deg,transparent_24%,#000_25%,#000_26%,transparent_27%,transparent_74%,#000_75%,#000_76%,transparent_77%,transparent),linear-gradient(90deg,transparent_24%,#000_25%,#000_26%,transparent_27%,transparent_74%,#000_75%,#000_76%,transparent_77%,transparent)] bg-[length:40px_40px]"></div>
<div className="relative w-full h-full max-h-[800px] min-h-[600px] bg-[#eef8f2] dark:bg-[#1a2e23] border-4 border-slate-300 dark:border-dark-border rounded-2xl shadow-2xl p-4 transition-all duration-500 overflow-hidden">
<div className="absolute inset-0 opacity-10 bg-[linear-gradient(0deg,transparent_24%,#000_25%,#000_26%,transparent_27%,transparent_74%,#000_75%,#000_76%,transparent_77%,transparent),linear-gradient(90deg,transparent_24%,#000_25%,#000_26%,transparent_27%,transparent_74%,#000_75%,#000_76%,transparent_77%,transparent)] bg-[length:40px_40px]"></div>
{/* Visual River */}
<div className="absolute right-0 top-0 bottom-0 w-[12%] bg-blue-400/20 dark:bg-blue-600/20 border-l-4 border-blue-300/30 dark:border-blue-700/30 flex items-center justify-center overflow-hidden pointer-events-none">
<div className="text-blue-500/30 dark:text-blue-400/20 font-bold text-3xl rotate-90 whitespace-nowrap tracking-[1em]">RIO</div>
<div className="absolute right-0 top-0 bottom-0 w-[12%] bg-blue-400/30 dark:bg-blue-600/30 border-l-8 border-blue-300/50 dark:border-blue-700/50 flex items-center justify-center overflow-hidden pointer-events-none">
<div className="text-blue-600/40 dark:text-blue-300/30 font-black text-4xl rotate-90 whitespace-nowrap tracking-[1em]">RIO TEJO</div>
</div>
<div className="absolute top-1/2 left-0 w-[88%] h-12 bg-slate-200 dark:bg-dark-card transform -translate-y-1/2 border-y-2 border-slate-300 dark:border-slate-600 border-dashed flex items-center justify-center text-slate-400 font-bold tracking-[0.5em] opacity-40 text-xs sm:text-sm pointer-events-none">VIA CENTRAL</div>
{/* Ruas e Caminhos em SVG */}
<svg viewBox="0 0 100 100" preserveAspectRatio="none" className="absolute inset-0 w-full h-full pointer-events-none z-0" style={{ overflow: 'visible' }}>
{/* Via Central */}
<rect x="0" y="46" width="88" height="8" fill="#cbd5e1" className="dark:fill-slate-700" />
<line x1="0" y1="50" x2="88" y2="50" stroke="#f8fafc" strokeWidth="0.5" strokeDasharray="2,2" className="dark:stroke-slate-400" />
{/* Caminhos Secundários Orgânicos */}
<g stroke="#cbd5e1" strokeWidth="3" className="dark:stroke-slate-700" strokeLinecap="round" strokeLinejoin="round" fill="none">
{/* Top Arch */}
<path d="M 25 50 C 25 15, 40 5, 55 5 C 75 5, 80 20, 80 30 C 80 40, 85 45, 85 50" />
{/* Middle Top Winding */}
<path d="M 40 50 C 40 30, 50 25, 60 25 C 70 25, 75 30, 80 30" />
{/* Bottom Winding S-shape */}
<path d="M 18 50 C 18 85, 45 85, 45 65 C 45 45, 65 95, 85 50" />
{/* Ramos de Ligação (Atalhos) */}
<path d="M 15 15 L 28 15" strokeWidth="1.5" /> {/* Bloco A */}
<path d="M 8 80 L 27 80" strokeWidth="1.5" /> {/* Moradia 7 */}
<path d="M 20 90 L 20 60" strokeWidth="1.5" /> {/* Moradia 8 */}
<path d="M 12 40 L 12 50" strokeWidth="1.5" /> {/* Moradia 1 */}
<path d="M 35 10 L 35 15" strokeWidth="1.5" /> {/* Moradia 2 */}
<path d="M 45 35 L 45 29" strokeWidth="1.5" /> {/* Moradia 3 */}
<path d="M 55 80 L 55 64" strokeWidth="1.5" /> {/* Moradia 4 */}
<path d="M 25 60 L 25 78" strokeWidth="1.5" /> {/* Moradia 5 */}
<path d="M 65 30 L 65 26" strokeWidth="1.5" /> {/* Moradia 6 */}
<path d="M 75 65 L 75 68" strokeWidth="1.5" /> {/* Cafetaria */}
<path d="M 35 90 L 35 72" strokeWidth="1.5" /> {/* Clinica */}
<path d="M 60 55 L 60 68" strokeWidth="1.5" /> {/* Piscina */}
<path d="M 50 15 L 50 5" strokeWidth="1.5" /> {/* Parque */}
<path d="M 75 85 L 72 65" strokeWidth="1.5" /> {/* Ginasio */}
<path d="M 65 15 L 65 28" strokeWidth="1.5" /> {/* Salao */}
<path d="M 86 35 L 80 35" strokeWidth="1.5" /> {/* Barcos */}
<path d="M 88 75 L 78 60" strokeWidth="1.5" /> {/* Deque */}
</g>
<g stroke="#f8fafc" strokeWidth="0.5" strokeDasharray="1,1" className="dark:stroke-slate-400" strokeLinecap="round" strokeLinejoin="round" fill="none">
{/* Centros das Vias Orgânicas */}
<path d="M 25 50 C 25 15, 40 5, 55 5 C 75 5, 80 20, 80 30 C 80 40, 85 45, 85 50" />
<path d="M 40 50 C 40 30, 50 25, 60 25 C 70 25, 75 30, 80 30" />
<path d="M 18 50 C 18 85, 45 85, 45 65 C 45 45, 65 95, 85 50" />
</g>
</svg>
<div className="absolute top-[50%] left-0 w-[88%] h-12 transform -translate-y-1/2 flex items-center justify-center text-slate-500 dark:text-slate-300 font-black tracking-[0.8em] opacity-60 text-xs sm:text-sm pointer-events-none z-0">VIA CENTRAL</div>
{/* Árvores Decorativas (Espalhadas) */}
{[
{x: 5, y: 5}, {x: 12, y: 8}, {x: 25, y: 5}, {x: 45, y: 8}, {x: 60, y: 5}, {x: 80, y: 8},
{x: 5, y: 90}, {x: 12, y: 85}, {x: 25, y: 90}, {x: 45, y: 88}, {x: 60, y: 92}, {x: 80, y: 85},
{x: 25, y: 35}, {x: 45, y: 45}, {x: 80, y: 40},
{x: 25, y: 65}, {x: 45, y: 60}, {x: 80, y: 60},
{x: 50, y: 30}, {x: 55, y: 65}, {x: 10, y: 70}
].map((tree, i) => (
<div key={`tree-${i}`} className="absolute w-6 h-6 bg-green-600/50 dark:bg-green-800/50 rounded-full blur-[2px] shadow-lg pointer-events-none z-0" style={{ left: `${tree.x}%`, top: `${tree.y}%` }}></div>
))}
{/* SVG Route Overlay */}
{route && route.targetId && (
@@ -1343,18 +1419,22 @@
<polygon points="0 0, 10 3.5, 0 7" fill="#3b82f6" />
</marker>
</defs>
{espacos.filter(e => e.id === route.targetId).map(target => (
<path
key="route-path"
d={`M ${route.userX}% ${route.userY}% Q 50% 50% ${target.x + (target.w||0)/2}% ${target.y + (target.h||0)/2}%`}
fill="none"
stroke="#3b82f6"
strokeWidth="4"
strokeDasharray="8, 8"
className="animate-[dash_1s_linear_infinite]"
markerEnd="url(#arrowhead)"
/>
))}
{espacos.filter(e => e.id === route.targetId).map(target => {
const targetCX = target.cx !== undefined ? target.cx : target.x + (target.w||10) / 2;
const targetCY = target.cy !== undefined ? target.cy : target.y + (target.h||10) / 2;
return (
<path
key="route-path"
d={`M ${route.userX}% ${route.userY}% Q 50% 50% ${targetCX}% ${targetCY}%`}
fill="none"
stroke="#3b82f6"
strokeWidth="4"
strokeDasharray="8, 8"
className="animate-[dash_1s_linear_infinite]"
markerEnd="url(#arrowhead)"
/>
);
})}
<circle cx={`${route.userX}%`} cy={`${route.userY}%`} r="6" fill="#3b82f6" className="animate-ping" />
<circle cx={`${route.userX}%`} cy={`${route.userY}%`} r="4" fill="#1e40af" />
<style>{`
@@ -1365,17 +1445,26 @@
{espacos.map(loc => {
const IconComp = IconMap[loc.icone] || MapPin;
// Reduzir o tamanho em 25% (scale = 0.75) mantendo o centro
const scale = 0.75;
const w = (loc.w || 10) * scale;
const h = (loc.h || 10) * scale;
const cx = loc.cx !== undefined ? loc.cx : loc.x + (loc.w || 10) / 2;
const cy = loc.cy !== undefined ? loc.cy : loc.y + (loc.h || 10) / 2;
const x = cx - w / 2;
const y = cy - h / 2;
return (
<div
key={loc.id}
onClick={() => setActivePoint(loc.id)}
onMouseEnter={() => setActivePoint(loc.id)}
className={`absolute flex flex-col items-center justify-center cursor-pointer transition-all duration-300 border-2 ${loc.bg} ${loc.border} ${activePoint === loc.id ? 'scale-110 shadow-lg z-20 ring-4 ring-blue-400/30' : 'hover:scale-105 shadow-sm z-10'} ${loc.isRound ? 'rounded-full' : 'rounded-lg'}`}
style={{ left: `${loc.x}%`, top: `${loc.y}%`, width: `${loc.w}%`, height: `${loc.h}%` }}
className={`absolute flex flex-col items-center justify-center cursor-pointer transition-all duration-300 border-2 ${loc.bg} ${loc.border} ${activePoint === loc.id ? 'scale-110 shadow-2xl z-20 ring-4 ring-blue-400/50' : 'hover:scale-105 shadow-md z-10'} ${loc.isRound ? 'rounded-full' : 'rounded-xl bg-white/90 dark:bg-dark-surface/90 backdrop-blur-sm'}`}
style={{ left: `${x}%`, top: `${y}%`, width: `${w}%`, height: `${h}%` }}
>
<IconComp size={loc.isRound ? 16 : 24} className={`${loc.color} ${activePoint === loc.id ? 'animate-bounce' : ''}`} />
<IconComp size={loc.isRound ? 14 : 20} className={`${loc.color} ${activePoint === loc.id ? 'animate-bounce' : ''}`} />
{!loc.isRound && (
<span className={`font-bold text-[9px] sm:text-[10px] mt-1 text-center px-1 text-slate-800 dark:text-slate-200 leading-tight`}>
<span className={`font-black text-[9px] sm:text-[10px] mt-1 text-center px-1 text-slate-800 dark:text-slate-200 leading-tight drop-shadow-sm`}>
{loc.nome}
</span>
)}
@@ -1554,7 +1643,8 @@
role: `Fração ${currentUserData.unit || 'N/A'}`,
email: currentUserData.email || '',
contact: currentUserData.contact || '',
address: 'Morada do Condomínio'
address: 'Morada do Condomínio',
photoUrl: currentUserData.photoUrl || ''
});
} else {
const adminRef = ref(db, 'configuracoes/admin_profile');
@@ -1623,6 +1713,9 @@
try {
await set(ref(db, `condominos/${currentUserData.id}/email`), formData.email);
await set(ref(db, `condominos/${currentUserData.id}/contact`), formData.contact);
if (formData.photoUrl !== undefined) {
await set(ref(db, `condominos/${currentUserData.id}/photoUrl`), formData.photoUrl);
}
showNotification('Dados atualizados com sucesso!', 'success');
sendSystemNotification('Um utilizador atualizou os seus dados pessoais.', 'info', 'admin');
} catch (error) {
@@ -1641,15 +1734,44 @@
}
};
const fileInputRef = React.useRef(null);
const handleImageChange = (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onloadend = () => {
handleChange('photoUrl', reader.result);
};
reader.readAsDataURL(file);
}
};
return (
<div className="bg-white dark:bg-dark-surface rounded-xl shadow-sm border border-slate-100 dark:border-dark-border overflow-hidden animate-fade-in flex flex-col h-full transition-colors">
<div className="flex flex-col md:flex-row h-full">
{/* Profile Sidebar */}
<div className="w-full md:w-64 bg-slate-50 dark:bg-dark-bg border-r border-slate-100 dark:border-dark-border p-6 flex flex-col gap-2">
<div className="text-center mb-6">
<div className="w-24 h-24 bg-blue-100 dark:bg-blue-900/30 rounded-full mx-auto flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold text-3xl mb-3 border-4 border-white dark:border-dark-surface shadow-sm">
{userRole === 'admin' ? 'AD' : 'MO'}
<div
className="w-24 h-24 bg-blue-100 dark:bg-blue-900/30 rounded-full mx-auto flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold text-3xl mb-3 border-4 border-white dark:border-dark-surface shadow-sm cursor-pointer relative group overflow-hidden transition-all"
onClick={() => fileInputRef.current && fileInputRef.current.click()}
>
{formData.photoUrl ? (
<img src={formData.photoUrl} alt="Perfil" className="w-full h-full object-cover" />
) : (
userRole === 'admin' ? 'AD' : 'MO'
)}
<div className="absolute inset-0 bg-black/50 hidden group-hover:flex items-center justify-center text-white transition-all">
<span className="text-xs font-medium">Alterar</span>
</div>
</div>
<input
type="file"
ref={fileInputRef}
onChange={handleImageChange}
accept="image/*"
className="hidden"
/>
<h3 className="font-bold text-slate-800 dark:text-white">{userRole === 'admin' ? 'Admin Condomínio' : 'Morador'}</h3>
<p className="text-xs text-slate-500 dark:text-dark-mute">{userRole === 'admin' ? 'Administrador Geral' : 'Residente'}</p>
</div>
@@ -1997,7 +2119,12 @@
onClick={() => setActiveTab('profile')}
title="Meu Perfil"
>
{userRole === 'admin' ? 'AD' : 'MO'}
{(() => {
const currentUser = residents.find(r => r.id === currentUserId);
const photoUrl = userRole === 'admin' ? adminProfile?.photoUrl : currentUser?.photoUrl;
if (photoUrl) return <img src={photoUrl} alt="Perfil" className="w-full h-full rounded-full object-cover border border-slate-200 dark:border-slate-700" />;
return userRole === 'admin' ? 'AD' : 'MO';
})()}
</div>
</div>
</header>
@@ -2803,6 +2930,28 @@
</button>
</form>
</Modal>
<Modal isOpen={confirmDialog.isOpen} onClose={() => setConfirmDialog(prev => ({ ...prev, isOpen: false }))} title="Confirmação">
<div className="p-2">
<p className="text-slate-700 dark:text-slate-300 text-base mb-6 text-center font-medium">{confirmDialog.message}</p>
<div className="flex gap-3 justify-center">
<button
className="px-6 py-2 bg-slate-200 dark:bg-slate-700 hover:bg-slate-300 dark:hover:bg-slate-600 text-slate-800 dark:text-white rounded-lg transition-colors font-medium"
onClick={() => setConfirmDialog(prev => ({ ...prev, isOpen: false }))}
>
Cancelar
</button>
<button
className="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium shadow-sm"
onClick={() => {
setConfirmDialog(prev => ({ ...prev, isOpen: false }));
if (confirmDialog.onConfirm) confirmDialog.onConfirm();
}}
>
Confirmar
</button>
</div>
</div>
</Modal>
</main>
</div>