Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#251-project #257

Open
wants to merge 45 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
67c73a9
add weather app first steps #251
angelabernaldz Dec 8, 2024
2374b93
add landing and login page, loginform, errors and more #251
angelabernaldz Dec 10, 2024
6104a0e
add loginform, signupform, modals, data models and css #251
angelabernaldz Dec 11, 2024
8570cbc
add register user logic api #251
angelabernaldz Dec 12, 2024
3a73e76
add env variables to .gitignore #251
angelabernaldz Dec 12, 2024
1ffe0df
Stopped tracking .env File
angelabernaldz Dec 12, 2024
a38a31f
remove gitignore from api #251
angelabernaldz Dec 12, 2024
bcfb19c
add authenticate user api #251
angelabernaldz Dec 13, 2024
58e2f91
add delete user api, delete user tests and authenticate user tests #251
angelabernaldz Dec 13, 2024
dbac065
add registerUser logic app #251
angelabernaldz Dec 13, 2024
89c5cd3
fix issues and add pages new structure #251
angelabernaldz Dec 18, 2024
0844e35
add minor changes to app and add user location logic #251
angelabernaldz Dec 21, 2024
12ba572
add another add user location test + minor things on app #251
angelabernaldz Dec 21, 2024
5ab5c46
get all user locations logic #251
angelabernaldz Dec 23, 2024
acb1669
add user location and get all locations handlers #251
angelabernaldz Dec 26, 2024
101ae2d
resolve add user locations and get user info #251
angelabernaldz Dec 26, 2024
d6990d7
add retrieve locations nominatim api first steps and minor changes #251
angelabernaldz Dec 26, 2024
7b76ea1
add minor changes to login and signup form #251
angelabernaldz Jan 1, 2025
d2c3ed3
add front logic to get all user saved locations #251
angelabernaldz Jan 1, 2025
48e1df5
add last changes #251
angelabernaldz Jan 11, 2025
6ade390
add baby steps to front and some bits to logic #251
angelabernaldz Jan 20, 2025
26682ee
add city weather cards baby steps + logic #251
angelabernaldz Jan 21, 2025
9ec7f27
fix nominatim api issues #251
angelabernaldz Jan 29, 2025
cdf9ec3
add nominatim api logic handlers baby steps #251
angelabernaldz Jan 31, 2025
28cdb65
add location search box logic and more #251
angelabernaldz Feb 1, 2025
4a228da
add search box comments to implement things #251
angelabernaldz Feb 5, 2025
a0d528f
fix searchbar locations #251
angelabernaldz Feb 5, 2025
7afd5d9
finish location search box and render locations after adding a new on…
angelabernaldz Feb 11, 2025
495c5ef
add first steps update weather data and change some styles #251
angelabernaldz Feb 12, 2025
b024454
add small changes & homepage new structure #251
angelabernaldz Feb 17, 2025
f7ec843
add current location functionality and fix minor issues #251
angelabernaldz Feb 17, 2025
25522df
continue adding current location functionality + fix minor issues #251
angelabernaldz Feb 18, 2025
beb747a
add bring current location to front end #251
angelabernaldz Feb 19, 2025
47fc6b8
finish retrieve weather data and continue implementing logic to updat…
angelabernaldz Feb 19, 2025
2f9f6bd
add first icons #251
angelabernaldz Feb 20, 2025
3f17ee0
add more icons #251
angelabernaldz Feb 20, 2025
0cd68d2
add more weather icons #251
angelabernaldz Feb 21, 2025
b330e97
add modifications to retrieveWeatherData and updateWeatherData - some…
angelabernaldz Feb 21, 2025
9c5ecd2
finalise adding all weather icons #251
angelabernaldz Feb 22, 2025
dfcf661
add logic to dinamically get weather icon based on weather code #251
angelabernaldz Feb 22, 2025
4a53460
add retrieve weather data and update weather for location to front en…
angelabernaldz Feb 22, 2025
675d12c
add current location weather box to fron end #251
angelabernaldz Feb 23, 2025
d6496a0
add improvements to suninfo box #251
angelabernaldz Feb 24, 2025
1a7ba4d
add header and location search box inside header #251
angelabernaldz Feb 26, 2025
becbb73
solve issue with mixing icon classes and add icons to all location ca…
angelabernaldz Feb 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add city weather cards baby steps + logic #251
angelabernaldz committed Jan 21, 2025
commit 26682eeb4f96df1878a0b6cdf266630d4ff4d960
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
function LocationCard() {
function LocationCard({locationName, temperature}) {
// I guess I´d need to pass as an argument of this function the location data
// location name, min and max temperature, etc.

// this component is to be called once for each favlocation for a specfic user
return (
<div>
Location goes here
<div className="bg-slate-500 flex flex-row w-full md:w-1/2 lg:w-1/3 h-[8rem] items-center justify-between mb-6">
<div className="w-2/3 pl-[1rem]">
<h1>{locationName}</h1>
</div>
<div className="w-1/3 text-right pr-[1rem]">
<p>{temperature}</p>
</div>
</div>
)
}
}

