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

eGo #53

Open
wants to merge 280 commits into
base: main
Choose a base branch
from
Open

eGo #53

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
280 commits
Select commit Hold shift + click to select a range
0996700
added points model and added user as required for the travel model
kathinka Jun 2, 2024
c68c869
Merge pull request #5 from kathinka/update-points
El1an3 Jun 2, 2024
25d899b
added endpoint to update user points in user model
kathinka Jun 2, 2024
bf60836
Merge pull request #6 from vittoriamatteoli/error-messages
kathinka Jun 2, 2024
cf25df0
Merge branch 'main' of https://github.com/vittoriamatteoli/project-final
kathinka Jun 2, 2024
6db7677
added loading spinner
El1an3 Jun 2, 2024
94fc3d9
Added styled button, replaced buttons in login, logour and register. …
kathinka Jun 2, 2024
8168e02
changes server endpoints to retrieve id
vittoriamatteoli Jun 2, 2024
5060b23
functionality to fetch and display energy level
vittoriamatteoli Jun 2, 2024
4e2f5d0
removed authorizeUser from patch request /energy
vittoriamatteoli Jun 2, 2024
9de2c9e
added some styling energycard
vittoriamatteoli Jun 2, 2024
1e468d2
set up energy level section + functionality
vittoriamatteoli Jun 2, 2024
324c837
Energyslider:
kathinka Jun 2, 2024
6a78352
Merge branch 'pointsmodel'
kathinka Jun 2, 2024
88c180d
update[Backend] add default avatar array & random avatar function & a…
Yifan-858 Jun 3, 2024
aea1f7f
update[Frontend] add logic in Avatar component to fetch avatar img
Yifan-858 Jun 3, 2024
39b0360
updated /user/:id
vittoriamatteoli Jun 3, 2024
2328ce5
debugging
vittoriamatteoli Jun 3, 2024
2eee407
debugging
vittoriamatteoli Jun 3, 2024
d5d332f
debugging-can't retrieve id from the response
vittoriamatteoli Jun 3, 2024
3f02b31
mobile styling login ann register
kathinka Jun 3, 2024
6c553b8
Add required field for user in travel model, update login page to nav…
kathinka Jun 3, 2024
9a6229c
Merge branch 'energy-slider'
kathinka Jun 3, 2024
0b72bc0
debugging
vittoriamatteoli Jun 3, 2024
c99a094
fixed energy retrieve and update- removed buggy API
vittoriamatteoli Jun 3, 2024
87daf38
styling sidebar + retrieve username + updated logo
vittoriamatteoli Jun 4, 2024
592f03f
created and styled about page
vittoriamatteoli Jun 4, 2024
ca27468
added world
vittoriamatteoli Jun 4, 2024
69d906a
update[FE]setup logic for fetching the avatar image in Avatar component
Yifan-858 Jun 4, 2024
be7d36d
finished design mobile about page
vittoriamatteoli Jun 4, 2024
bdf78cd
Merge pull request #9 from kathinka/button
vittoriamatteoli Jun 4, 2024
67cab7e
Merge pull request #7 from vittoriamatteoli/pointsmodel
vittoriamatteoli Jun 4, 2024
227a919
Merge pull request #8 from vittoriamatteoli/loading-spinner
vittoriamatteoli Jun 4, 2024
312ec8d
added global styles and styled login and register page. added favic…
kathinka Jun 5, 2024
56f4b0a
build
kathinka Jun 5, 2024
03f8344
add images to public folder
kathinka Jun 5, 2024
1f8c634
Merge branch 'style-login-register-page'
kathinka Jun 5, 2024
d91a184
merge styling with main - fresh build
kathinka Jun 5, 2024
ee43b62
install mui/icons-material
Yifan-858 Jun 5, 2024
7c33091
add mui dependencies
Yifan-858 Jun 5, 2024
596b791
Merge pull request #14 from vittoriamatteoli/cloudinary-setup
Yifan-858 Jun 5, 2024
f85e854
Merge branch 'main' into aboutpage
vittoriamatteoli Jun 5, 2024
a9e90a9
Merge pull request #15 from vittoriamatteoli/aboutpage
vittoriamatteoli Jun 5, 2024
08d7212
Merge branch 'main' into sidebar
vittoriamatteoli Jun 5, 2024
8470ac0
Merge pull request #13 from vittoriamatteoli/sidebar
vittoriamatteoli Jun 5, 2024
ad7a8e6
chore: Refactor BatterySlider component and update Button component
kathinka Jun 5, 2024
c6350ba
moved button from components to reusables
kathinka Jun 5, 2024
d194c3b
merge sidebar
vittoriamatteoli Jun 5, 2024
f247d09
Merge branch 'main' into energy-be
vittoriamatteoli Jun 5, 2024
42ab8fe
Merge pull request #12 from vittoriamatteoli/energy-be
vittoriamatteoli Jun 5, 2024
a8ddfdc
merge energy card
vittoriamatteoli Jun 5, 2024
d7e974f
fixed routes for avatar and energyslider (and upcoming components), a…
kathinka Jun 5, 2024
2d09f75
Fix routes so we can have multiple components on the same page using …
kathinka Jun 5, 2024
ee6a9fe
format
kathinka Jun 5, 2024
bebacd5
Fix routes so we can have multiple components on the same page using …
kathinka Jun 5, 2024
701d631
fresh build
kathinka Jun 5, 2024
d4dd817
Refactor BatterySlider component, update Button component, and handle…
kathinka Jun 5, 2024
6429ad7
Merge branch 'main' of https://github.com/kathinka/project-final into…
kathinka Jun 5, 2024
4147815
Merge branch 'main' into style-login-register-page
Yifan-858 Jun 6, 2024
746ed37
Merge pull request #16 from kathinka/style-login-register-page
Yifan-858 Jun 6, 2024
062a984
Merge branch 'main' into routes-avatar
Yifan-858 Jun 6, 2024
b81cf3f
Merge pull request #17 from vittoriamatteoli/routes-avatar
Yifan-858 Jun 6, 2024
998334d
fix closing tag
Yifan-858 Jun 6, 2024
6e42e43
solved conflicts
vittoriamatteoli Jun 6, 2024
c1e7636
styled sidebar and changed structure according to new components
vittoriamatteoli Jun 6, 2024
001f169
Merge remote-tracking branch 'origin/main' into Google-API-setup
Yifan-858 Jun 6, 2024
23e9913
Merge pull request #18 from vittoriamatteoli/sidebarStyle
Yifan-858 Jun 6, 2024
e9b31d3
Merge remote-tracking branch 'origin/main' into Google-API-setup
Yifan-858 Jun 6, 2024
dcde759
add basic structure to TravelCard
Yifan-858 Jun 6, 2024
eead102
started dashboard styling +points card
vittoriamatteoli Jun 6, 2024
1e59f04
Merge pull request #19 from vittoriamatteoli/Google-API-setup
vittoriamatteoli Jun 6, 2024
8a8ea31
Merge branch 'main' into dashboardStyle
vittoriamatteoli Jun 6, 2024
2e5082c
Merge pull request #20 from vittoriamatteoli/dashboardStyle
vittoriamatteoli Jun 6, 2024
1e15d20
styling dashboard
vittoriamatteoli Jun 6, 2024
30de23a
add google route API & google-autocomplete search boxes & travel mode…
Yifan-858 Jun 6, 2024
cf7c1b9
Merge branch 'main' of https://github.com/kathinka/project-final into…
kathinka Jun 6, 2024
68bf927
adjusted design to new figmafile and fixed conflicts
kathinka Jun 6, 2024
7ae5f5c
Merge branch 'main' of https://github.com/vittoriamatteoli/project-fi…
kathinka Jun 6, 2024
33a89db
format
kathinka Jun 6, 2024
057dd6d
add handleConfirm to replace useEffect & update logic+style of autoco…
Yifan-858 Jun 6, 2024
dff9e2b
created pointsCard & battery-popup & fixed styling
vittoriamatteoli Jun 7, 2024
013ad01
adjusted route for button in logout page
vittoriamatteoli Jun 7, 2024
b3946c8
add react-google-autocomplete in FE package.json
Yifan-858 Jun 7, 2024
2583aa6
Refactor BatterySlider component, update Button component, and handle…
kathinka Jun 7, 2024
3b6fa0f
fresh build
kathinka Jun 7, 2024
da73ffc
update package and build
kathinka Jun 7, 2024
cbc849b
typo fix
kathinka Jun 7, 2024
04d725e
added typo in import url
kathinka Jun 7, 2024
f73829f
ugh- temoved the mui icons as its import keeps breaking the deploy
kathinka Jun 7, 2024
96a86b9
chore: Import IconButton from MUI for TravelForm component
kathinka Jun 7, 2024
943230f
removed brackets from import as its a default export
kathinka Jun 7, 2024
787b5fe
styled top and middle section, responsive
El1an3 Jun 7, 2024
e6f7c67
Merge branch 'style-login-register-page' into main
kathinka Jun 7, 2024
043ccc6
styled bottom section
El1an3 Jun 7, 2024
2b78f1c
fixed bottom part and sign up button
El1an3 Jun 7, 2024
393367c
fix für 320px width
El1an3 Jun 7, 2024
5d9ef3b
fixed styling battery
vittoriamatteoli Jun 7, 2024
697b382
Merge pull request #26 from vittoriamatteoli/dashboardStyle1
vittoriamatteoli Jun 7, 2024
445b2df
update styling with grids grids grids to support move devices
kathinka Jun 7, 2024
d298927
added touch even listeners to battery slider
vittoriamatteoli Jun 8, 2024
c44336b
Merge branch 'main' into Google-API-setup
vittoriamatteoli Jun 8, 2024
d23f9c2
Merge pull request #24 from vittoriamatteoli/Google-API-setup
vittoriamatteoli Jun 8, 2024
8b75deb
Merge branch 'main' into landing-page
vittoriamatteoli Jun 8, 2024
759674e
Merge pull request #25 from vittoriamatteoli/landing-page
vittoriamatteoli Jun 8, 2024
2e76db3
Merge pull request #27 from vittoriamatteoli/dashboardStyle1
vittoriamatteoli Jun 8, 2024
f3732ce
Merge branch 'main' of https://github.com/vittoriamatteoli/project-fi…
kathinka Jun 8, 2024
b69eecd
removed duplicates and unused files
kathinka Jun 8, 2024
1b34576
formatting and removed duplicate files
kathinka Jun 8, 2024
52bc751
fixed button logic for disabeling button on login
kathinka Jun 8, 2024
c6f42fb
fixed new ref to new globe
kathinka Jun 8, 2024
d559dee
added travelform again as it seems to be in use
kathinka Jun 8, 2024
5aeedb3
Merge pull request #28 from kathinka/freshpull
kathinka Jun 8, 2024
6557b81
styled responsiveness and added link to back arrow
El1an3 Jun 8, 2024
ef8904f
BE updated travel model and added new routes
vittoriamatteoli Jun 8, 2024
45ca42b
loader button styling tweak
kathinka Jun 8, 2024
690554c
small adjustments on the size of the globe
kathinka Jun 8, 2024
1482038
Merge pull request #32 from vittoriamatteoli/freshpull
kathinka Jun 8, 2024
8a8af69
fixed overflow issue on landingpage (new globe new issues)
kathinka Jun 8, 2024
f0bed79
Merge pull request #33 from vittoriamatteoli/freshpull
kathinka Jun 8, 2024
9c3b319
add postTravelData & change travelPoint to direct display without con…
Yifan-858 Jun 8, 2024
bfa6bf7
fixed about us route, and duplicate avatar name
kathinka Jun 8, 2024
5898f65
Merge pull request #34 from vittoriamatteoli/freshpull
kathinka Jun 8, 2024
e96707b
added import of about page
kathinka Jun 8, 2024
d9f7b12
Merge pull request #35 from vittoriamatteoli/freshpull
kathinka Jun 8, 2024
111636a
Merge branch 'main' into travel-routes
Yifan-858 Jun 8, 2024
b9ca5a4
Merge pull request #31 from vittoriamatteoli/travel-routes
Yifan-858 Jun 8, 2024
d707423
merge origin
Yifan-858 Jun 8, 2024
9aa5633
updated postTravelData request body according to new routes
Yifan-858 Jun 8, 2024
4c736fe
Made a backarrow component who will take the user back one page in hi…
kathinka Jun 8, 2024
5cbb3d8
Merge branch 'main' of https://github.com/vittoriamatteoli/project-fi…
kathinka Jun 8, 2024
b67cd0c
Merge pull request #36 from vittoriamatteoli/freshpull
kathinka Jun 8, 2024
ebda2a7
Merge branch 'main' into about-page
El1an3 Jun 8, 2024
743fbb1
Merge pull request #30 from vittoriamatteoli/about-page
El1an3 Jun 8, 2024
09610b0
add Distance display
Yifan-858 Jun 8, 2024
5147f00
Merge remote-tracking branch 'origin/main' into store-travel-data-FE
Yifan-858 Jun 8, 2024
d6f3852
add notes
Yifan-858 Jun 8, 2024
a1bb4d5
installed google autocomplete
vittoriamatteoli Jun 8, 2024
e5ca8b9
updated Readme file
vittoriamatteoli Jun 8, 2024
ec54089
add animation on the travel confirm button
Yifan-858 Jun 9, 2024
11de4f2
linked logo and fixed button text
El1an3 Jun 9, 2024
6a053ba
linked logo on register
El1an3 Jun 9, 2024
e74aa5b
linked logo in sidebar
El1an3 Jun 9, 2024
343b56a
chart for travel history
vittoriamatteoli Jun 9, 2024
8d49ac4
get back MUI Button and unified the button style in both cards
Yifan-858 Jun 9, 2024
d5b9e1f
Merge pull request #37 from vittoriamatteoli/store-travel-data-FE
Yifan-858 Jun 9, 2024
07feec0
update the style for the search boxes
Yifan-858 Jun 9, 2024
d7c0424
added logo in points card and linked it to landing
El1an3 Jun 9, 2024
c26fb2a
update reponsiveness on font-size in both cards
Yifan-858 Jun 9, 2024
3046761
Update button text in Login page to "Sign in" instead of "Sign up". …
kathinka Jun 9, 2024
079b03f
pull
Yifan-858 Jun 9, 2024
314859e
Merge pull request #39 from vittoriamatteoli/logo-functionality
vittoriamatteoli Jun 10, 2024
19f886a
created mobile header
vittoriamatteoli Jun 10, 2024
7733212
Merge pull request #38 from vittoriamatteoli/chart
vittoriamatteoli Jun 10, 2024
bc73da5
adjusted cards on dashboard
vittoriamatteoli Jun 10, 2024
2adfd0f
Merge branch 'main' of https://github.com/vittoriamatteoli/project-final
kathinka Jun 10, 2024
d49e758
fixed small typo
kathinka Jun 10, 2024
81aed2a
Merge pull request #41 from vittoriamatteoli/header-mobile
vittoriamatteoli Jun 10, 2024
df50e08
fixed buttons on landing, added rippleeffect, updated styles.
kathinka Jun 10, 2024
03c298a
Update button styles and typography in Login and Register pages
kathinka Jun 10, 2024
f972c0c
Update button styles and typography in Login and Register pages - fix…
kathinka Jun 10, 2024
3488022
fresh build
kathinka Jun 10, 2024
f1770e5
fresh pull from team main
kathinka Jun 10, 2024
1db564c
Merge pull request #40 from vittoriamatteoli/dashcontext-and-calculat…
kathinka Jun 10, 2024
5c53447
Revert "its all connected: read the description 👇🏼"
vittoriamatteoli Jun 11, 2024
80176c0
Merge pull request #42 from vittoriamatteoli/revert-40-dashcontext-an…
vittoriamatteoli Jun 11, 2024
7aeb17a
pushing changes from PR40 but not the styling
vittoriamatteoli Jun 11, 2024
df6e339
Merge pull request #43 from vittoriamatteoli/point-calc-kathinka
vittoriamatteoli Jun 11, 2024
2b260fd
commented out Ripple
vittoriamatteoli Jun 11, 2024
8db0585
Merge remote-tracking branch 'origin/main' into button-animation
Yifan-858 Jun 11, 2024
8896194
pulled and cleaned up
Yifan-858 Jun 11, 2024
004c032
size adjustment
Yifan-858 Jun 11, 2024
0bd9222
pulled changes and merged
vittoriamatteoli Jun 11, 2024
19f2c37
add aria-label to buttons
Yifan-858 Jun 11, 2024
5d42f5f
responsiveness dashboard
vittoriamatteoli Jun 11, 2024
d6e8661
Merge pull request #45 from vittoriamatteoli/dashboard-responsiveness
vittoriamatteoli Jun 11, 2024
12edb4a
Merge branch 'main' into button-animation
vittoriamatteoli Jun 11, 2024
e2875ce
Merge pull request #44 from vittoriamatteoli/button-animation
vittoriamatteoli Jun 11, 2024
078f501
tweaks
kathinka Jun 11, 2024
827d7db
small typo
kathinka Jun 11, 2024
a29f1f8
small adjustment to cards to adjust size due added text
vittoriamatteoli Jun 11, 2024
766a21e
adjusted style on graph + minor errors
vittoriamatteoli Jun 11, 2024
cffff62
fixed button on landing page
kathinka Jun 11, 2024
450e533
Merge pull request #46 from vittoriamatteoli/cards-style
Yifan-858 Jun 11, 2024
5f2b5eb
Merge pull request #47 from vittoriamatteoli/graph
Yifan-858 Jun 11, 2024
405d070
buttonupdate hover styles
kathinka Jun 11, 2024
904911e
add missing token in BatterySlider
Yifan-858 Jun 11, 2024
3379d4b
add a confirm indicator in BatterySlider
Yifan-858 Jun 11, 2024
6667668
fixed some minor errors
Yifan-858 Jun 11, 2024
12afadc
adjust the travel icons and the texts in TravelForm
Yifan-858 Jun 11, 2024
8f89210
fix extra s
Yifan-858 Jun 11, 2024
2f5dcce
Merge pull request #48 from vittoriamatteoli/battery-update-effect
Yifan-858 Jun 12, 2024
4075a1f
Merge pull request #49 from vittoriamatteoli/travel-mode-icon-flow
Yifan-858 Jun 12, 2024
d21457e
no select on middle section, fixed overlap, deleted logo link
El1an3 Jun 12, 2024
0d404db
deleted outcommented code
El1an3 Jun 12, 2024
d924a14
adding UserFlowArrow, only rendered on Desktop/Tablet
El1an3 Jun 12, 2024
c29ca87
fix size globe, fonts, beige shadow, and select none on globe login/r…
El1an3 Jun 12, 2024
3642f9c
fixed battery dragging
vittoriamatteoli Jun 13, 2024
ecc1e8b
Merge pull request #50 from vittoriamatteoli/landing-fixes
vittoriamatteoli Jun 13, 2024
2d7050a
Merge pull request #51 from vittoriamatteoli/userflow-arrow
vittoriamatteoli Jun 13, 2024
90b03f6
Merge pull request #52 from vittoriamatteoli/login-register-fixes
vittoriamatteoli Jun 13, 2024
6fbefe5
center globe on landing
El1an3 Jun 13, 2024
990ff2e
made background scrollable on about us. fixed globe to the bottom of …
El1an3 Jun 13, 2024
34d83e5
Update README.md
vittoriamatteoli Jun 13, 2024
21b5e61
Update button styles and typography in Login and Register pages
kathinka Jun 13, 2024
906b89d
styling fixes for very small screen iphone 5s/se
El1an3 Jun 13, 2024
646f085
Merge branch 'main' of https://github.com/vittoriamatteoli/project-fi…
kathinka Jun 13, 2024
6d49b98
styling fixes
El1an3 Jun 13, 2024
5f930f6
Merge pull request #54 from vittoriamatteoli/styling
El1an3 Jun 13, 2024
c96e6f5
animation for points update
El1an3 Jun 14, 2024
f326656
styled username and sidebar for mobile, tablet, desktop
El1an3 Jun 14, 2024
649c85f
styled pointscard for mob/tablet/desk
El1an3 Jun 14, 2024
4c61763
styled energy card
El1an3 Jun 14, 2024
7ac117c
styled travel card, centered arrow
El1an3 Jun 14, 2024
eecc424
sidebar smaller to make sure travelform is not cut
El1an3 Jun 14, 2024
892e4a7
styled chart
El1an3 Jun 14, 2024
22497c0
Merge pull request #53 from vittoriamatteoli/battery-drag
vittoriamatteoli Jun 15, 2024
4308b0d
Merge pull request #55 from vittoriamatteoli/dashboard-update-animation
vittoriamatteoli Jun 15, 2024
83a9489
Merge pull request #56 from vittoriamatteoli/styling-dashboard
vittoriamatteoli Jun 15, 2024
a7f5ab3
mobile-graph with popup
vittoriamatteoli Jun 15, 2024
2c73c7b
fixed popup for graph
vittoriamatteoli Jun 15, 2024
b522c1b
Merge pull request #57 from vittoriamatteoli/graph-fixing
vittoriamatteoli Jun 15, 2024
0435316
set up pop-up default closed
vittoriamatteoli Jun 15, 2024
51c683d
added accessibility
vittoriamatteoli Jun 15, 2024
beeff05
Merge pull request #58 from vittoriamatteoli/accessibility
vittoriamatteoli Jun 15, 2024
f2b3f53
deleted unused files, structured svg in folders, rerouted
El1an3 Jun 16, 2024
4e4cbf9
added tonl file
vittoriamatteoli Jun 16, 2024
a502e11
Merge pull request #59 from vittoriamatteoli/code-cleaning
El1an3 Jun 16, 2024
7a0d032
updated the readme file
vittoriamatteoli Jun 16, 2024
b701e6d
removed consol-logs
vittoriamatteoli Jun 16, 2024
7b8c9e0
switched png to svg, adjusted alignment graph
vittoriamatteoli Jun 16, 2024
253d2b9
Merge pull request #60 from vittoriamatteoli/console-log
El1an3 Jun 16, 2024
e470fe1
Merge pull request #61 from vittoriamatteoli/fixes
El1an3 Jun 16, 2024
5049e50
fixed position of BatteryUpdateIcon
El1an3 Jun 16, 2024
3b112b0
Merge pull request #62 from vittoriamatteoli/battery
El1an3 Jun 16, 2024
f17b9db
Merge branch 'main' of https://github.com/vittoriamatteoli/project-fi…
kathinka Jun 17, 2024
38d10b2
admin styles
kathinka Jun 17, 2024
6d89ea0
Merge branch 'styling-admin' into update
kathinka Jun 17, 2024
c95e3bd
removed issue with extra </link>
kathinka Jun 17, 2024
5b791f9
Update Dashboard.jsx
kathinka Jun 17, 2024
2512873
Update Landing.jsx
kathinka Jun 17, 2024
5244fb0
Update BatterySlider.jsx
kathinka Jun 17, 2024
0e38703
Update Button.jsx
kathinka Jun 17, 2024
89cae54
Update Sidebar.jsx
kathinka Jun 17, 2024
2b910e2
Merge pull request #63 from kathinka/update
vittoriamatteoli Jun 17, 2024
8620ee5
fixed issue with admin dash due to password validation failing becaus…
kathinka Jun 18, 2024
f6e9545
Merge branch 'update' of https://github.com/kathinka/project-final in…
kathinka Jun 18, 2024
1bb2142
cleanup - added reset of formfields and removed unused code
kathinka Jun 18, 2024
03df9a2
Merge pull request #64 from kathinka/update
kathinka Jun 18, 2024
98cbf1c
fixed logo & graph on dashboard
vittoriamatteoli Jun 25, 2024
d882a31
Merge pull request #65 from vittoriamatteoli/chart-loading
vittoriamatteoli Jun 25, 2024
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
3 changes: 3 additions & 0 deletions .vscode/settings.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add this to .gitignore and delete the folder 🧹

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.tabSize": 2
}
62 changes: 55 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,61 @@
# Final Project
<h1 align="center">Welcome to eGo 👋</h1>
<p>
<a href="https://project-final-1-4w43.onrender.com" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a>
</p>

Replace this readme with your own information about your project.
> eGo is a mobile app that rewards eco-friendly travel choices. Integrated with the Google Routing API, it suggests low-emission routes for walking, cycling, public transport, and carpooling. Users earn &#34;Green Points&#34; for sustainable travel.
> Developed with React, MongoDB, and styled-components, eGo tracks carbon footprint reduction and helps users set sustainability goals.

Start by briefly describing the assignment in a sentence or two. Keep it short and to the point.
### ✨ [Demo](https://ego-app.netlify.app/)

## The problem
## Tech stack
<ul>
<li>Styled-components</li>
<li>Material UI </li>
<li>Cloudinary</li>
<li>Chart.js</li>
<li>React-google-autocomplete</li>
<li>React-joyride</li>
</ul>

Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next?
## Development process

## View it live
## 1 Step
We designed the interface in Figma, established the primary database models, and set up the main server routes.
## 2 Step
We set up all the backend endpoints for user registration and login, and on the frontend, we implemented the forms and main component.
## 3 Step
We implemented a model for travels and stored points in the backend. On the frontend, we integrated all necessary travel forms, graphs, and components.
## 4 Step
We integrated the admin functionality and its dashboard and worked on the final documentation.To make the whole app more user-friendly we integrated a walkthrough.

Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about.
## Extra features
If we had more time we would start integrate the following features:
- Rewards for points
- Weather data
- Add a function for display the password to the user when they log in
- AI coach integration.
- Add function for the user to upload their profile image to Cloudinary.
- Integrate carbon footprints API.

