diff --git a/frontend/package.json b/frontend/package.json index e2b6694..25b6f5b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "build": "npx vite build", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, diff --git a/frontend/public/controller/Info.png b/frontend/public/controller/Info.png new file mode 100644 index 0000000..026a19e Binary files /dev/null and b/frontend/public/controller/Info.png differ diff --git a/frontend/public/controller/Search Contacts.png b/frontend/public/controller/Search Contacts.png new file mode 100644 index 0000000..c6190b7 Binary files /dev/null and b/frontend/public/controller/Search Contacts.png differ diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 6b9f6ea..eb3cd0b 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -17,6 +17,8 @@ import { DisasterInformationAdder } from './pages/controller/DisasterInformation import { DisasterMap } from './pages/controller/DisasterMap'; import SearchResults from './components/Controller/SearchResult'; import PrivateRoute from './authanticate/PrivateRoutes'; +import { DonationsPage } from './pages/controller/DonationsPage'; +import { InformationPage } from './pages/controller/InformationPage'; const isAuthenticated = () => { // Check if the user is logged in (e.g., check if token exists in localStorage) @@ -44,6 +46,8 @@ function App() { } /> }/> }/> + }/> + }/> diff --git a/frontend/src/Windows/RequestWindow.jsx b/frontend/src/Windows/RequestWindow.jsx index 7b9a957..551182b 100644 --- a/frontend/src/Windows/RequestWindow.jsx +++ b/frontend/src/Windows/RequestWindow.jsx @@ -15,7 +15,8 @@ export const WindowComponent = ({ otherNeeds, verification, image, - locationLatLan, + province, + locationLatLan }) => { const [clickButton,setclickButton] = useState(); const lat = parseFloat(locationLatLan[0]); @@ -48,7 +49,7 @@ export const WindowComponent = ({

- {verification} + {verification? "Verified": "Unverified"}

@@ -101,7 +102,7 @@ export const WindowComponent = ({ id="No_of_people_effected" className="block p-2.5 text-sm w-full text-gray-600 bg-gray-50 rounded-lg border border-b-4 border-gray-400" > - {affectedCount} + {affectedCount}{province}
diff --git a/frontend/src/axiosConfig.jsx b/frontend/src/axiosConfig.jsx index 74050fa..cc26492 100644 --- a/frontend/src/axiosConfig.jsx +++ b/frontend/src/axiosConfig.jsx @@ -1,4 +1,4 @@ import axios from "axios"; axios.defaults.baseURL = - process.env.NODE_ENV != 'production'? 'http://localhost:5000' : 'https://dms-server-dgtg.onrender.com'; \ No newline at end of file + process.env.NODE_ENV != 'production'? 'http://localhost:5000' : 'https://dms-server-goil.onrender.com'; \ No newline at end of file diff --git a/frontend/src/components/Controller/Home/Menues.jsx b/frontend/src/components/Controller/Home/Menues.jsx index bdc3621..b7464ae 100644 --- a/frontend/src/components/Controller/Home/Menues.jsx +++ b/frontend/src/components/Controller/Home/Menues.jsx @@ -4,9 +4,9 @@ export const Menues = () => { const service = [ { id: 1, - title: "Family Emergency Plans", - description: "Tool to create plans during the Emergency.", - image: "/controller/Full Family.png", + title: "Disaster Information", + description: "Aware about various kinds of disasters in Sri Lanka", + image: "/controller/Info.png", url: "/controller/information" }, { @@ -22,7 +22,7 @@ export const Menues = () => { title: "Emergency Contacts", description: "Discover essential contact info for any disaster. Be ready, stay vigilant.", - image: "/controller/Light On.png", + image: "/controller/Search Contacts.png", url: "/controller/ContactInfoAdder" }, { @@ -31,7 +31,7 @@ export const Menues = () => { description: "Contribute today to support disaster relief efforts, helping communities rebuild and thrive. ", image: "/controller/Donation.png", - url: "/controller/news" + url: "/controller/donations" }, { id: 5, diff --git a/frontend/src/components/Controller/LanguageBar.jsx b/frontend/src/components/Controller/LanguageBar.jsx index 4b546ab..36ad711 100644 --- a/frontend/src/components/Controller/LanguageBar.jsx +++ b/frontend/src/components/Controller/LanguageBar.jsx @@ -1,5 +1,4 @@ import React from 'react' -import { LanguageButtons } from "./LanguageButtons" import { Button } from '@mui/material' import { useNavigate } from 'react-router-dom' @@ -12,12 +11,11 @@ export const LanguageBar = () => { } return ( -
- -
+
+

Call center 1717

-
diff --git a/frontend/src/components/Controller/LanguageButtons.jsx b/frontend/src/components/Controller/LanguageButtons.jsx deleted file mode 100644 index 6c71aef..0000000 --- a/frontend/src/components/Controller/LanguageButtons.jsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react' - -export const LanguageButtons = () => { - - return( -
- - - - -
- ) -} \ No newline at end of file diff --git a/frontend/src/components/Controller/News/NewsPreview.jsx b/frontend/src/components/Controller/News/NewsPreview.jsx index 450ba74..b9447dc 100644 --- a/frontend/src/components/Controller/News/NewsPreview.jsx +++ b/frontend/src/components/Controller/News/NewsPreview.jsx @@ -157,7 +157,7 @@ export const NewsPreview = () =>{

{selectedNews.heading}

-

{selectedNews.author}

+

by {selectedNews.author}

{selectedNews.createdTime.split(' ')[0]}

{selectedNews.createdDate}

@@ -224,10 +224,10 @@ export const NewsPreview = () =>{ {/* News item */}
- + {Array.isArray(newsItems) && newsItems.map((news, i) => ( -
handleCardClick(news)}> +
handleCardClick(news)}>
{news.image && ( @@ -245,7 +245,7 @@ export const NewsPreview = () =>{
-

{news.author}

+

by {news.author}

{news.createdDate}

Display :{(news.show).toString()}

diff --git a/frontend/src/components/Controller/Requests/BarSlideShow.jsx b/frontend/src/components/Controller/Requests/BarSlideShow.jsx index f4b29dc..8225f27 100644 --- a/frontend/src/components/Controller/Requests/BarSlideShow.jsx +++ b/frontend/src/components/Controller/Requests/BarSlideShow.jsx @@ -16,9 +16,10 @@ import { Fa2 } from 'react-icons/fa6'; const [currentMonth, setCurrentMonth] = useState(0); // Index of current month dataset //const dataset =[]; const [dataset, setDataset] = useState([]); - const months = [ "March","April", "May"]; - const provinces =["Colombo", "Rathnapura","Galle","Kottawa"]; - // const provinces =["Western Province", "Southern Province", "Sabaragamuwa Province"]; + const months = [ "March","April", "May", "June"]; + // const provinces =["Colombo", "Rathnapura","Galle","Kottawa"]; + const provinces =["Western Province", "Southern Province", "Sabaragamuwa Province"]; + const disasters = ["flood", "tsunami", "fire", "wind", "landslide"]; const newDataset = []; @@ -29,7 +30,7 @@ import { Fa2 } from 'react-icons/fa6'; const provinceDataset = []; for(let k=0;k (request.disasterLocation) === provinces[k]); + const provReq = monthlyReq.filter(request => (request.requestProvince) === provinces[k]); // const provReq = monthlyReq.filter(async(request) => {await getProvince(request.disasterLocation) === provinces[k]}); // const provReq = await Promise.all(monthlyReq.map(async (request) => { @@ -46,6 +47,7 @@ import { Fa2 } from 'react-icons/fa6'; landslide:provReq.filter(request => request.disasterType.toLowerCase().includes("landslide") ).length, wind:provReq.filter(request => request.disasterType.toLowerCase().includes("wind") ).length, fire:provReq.filter(request => request.disasterType.toLowerCase().includes("fire") ).length, + other:provReq.filter(request =>!disasters.some(disasters =>request.disasterType.toLowerCase().includes(disasters))).length, }; provinceDataset.push(provinceData); } @@ -74,7 +76,7 @@ import { Fa2 } from 'react-icons/fa6'; - + ); diff --git a/frontend/src/components/Controller/Requests/RequestsDetails.jsx b/frontend/src/components/Controller/Requests/RequestsDetails.jsx index 458a74e..8a78d16 100644 --- a/frontend/src/components/Controller/Requests/RequestsDetails.jsx +++ b/frontend/src/components/Controller/Requests/RequestsDetails.jsx @@ -231,8 +231,7 @@ export const RequestsDetails = ({flood,tsunami,fire,wind,other,today, monthly}) }, ]} width={300} - height={200} - + height={200} />
@@ -303,7 +302,6 @@ export const RequestsDetails = ({flood,tsunami,fire,wind,other,today, monthly}) { id: 0, value:monthlyAccepted.length, label: `${monthlyAccepted.length}`}, { id: 1, value:monthlyNotAccepted.length}, ], - outerRadius: 50, innerRadius:40, paddingAngle: 1, @@ -311,10 +309,8 @@ export const RequestsDetails = ({flood,tsunami,fire,wind,other,today, monthly}) startAngle: 0, endAngle: 360, cx: 45, - cy: 45, - - }, - + cy: 45, + }, ]} width={100} height={100} diff --git a/frontend/src/components/Controller/TitleBar.jsx b/frontend/src/components/Controller/TitleBar.jsx index ccaa923..71e4036 100644 --- a/frontend/src/components/Controller/TitleBar.jsx +++ b/frontend/src/components/Controller/TitleBar.jsx @@ -4,7 +4,6 @@ import { SearchBar } from "./SearchBar" export const TitleBar = () => { return(
-
Disaster Management Center logo_main diff --git a/frontend/src/pages/controller/ControllerHomePage.jsx b/frontend/src/pages/controller/ControllerHomePage.jsx index c8cc5bc..2f96e53 100644 --- a/frontend/src/pages/controller/ControllerHomePage.jsx +++ b/frontend/src/pages/controller/ControllerHomePage.jsx @@ -27,8 +27,6 @@ export const ControllerHomePage = () => {
- -
) diff --git a/frontend/src/pages/controller/DonationsPage.jsx b/frontend/src/pages/controller/DonationsPage.jsx new file mode 100644 index 0000000..52d541f --- /dev/null +++ b/frontend/src/pages/controller/DonationsPage.jsx @@ -0,0 +1,17 @@ +import React from "react"; +import { LanguageBar } from "../../components/Controller/LanguageBar"; +import { HeaderBar } from "../../components/Controller/HeaderBar"; +import { Footer } from "../../components/Controller/Footer" + +export const DonationsPage = () =>{ + return ( +
+ + +
+

Donation Page

+
+
+
+ ); +} \ No newline at end of file diff --git a/frontend/src/pages/controller/InformationPage.jsx b/frontend/src/pages/controller/InformationPage.jsx new file mode 100644 index 0000000..5cf0d4a --- /dev/null +++ b/frontend/src/pages/controller/InformationPage.jsx @@ -0,0 +1,17 @@ +import React from "react"; +import { LanguageBar } from "../../components/Controller/LanguageBar"; +import { HeaderBar } from "../../components/Controller/HeaderBar"; +import { Footer } from "../../components/Controller/Footer" + +export const InformationPage = () =>{ + return ( +
+ + +
+

Disaster Information Page

+
+
+
+ ); +} \ No newline at end of file diff --git a/frontend/src/pages/controller/Requests.jsx b/frontend/src/pages/controller/Requests.jsx index c351a9f..1fd778e 100644 --- a/frontend/src/pages/controller/Requests.jsx +++ b/frontend/src/pages/controller/Requests.jsx @@ -93,7 +93,7 @@ export const Requests = () => { request.disasterType.toLowerCase().includes("landslide") ); const verified = requests.filter( - request => request.verification === "verified" + request => request.verify === true ); const today = requests.filter( request => request.requestDate === new Date().toDateString() @@ -103,7 +103,7 @@ export const Requests = () => { request.requestDate.split(" ")[1] === new Date().toDateString().split(" ")[1] ); - const allRead = requests.filter(request => request.read === false); + const allRead = requests.filter(request => request.read === true); const todayRead = requests.filter( request => request.read === true && @@ -168,6 +168,7 @@ export const Requests = () => { } setSelectedRequest(updatedRequest); console.log("request Image", request.image); + console.log("request province", request.requestProvince); const updatedRequests = await getRequests(); setShowRequests(updatedRequests); } catch (error) { @@ -203,6 +204,12 @@ export const Requests = () => { } }; + useEffect(()=>{ + if(showRequests.length != 0){ + console.log("Request filtered!"); + } + },[showRequests]) + const [isMenuOpen, setIsMenuOpen] = useState(false); const toggleMenu = () => { setIsMenuOpen(!isMenuOpen); @@ -250,6 +257,7 @@ export const Requests = () => { otherNeeds={selectedRequest.otherNeeds} verification={selectedRequest.verify} image={selectedRequest.image} + province = {selectedRequest.requestProvince} locationLatLan={selectedRequest.disasterLocationLatLan} />
@@ -259,67 +267,67 @@ export const Requests = () => {
handleTag("all")} > All{" "} handleTag("flood")} > Flood{" "} handleTag("tsunami")} > Tsunami handleTag("extreme wind")} > Extreme Wind handleTag("fire")} > Fire handleTag("landslide")} > Landslide handleTag("other")} > Other handleTag("today")} > Today handleTag("monthly")} > Monthly handleTag("verified")} > Verified handleTag("read")} > Read