Update app.py
Browse files
app.py
CHANGED
|
@@ -13,10 +13,9 @@ SUPABASE_URL = os.getenv("SUPABASE_URL")
|
|
| 13 |
SUPABASE_KEY = os.getenv("SUPABASE_KEY")
|
| 14 |
GAS_MAIL_URL = os.getenv("GAS_MAIL_URL")
|
| 15 |
LINE_ACCESS_TOKEN = os.getenv("LINE_ACCESS_TOKEN")
|
| 16 |
-
# ⚠️ 請確認這是您 Space A 的正確網址 (結尾不要有斜線)
|
| 17 |
PUBLIC_SPACE_URL = "https://deeplearning101-ciecietaipei.hf.space"
|
| 18 |
|
| 19 |
-
# 取得帳密
|
| 20 |
REAL_ADMIN_USER = os.getenv("ADMIN_USER") or "Deep Learning 101"
|
| 21 |
REAL_ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD") or "2016-11-11"
|
| 22 |
|
|
@@ -132,7 +131,7 @@ def check_login(user, password):
|
|
| 132 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 133 |
}
|
| 134 |
|
| 135 |
-
# --- 🔥 [
|
| 136 |
custom_css = """
|
| 137 |
/* 1. 外層容器:允許左右滑動 */
|
| 138 |
.table-wrap, .wrap, .svelte-12cmxck, div[id^="dataframe"] {
|
|
@@ -140,42 +139,61 @@ custom_css = """
|
|
| 140 |
display: block !important;
|
| 141 |
}
|
| 142 |
|
| 143 |
-
/* 2. 表格本體
|
| 144 |
-
display: table -> 強制表格行為 (修復垂直堆疊)
|
| 145 |
-
width: auto -> 寬度依內容決定,不強制撐滿
|
| 146 |
-
table-layout: auto -> 自動計算欄寬
|
| 147 |
-
*/
|
| 148 |
table {
|
| 149 |
display: table !important;
|
| 150 |
-
table-layout:
|
| 151 |
width: auto !important;
|
| 152 |
-
min-width: 100% !important;
|
| 153 |
border-collapse: collapse !important;
|
| 154 |
margin: 0 !important;
|
| 155 |
}
|
| 156 |
|
| 157 |
-
/* 3.
|
| 158 |
-
width: 20px -> 【核心技巧】這會強迫瀏覽器把欄位縮到最小
|
| 159 |
-
white-space: nowrap -> 但因為禁止換行,所以最小寬度 = 文字寬度
|
| 160 |
-
結果:完美的「內容自適應寬度」
|
| 161 |
-
*/
|
| 162 |
th, td {
|
| 163 |
display: table-cell !important;
|
| 164 |
-
white-space:
|
| 165 |
-
|
| 166 |
-
|
| 167 |
|
| 168 |
box-sizing: border-box !important;
|
| 169 |
-
padding: 10px
|
| 170 |
border: 1px solid #444 !important;
|
| 171 |
-
|
|
|
|
| 172 |
}
|
| 173 |
|
| 174 |
-
/* 4.
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
"""
|
| 180 |
|
| 181 |
# --- 介面開始 (加入 css 參數) ---
|
|
|
|
| 13 |
SUPABASE_KEY = os.getenv("SUPABASE_KEY")
|
| 14 |
GAS_MAIL_URL = os.getenv("GAS_MAIL_URL")
|
| 15 |
LINE_ACCESS_TOKEN = os.getenv("LINE_ACCESS_TOKEN")
|
|
|
|
| 16 |
PUBLIC_SPACE_URL = "https://deeplearning101-ciecietaipei.hf.space"
|
| 17 |
|
| 18 |
+
# 取得帳密
|
| 19 |
REAL_ADMIN_USER = os.getenv("ADMIN_USER") or "Deep Learning 101"
|
| 20 |
REAL_ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD") or "2016-11-11"
|
| 21 |
|
|
|
|
| 131 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 132 |
}
|
| 133 |
|
| 134 |
+
# --- 🔥 [客製化 CSS]:針對每個欄位設定寬度 + 允許換行 ---
|
| 135 |
custom_css = """
|
| 136 |
/* 1. 外層容器:允許左右滑動 */
|
| 137 |
.table-wrap, .wrap, .svelte-12cmxck, div[id^="dataframe"] {
|
|
|
|
| 139 |
display: block !important;
|
| 140 |
}
|
| 141 |
|
| 142 |
+
/* 2. 表格本體 */
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
table {
|
| 144 |
display: table !important;
|
| 145 |
+
table-layout: fixed !important; /* ⚠️ 關鍵:固定布局,強制生效我們設定的寬度 */
|
| 146 |
width: auto !important;
|
|
|
|
| 147 |
border-collapse: collapse !important;
|
| 148 |
margin: 0 !important;
|
| 149 |
}
|
| 150 |
|
| 151 |
+
/* 3. 通用儲存格設定 */
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
th, td {
|
| 153 |
display: table-cell !important;
|
| 154 |
+
white-space: normal !important; /* ✅ 允許換行 */
|
| 155 |
+
word-break: break-word !important; /* ✅ 長單字(如User ID)強制換行 */
|
| 156 |
+
vertical-align: top !important; /* 對齊上方,換行後比較好看 */
|
| 157 |
|
| 158 |
box-sizing: border-box !important;
|
| 159 |
+
padding: 8px 10px !important;
|
| 160 |
border: 1px solid #444 !important;
|
| 161 |
+
font-size: 14px !important;
|
| 162 |
+
line-height: 1.4 !important;
|
| 163 |
}
|
| 164 |
|
| 165 |
+
/* 4. 🔥【個別欄位寬度設定】(依照您的欄位順序 1~10) */
|
| 166 |
+
|
| 167 |
+
/* #1 id: 短數字 */
|
| 168 |
+
th:nth-child(1), td:nth-child(1) { min-width: 50px !important; width: 50px !important; }
|
| 169 |
+
|
| 170 |
+
/* #2 date: 日期 (2026-01-23) */
|
| 171 |
+
th:nth-child(2), td:nth-child(2) { min-width: 110px !important; width: 110px !important; }
|
| 172 |
+
|
| 173 |
+
/* #3 time: 時間 (19:30) */
|
| 174 |
+
th:nth-child(3), td:nth-child(3) { min-width: 70px !important; width: 70px !important; }
|
| 175 |
+
|
| 176 |
+
/* #4 name: 姓名 */
|
| 177 |
+
th:nth-child(4), td:nth-child(4) { min-width: 90px !important; width: 90px !important; }
|
| 178 |
+
|
| 179 |
+
/* #5 tel: 電話 */
|
| 180 |
+
th:nth-child(5), td:nth-child(5) { min-width: 110px !important; width: 110px !important; }
|
| 181 |
+
|
| 182 |
+
/* #6 email: 電子信箱 (很長,給寬一點) */
|
| 183 |
+
th:nth-child(6), td:nth-child(6) { min-width: 200px !important; width: 200px !important; }
|
| 184 |
+
|
| 185 |
+
/* #7 pax: 人數 (短) */
|
| 186 |
+
th:nth-child(7), td:nth-child(7) { min-width: 50px !important; width: 50px !important; }
|
| 187 |
+
|
| 188 |
+
/* #8 remarks: 備註 (文字多,給寬一點) */
|
| 189 |
+
th:nth-child(8), td:nth-child(8) { min-width: 180px !important; width: 180px !important; }
|
| 190 |
+
|
| 191 |
+
/* #9 status: 狀態 */
|
| 192 |
+
th:nth-child(9), td:nth-child(9) { min-width: 90px !important; width: 90px !important; }
|
| 193 |
+
|
| 194 |
+
/* #10 user_id: 亂碼 (非常長,給寬一點,反正會換行) */
|
| 195 |
+
th:nth-child(10), td:nth-child(10) { min-width: 180px !important; width: 180px !important; }
|
| 196 |
+
|
| 197 |
"""
|
| 198 |
|
| 199 |
# --- 介面開始 (加入 css 參數) ---
|