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,58 +131,39 @@ def check_login(user, password):
|
|
| 132 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 133 |
}
|
| 134 |
|
| 135 |
-
# --- 🔥 [
|
| 136 |
custom_css = """
|
| 137 |
-
/* 1. 隱藏外層多餘捲軸 */
|
| 138 |
-
#booking_table {
|
| 139 |
-
|
| 140 |
-
border: none !important;
|
| 141 |
-
padding: 0 !important;
|
| 142 |
}
|
| 143 |
|
| 144 |
-
/* 2.
|
| 145 |
-
#booking_table .table-wrap
|
| 146 |
-
#booking_table div[class*="table"],
|
| 147 |
-
div[data-testid="dataframe"] > div {
|
| 148 |
overflow-x: auto !important;
|
| 149 |
overflow-y: hidden !important;
|
| 150 |
-
display: block !important;
|
| 151 |
}
|
| 152 |
|
| 153 |
-
/* 3. 表格設定:
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
|
|
|
|
|
|
| 158 |
border-collapse: collapse !important;
|
| 159 |
-
margin: 0 !important;
|
| 160 |
}
|
| 161 |
|
| 162 |
-
/* 4. 欄位設定:
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
padding: 8px
|
| 171 |
-
border: 1px solid #444 !important;
|
| 172 |
-
font-size: 14px !important;
|
| 173 |
-
vertical-align: middle !important;
|
| 174 |
}
|
| 175 |
-
|
| 176 |
-
/* 5. 指定欄位寬度 (依照您的需求) */
|
| 177 |
-
th:nth-child(1), td:nth-child(1) { width: 60px !important; } /* ID */
|
| 178 |
-
th:nth-child(2), td:nth-child(2) { width: 170px !important; } /* Date */
|
| 179 |
-
th:nth-child(3), td:nth-child(3) { width: 80px !important; } /* Time */
|
| 180 |
-
th:nth-child(4), td:nth-child(4) { width: 120px !important; } /* Name */
|
| 181 |
-
th:nth-child(5), td:nth-child(5) { width: 120px !important; } /* Tel */
|
| 182 |
-
th:nth-child(6), td:nth-child(6) { width: 250px !important; } /* Email (長) */
|
| 183 |
-
th:nth-child(7), td:nth-child(7) { width: 50px !important; } /* Pax */
|
| 184 |
-
th:nth-child(8), td:nth-child(8) { width: 180px !important; } /* Remarks */
|
| 185 |
-
th:nth-child(9), td:nth-child(9) { width: 12px !important; } /* Status */
|
| 186 |
-
th:nth-child(10), td:nth-child(10) { width: 280px !important; } /* UserID */
|
| 187 |
"""
|
| 188 |
|
| 189 |
# --- 介面開始 (加入 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 |
# 取得帳密
|
|
|
|
| 131 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 132 |
}
|
| 133 |
|
| 134 |
+
# --- 🔥 [最終簡化版 CSS]:不破壞結構,只控制寬度和捲軸 ---
|
| 135 |
custom_css = """
|
| 136 |
+
/* 1. 隱藏元件最外層多餘的捲軸,解決雙重捲軸問題 */
|
| 137 |
+
#booking_table .wrap {
|
| 138 |
+
overflow: visible !important;
|
|
|
|
|
|
|
| 139 |
}
|
| 140 |
|
| 141 |
+
/* 2. 針對負責捲動的容器設定水平捲軸 */
|
| 142 |
+
#booking_table .table-wrap {
|
|
|
|
|
|
|
| 143 |
overflow-x: auto !important;
|
| 144 |
overflow-y: hidden !important;
|
|
|
|
| 145 |
}
|
| 146 |
|
| 147 |
+
/* 3. 表格設定:
|
| 148 |
+
width: max-content -> 讓表格寬度等於內容總寬度 (實現自動撐開)
|
| 149 |
+
table-layout: auto -> 讓瀏覽器依照文字長度自動計算每一欄寬度
|
| 150 |
+
*/
|
| 151 |
+
#booking_table table {
|
| 152 |
+
width: max-content !important;
|
| 153 |
+
table-layout: auto !important;
|
| 154 |
border-collapse: collapse !important;
|
|
|
|
| 155 |
}
|
| 156 |
|
| 157 |
+
/* 4. 欄位設定:
|
| 158 |
+
white-space: nowrap -> 禁止換行,確保寬度是「撐開」而不是「擠高」
|
| 159 |
+
width: auto -> 自動寬度
|
| 160 |
+
*/
|
| 161 |
+
#booking_table td, #booking_table th {
|
| 162 |
+
white-space: nowrap !important;
|
| 163 |
+
width: auto !important;
|
| 164 |
+
max-width: none !important;
|
| 165 |
+
padding: 8px 12px !important;
|
|
|
|
|
|
|
|
|
|
| 166 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
"""
|
| 168 |
|
| 169 |
# --- 介面開始 (加入 css 參數) ---
|