实时时间显示对齐

This commit is contained in:
NY 2025-03-05 10:44:38 +08:00
parent 2bf5cf28b7
commit 938aa3ea8d
3 changed files with 18 additions and 12 deletions

View File

@ -20,9 +20,7 @@ def layout_config(app):
html.Div(
id='clock-tooltip',
children=[
html.Div(id='pst-clock'),
html.Div(id='cst-clock'),
html.Div(id='est-clock')
html.Div(id='pst-clock')
],
style={
'position': 'absolute',

View File

@ -3,12 +3,10 @@ from pkg.dash.app_init import app
from dash.dependencies import Input, Output
from pkg.config import pacific,central,eastern
from datetime import datetime
from dash import html
# Callback for updating clocks (unchanged)
@app.callback(
[Output('pst-clock', 'children'),
Output('cst-clock', 'children'),
Output('est-clock', 'children')],
[Output('pst-clock', 'children')],
[Input('clock-interval', 'n_intervals')]
)
def update_clocks(n):
@ -16,4 +14,17 @@ def update_clocks(n):
pst_time = now_utc.astimezone(pacific).strftime('%Y-%m-%d %H:%M:%S PST')
cst_time = now_utc.astimezone(central).strftime('%Y-%m-%d %H:%M:%S CST')
est_time = now_utc.astimezone(eastern).strftime('%Y-%m-%d %H:%M:%S EST')
return f"𝕏: {pst_time}", f"🚀: {cst_time}", f"🏛️/🌴: {est_time}"
table = html.Table([
html.Tr([html.Td('𝕏', style={'textAlign': 'center'}), html.Td(pst_time)]),
html.Tr([html.Td('🚀', style={'textAlign': 'center'}), html.Td(cst_time)]),
html.Tr([html.Td('🏛️🌴', style={'textAlign': 'center'}), html.Td(est_time)])
], style={
'width': '100%',
'textAlign': 'left',
'borderCollapse': 'collapse'
})
return [table]

View File

@ -1,8 +1,5 @@
#### 2025.3.4
1. 完善main.py的 ▶️🔄✅
* 使用api的方式前端请求后端api返回结果
2. 实时时间显示对齐
3. 添加一天内发帖热图
1. 添加一天内发帖热图
#### 后续
1. 考虑通过 tweets 数预测市场曲线的模型(人工智能)