from reactpy import component, html, run
from main import main


@component
def Data():
    data = main()

    lis = []
    sorted_df = data.sort_values(by='money transfers', ascending=False)
    for index, row in sorted_df.iterrows():
        lis.append(html.li([index, ' ', row['money transfers']]))

    return html.ul(lis)


@component
def hello_world():
    return html.section(
        html.h1("Data from Biwenger"),
        Data())


run(hello_world)
# from flask import Flask

# @app.route("/")
#
#
# if __name__ == "__main__":
#     app = Flask(__name__)
#     app.run(debug=True)