export default LocationCard
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import _LocationCard from './LocationCard.jsx'

export const LocationCard = _LocationCard
Original file line number Diff line number Diff line change
@@ -13,6 +13,9 @@ import logic from '../../logic/index.js'

function LogInForm({ onUserLoggedIn, className }) {

// podria quitarme classNames y quitarlo de argumento
// quitar classnames y pasar classname como string dentro (see locationCard ahi esta hecho)

const navigate = useNavigate()

const sendLogInForm = (event) => {
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
import {useState, useEffect} from 'react'

function LocationSearchBox() {

const [lastCall, setLastCall] = useState(Date.now())

const [locations, setLocations] = useState([])
// locations se ira actualizando con lo que me vaya devolviendo nominatim api
// setLocations(..... de lo que me devuelva la api)

// renderizar un menu hacia abajo siempre y cuando haya localizaciones o cambios en las loc

const onChangeInput = (event) => {
event.preventDefault()

const dateNow = Date.now()
console.log(dateNow - lastCall)

if (dateNow - lastCall > 1000) {
setLastCall(dateNow)
// llamada a la nominatim api
// event.target.value
console.log(event.target.value)
}
}

return (
<div>
<input
onChange={onChangeInput}
type="text"
id="locationSearch"
placeholder="Search for a city"
className="input input-bordered input-ghost glass w-full focus:text-white placeholder:text-white placeholder:text-opacity-70"
/>
{/*componente a parte al que le pase como prop locations y lo renderice x cada loc
haciendo un map
y le pongo el useEffect con el locations como variable (antes del return)*/}
</div>
// poner un onchange en lugar de onsubmit
// y poner un settimeout
)
}

Original file line number Diff line number Diff line change
@@ -13,17 +13,17 @@ const getAllUserLocations = () => {
.then((res) => {
if (res.status === 200) return res.json()
.then(body => body.user.favLocations)
return res.json()
.then(body => {
const constructor = Errors[body.name]
throw new constructor(`${body.message}`)
})
return res.json()
.then(body => {
const constructor = Errors[body.name]
throw new constructor(`${body.message}`)
})
})
.catch((error) => {
if (error instanceof Errors.BadRequestError)
throw new Errors.ServerError("Server in not connected")
throw error
});
})
}

export default getAllUserLocations
12 changes: 5 additions & 7 deletions staff/angela-bernaldez/project/app/src/pages/Authenticated.jsx
Original file line number Diff line number Diff line change
@@ -3,13 +3,11 @@ import { Overview } from './authenticatedPages'

function Authenticated({ onUserLoggedOut }) {
return <>
<div className='container'>
<Routes>
<Route path='/overview' element={<Overview onUserLoggedOut={onUserLoggedOut} />} />
{/*Solamente deberia pasar el onuserloggedout a las pags/comp donde esta el boton de log out*/}
</Routes>
</div>
<Outlet />
<Routes>
<Route path='/overview' element={<Overview onUserLoggedOut={onUserLoggedOut} />} />
{/*Solamente deberia pasar el onuserloggedout a las pags/comp donde esta el boton de log out*/}
</Routes>
<Outlet />
</>
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import LocationSearchBox from '../../components/Others/LocationSearchBox'
import LocationCard from '../../components/Cards/LocationCard'

function Overview() {
// do something here
return <div>

return <div className="flex flex-col gap-2 w-full px-14 items-center">
<LocationSearchBox />
<LocationCard locationName="Sevilla" temperature={15}/>
<LocationCard locationName="Madrid" temperature={12}/>
<LocationCard locationName="Brighton" temperature={8}/>
</div>

// mirar el ejemplo en Home.jsx

// bring list of all cities for user logged in
// getAllUserLocations is what I need to call