Skip to content

Commit

Permalink
Add initial treasury dashboard HUD
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAurelius committed Jan 8, 2024
1 parent b69948d commit 680c473
Show file tree
Hide file tree
Showing 47 changed files with 515 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ jobs:
DIGITALOCEAN_APP_NAME: ${{ secrets.DIGITALOCEAN_APP_NAME }}
DIGITALOCEAN_APP_DOMAIN: ${{ secrets.DIGITALOCEAN_APP_DOMAIN }}
DIGITALOCEAN_APP_DOMAIN_ALIAS: ${{ vars.DIGITALOCEAN_APP_DOMAIN_ALIAS }}
DIGITALOCEAN_SIZE_SLUG: ${{ secrets.DIGITALOCEAN_SIZE_SLUG }}
DIGITALOCEAN_SIZE_SLUG: ${{ vars.DIGITALOCEAN_SIZE_SLUG }}
PREFECT_API_KEY: ${{ secrets.PREFECT_API_KEY }}
PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }}
ENV: ${{ secrets.ENV }}
GUNICORN_TIMEOUT: ${{ secrets.GUNICORN_TIMEOUT }}
GUNICORN_TIMEOUT: ${{ vars.GUNICORN_TIMEOUT }}
steps:
- name: Check out source repository
uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

file_system_store/
20 changes: 20 additions & 0 deletions app-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ envs:
name: ${DIGITALOCEAN_APP_NAME}
region: nyc
services:
- environment_slug: python
image:
registry_type: DOCR
repository: dash-apps
tag: ${GITHUB_SHA}
health_check:
http_path: /
initial_delay_seconds: 60
timeout_seconds: 1200
period_seconds: 20
success_threshold: 1
failure_threshold: 20
http_port: 8050
routes:
- path: /
instance_count: 1
instance_size_slug: ${DIGITALOCEAN_SIZE_SLUG}
name: treasury-dashboard
run_command: gunicorn --worker-tmp-dir /dev/shm --timeout ${GUNICORN_TIMEOUT} src.apps.treasury.app:server
source_dir: /
- environment_slug: python
image:
registry_type: DOCR
Expand Down
26 changes: 13 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
version: "3.5"

services:
tco2-dashboard:
image: dash-apps
treasury:
# image: dash-apps
build:
context: ./
working_dir: /src
env_file: .env
entrypoint: python
command: ["-m", "src.apps.tco2_dashboard.app"]
command: ["-m", "src.apps.treasury.index"]
ports:
- 8050:8050
volumes:
- ./:/src

api:
image: dash-apps
working_dir: /src
env_file: .env
entrypoint: python
command: ["-m", "src.apps.api.app"]
ports:
- 8051:8050
volumes:
- ./:/src
# api:
# image: dash-apps
# working_dir: /src
# env_file: .env
# entrypoint: python
# command: ["-m", "src.apps.api.app"]
# ports:
# - 8051:8050
# volumes:
# - ./:/src
6 changes: 4 additions & 2 deletions requirements1.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
dash-bootstrap-components==1.0.3
dash-extensions==0.1.1
Flask_Caching==1.10.1
gunicorn
millify
orjson
pycountry==22.1.10
pytest
pandas<2.0.0
pandas<3.0
subgrounds<1.7
werkzeug<2.1.0
circlify==0.14.0
matplotlib==3.5.2
plotly==5.7.0
kaleido==0.2.1
dash==2.8.1
dash==2.14.2

1 change: 0 additions & 1 deletion requirements2.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
prefect==2.12.0
prefect-aws==0.3.7
pydantic==1.10.9
pyarrow==12.0.0
Flask-RESTful==0.3.10
6 changes: 3 additions & 3 deletions scripts/smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

FAILING=0

ENTRIES=(src/apps/api/app.py:/api/v1)
ENTRIES=(src/apps/api/app.py:/api/v1 src/apps/treasury/index.py:/)

for ENTRY in ${ENTRIES[@]}; do
ITEMS=(`echo $ENTRY | tr ":" " "`)
APP=${ITEMS[0]}
SUBPATH=${ITEMS[1]}
URL=http://127.0.0.1:8050$SUBPATH
echo $APP : Starting
echo $APP : Starting
module="${APP////.}"
nohup python -m ${module%.py} > /tmp/nohup.out 2>&1 &
DASH_PID=$!
Expand All @@ -18,7 +18,7 @@ for ENTRY in ${ENTRIES[@]}; do
echo $APP : Pinging $URL
RESP_CODE=$(curl --head --location --write-out %{http_code} --silent --output response.txt $URL)
echo $APP : Response code: $RESP_CODE
kill $DASH_PID
kill $DASH_PID
# kill `lsof -w -n -i tcp:8050 | awk '$2!="PID" {print $2;}'` | head -n 1
if [ "$RESP_CODE" != "200" ];
then
Expand Down
Empty file added src/apps/treasury/__init__.py
Empty file.
33 changes: 33 additions & 0 deletions src/apps/treasury/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import dash_bootstrap_components as dbc
from dash import Dash

app = Dash(
__name__,
external_stylesheets=[dbc.themes.DARKLY],
suppress_callback_exceptions=True,
title="KlimaDAO Treasury Dashboard",
use_pages=True,
meta_tags=[
{
'name': 'viewport',
'content':
'width=device-width, initial-scale=1.0, maximum-scale=1.2, minimum-scale=0.5,'
},
{"property": "og:type", "content": "website"},
{"property": "og:site_name", "content": "KlimaDAO Treasury Dashboard"},
{"property": "og:title", "content": "Overview of KlimaDAO treasury composition and Green Ratio status"},
{
"property": "og:description",
"content":
"Overview of the inner workings of "
"KlimaDAO's carbon-backed reserve currency protocol."
},
{
"property": "og:image",
"content": "https://static.wixstatic.com/media/5f17af_bfd51fccab89436e82f2cc2911097544~mv2.png/v1/fill/w_1306,h_734,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/5f17af_bfd51fccab89436e82f2cc2911097544~mv2.png" # noqa: E501
},
{"name": "twitter:card", "content": "summary_large_image"},
{"name": "twitter:site", "content": "@discord"},
{"name": "twitter:creator", "content": "@KlimaDAO"}
]
)
Binary file added src/apps/treasury/assets/Como/Como-Bold.ttf
Binary file not shown.
Binary file added src/apps/treasury/assets/Como/Como-ExtraBold.ttf
Binary file not shown.
Binary file added src/apps/treasury/assets/Como/Como-ExtraLight.ttf
Binary file not shown.
Binary file added src/apps/treasury/assets/Como/Como-Heavy.ttf
Binary file not shown.
Binary file added src/apps/treasury/assets/Como/Como-Light.ttf
Binary file not shown.
Binary file added src/apps/treasury/assets/Como/Como-Medium.ttf
Binary file not shown.
Binary file added src/apps/treasury/assets/Como/Como-SemiBold.ttf
Binary file not shown.
Binary file added src/apps/treasury/assets/Como/Como.ttf
Binary file not shown.
15 changes: 15 additions & 0 deletions src/apps/treasury/assets/Klima_logo_v2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 93 additions & 0 deletions src/apps/treasury/assets/Poppins/OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
72 changes: 72 additions & 0 deletions src/apps/treasury/assets/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* Fonts used in the app. To add a new font, it's easier to download the font tff file and import it here */
@font-face {
font-family: 'Como';
src: url('Como/Como.ttf') format('truetype');
}
@font-face {
font-family: 'Poppins';
src: url('Poppins/Poppins-Regular.ttf') format('truetype');
}
@font-face {
font-family: 'Poppins-SemiBold';
src: url('Poppins/Poppins-SemiBold.ttf') format('truetype');
}
/* Set the default font to Poppins regular*/
*{
font-family: 'Poppins', sans-serif;
}

.card_topic{
font-family: 'Poppins-SemiBold', sans-serif;
font-style: normal;
font-weight: 500;
font-size: 40px;
line-height: 54px;
text-align: center;
color: #FFFFFF;
}

.card_metric{
font-family: 'Inter', sans-serif;
font-style: normal;
font-weight: 500;
font-size: 26px;
line-height: 54px;
text-align: center;
color: #FFFFFF;
}
.vl {
border-left: 1px solid #FFFFFF;
height: 100%;
width: 1px;
/*display: inline-block;*/
margin: 0 auto;
position: relative;
transform: rotate(0deg);
}
.carousel-inner > .item > img {
width:40px;
height:60px;
}

*{
margin:0;
padding:0;
}
body{
font-family: 'Poppins', sans-serif;
line-height:1.2;
background-color: #202020;
background-size:auto;
background-position:center;
}

.center {
margin: auto;
width: 100%;
}
.center_2{
margin: 140px
}


Binary file added src/apps/treasury/assets/favicon.ico
Binary file not shown.
Empty file.
Loading

0 comments on commit 680c473

Please sign in to comment.