-
无法加载短信列表。
+
+
无法加载短信对话。
) : messages === undefined ? (
-
正在加载短信…
- ) : messages.length === 0 ? (
-
暂无短信。
+
+ 正在加载短信…
+
+ ) : conversations.length === 0 ? (
+
暂无对话。可以新建对话开始发送短信。
) : (
-
- {messages.map((message) => (
- -
-
-
- {directionLabel(message.direction)} · {message.phoneNumber}
-
-
-
-
{message.content}
- 状态:{message.status}
+
+ {conversations.map((conversation) => (
+ -
+
))}
)}
+
+
+ {!selectedPhone ? (
+
+
选择一个对话
+
从左侧选择已有对话,或新建对话开始发送短信。
+
+ ) : (
+ <>
+
+
+ {activeConversation?.messages.map((message) => (
+ -
+
+
+ {directionLabel(message.direction)} · {message.phoneNumber}
+
+
+
+
{message.content}
+ 状态:{message.status}
+
+ ))}
+
+
+ {sendState === 'success' ? 短信已提交发送。
: null}
+ {sendState === 'error' ? (
+ 短信发送失败,请核对设备状态后重试。
+ ) : null}
+ {pendingSend ? (
+
+ 发送前确认
+ 实例:{instance.name}
+ 号码:{pendingSend.phoneNumber}
+ 内容:{pendingSend.content}
+ 确认后会立即提交到当前设备。
+
+
+
+
+
+ ) : null}
+ >
+ )}
+
+
+ {newConversationOpen ? (
+
+ ) : null}
);
}
diff --git a/apps/web/src/styles.css b/apps/web/src/styles.css
index 5484f55..8e7d36f 100644
--- a/apps/web/src/styles.css
+++ b/apps/web/src/styles.css
@@ -284,6 +284,7 @@ small {
gap: 1rem;
}
.fleet-card {
+ position: relative;
min-width: 0;
padding: 1rem;
border: 1px solid var(--border);
@@ -588,6 +589,43 @@ tbody th small {
justify-content: flex-end;
padding-top: 1rem;
}
+.fleet-card-entry {
+ display: block;
+ min-width: 0;
+ color: inherit;
+ text-decoration: none;
+}
+.fleet-card-entry::after {
+ content: '';
+ position: absolute;
+ inset: 0;
+ z-index: 0;
+ border-radius: var(--radius);
+}
+.fleet-card-entry:focus-visible {
+ outline: none;
+}
+.fleet-card-entry:focus-visible::after {
+ outline: 3px solid var(--warning);
+ outline-offset: 3px;
+}
+.fleet-card-entry:hover h2,
+.fleet-card-entry:focus-visible h2 {
+ color: var(--accent-strong);
+ text-decoration: underline;
+ text-underline-offset: 0.2em;
+}
+.fleet-card-entry code {
+ display: block;
+ overflow-wrap: anywhere;
+}
+.fleet-card-admin-actions {
+ position: relative;
+ z-index: 1;
+ justify-content: flex-end;
+ padding-top: 0.25rem;
+ border-top: 1px solid #e9dfca;
+}
.instance-detail {
display: grid;
grid-template-columns: 13rem minmax(0, 1fr);
@@ -622,57 +660,171 @@ dd {
.instance-module-detail {
min-width: 0;
}
-.messages-module {
+.messages-workbench {
display: grid;
- grid-template-columns: minmax(16rem, 0.85fr) minmax(22rem, 1.4fr);
- align-items: start;
- gap: 0.8rem;
+ grid-template-columns: minmax(16rem, 21rem) minmax(24rem, 1fr);
+ min-height: 36rem;
+ overflow: hidden;
+ border: 1px solid #e2d6bf;
+ border-radius: var(--radius);
+ background: var(--surface-raised);
}
-.messages-module,
-.messages-card,
-.sms-list,
-.sms-message-card {
+.conversation-panel {
min-width: 0;
- max-width: 100%;
- overflow-wrap: anywhere;
+ border-right: 1px solid #e2d6bf;
+ background: #fffdf5;
}
-.messages-card h2 {
- margin-top: 0;
-}
-.messages-card form,
-.messages-card label {
- display: grid;
- min-width: 0;
- gap: 0.5rem;
-}
-.messages-card form {
+.conversation-panel-header,
+.conversation-detail-header,
+.conversation-entry-title,
+.composer-footer {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
gap: 0.75rem;
}
-.messages-card textarea {
- min-height: 8rem;
+.conversation-panel-header,
+.conversation-detail-header {
+ min-height: 4.5rem;
+ padding: 0.8rem 1rem;
+ border-bottom: 1px solid #e2d6bf;
+}
+.conversation-panel-header h2,
+.conversation-detail-header h2,
+.conversation-panel-header span,
+.conversation-detail-header small {
+ margin: 0;
+}
+.conversation-panel-header span,
+.conversation-detail-header span,
+.conversation-entry small,
+.conversation-entry time,
+.composer-footer small {
+ color: var(--muted);
+ font-size: 0.78rem;
+}
+.conversation-list,
+.message-thread {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+}
+.conversation-entry {
+ width: 100%;
+ display: grid;
+ gap: 0.3rem;
+ padding: 0.85rem 1rem;
+ border: 0;
+ border-bottom: 1px solid #eee4d2;
+ border-radius: 0;
+ color: inherit;
+ background: transparent;
+ box-shadow: none;
+ text-align: left;
+}
+.conversation-entry > span:not(.conversation-entry-title) {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+.conversation-entry:hover,
+.conversation-entry[aria-pressed='true'] {
+ background: #f2f8e9;
+}
+.conversation-state,
+.conversation-empty-state {
+ padding: 1.2rem;
+}
+.conversation-detail {
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ background: #fffaf0;
+}
+.conversation-empty-state {
+ margin: auto;
+ max-width: 24rem;
+ text-align: center;
+ color: var(--muted);
+}
+.message-thread {
+ flex: 1 1 auto;
+ display: flex;
+ flex-direction: column;
+ gap: 0.65rem;
+ max-height: 32rem;
+ padding: 1rem;
+ overflow-y: auto;
+}
+.message-bubble {
+ max-width: min(78%, 36rem);
+ padding: 0.75rem 0.9rem;
+ border: 1px solid #e2d6bf;
+ border-radius: 14px;
+ background: #fffdf5;
+}
+.message-bubble header {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ gap: 0.5rem;
+}
+.message-bubble p {
+ white-space: pre-wrap;
+}
+.message-发送 {
+ align-self: flex-end;
+ background: #eaf4dd;
+}
+.message-composer {
+ display: grid;
+ gap: 0.6rem;
+ padding: 0.8rem 1rem;
+ border-top: 1px solid #e2d6bf;
+ background: #fffdf5;
+}
+.message-composer label {
+ display: grid;
+ gap: 0.35rem;
+}
+.message-composer textarea {
+ box-sizing: border-box;
+ width: 100%;
+ min-height: 5rem;
resize: vertical;
}
.send-confirmation {
- margin-top: 0.8rem;
+ margin: 0 1rem 1rem;
padding: 0.8rem;
border: 1px solid #dca66d;
border-radius: 14px;
background: #fff5dc;
}
-.send-confirmation h3,
-.send-confirmation p {
- margin-top: 0;
+.dialog-backdrop {
+ position: fixed;
+ inset: 0;
+ z-index: 20;
+ display: grid;
+ place-items: center;
+ padding: 1rem;
+ background: rgba(72, 52, 33, 0.36);
}
-.messages-card input,
-.messages-card textarea {
+.new-conversation-dialog {
+ width: min(100%, 26rem);
+ padding: 1.2rem;
+ border: 1px solid #e2d6bf;
+ border-radius: var(--radius);
+ background: #fffdf5;
+ box-shadow: 0 20px 60px rgba(72, 52, 33, 0.24);
+}
+.new-conversation-dialog label {
+ display: grid;
+ gap: 0.4rem;
+}
+.new-conversation-dialog input {
box-sizing: border-box;
- min-width: 0;
- max-width: 100%;
width: 100%;
}
-.sms-list {
- padding-inline-start: 1.25rem;
-}
.overview-grid,
.cellular-grid,
.device-network-grid,
@@ -767,8 +919,16 @@ main ul[aria-label='已配置实例'] {
.instance-context {
margin-bottom: 1rem;
}
- .messages-module {
+ .messages-workbench {
grid-template-columns: minmax(0, 1fr);
+ min-height: 0;
+ }
+ .conversation-panel {
+ border-right: 0;
+ border-bottom: 1px solid #e2d6bf;
+ }
+ .message-thread {
+ max-height: none;
}
.instance-context ul {
display: grid;