diff --git a/backend b/backend index 183bf60..1a5700e 160000 --- a/backend +++ b/backend @@ -1 +1 @@ -Subproject commit 183bf60fc089c76a9f1b9e9fde31d02b910d11a6 +Subproject commit 1a5700e9a0bdc404d0d2a49898dba78d872b53e8 diff --git a/server/googleHandler.py b/server/googleHandler.py index 4794035..fbf6bc7 100644 --- a/server/googleHandler.py +++ b/server/googleHandler.py @@ -161,6 +161,8 @@ def fetchCalendarEvents(user, calendars, startDate, endDate): def fetchCalendars(): # get client api service + if current_user.google_token == None: + return [], None, None client_token = GC.build_credentials(current_user.google_token.token, current_user.google_token.refresh_token) credentials = google.oauth2.credentials.Credentials(**client_token) diff --git a/server/routes.py b/server/routes.py index b9d6643..177ce13 100644 --- a/server/routes.py +++ b/server/routes.py @@ -26,27 +26,39 @@ from database.models import User, Calendar, Device, GoogleToken os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1' @app.route("/") -def account(): - return flask.redirect('account') +def startpage(): + return flask.render_template('startpage.html') + + @app.route("/privacy") def privacy(): return flask.render_template('privacy.html') -@app.route("/account") -def index(): +@app.route("/login") +def login(): if current_user.is_authenticated: + return redirect(url_for('account')) + return flask.render_template('login.html') + + +@app.route("/account") +def account(): + if current_user.is_authenticated: + calendars = [] gCalendars, colors, token = google.fetchCalendars() - current_user.google_token.token = token - db.session.commit() - backend.updateCalendars(current_user, gCalendars, colors) + if token != None: + current_user.google_token.token = token + db.session.commit() + calendars.extend(gCalendars) + backend.updateCalendars(current_user, calendars, colors) return (flask.render_template('account.html', username = current_user.username, email = current_user.email, profile_img=current_user.profile_pic ) ) else: - return flask.render_template('login.html') + return redirect(url_for("login")) @app.route("/view") def view(): diff --git a/server/static/css/main.css b/server/static/css/main.css index 663b61e..0ef2e23 100644 --- a/server/static/css/main.css +++ b/server/static/css/main.css @@ -3,9 +3,8 @@ html, body { font-family: "Trebuchet MS", Helvetica, sans-serif; - margin: 0.5rem; padding: 0; - height: calc(100% - 1rem) + height: calc(100% - 0.5rem) } #container { @@ -31,15 +30,55 @@ body .banner { display:flex; justify-content: center; + margin: 5rem; align-items:center; - background-color: orange; - height: 20rem; flex-direction: column; - margin-bottom: 10rem; +} + +.subtitle { + color: #333; + text-align: center; + margin: 1rem; +} + +.primeblue { + color: #1b75bc; } .title { - color: blue; + font-size: 5rem; + font-weight: bold; + text-align: center; + margin: 1rem; +} + +.grayblock { + background-color: #ddd; + align-items: center; + justify-content: center; +} + +.grayblock .padded { + padding: 3rem; +} + +.horizontal { + display: flex; + flex-wrap: wrap; +} + +.horizontal .content { + font-size: 2rem; + text-align: center; +} + +.horizontal .image { + margin: 1rem; + margin-left: 4rem; + margin-right: 4rem; + height: 30rem; + border-radius: 1rem; + width: auto; } .logins { @@ -82,14 +121,20 @@ body /* top navigation */ .navigation { - background-color: orange; + background-color: #eaeaea; overflow: hidden; + margin: auto; + display: flex; +} + +.navigation_rightside { + margin-left: auto; } .navigation a { float: left; display: flex; - color: #f2f2f2; + color: #333; text-align: center; padding: 14px 16px; text-decoration: none; diff --git a/server/static/res/arrow.svg b/server/static/res/arrow.svg new file mode 100755 index 0000000..ae77563 --- /dev/null +++ b/server/static/res/arrow.svg @@ -0,0 +1,12 @@ + diff --git a/server/static/res/calendar.svg b/server/static/res/calendar.svg new file mode 100755 index 0000000..5938297 --- /dev/null +++ b/server/static/res/calendar.svg @@ -0,0 +1,102 @@ + diff --git a/server/static/res/googlelogo.png b/server/static/res/googlelogo.png new file mode 100644 index 0000000..333bda9 Binary files /dev/null and b/server/static/res/googlelogo.png differ diff --git a/server/static/res/tizenlogo.png b/server/static/res/tizenlogo.png new file mode 100644 index 0000000..2fb647f Binary files /dev/null and b/server/static/res/tizenlogo.png differ diff --git a/server/static/res/watchface.svg b/server/static/res/watchface.svg new file mode 100755 index 0000000..af2b338 --- /dev/null +++ b/server/static/res/watchface.svg @@ -0,0 +1,61 @@ + diff --git a/server/template/base_navigation.html b/server/template/base_navigation.html new file mode 100644 index 0000000..2a0fd6e --- /dev/null +++ b/server/template/base_navigation.html @@ -0,0 +1,11 @@ + +
diff --git a/server/template/login.html b/server/template/login.html index 301c963..c7a2c4e 100644 --- a/server/template/login.html +++ b/server/template/login.html @@ -2,6 +2,8 @@ {% block content %} +{% include "base_navigation.html" %} +