## Install

```sh
npm install
```

## Usage

```sh
npm run dev
```

## Author

👤 ** [Yifan](https://github.com/Yifan-858) - [Kathinka](https://github.com/kathinka) - [Eliane ](https://github.com/El1an3 ) - [Vittoria](https://github.com/vittoriamatteoli)**

## Show your support

Give a ⭐️ if this project helped you!
15 changes: 15 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

build

npm-debug.log*
yarn-debug.log*
yarn-error.log*

package-lock.json
73 changes: 73 additions & 0 deletions backend/middleware/middleware.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import User from "../models/user-model.js"
import dotenv from "dotenv"
import jwt from "jsonwebtoken"

dotenv.config()
const SECRET = process.env.SECRET || "toast is the best secret"

const authenticateUser = async (req, res, next) => {
try {
const authHeader = req.header("Authorization")
if (!authHeader) {
return res.status(401).json({
loggedOut: true,
message: "Authorization header is missing",
})
}

const parts = authHeader.split(" ")
if (parts.length !== 2 || parts[0] !== "Bearer") {
return res.status(401).json({
loggedOut: true,
message: "Invalid authorization format. Expected 'Bearer <token>'",
})
}

const accessToken = parts[1]
req.accessToken = accessToken // add the token to the request object in case we need it for later use in other middlewares..

const decoded = jwt.verify(accessToken, SECRET)
if (!decoded) {
return res.status(403).json({
message: "Invalid access token",
})
}
const user = await User.findOne({ _id: decoded.id , role:decoded.role});
if (!user) {
return res.status(404).json({
message: "User not found",
})
}
req.user = user
next()
} catch (error) {
res.status(403).json({ message: "Access forbidden", error: error.message })
}
}

// add authorization to the routes that need it, if we want to make an GUI for the admins who can see all users and their data and preform operations on the data - or if we want some kind of superusers (paid access for instance - but then we need to add "roles" to the user model)

const authorizeUser = (role) => {
return (req, res, next) => {
if (!role.includes(req.user.role)) {
return res.status(403).json({ message: "Access forbidden" });
}
next()
}
}

// log out the user (and lets remmeberdelete the session token)
const signOut = async (req, res) => {
try {
const user = req.user
// option to add the used token to a blacklist if we want to set that up
//option to add a refresh token if we want the service to "remember" the user and keep the user logged in for a longer period of time.
//user.refreshToken = null;
//await user.save();
res.json({ message: "User logged out successfully" })
} catch (error) {
res.status(500).json({ message: "Error logging out", error: error.message })
}
}

export { authenticateUser, authorizeUser, signOut }
26 changes: 26 additions & 0 deletions backend/models/points-model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import mongoose from 'mongoose';

const pointsSchema = new mongoose.Schema({
points: {
type: Number,
required: [true, "Points is required"],
min: [0, "Points cannot be negative"],
},
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
requred: [true, "User is required"],
},
travel: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Travel',
required: [true, "Travel is required"],
},
date:{
type: Date,
required: [true, "Date is required"],
default: Date.now,
},
});

