Spaces:
Sleeping
Sleeping
Upload 7_Feedback.py
Browse files- pages/7_Feedback.py +19 -7
pages/7_Feedback.py
CHANGED
|
@@ -5,17 +5,26 @@ from urllib import error, request
|
|
| 5 |
|
| 6 |
import streamlit as st
|
| 7 |
|
| 8 |
-
from src.ui_style import apply_global_style
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def _submit_to_google_sheet(payload: dict) -> tuple[bool, str]:
|
| 12 |
-
webhook_url =
|
| 13 |
-
webhook_token =
|
| 14 |
|
| 15 |
if not webhook_url:
|
| 16 |
return (
|
| 17 |
False,
|
| 18 |
-
"Missing webhook config. Set `FEEDBACK_WEBHOOK_URL` in
|
| 19 |
)
|
| 20 |
|
| 21 |
endpoint = webhook_url
|
|
@@ -57,8 +66,11 @@ def _submit_to_google_sheet(payload: dict) -> tuple[bool, str]:
|
|
| 57 |
st.set_page_config(page_title="Feedback", layout="wide")
|
| 58 |
apply_global_style()
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
with st.form("feedback_form", clear_on_submit=True):
|
| 64 |
c1, c2 = st.columns(2)
|
|
@@ -103,7 +115,7 @@ if submit:
|
|
| 103 |
"rating": int(rating),
|
| 104 |
"message": text,
|
| 105 |
"allow_contact": bool(allow_contact),
|
| 106 |
-
"source": "
|
| 107 |
"submitted_at_utc": datetime.now(timezone.utc).isoformat(),
|
| 108 |
}
|
| 109 |
ok, msg = _submit_to_google_sheet(payload)
|
|
|
|
| 5 |
|
| 6 |
import streamlit as st
|
| 7 |
|
| 8 |
+
from src.ui_style import apply_global_style, render_page_header
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def _config_value(name: str, default: str = "") -> str:
|
| 12 |
+
try:
|
| 13 |
+
if name in st.secrets:
|
| 14 |
+
return str(st.secrets[name]).strip()
|
| 15 |
+
except Exception:
|
| 16 |
+
pass
|
| 17 |
+
return str(os.getenv(name, default)).strip()
|
| 18 |
|
| 19 |
|
| 20 |
def _submit_to_google_sheet(payload: dict) -> tuple[bool, str]:
|
| 21 |
+
webhook_url = _config_value("FEEDBACK_WEBHOOK_URL", "")
|
| 22 |
+
webhook_token = _config_value("FEEDBACK_WEBHOOK_TOKEN", "")
|
| 23 |
|
| 24 |
if not webhook_url:
|
| 25 |
return (
|
| 26 |
False,
|
| 27 |
+
"Missing webhook config. Set `FEEDBACK_WEBHOOK_URL` in environment variables or Streamlit secrets.",
|
| 28 |
)
|
| 29 |
|
| 30 |
endpoint = webhook_url
|
|
|
|
| 66 |
st.set_page_config(page_title="Feedback", layout="wide")
|
| 67 |
apply_global_style()
|
| 68 |
|
| 69 |
+
render_page_header(
|
| 70 |
+
title="Feedback",
|
| 71 |
+
subtitle="Share bugs, feature requests, and usability feedback for the platform.",
|
| 72 |
+
badge="Feedback",
|
| 73 |
+
)
|
| 74 |
|
| 75 |
with st.form("feedback_form", clear_on_submit=True):
|
| 76 |
c1, c2 = st.columns(2)
|
|
|
|
| 115 |
"rating": int(rating),
|
| 116 |
"message": text,
|
| 117 |
"allow_contact": bool(allow_contact),
|
| 118 |
+
"source": _config_value("APP_DEPLOYMENT_SOURCE", "streamlit_app"),
|
| 119 |
"submitted_at_utc": datetime.now(timezone.utc).isoformat(),
|
| 120 |
}
|
| 121 |
ok, msg = _submit_to_google_sheet(payload)
|