"""邮件链接落地页:一键参加活动与邮件按钮测试。""" from __future__ import annotations from html import escape JOIN_PAGE = """\ 一键参加 · WorkLog

正在处理…

""" def join_page(message: str, state: str, activity_title: str = "", extra: str = "") -> str: icon = "✓" if state == "ok" else ("?" if state == "confirm" else "✕") button = '打开 WorkLog' if state == "ok" else "" title_html = ( f'

{escape(activity_title)}

' if activity_title else "" ) heading = {"ok": "记录成功", "confirm": "确认参加", "err": "无法完成"}[state] return JOIN_PAGE.replace( '

正在处理…

', f'
{icon}
' f"

{heading}

{title_html}" f"

{escape(str(message))}

{button}{extra}
", ) def confirmation_page(message: str, nonce: str | None = None, title: str = '值班邮件确认', button_label: str = '确认已知晓值班安排') -> str: form = ( f'
' f'
' if nonce else "" ) return ( f'' f'{escape(title)} · WorkLog' f"" f"

{escape(title)}

{escape(message)}

{form}
" )