mirror of
https://github.com/System-End/nephthys.git
synced 2026-04-19 18:35:14 +00:00
Make the header in app home configurable (#87)
* Add an app_title env var * Use app_title in app home * Fix header being wrapped in a tuple
This commit is contained in:
parent
8f96d64267
commit
c2f2584101
5 changed files with 21 additions and 16 deletions
|
|
@ -12,3 +12,5 @@ SLACK_MAINTAINER_ID="U..."
|
|||
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/nephthys"
|
||||
SITE_URL="https://summer.hackclub.com"
|
||||
SITE_API_KEY="..."
|
||||
# Title shown in app home:
|
||||
APP_TITLE="helper heidi"
|
||||
|
|
@ -31,6 +31,7 @@ class Environment:
|
|||
self.slack_maintainer_id = os.environ.get("SLACK_MAINTAINER_ID", "unset")
|
||||
self.program = os.environ.get("PROGRAM", "summer_of_making")
|
||||
self.daily_summary = True if not os.environ.get("DAILY_SUMMARY") else False
|
||||
self.app_title = os.environ.get("APP_TITLE", "helper heidi")
|
||||
|
||||
self.port = int(os.environ.get("PORT", 3000))
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@ import pytz
|
|||
|
||||
from nephthys.utils.env import env
|
||||
from nephthys.views.home.components.buttons import get_buttons
|
||||
from nephthys.views.home.components.header import get_header
|
||||
from prisma.enums import TicketStatus
|
||||
from prisma.models import User
|
||||
|
||||
|
||||
async def get_assigned_tickets_view(user: User):
|
||||
header = get_header()
|
||||
btns = get_buttons(user, "assigned-tickets")
|
||||
|
||||
tickets = (
|
||||
|
|
@ -71,14 +73,7 @@ async def get_assigned_tickets_view(user: User):
|
|||
return {
|
||||
"type": "home",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "header",
|
||||
"text": {
|
||||
"type": "plain_text",
|
||||
"text": ":rac_cute: helper heidi",
|
||||
"emoji": True,
|
||||
},
|
||||
},
|
||||
header,
|
||||
btns,
|
||||
{"type": "divider"},
|
||||
{
|
||||
|
|
|
|||
12
nephthys/views/home/components/header.py
Normal file
12
nephthys/views/home/components/header.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from nephthys.utils.env import env
|
||||
|
||||
|
||||
def get_header():
|
||||
return {
|
||||
"type": "header",
|
||||
"text": {
|
||||
"type": "plain_text",
|
||||
"text": f":rac_cute: {env.app_title}",
|
||||
"emoji": True,
|
||||
},
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import pytz
|
|||
|
||||
from nephthys.utils.env import env
|
||||
from nephthys.views.home.components.buttons import get_buttons
|
||||
from nephthys.views.home.components.header import get_header
|
||||
from nephthys.views.home.components.leaderboards import get_leaderboard_view
|
||||
from nephthys.views.home.components.ticket_status_pie import get_ticket_status_pie_chart
|
||||
from nephthys.views.home.error import get_error_view
|
||||
|
|
@ -34,6 +35,7 @@ async def get_helper_view(user: User):
|
|||
f"Generated leaderboard in {time_leaderboard - time_pie_chart:.4f} seconds"
|
||||
)
|
||||
|
||||
header = get_header()
|
||||
btns = get_buttons(user, "dashboard")
|
||||
logging.debug(
|
||||
f"Generated Dashboard view in {perf_counter() - time_start:.4f} seconds total"
|
||||
|
|
@ -42,14 +44,7 @@ async def get_helper_view(user: User):
|
|||
return {
|
||||
"type": "home",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "header",
|
||||
"text": {
|
||||
"type": "plain_text",
|
||||
"text": ":rac_cute: helper heidi",
|
||||
"emoji": True,
|
||||
},
|
||||
},
|
||||
header,
|
||||
btns,
|
||||
{"type": "divider"},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue