diff --git a/models/user.py b/models/user.py index b561a3d..3fda0b6 100644 --- a/models/user.py +++ b/models/user.py @@ -1,4 +1,5 @@ class User: + id = 0 name = "" event_preferences = [] event_blacklist = [] @@ -6,12 +7,36 @@ class User: group_size = 0 min_age = 0 max_age = 0 + travel_history = [] # (Name, coordinates) + co2_savings = [] def __init__(self, **kwargs): + self.id = kwargs.pop("id") self.name = kwargs.pop("name") self.home_coordinates = kwargs.pop("home_coordinates") self.event_preferences = kwargs.pop("event_preferences") - self.event_blacklist = kwargs.pop("name") + self.event_blacklist = kwargs.pop("event_blacklist") self.group_size = kwargs.pop("group_size") self.min_age = kwargs.pop("min_age") self.max_age = kwargs.pop("max_age") + + + @property + def number_of_trips(self): + return len(self.travel_history) + + @property + def total_co2_savings(self): + return sum(self.co2_savings) + + +class Users: + _users = [] + + def add_user(self, **kwargs): + self._users.append(User(**kwargs)) + + def get_by_id(self, id): + for u in self._users: + if u.id == id: + return u \ No newline at end of file diff --git a/server.py b/server.py index 9939bdc..bc15cca 100644 --- a/server.py +++ b/server.py @@ -1,37 +1,40 @@ -from flask import Flask, render_template, request, jsonify, make_response, request +from flask import Flask, render_template, request, request, session import random -import time -from flask.templating import render_template_string +from apis.interactive_maps import SwissMap +from models.user import Users + +USERBASE = Users() +USERBASE.add_user(id=239842123, name="Remy", event_preferences=["hiking","skiing"], event_blacklist = [], home_coordinates=[0,0], group_size=1, min_age=20, max_age=20) +MAP = SwissMap() app = Flask(__name__) - -heading = "Lorem ipsum dolor sit amet." - -content = """ -Lorem ipsum dolor sit amet consectetur, adipisicing elit. -Repellat inventore assumenda laboriosam, -obcaecati saepe pariatur atque est? Quam, molestias nisi. -""" - -db = list() # The mock database - -posts = 500 # num posts to generate - -quantity = 20 # num posts to return per request +app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT' @app.route("/") def index(): - """ Route to render the HTML """ + session["user_id"] = 239842123 # a perfectly safe login, hem hem context = { "title" : f"Event title {id}", "image_name" : "fallback.jpg", "star_rating" : random.randint(1,4), "reviews" : random.randint(10,30), - "user" : "Remy" + "user" : USERBASE.get_by_id(session["user_id"]).name } - return render_template("base.html", context=context) + return render_template("event_overview.html", context=context) + + + +@app.route("/profile") +def profile(): + uid = session["user_id"] + user = USERBASE.get_by_id(uid) + + context = { + "map_path" : MAP.travel_history_map(user.id, user.travel_history) + } + return render_template("user_detail.html", conbtext=context, user=user) @@ -48,4 +51,5 @@ def get_event(): return render_template("event_card.html", context=context) + app.run(port=8000, debug=True) \ No newline at end of file diff --git a/static/background.mp4 b/static/background.mp4 new file mode 100644 index 0000000..6351f70 Binary files /dev/null and b/static/background.mp4 differ diff --git a/static/custom-bootstrap-override.css b/static/custom-bootstrap-override.css index b64962c..a0616a5 100644 --- a/static/custom-bootstrap-override.css +++ b/static/custom-bootstrap-override.css @@ -1,9 +1,69 @@ .bg-primary .btn-primary .btn-primary:hover{ - border-color: red; - background-color: red !important; + border-color: #D50505; + background-color: #D50505 !important; } - +.navbar-custom { + background-color: #D50505; +} * { border-radius: 0 !important; +} +.content { + margin-top: 5rem; +} +/* +* +* ========================================== +* CUSTOM UTIL CLASSES +* ========================================== +* +*/ + +.video-background-holder { + position: relative; + background-color: black; + height: 20vh; + width: 100%; + overflow: hidden; + } + + .video-background-holder video { + position: absolute; + top: 20%; + left: 50%; + min-width: 100%; + min-height: 100%; + width: auto; + height: auto; + z-index: 0; + -ms-transform: translateX(-50%) translateY(-50%); + -moz-transform: translateX(-50%) translateY(-50%); + -webkit-transform: translateX(-50%) translateY(-50%); + transform: translateX(-50%) translateY(-50%); + } + + .video-background-content { + position: relative; + z-index: 2; + } + + .video-background-overlay { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + background-color: black; + opacity: 0.5; + z-index: 1; + } + + +.ml4 .letters { + position: absolute; + margin: auto; + left: 6.7em; + top: 0.75em; + opacity: 0; } \ No newline at end of file diff --git a/static/sbb.png b/static/sbb.png new file mode 100644 index 0000000..1b011c6 Binary files /dev/null and b/static/sbb.png differ diff --git a/static/sbb.svg b/static/sbb.svg new file mode 100644 index 0000000..0856799 --- /dev/null +++ b/static/sbb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index cde94ea..ff6ef24 100644 --- a/templates/base.html +++ b/templates/base.html @@ -16,17 +16,11 @@ +
{% include "sidebar.html" %} -