export default mongoose.model('Points', pointsSchema);
52 changes: 52 additions & 0 deletions backend/models/travel-model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import mongoose from "mongoose";
import { updatePoints } from "../utils/updatePoints";

const travelSchema = new mongoose.Schema({
distance: {
type: Number,
required: [true, "Distance is required"],
min: [0, "Distance cannot be negative"],
},
mode: {
type: String,
enum: ["DRIVE", "BICYCLE", "WALK", "TRANSIT"],
required: [true, "Way of travel is required"],
},
date: {
type: Date,
default: () => Date.now(),
},
origin: {
type: String,
required: [true, "Start location is required"],
},
destination: {
type: String,
required: [true, "End location is required"],
},
user: {
type: mongoose.Schema.Types.ObjectId,
ref: "User",
required: [true, "User is required"],
},
travelPoints: {
type: Number,
required: [true, "Travel points are required"],
},
});

// Update user's points after saving a travel
travelSchema.post("save", function (doc, next) {
const userId = doc.user;
const travelId = doc._id;
const travelPoints = doc.travelPoints;
console.log("calculated points by travelschema:", travelPoints);
console.log("userId by travelschema:", userId);
console.log("travelId by travelschema:", travelId);

updatePoints(userId, travelId, travelPoints)
.then(() => next())
.catch((err) => next(err));
});

