Skip to content

Commit

Permalink
Merge pull request #63 from agiledev-students-fall2023/user-story/18/…
Browse files Browse the repository at this point in the history
…task/57/map-api

User story/18/task/57/map api
  • Loading branch information
lunnnnnn authored Oct 30, 2023
2 parents 0dfcf4a + f3f4b6d commit 2b94297
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 17 deletions.
8 changes: 7 additions & 1 deletion front-end/GoodOldMap/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
<link rel="icon" type="image/svg+xml" href="/maplogo.png" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lora&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GoodOldMap</title>
</head>
Expand Down
49 changes: 49 additions & 0 deletions front-end/GoodOldMap/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions front-end/GoodOldMap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"leaflet": "^1.9.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-leaflet": "^4.2.1",
"react-router-dom": "^6.17.0"
},
"devDependencies": {
Expand Down
18 changes: 10 additions & 8 deletions front-end/GoodOldMap/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ import Login from './pages/Authenticate/Login';
import Register from './pages/Authenticate/Register';
import Error from './pages/Error/Error';
import InfoDetail from './pages/InfoDetail/InfoDetail';
import Favorite from './pages/FavoriteList/Favorite';
import AuthLayout from './pages/Authenticate/AuthLayout';
import AccountLayout from './pages/Account/AccountLayout';
import Favorite from './pages/FavoriteList/Favorite';

import MapLayout from './pages/MainMap/MapLayout';
const App = () => {

return (
<>
<BrowserRouter>
<Routes>
<Route path="/" element={<MainMap />} />

<Route element={<MapLayout />}>
<Route path="/" element={<MainMap />} />
</Route>
<Route element={<AuthLayout />}>
<Route path="/login" element={<Login />} />
<Route path="/register" element={<Register />} />
Expand All @@ -25,11 +28,10 @@ const App = () => {
{/* TODO: add params: /info/:pieceInfo */}
<Route path="/info" element={<InfoDetail/>}/>

<Route element={<AccountLayout />}>
<Route path="/account" element={<Account />}>
<Route path="favorite" element={<Favorite />}/>
<Route path="edit" element={<AccountEdit />} />
</Route>
<Route path="/account" element={<AccountLayout />}>
<Route path="" element={<Account />} />
<Route path="favorite" element={<Favorite />}/>
<Route path="edit" element={<AccountEdit />} />
</Route>

</Routes>
Expand Down
4 changes: 2 additions & 2 deletions front-end/GoodOldMap/src/components/popup/popupContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function PopupContent(props){
return (
// dark background
<div
className="fixed top-0 left-0 z-50 w-full h-full bg-black bg-opacity-50 flex items-center justify-center"
onClick={() => {props.handleClick()}}>
className="popupBackground fixed top-0 left-0 z-50 w-full h-full bg-black bg-opacity-50 flex items-center justify-center"
onClick={props.handleClick}>
{/* white popup container: */}
<div className="bg-white rounded-lg shadow-xl w-[80%]">
<div className="p-8">
Expand Down
1 change: 0 additions & 1 deletion front-end/GoodOldMap/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@
}

@layer utilities {

}
6 changes: 3 additions & 3 deletions front-end/GoodOldMap/src/pages/Account/Account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ const Account = () => {
return(
<div>
<div className="min-h-screen flex flex-col items-center justify-center">
<Link to="/ChangeProfilePic">
<Link to="changeProfilePic">
<img className="w-32 h-32 rounded-full object-cover cursor-pointer" src={props.pic} alt="profile picture" />
</Link>

<h1 className="text-2xl font-bold mt-4">{props.username}</h1>
<p className="text-gray-500">{props.email}</p>
{/* Add a button that redirects to another place */}
<Link to="/edit">
<Link to="edit">
<button className="bg-white-500 text-black font-bold py-2 px-4 rounded mt-4">
Edit Account
</button>
</Link>
<Link to="/Favorite">
<Link to="favorite">
<button className="bg-white-500 text-black font-bold py-2 px-4 rounded mt-4">
My Fav
</button>
Expand Down
6 changes: 5 additions & 1 deletion front-end/GoodOldMap/src/pages/AccountEdit/AccountEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ const AccountEdit = () => {
console.error(error)
}
};
const handleClose = (evt) => {
evt.stopPropagation()
if(evt.target.classList.contains("popupBackground")) setCurrentActionData(null)
}

//Return the AccountEdit component
return (
Expand All @@ -106,7 +110,7 @@ const AccountEdit = () => {
title={currentActionData.title}
inputs={currentActionData.inputs}
buttons={currentActionData.buttons}
handleClick = {() => {setCurrentActionData(null)}}
handleClick = {handleClose}
/>}

</div>
Expand Down
14 changes: 13 additions & 1 deletion front-end/GoodOldMap/src/pages/MainMap/MainMap.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import { MapContainer, TileLayer, useMap } from 'react-leaflet'

const MainMap = () => {
return(
<>
main map page
<MapContainer className='h-full' center={[51.505, -0.09]} zoom={13} scrollWheelZoom={false}>
<TileLayer
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
{/* <Marker position={[51.505, -0.09]}>
<Popup>
A pretty CSS3 popup. <br /> Easily customizable.
</Popup>
</Marker> */}
</MapContainer>
</>
)
}
Expand Down
21 changes: 21 additions & 0 deletions front-end/GoodOldMap/src/pages/MainMap/MapLayout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Outlet } from "react-router-dom";
import FormInput from "../../components/form/formInput";

const MapLayout = () => {
return (
<>
<div className="h-screen flex flex-col">
<nav className="py-[2vh] px-[5%] w-full bg-white flex flex-row justify-between">
{/* TODO: search bar and user img goes here, below is sample search bar*/}
<FormInput placeholder="search for city"/>
{/* TODO: timeline goes here */}
</nav>
<div className='w-full h-full'>
<Outlet />
</div>
</div>
</>
);
};

export default MapLayout;

0 comments on commit 2b94297

Please sign in to comment.