feat: 添加双卡支持

This commit is contained in:
2026-06-27 16:28:41 +08:00
parent 57ca2f1ea3
commit ecca396792
7 changed files with 1624 additions and 282 deletions
+323 -84
View File
@@ -66,7 +66,9 @@
--r-pill: 9999px;
}
* { box-sizing: border-box; }
* {
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
@@ -85,12 +87,18 @@ body {
-moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select {
button,
input,
textarea,
select {
font: inherit;
letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
a {
color: inherit;
text-decoration: none;
}
::selection {
background: rgba(204, 120, 92, 0.22);
@@ -104,9 +112,16 @@ a { color: inherit; text-decoration: none; }
/* ---------- Type primitives ---------------------------------------------- */
h1, h2, h3, h4, p { margin: 0; }
h1,
h2,
h3,
h4,
p {
margin: 0;
}
h1, h2 {
h1,
h2 {
color: var(--ink);
font-family: var(--font-serif);
font-weight: 400;
@@ -119,7 +134,8 @@ h1 {
}
/* italic serif as editorial flourish — DESIGN allows italic for emphasis */
h1 em, h2 em {
h1 em,
h2 em {
font-style: italic;
font-weight: 400;
color: var(--primary);
@@ -158,7 +174,9 @@ h3 {
color: var(--ink);
}
.spike--coral { color: var(--primary); }
.spike--coral {
color: var(--primary);
}
/* ---------- Eyebrows (caption-uppercase) --------------------------------- */
@@ -191,7 +209,9 @@ h3 {
box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.18);
}
.eyebrow--spike { gap: 6px; }
.eyebrow--spike {
gap: 6px;
}
/* Coral inline text-link */
.text-link {
@@ -201,7 +221,9 @@ h3 {
transition: color 120ms ease;
}
.text-link:hover { color: var(--primary-active); }
.text-link:hover {
color: var(--primary-active);
}
/* ---------- Top nav ------------------------------------------------------- */
@@ -266,7 +288,9 @@ h3 {
transition: color 120ms ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover {
color: var(--ink);
}
.top-nav__actions {
margin-left: auto;
@@ -304,7 +328,9 @@ h3 {
color: var(--on-primary);
}
.button--primary:active { background: var(--primary-active); }
.button--primary:active {
background: var(--primary-active);
}
.button--secondary {
background: var(--canvas);
@@ -335,7 +361,9 @@ h3 {
color: var(--error);
}
.button--danger:active { background: rgba(198, 69, 69, 0.16); }
.button--danger:active {
background: rgba(198, 69, 69, 0.16);
}
.button--compact {
min-height: 32px;
@@ -357,8 +385,14 @@ h3 {
transition: background-color 120ms ease;
}
.icon-button:hover { background: var(--surface-card); }
.icon-button svg { width: 14px; height: 14px; }
.icon-button:hover {
background: var(--surface-card);
}
.icon-button svg {
width: 14px;
height: 14px;
}
.button:focus-visible,
.icon-button:focus-visible,
@@ -406,7 +440,9 @@ h3 {
padding-block: 12px;
}
.hero-copy h1 { margin-top: 18px; }
.hero-copy h1 {
margin-top: 18px;
}
.hero-actions {
margin-top: 32px;
@@ -416,7 +452,9 @@ h3 {
flex-wrap: wrap;
}
.hero-divider { color: var(--muted-soft); }
.hero-divider {
color: var(--muted-soft);
}
/* Runtime card (hero right side) */
.runtime-card {
@@ -541,7 +579,9 @@ h3 {
background: var(--canvas);
}
.section-band--soft { background: var(--surface-soft); }
.section-band--soft {
background: var(--surface-soft);
}
.section-heading {
display: flex;
@@ -563,7 +603,9 @@ h3 {
margin-bottom: var(--space-lg);
}
.section-heading--compact p { margin-top: var(--space-sm); }
.section-heading--compact p {
margin-top: var(--space-sm);
}
/* ---------- Status bento -------------------------------------------------- */
@@ -646,7 +688,103 @@ h3 {
margin-top: auto;
}
.mobile-data-status { min-height: 18px; }
.mobile-data-status {
min-height: 18px;
}
/* SIM manager */
.sim-manager {
display: grid;
gap: var(--space-md);
margin-bottom: var(--space-md);
border-radius: var(--r-lg);
background: var(--surface-card);
border: 1px solid var(--hairline);
padding: var(--space-lg);
}
.sim-manager__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--space-lg);
}
.sim-manager__header h3 {
margin-top: 8px;
font-size: 24px;
}
.sim-manager__status {
min-width: 180px;
text-align: right;
}
.sim-slot-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--space-md);
}
.sim-slot {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
gap: 8px 12px;
border: 1px solid var(--hairline);
border-radius: var(--r-md);
background: var(--canvas);
padding: 12px 14px;
}
.sim-slot.is-active {
border-color: rgba(93, 184, 114, 0.55);
box-shadow: inset 3px 0 0 var(--success);
}
.sim-slot__topline {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 10px;
min-width: 0;
}
.sim-slot__name {
color: var(--ink);
font-size: 16px;
font-weight: 600;
letter-spacing: 0;
}
.sim-slot__state {
border-radius: var(--r-pill);
background: var(--surface-soft);
color: var(--muted);
padding: 4px 10px;
font-size: 12px;
font-weight: 500;
line-height: 1.4;
white-space: nowrap;
}
.sim-slot.is-active .sim-slot__state {
background: rgba(93, 184, 114, 0.16);
color: #2f7c44;
}
.sim-slot__phone {
grid-column: 1 / -1;
color: var(--body-strong);
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.35;
overflow-wrap: anywhere;
}
.sim-slot__phone[hidden] {
display: none;
}
/* Stat strip (3-up compact) */
.stat-strip {
@@ -670,7 +808,9 @@ h3 {
border-color: var(--surface-cream-strong);
}
.stat-tile .eyebrow { margin-bottom: var(--space-md); }
.stat-tile .eyebrow {
margin-bottom: var(--space-md);
}
.stat-tile__value {
font-family: var(--font-serif);
@@ -682,13 +822,6 @@ h3 {
overflow-wrap: anywhere;
}
.stat-tile__value--mono {
font-family: var(--font-mono);
font-size: 17px;
font-weight: 500;
letter-spacing: 0;
}
.stat-tile__hint {
margin-top: auto;
padding-top: var(--space-sm);
@@ -699,6 +832,14 @@ h3 {
/* ---------- Inbox --------------------------------------------------------- */
.inbox-actions {
display: flex;
align-items: center;
gap: var(--space-sm);
flex-wrap: wrap;
justify-content: flex-end;
}
.inbox-panel {
border-radius: var(--r-lg);
background: var(--surface-card);
@@ -759,26 +900,6 @@ h3 {
letter-spacing: -0.2px;
}
.message-meta {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
margin-top: 8px;
}
.message-sim {
border: 1px solid var(--hairline);
border-radius: var(--r-pill);
background: var(--surface-soft);
color: var(--muted);
padding: 3px 9px;
font-family: var(--font-mono);
font-size: 11px;
line-height: 1.5;
overflow-wrap: anywhere;
}
.message-item__header time {
color: var(--muted);
font-family: var(--font-sans);
@@ -841,14 +962,36 @@ h3 {
gap: var(--space-lg);
}
.send-sim-banner {
display: inline-flex;
align-items: center;
gap: 8px;
margin: -4px 0 var(--space-md);
padding: 0;
}
.send-sim-banner span {
color: var(--muted);
font-size: 13px;
font-weight: 500;
}
.send-sim-banner strong {
color: var(--body-strong);
font-family: var(--font-sans);
font-size: 13px;
font-weight: 600;
overflow-wrap: anywhere;
}
.field {
display: grid;
gap: var(--space-xs);
}
.field__label,
.stack-form label > span:not(.field__label),
.channel-form label > span:not(.field__label) {
.stack-form label>span:not(.field__label),
.channel-form label>span:not(.field__label) {
color: var(--body-strong);
font-size: 13px;
font-weight: 500;
@@ -868,7 +1011,9 @@ h3 {
transition: border-color 120ms ease, box-shadow 120ms ease;
}
.text-input::placeholder { color: var(--muted-soft); }
.text-input::placeholder {
color: var(--muted-soft);
}
.text-input:focus {
border-color: var(--primary);
@@ -876,7 +1021,9 @@ h3 {
box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.18);
}
.select-input { appearance: auto; }
.select-input {
appearance: auto;
}
.text-area {
min-height: 144px;
@@ -908,8 +1055,13 @@ h3 {
font-size: 13px;
}
.form-status.is-error { color: var(--error); }
.form-status.is-success { color: var(--success); }
.form-status.is-error {
color: var(--error);
}
.form-status.is-success {
color: var(--success);
}
/* ---------- Console card -------------------------------------------------- */
@@ -994,7 +1146,9 @@ h3 {
padding: 10px 0;
}
.log-line:last-child { border-bottom: 0; }
.log-line:last-child {
border-bottom: 0;
}
.log-level {
color: var(--muted);
@@ -1006,9 +1160,17 @@ h3 {
text-transform: uppercase;
}
.log-line.is-error .log-level { color: var(--error); }
.log-line.is-warn .log-level { color: var(--warning); }
.log-line.is-info .log-level { color: var(--accent-teal); }
.log-line.is-error .log-level {
color: var(--error);
}
.log-line.is-warn .log-level {
color: var(--warning);
}
.log-line.is-info .log-level {
color: var(--accent-teal);
}
.log-message {
overflow-wrap: anywhere;
@@ -1018,8 +1180,15 @@ h3 {
line-height: 1.6;
}
.empty-state { color: var(--muted); font-size: 14px; }
.empty-state--light { color: var(--muted); font-size: 14px; }
.empty-state {
color: var(--muted);
font-size: 14px;
}
.empty-state--light {
color: var(--muted);
font-size: 14px;
}
/* ---------- Footer (slim, single row) ------------------------------------ */
@@ -1044,7 +1213,9 @@ h3 {
font-weight: 500;
}
.brand--footer .brand__mark { color: var(--on-dark); }
.brand--footer .brand__mark {
color: var(--on-dark);
}
.footer__meta {
color: var(--on-dark-soft);
@@ -1056,7 +1227,9 @@ h3 {
/* ---------- Modal --------------------------------------------------------- */
body.modal-open { overflow: hidden; }
body.modal-open {
overflow: hidden;
}
.modal {
position: fixed;
@@ -1068,7 +1241,9 @@ body.modal-open { overflow: hidden; }
padding: var(--space-lg);
}
.modal.is-open { display: flex; }
.modal.is-open {
display: flex;
}
.modal__backdrop {
position: absolute;
@@ -1098,7 +1273,9 @@ body.modal-open { overflow: hidden; }
padding-bottom: var(--space-lg);
}
.modal__header h2 { margin-top: 10px; }
.modal__header h2 {
margin-top: 10px;
}
.push-settings {
display: grid;
@@ -1114,7 +1291,9 @@ body.modal-open { overflow: hidden; }
padding: 20px;
}
.panel-header--light { color: var(--muted); }
.panel-header--light {
color: var(--muted);
}
.channel-list-panel .panel-header {
display: grid;
@@ -1203,7 +1382,9 @@ body.modal-open { overflow: hidden; }
text-transform: uppercase;
}
.channel-list__item.is-active .channel-list__meta { color: var(--primary); }
.channel-list__item.is-active .channel-list__meta {
color: var(--primary);
}
.channel-form {
border-radius: var(--r-lg);
@@ -1218,7 +1399,9 @@ body.modal-open { overflow: hidden; }
padding: 0;
}
.form-fieldset:disabled { opacity: 0.55; }
.form-fieldset:disabled {
opacity: 0.55;
}
.channel-form__grid {
display: grid;
@@ -1248,19 +1431,27 @@ body.modal-open { overflow: hidden; }
accent-color: var(--primary);
}
.field-row--wide { grid-column: 1 / -1; }
.field-row--wide {
grid-column: 1 / -1;
}
.channel-form__actions { margin-top: var(--space-lg); }
.channel-form__actions {
margin-top: var(--space-lg);
}
.is-hidden { display: none !important; }
.is-hidden {
display: none !important;
}
/* ---------- Responsive ---------------------------------------------------- */
@media (max-width: 1024px) {
.hero-grid,
.workbench-grid,
.push-settings,
.bento-grid {
.bento-grid,
.sim-slot-grid {
grid-template-columns: 1fr;
}
@@ -1270,12 +1461,15 @@ body.modal-open { overflow: hidden; }
}
@media (max-width: 767px) {
.container,
.top-nav__inner {
width: min(100% - 32px, 1200px);
}
.top-nav { height: auto; }
.top-nav {
height: auto;
}
.top-nav__inner {
min-height: 64px;
@@ -1292,13 +1486,21 @@ body.modal-open { overflow: hidden; }
gap: 16px;
}
.top-nav__actions { margin-left: auto; }
.top-nav__actions {
margin-left: auto;
}
.hero-band { padding: 56px 0 64px; }
.hero-band {
padding: 56px 0 64px;
}
.hero-copy { min-height: 0; }
.hero-copy {
min-height: 0;
}
.section-band { padding: 64px 0; }
.section-band {
padding: 64px 0;
}
.section-heading {
display: grid;
@@ -1306,15 +1508,42 @@ body.modal-open { overflow: hidden; }
gap: var(--space-md);
}
.stat-strip { grid-template-columns: 1fr; }
.inbox-actions {
justify-content: stretch;
}
.sim-manager {
padding: var(--space-lg);
}
.sim-slot {
padding: 12px 14px;
}
.sim-manager__header {
display: grid;
}
.sim-manager__status {
min-width: 0;
text-align: left;
}
.stat-strip {
grid-template-columns: 1fr;
}
.form-card,
.console-card,
.bento-hero,
.bento-control,
.runtime-card { padding: var(--space-lg); }
.runtime-card {
padding: var(--space-lg);
}
.at-form { grid-template-columns: 1fr; }
.at-form {
grid-template-columns: 1fr;
}
.message-item__header {
grid-template-columns: 1fr;
@@ -1322,9 +1551,13 @@ body.modal-open { overflow: hidden; }
}
.message-item__header time,
.message-status { width: max-content; }
.message-status {
width: max-content;
}
.log-window { height: 360px; }
.log-window {
height: 360px;
}
.log-line {
grid-template-columns: 1fr;
@@ -1347,10 +1580,16 @@ body.modal-open { overflow: hidden; }
}
.channel-form,
.channel-list-panel { padding: 20px; }
.channel-list-panel {
padding: 20px;
}
.channel-form__grid { grid-template-columns: 1fr; }
.channel-form__grid {
grid-template-columns: 1fr;
}
.switch-row,
.field-row--wide { grid-column: auto; }
}
.field-row--wide {
grid-column: auto;
}
}
+158 -20
View File
@@ -2,7 +2,9 @@ const state = {
busy: false,
mobileDataBusy: false,
trafficBusy: false,
simBusy: false,
currentMobileData: null,
currentSim: null,
pushChannels: [],
selectedPushChannel: -1,
pushLoaded: false
@@ -44,10 +46,20 @@ const elements = {
mobileDataConsume: document.querySelector('#mobileDataConsume'),
mobileDataTrafficHint: document.querySelector('#mobileDataTrafficHint'),
mobileDataStatus: document.querySelector('#mobileDataStatus'),
simMode: document.querySelector('#simMode'),
simStatus: document.querySelector('#simStatus'),
simSlot0: document.querySelector('#simSlot0'),
simSlot1: document.querySelector('#simSlot1'),
simSlot0State: document.querySelector('#simSlot0State'),
simSlot1State: document.querySelector('#simSlot1State'),
simSlot0Phone: document.querySelector('#simSlot0Phone'),
simSlot1Phone: document.querySelector('#simSlot1Phone'),
simSwitchButtons: [...document.querySelectorAll('[data-sim-switch]')],
moduleModel: document.querySelector('#moduleModel'),
moduleVersion: document.querySelector('#moduleVersion'),
iccid: document.querySelector('#iccid'),
currentSim: document.querySelector('#currentSim'),
smsForm: document.querySelector('#smsForm'),
sendSimLabel: document.querySelector('#sendSimLabel'),
smsStatus: document.querySelector('#smsStatus'),
messagesButton: document.querySelector('#messagesButton'),
messageCount: document.querySelector('#messageCount'),
@@ -225,12 +237,97 @@ function renderMobileData(mobileData = {}) {
elements.mobileDataConsume.disabled = state.mobileDataBusy || state.trafficBusy || !enabled;
}
function renderStatus(status, info) {
function getActiveSimSlot(sim = {}) {
return (sim.slots || []).find(slot => slot.active) || null;
}
function getSimDisplayLabel(slot) {
return slot?.phoneLabel || slot?.phoneNumber || slot?.name || 'SIM';
}
function getActiveSimLabel() {
return getSimDisplayLabel(getActiveSimSlot(state.currentSim || {}));
}
function renderSendSimLabel() {
setText(elements.sendSimLabel, getActiveSimLabel());
}
function getSimSlot(sim = {}, slotNumber) {
return (sim.slots || []).find(slot => slot.slot === slotNumber) || {
slot: slotNumber,
name: `SIM${slotNumber + 1}`,
active: false,
phoneNumber: '',
phoneLabel: `SIM${slotNumber + 1}`
};
}
function formatSimSlotPhone(slot) {
if (slot?.phoneNumber) {
return slot.phoneNumber;
}
if (slot?.phoneLabel && slot.phoneLabel !== slot.name) {
return slot.phoneLabel;
}
return '';
}
function renderSimSlot(slot, card, stateNode, phoneNode) {
if (!card) {
return;
}
card.classList.toggle('is-active', Boolean(slot.active));
setText(stateNode, slot.active ? '当前使用' : '未选中');
const phoneText = formatSimSlotPhone(slot);
if (phoneNode) {
phoneNode.textContent = phoneText;
phoneNode.hidden = !phoneText;
}
}
function renderSimStatus(sim = {}) {
state.currentSim = sim;
const supported = Boolean(sim.supported && sim.canSwitch);
const activeSlot = getActiveSimSlot(sim);
const modeLabel = supported ? (sim.modeLabel || '双卡') : '单卡/未检测到双卡';
setText(elements.simMode, modeLabel);
renderSimSlot(getSimSlot(sim, 0), elements.simSlot0, elements.simSlot0State, elements.simSlot0Phone);
renderSimSlot(getSimSlot(sim, 1), elements.simSlot1, elements.simSlot1State, elements.simSlot1Phone);
elements.simSwitchButtons.forEach((button) => {
const slot = Number.parseInt(button.dataset.simSwitch, 10);
const isActive = activeSlot?.slot === slot;
button.disabled = state.simBusy || Boolean(sim.switching) || !supported || isActive;
button.textContent = isActive ? '正在使用' : `切到SIM${slot + 1}`;
});
if (state.simBusy || sim.switching) {
setStatusMessage(elements.simStatus, '正在切换SIM...');
} else if (supported && activeSlot) {
setStatusMessage(elements.simStatus, `当前 ${getSimDisplayLabel(activeSlot)}`, 'success');
} else if (!supported) {
setStatusMessage(elements.simStatus, '双卡不可用');
} else {
setStatusMessage(elements.simStatus, '');
}
renderSendSimLabel();
}
function renderStatus(status, info, sim) {
const data = status.data || {};
const infoData = info.data || {};
const model = data.model || infoData.model || {};
const signal = data.signal || {};
const ready = Boolean(data.ready);
const simData = sim?.data || data.sim || {};
const activeSim = getActiveSimSlot(simData);
setText(elements.readyBadge, ready ? '模组已就绪' : '模组未就绪');
setText(elements.panelStatus, ready ? 'ready' : 'not ready');
@@ -246,7 +343,8 @@ function renderStatus(status, info) {
setText(elements.signalHint, signal.ber === undefined ? 'RSSI 与误码率将在刷新后显示。' : `误码率 ${signal.ber},质量 ${signal.quality || '未知'}`);
setText(elements.moduleModel, model.model || '--');
setText(elements.moduleVersion, model.version || '--');
setText(elements.iccid, infoData.iccid || '--');
setText(elements.currentSim, getSimDisplayLabel(activeSim) || infoData.simLabel || '--');
renderSimStatus(simData);
}
function parseLogLine(line) {
@@ -314,11 +412,8 @@ function formatDateTime(value) {
function renderMessages(messages, meta = {}) {
elements.messageList.replaceChildren();
const currentSimLabel = meta.currentSim?.simLabel || '当前SIM未知';
const countLabel = meta.partitionBySim ? `${currentSimLabel} 最近 ${messages.length}` : `全部SIM 最近 ${messages.length}`;
const scopeLabel = meta.partitionBySim
? (meta.currentSimKnown ? '仅显示当前SIM收到的短信' : '未识别当前SIM,收件箱已隐藏')
: 'SIM隔离未启用';
const countLabel = `最近 ${messages.length}`;
const scopeLabel = '新短信自动显示';
setText(elements.messageCount, countLabel);
setText(elements.messageScope, scopeLabel);
@@ -353,16 +448,8 @@ function renderMessages(messages, meta = {}) {
text.className = 'message-text';
text.textContent = message.text || '';
const metaRow = document.createElement('div');
metaRow.className = 'message-meta';
const sim = document.createElement('span');
sim.className = 'message-sim';
sim.textContent = message.simLabel || '未知SIM';
metaRow.append(sim);
header.append(sender, status, time);
item.append(header, metaRow, text);
item.append(header, text);
fragment.append(item);
});
@@ -679,10 +766,54 @@ async function refreshLogs() {
}
async function refreshMessages() {
const messages = await requestJSON('/api/sms/received?limit=50');
const params = new URLSearchParams({ limit: '50', scope: 'all' });
const messages = await requestJSON(`/api/sms/received?${params.toString()}`);
renderMessages(messages.data || [], messages.meta || {});
}
async function refreshSim() {
const sim = await requestJSON('/api/modem/sim?refresh=true');
renderSimStatus(sim.data || {});
return sim;
}
async function switchSim(slot) {
if (state.simBusy) {
return;
}
const slotNumber = Number.parseInt(slot, 10);
if (!Number.isInteger(slotNumber)) {
return;
}
if (!window.confirm(`切换到SIM${slotNumber + 1}会重新初始化SIM、驻网和短信功能,期间可能短暂收不到短信。确定继续吗?`)) {
return;
}
state.simBusy = true;
renderSimStatus({
...(state.currentSim || {}),
switching: true
});
try {
const result = await requestJSON('/api/modem/sim/switch', {
method: 'POST',
body: JSON.stringify({ slot: slotNumber })
});
renderSimStatus(result.data || {});
setStatusMessage(elements.simStatus, result.message || `已切换到SIM${slotNumber + 1}`, 'success');
await refreshAll();
} catch (err) {
setStatusMessage(elements.simStatus, err.message, 'error');
await refreshSim().catch(() => {});
} finally {
state.simBusy = false;
renderSimStatus(state.currentSim || {});
}
}
async function toggleMobileData() {
if (state.mobileDataBusy) {
return;
@@ -754,7 +885,8 @@ async function refreshAll() {
try {
const status = await requestJSON('/api/status');
const info = await requestJSON('/api/modem/info');
renderStatus(status, info);
const sim = await requestJSON('/api/modem/sim?refresh=true');
renderStatus(status, info, sim);
setStatusMessage(elements.mobileDataStatus, '');
await refreshMessages();
await refreshLogs();
@@ -784,7 +916,8 @@ async function sendSMS(event) {
}
submit.disabled = true;
setStatusMessage(elements.smsStatus, '发送中...');
renderSendSimLabel();
setStatusMessage(elements.smsStatus, `正在使用 ${getActiveSimLabel()} 发送...`);
try {
const result = await requestJSON('/api/sms/send', {
@@ -845,6 +978,11 @@ elements.pushChannelForm.elements.type.addEventListener('change', handlePushType
elements.refreshButton.addEventListener('click', refreshAll);
elements.mobileDataToggle.addEventListener('click', toggleMobileData);
elements.mobileDataConsume.addEventListener('click', consumeMobileDataTraffic);
elements.simSwitchButtons.forEach((button) => {
button.addEventListener('click', () => {
switchSim(button.dataset.simSwitch);
});
});
elements.logsButton.addEventListener('click', refreshLogs);
elements.messagesButton.addEventListener('click', refreshMessages);
elements.smsForm.addEventListener('submit', sendSMS);