export default mongoose.model("Travel", travelSchema);
86 changes: 86 additions & 0 deletions backend/models/user-model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import mongoose from "mongoose";
import bcryptjs from "bcryptjs";
import { getRandomAvatarUrl } from "../utils/avatarUtils.js";

const SALT_ROUNDS = 12; // make this configurable so we can adjust the security level if needed

const userSchema = new mongoose.Schema({
username: {
type: String,
required: [true, "Username is required"],
minlength: [3, "Username must be at least 3 characters long"],
maxlength: [30, "Username must be at most 30 characters long"],
unique: true,
},
email: {
type: String,
required: [true, "Email is required"],
unique: true,
match: [/\S+@\S+\.\S+/, "Email is invalid"],
},
password: {
type: String,
required: [true, "Password is required"],
minlength: [6, "Password must be at least 6 characters long"],
},
role: {
type: String,
default: "user",
},
// optional field for a refresh token if we want to keep the user logged in for a longer period of time
//refreshToken: {
// type: String,
// default: null,
// },

points: {
type: Number,
default: 0,
},
energyLevel: {
type: Number,
default: 5,
},
avatarUrl: {
type: String,
default: function () {
return getRandomAvatarUrl();
},
},
});
//update the users travelpoints after saving a travel
userSchema.methods.incrementPoints = function (points) {
return this.model("User")
.updateOne({ _id: this._id }, { $inc: { points: points } })
.then(() => {
console.log(
`Points incremented by ${points}. New points: ${this.points + points}`
);
})
.catch((error) => {
console.error(`Error incrementing points: ${error}`);
});
};

