From 23c3aa97dd89cf222a5ab20c0b2c40b68273a512 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Tue, 14 Mar 2023 17:59:36 +1100 Subject: [PATCH] Added basic space selector, need to integrate it into the page --- priceybot2/main.py | 13 +++++++++++-- priceybot2/sass/branding.scss | 6 +++--- priceybot2/static/css/main.css | 6 +++--- priceybot2/templates/base.html | 10 ++++++++++ priceybot2/templates/quotes.html | 19 +++++++++++-------- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/priceybot2/main.py b/priceybot2/main.py index 7861c71..d04d7d6 100644 --- a/priceybot2/main.py +++ b/priceybot2/main.py @@ -1,6 +1,7 @@ from flask import Blueprint, render_template from flask_login import login_required, current_user from .models import Quote +from .chatbot import chat as bot main = Blueprint('main', __name__) @@ -24,5 +25,13 @@ def profile(): @main.route('/quotes') @login_required def quotes(): - quotes = [q.quote for q in Quote.query.all()] - return render_template("quotes.html", quotes=quotes) \ No newline at end of file + spaces = bot.spaces().list().execute()['spaces'] + space_list = list() + for space in spaces: + if space.get('singleUserBotDm'): + continue + else: + space_list.append([space['name'].split('/')[1], space['displayName']]) + + quotes = [[q.quote, q.id] for q in Quote.query.all()] + return render_template("quotes.html", quotes=quotes, space_list=space_list) \ No newline at end of file diff --git a/priceybot2/sass/branding.scss b/priceybot2/sass/branding.scss index 2d2e93f..72d5dda 100644 --- a/priceybot2/sass/branding.scss +++ b/priceybot2/sass/branding.scss @@ -75,6 +75,6 @@ $box-background-color: $nexi-grey; $input-background-color: $nexi-darker-grey; $input-color: $nexi-black; -$table-background-color: $nexi-black; -$table-striped-row-even-background-color: $nexi-lighter-black; -$table-color: $nexi-white; \ No newline at end of file +// $table-background-color: $primary; +// $table-striped-row-even-background-color: $nexi-lighter-black; +// $table-color: $nexi-white; \ No newline at end of file diff --git a/priceybot2/static/css/main.css b/priceybot2/static/css/main.css index cae5d25..2ce1bcf 100644 --- a/priceybot2/static/css/main.css +++ b/priceybot2/static/css/main.css @@ -3137,8 +3137,8 @@ div.icon-text { background-position: -200% 0; } } .table { - background-color: #181818; - color: #f8fafb; } + background-color: white; + color: #363636; } .table td, .table th { border: 1px solid #D2D2D2; @@ -3330,7 +3330,7 @@ div.icon-text { .table.is-narrow th { padding: 0.25em 0.5em; } .table.is-striped tbody tr:not(.is-selected):nth-child(even) { - background-color: #353535; } + background-color: #fafafa; } .table-container { -webkit-overflow-scrolling: touch; diff --git a/priceybot2/templates/base.html b/priceybot2/templates/base.html index 5cfef7c..2a226a1 100644 --- a/priceybot2/templates/base.html +++ b/priceybot2/templates/base.html @@ -36,6 +36,16 @@ Logout + {% if space_list is defined %} +
+ +
+ {% endif %} {% endif %} diff --git a/priceybot2/templates/quotes.html b/priceybot2/templates/quotes.html index 1739e02..6f41727 100644 --- a/priceybot2/templates/quotes.html +++ b/priceybot2/templates/quotes.html @@ -1,6 +1,12 @@ {% extends "base.html" %} {% block content %} +

Quotes

@@ -11,21 +17,18 @@
{% endif %} {% endwith %} - +
{% for quote in quotes %} - + {% endfor %}
- {{ quote }} + + {{ quote[0] }}
-
+ {% endblock %}