Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,6 @@ 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 |
# 取得帳密
|
|
@@ -132,9 +131,9 @@ def check_login(user, password):
|
|
| 132 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 133 |
}
|
| 134 |
|
| 135 |
-
# --- 🔥 [絕對
|
| 136 |
custom_css = """
|
| 137 |
-
/* 1. 隱藏
|
| 138 |
#booking_table .wrap {
|
| 139 |
overflow: hidden !important;
|
| 140 |
}
|
|
@@ -143,70 +142,72 @@ custom_css = """
|
|
| 143 |
#booking_table .table-wrap {
|
| 144 |
overflow-x: auto !important;
|
| 145 |
overflow-y: hidden !important;
|
|
|
|
| 146 |
}
|
| 147 |
|
| 148 |
/* 3. 表格本體:
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
*/
|
| 153 |
#booking_table table {
|
| 154 |
table-layout: fixed !important;
|
| 155 |
-
width:
|
| 156 |
border-collapse: collapse !important;
|
| 157 |
margin: 0 !important;
|
| 158 |
}
|
| 159 |
|
| 160 |
/* 4. 欄位通用設定:
|
| 161 |
-
white-space: normal -> 允許換行
|
| 162 |
-
|
| 163 |
-
vertical-align: top -> 對齊上方 (換行後比較好看)
|
| 164 |
*/
|
| 165 |
#booking_table th, #booking_table td {
|
| 166 |
display: table-cell !important;
|
| 167 |
-
white-space: normal !important;
|
| 168 |
-
word-break: break-word !important;
|
| 169 |
overflow-wrap: break-word !important;
|
| 170 |
-
|
| 171 |
|
|
|
|
| 172 |
box-sizing: border-box !important;
|
| 173 |
-
padding: 8px
|
| 174 |
border: 1px solid #444 !important;
|
| 175 |
-
font-size:
|
| 176 |
line-height: 1.4 !important;
|
| 177 |
}
|
| 178 |
|
| 179 |
-
/* 5. 🔥【依照您的要求,固定每個欄位寬度】🔥
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
/* #1 id */
|
| 182 |
-
#booking_table th:nth-child(1), #booking_table td:nth-child(1) {
|
| 183 |
|
| 184 |
-
/* #2 date */
|
| 185 |
-
#booking_table th:nth-child(2), #booking_table td:nth-child(2) {
|
| 186 |
|
| 187 |
-
/* #3 time */
|
| 188 |
-
#booking_table th:nth-child(3), #booking_table td:nth-child(3) {
|
| 189 |
|
| 190 |
-
/* #4 name */
|
| 191 |
-
#booking_table th:nth-child(4), #booking_table td:nth-child(4) {
|
| 192 |
|
| 193 |
-
/* #5 tel */
|
| 194 |
-
#booking_table th:nth-child(5), #booking_table td:nth-child(5) {
|
| 195 |
|
| 196 |
-
/* #6 email */
|
| 197 |
-
#booking_table th:nth-child(6), #booking_table td:nth-child(6) {
|
| 198 |
|
| 199 |
-
/* #7 pax */
|
| 200 |
-
#booking_table th:nth-child(7), #booking_table td:nth-child(7) {
|
| 201 |
|
| 202 |
-
/* #8 remarks */
|
| 203 |
-
#booking_table th:nth-child(8), #booking_table td:nth-child(8) {
|
| 204 |
|
| 205 |
-
/* #9 status */
|
| 206 |
-
#booking_table th:nth-child(9), #booking_table td:nth-child(9) {
|
| 207 |
|
| 208 |
-
/* #10 user_id */
|
| 209 |
-
#booking_table th:nth-child(10), #booking_table td:nth-child(10) {
|
| 210 |
"""
|
| 211 |
|
| 212 |
# --- 介面開始 ---
|
|
|
|
| 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 |
# 取得帳密
|
|
|
|
| 131 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 132 |
}
|
| 133 |
|
| 134 |
+
# --- 🔥 [絕對定寬 + 自動換行 CSS] ---
|
| 135 |
custom_css = """
|
| 136 |
+
/* 1. 隱藏最外層的捲軸,只留內部一個 */
|
| 137 |
#booking_table .wrap {
|
| 138 |
overflow: hidden !important;
|
| 139 |
}
|
|
|
|
| 142 |
#booking_table .table-wrap {
|
| 143 |
overflow-x: auto !important;
|
| 144 |
overflow-y: hidden !important;
|
| 145 |
+
border: 1px solid #444 !important;
|
| 146 |
}
|
| 147 |
|
| 148 |
/* 3. 表格本體:
|
| 149 |
+
min-width: 1600px -> 【關鍵】直接把表格撐到 1600px 寬。
|
| 150 |
+
這樣在手機上(寬度~400px)一定會超出,進而觸發捲軸。
|
| 151 |
+
table-layout: fixed -> 嚴格遵守下方設定的欄位寬度。
|
| 152 |
*/
|
| 153 |
#booking_table table {
|
| 154 |
table-layout: fixed !important;
|
| 155 |
+
min-width: 1600px !important;
|
| 156 |
border-collapse: collapse !important;
|
| 157 |
margin: 0 !important;
|
| 158 |
}
|
| 159 |
|
| 160 |
/* 4. 欄位通用設定:
|
| 161 |
+
white-space: normal -> 【關鍵】允許換行,太長就變兩行。
|
| 162 |
+
overflow-wrap: break-word -> 確保長單字也能換行。
|
|
|
|
| 163 |
*/
|
| 164 |
#booking_table th, #booking_table td {
|
| 165 |
display: table-cell !important;
|
| 166 |
+
white-space: normal !important;
|
|
|
|
| 167 |
overflow-wrap: break-word !important;
|
| 168 |
+
word-break: break-word !important;
|
| 169 |
|
| 170 |
+
vertical-align: top !important;
|
| 171 |
box-sizing: border-box !important;
|
| 172 |
+
padding: 8px 5px !important;
|
| 173 |
border: 1px solid #444 !important;
|
| 174 |
+
font-size: 13px !important;
|
| 175 |
line-height: 1.4 !important;
|
| 176 |
}
|
| 177 |
|
| 178 |
+
/* 5. 🔥【依照您的要求,固定每個欄位寬度】🔥
|
| 179 |
+
這些寬度加總起來大約是 1600px,會剛好撐滿上面的 min-width
|
| 180 |
+
*/
|
| 181 |
|
| 182 |
+
/* #1 id: 短數字 */
|
| 183 |
+
#booking_table th:nth-child(1), #booking_table td:nth-child(1) { width: 60px !important; }
|
| 184 |
|
| 185 |
+
/* #2 date: 日期 */
|
| 186 |
+
#booking_table th:nth-child(2), #booking_table td:nth-child(2) { width: 170px !important; }
|
| 187 |
|
| 188 |
+
/* #3 time: 時間 */
|
| 189 |
+
#booking_table th:nth-child(3), #booking_table td:nth-child(3) { width: 80px !important; }
|
| 190 |
|
| 191 |
+
/* #4 name: 姓名 */
|
| 192 |
+
#booking_table th:nth-child(4), #booking_table td:nth-child(4) { width: 120px !important; }
|
| 193 |
|
| 194 |
+
/* #5 tel: 電話 */
|
| 195 |
+
#booking_table th:nth-child(5), #booking_table td:nth-child(5) { width: 120px !important; }
|
| 196 |
|
| 197 |
+
/* #6 email: 電子信箱 (給寬一點) */
|
| 198 |
+
#booking_table th:nth-child(6), #booking_table td:nth-child(6) { width: 250px !important; }
|
| 199 |
|
| 200 |
+
/* #7 pax: 人數 */
|
| 201 |
+
#booking_table th:nth-child(7), #booking_table td:nth-child(7) { width: 50px !important; }
|
| 202 |
|
| 203 |
+
/* #8 remarks: 備註 */
|
| 204 |
+
#booking_table th:nth-child(8), #booking_table td:nth-child(8) { width: 180px !important; }
|
| 205 |
|
| 206 |
+
/* #9 status: 狀態 */
|
| 207 |
+
#booking_table th:nth-child(9), #booking_table td:nth-child(9) { width: 120px !important; }
|
| 208 |
|
| 209 |
+
/* #10 user_id: 亂碼 (非常長) */
|
| 210 |
+
#booking_table th:nth-child(10), #booking_table td:nth-child(10) { width: 320px !important; }
|
| 211 |
"""
|
| 212 |
|
| 213 |
# --- 介面開始 ---
|