diff --git a/csv_browser.py b/csv_browser.py
index dcacbc7..eaad900 100644
--- a/csv_browser.py
+++ b/csv_browser.py
@@ -1,5 +1,5 @@
import os
-from flask import Flask, render_template_string, send_from_directory, request
+from flask import Flask, render_template_string, request
import pandas as pd
EXPORTS_DIR = "exports"
@@ -9,38 +9,61 @@ app = Flask(__name__)
TEMPLATE = """
-
+
CSV Viewer
-
-
-
-
-
- 📂 CSV Viewer
- {% if files %}
-
- {% for file in files %}
- - {{ file }}
- {% endfor %}
-
- {% else %}
- Brak plików w katalogu {{ dir }}
.
- {% endif %}
+
- {% if table %}
-
- Plik: {{ filename }}
- {{ table | safe }}
-
- {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
📊 CSV Viewer
+
+ {% if files %}
+
+ {% else %}
+
Brak plików w katalogu {{ dir }}
.
+ {% endif %}
+
+ {% if table %}
+
+
Plik: {{ filename }}
+
+ {{ table | safe }}
+
+
+ {% endif %}
+
"""
@@ -48,7 +71,7 @@ TEMPLATE = """
@app.route("/")
def index():
files = [f for f in os.listdir(EXPORTS_DIR) if f.endswith(".csv")]
- return render_template_string(TEMPLATE, files=files, table=None, dir=EXPORTS_DIR)
+ return render_template_string(TEMPLATE, files=files, table=None, filename=None, dir=EXPORTS_DIR)
@app.route("/view")
def view_file():
@@ -61,7 +84,7 @@ def view_file():
try:
df = pd.read_csv(path)
- html_table = df.to_html(classes="display", index=False, table_id="csv-table")
+ html_table = df.to_html(classes="table table-striped table-bordered display", index=False, table_id="csv-table")
files = [f for f in os.listdir(EXPORTS_DIR) if f.endswith(".csv")]
return render_template_string(TEMPLATE, files=files, table=html_table, filename=filename, dir=EXPORTS_DIR)
except Exception as e: