Update app.py
Browse files
app.py
CHANGED
|
@@ -119,7 +119,7 @@ def send_confirmation_hybrid(booking_id):
|
|
| 119 |
return log_msg
|
| 120 |
except Exception as e: return f"❌ Error: {str(e)}"
|
| 121 |
|
| 122 |
-
# --- 登入邏輯
|
| 123 |
def check_login(user, password):
|
| 124 |
if user == REAL_ADMIN_USER and password == REAL_ADMIN_PASSWORD:
|
| 125 |
return {
|
|
@@ -128,48 +128,54 @@ def check_login(user, password):
|
|
| 128 |
error_msg: ""
|
| 129 |
}
|
| 130 |
else:
|
| 131 |
-
# ✅ 使用 HTML span 標籤來顯示紅色,而不是在 gr.Markdown 用 style 參數
|
| 132 |
return {
|
| 133 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 134 |
}
|
| 135 |
|
| 136 |
-
# --- 🔥 [
|
| 137 |
custom_css = """
|
| 138 |
-
/* 1. 外層容器:
|
| 139 |
-
.table-wrap, .svelte-12cmxck,
|
| 140 |
overflow-x: auto !important;
|
|
|
|
| 141 |
display: block !important;
|
|
|
|
|
|
|
| 142 |
}
|
| 143 |
|
| 144 |
-
/* 2. 表格本體:
|
| 145 |
-
width: auto -> 內容多少寬度就多少
|
| 146 |
-
table-layout: auto -> 自動依內容計算
|
| 147 |
-
*/
|
| 148 |
table {
|
|
|
|
| 149 |
table-layout: auto !important;
|
| 150 |
-
width:
|
|
|
|
| 151 |
border-collapse: collapse !important;
|
|
|
|
| 152 |
}
|
| 153 |
|
| 154 |
-
/* 3.
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
|
|
|
| 162 |
width: auto !important;
|
|
|
|
| 163 |
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
}
|
| 167 |
|
| 168 |
-
/*
|
| 169 |
-
|
| 170 |
-
white-space: nowrap !important;
|
| 171 |
-
display: inline-block !important;
|
| 172 |
-
}
|
| 173 |
"""
|
| 174 |
|
| 175 |
# --- 介面開始 (加入 css 參數) ---
|
|
|
|
| 119 |
return log_msg
|
| 120 |
except Exception as e: return f"❌ Error: {str(e)}"
|
| 121 |
|
| 122 |
+
# --- 登入邏輯 ---
|
| 123 |
def check_login(user, password):
|
| 124 |
if user == REAL_ADMIN_USER and password == REAL_ADMIN_PASSWORD:
|
| 125 |
return {
|
|
|
|
| 128 |
error_msg: ""
|
| 129 |
}
|
| 130 |
else:
|
|
|
|
| 131 |
return {
|
| 132 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 133 |
}
|
| 134 |
|
| 135 |
+
# --- 🔥 [核彈級 CSS 重置]:強制回歸原始表格行為 ---
|
| 136 |
custom_css = """
|
| 137 |
+
/* 1. 外層容器:負責產生捲軸,並強制為區塊元素 */
|
| 138 |
+
.table-wrap, .wrap, .svelte-12cmxck, div[id^="dataframe"] {
|
| 139 |
overflow-x: auto !important;
|
| 140 |
+
overflow-y: hidden !important;
|
| 141 |
display: block !important;
|
| 142 |
+
width: 100% !important;
|
| 143 |
+
max-width: 100vw !important;
|
| 144 |
}
|
| 145 |
|
| 146 |
+
/* 2. 表格本體:強制使用表格佈局,禁止 Flex/Grid 干擾 */
|
|
|
|
|
|
|
|
|
|
| 147 |
table {
|
| 148 |
+
display: table !important;
|
| 149 |
table-layout: auto !important;
|
| 150 |
+
width: max-content !important; /* 核心:內容多少就撐多寬,超出就滾動 */
|
| 151 |
+
min-width: 100% !important;
|
| 152 |
border-collapse: collapse !important;
|
| 153 |
+
margin: 0 !important;
|
| 154 |
}
|
| 155 |
|
| 156 |
+
/* 3. 強制橫向排列 (解決變垂直堆疊的問題) */
|
| 157 |
+
thead { display: table-header-group !important; }
|
| 158 |
+
tbody { display: table-row-group !important; }
|
| 159 |
+
tr { display: table-row !important; }
|
| 160 |
+
|
| 161 |
+
/* 4. 儲存格:死都不換行,自動寬度 */
|
| 162 |
+
th, td {
|
| 163 |
+
display: table-cell !important;
|
| 164 |
+
white-space: nowrap !important; /* 禁止換行 */
|
| 165 |
width: auto !important;
|
| 166 |
+
max-width: none !important; /* 移除任何最大寬度限制 */
|
| 167 |
|
| 168 |
+
box-sizing: border-box !important;
|
| 169 |
+
padding: 10px 15px !important; /* 增加一點間距讓手指好滑 */
|
| 170 |
+
border: 1px solid #444 !important;
|
| 171 |
+
|
| 172 |
+
/* 確保內容可見 */
|
| 173 |
+
visibility: visible !important;
|
| 174 |
+
opacity: 1 !important;
|
| 175 |
}
|
| 176 |
|
| 177 |
+
/* 5. 隱藏 Gradio 可能產生的手機版卡片視圖元素 */
|
| 178 |
+
.mobile-view, .cards, .card { display: none !important; }
|
|
|
|
|
|
|
|
|
|
| 179 |
"""
|
| 180 |
|
| 181 |
# --- 介面開始 (加入 css 參數) ---
|