//this uses matchPassword method to compare the entered password with the hashed password in the database
userSchema.methods.matchPassword = async function (enteredPassword) {
return await bcryptjs.compare(enteredPassword, this.password);
};
//This adds a pre-save (pre) hook to hash the password *before* saving it to the database so we don't store the password in plain text
userSchema.pre("save", async function (next) {
// we only hash the password if it has been modified (or is new)
if (!this.isModified("password")) {
return next();
}

this.password = await bcryptjs.hash(this.password, SALT_ROUNDS);

// set a random avatar URL for new users
if (this.isNew) {
this.avatarUrl = this.avatarUrl || getRandomAvatarUrl();
}

next();
});

export default mongoose.model("User", userSchema);
18 changes: 12 additions & 6 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
"author": "",
"license": "ISC",
"dependencies": {
"@babel/core": "^7.17.9",
"@babel/node": "^7.16.8",
"@babel/preset-env": "^7.16.11",
"@babel/core": "^7.24.6",
"@babel/node": "^7.24.6",
"@babel/preset-env": "^7.24.6",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"express": "^4.17.3",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"express-list-endpoints": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"jwt-decode": "^4.0.0",
"mongoose": "^8.4.0",
"nodemon": "^3.0.1"
"nodemon": "^3.1.2",
"react-google-autocomplete": "^2.7.3"
}
}
}
Loading