Skip to content

Commit de8e8a2

Browse files
committed
Declutter IPTV source status line
- Shorten the EPG count label and drop it when zero (most sources have no EPG configured). - Only show a status badge when there's something to flag (error/pending); "ok" is already implied by having fresh counts. - Truncate the status line with ellipsis instead of wrapping/overflowing.
1 parent 92025ce commit de8e8a2

3 files changed

Lines changed: 29 additions & 20 deletions

File tree

web/app.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,18 +3207,27 @@ function renderServerList(servers) {
32073207
servers.filter(s => _normType(s.type) === 'iptv').forEach(refreshIPTVServerCardStatus);
32083208
}
32093209

3210+
// Channel/EPG-matched counts shared by the settings server card and the
3211+
// library browser status line. EPG is dropped entirely when zero — most
3212+
// sources have no EPG configured, and "EPG 0" carries no information.
3213+
function _iptvCountParts(summary) {
3214+
const parts = [tr('iptvChannelsCount', { count: summary.channel_count || 0 })];
3215+
if (summary.epg_matched_count) parts.push(tr('iptvEpgMatched', { count: summary.epg_matched_count }));
3216+
return parts;
3217+
}
3218+
32103219
async function refreshIPTVServerCardStatus(s) {
32113220
try {
32123221
const summary = await api('GET', `/api/iptv/summary?server_id=${encodeURIComponent(s.id)}`);
32133222
const el = document.getElementById(`iptv-summary-${s.id}`);
32143223
if (!el) return;
3215-
const statusKey = summary.refresh_status === 'ok' ? 'iptvSourceStatusOk'
3216-
: (summary.refresh_status === 'error' ? 'iptvSourceStatusError' : 'iptvSourceStatusPending');
3217-
el.textContent = [
3218-
tr('iptvChannelsCount', { count: summary.channel_count || 0 }),
3219-
tr('iptvEpgMatched', { count: summary.epg_matched_count || 0 }),
3220-
tr(statusKey),
3221-
].join(' · ');
3224+
const parts = _iptvCountParts(summary);
3225+
// "ok" is the expected steady state and is already implied by having
3226+
// fresh counts; only surface the badge when there's something to flag.
3227+
if (summary.refresh_status !== 'ok') {
3228+
parts.push(tr(summary.refresh_status === 'error' ? 'iptvSourceStatusError' : 'iptvSourceStatusPending'));
3229+
}
3230+
el.textContent = parts.join(' · ');
32223231
el.classList.toggle('iptv-status-error', summary.refresh_status === 'error');
32233232
} catch (_) {}
32243233
}
@@ -3782,21 +3791,18 @@ async function loadIPTVSourceStatus() {
37823791
function renderIPTVSourceStatus(s) {
37833792
const el = document.getElementById('iptv-source-status');
37843793
if (!el) return;
3785-
const statusKey = s.refresh_status === 'ok' ? 'iptvSourceStatusOk'
3786-
: (s.refresh_status === 'error' ? 'iptvSourceStatusError' : 'iptvSourceStatusPending');
3787-
const parts = [
3788-
tr('iptvChannelsCount', { count: s.channel_count || 0 }),
3789-
tr('iptvEpgMatched', { count: s.epg_matched_count || 0 }),
3790-
];
3794+
const parts = _iptvCountParts(s);
37913795
if (s.last_refreshed) {
37923796
const time = new Date(s.last_refreshed);
37933797
if (!isNaN(time)) parts.push(tr('iptvLastUpdated', { time: time.toLocaleString() }));
37943798
}
3795-
const statusCls = s.refresh_status === 'error' ? ' iptv-status-error' : '';
3796-
el.innerHTML = `
3797-
<span>${parts.map(esc).join(' · ')}</span>
3798-
<span class="${statusCls}">${esc(tr(statusKey))}</span>
3799-
`;
3799+
// "ok" is the expected steady state and is already implied by having
3800+
// fresh counts; only show a second line when there's something to flag.
3801+
const badge = s.refresh_status === 'ok' ? '' : `
3802+
<span class="${s.refresh_status === 'error' ? 'iptv-status-error' : ''}">${esc(tr(
3803+
s.refresh_status === 'error' ? 'iptvSourceStatusError' : 'iptvSourceStatusPending'
3804+
))}</span>`;
3805+
el.innerHTML = `<span class="iptv-source-status-line">${parts.map(esc).join(' · ')}</span>${badge}`;
38003806
}
38013807

38023808
async function refreshIPTVSource() {

web/i18n.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
needPlaylistUrl: '请输入播放列表地址',
319319
iptvRefreshing: '正在获取频道列表…',
320320
iptvChannelsCount: '{count} 个频道',
321-
iptvEpgMatched: 'EPG 匹配 {count} 个频道',
321+
iptvEpgMatched: 'EPG {count}',
322322
iptvLastUpdated: '上次更新:{time}',
323323
iptvNoGuide: '暂无节目单',
324324
categoryAll: '全部',
@@ -656,7 +656,7 @@
656656
needPlaylistUrl: 'Please enter a playlist URL',
657657
iptvRefreshing: 'Fetching channel list…',
658658
iptvChannelsCount: '{count} channels',
659-
iptvEpgMatched: 'EPG matched {count} channels',
659+
iptvEpgMatched: 'EPG {count}',
660660
iptvLastUpdated: 'Last updated: {time}',
661661
iptvNoGuide: 'No guide available',
662662
categoryAll: 'All',

web/styles.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,9 @@ button { font-family: inherit; }
12301230
padding: 10px 14px; font-size: 12px; color: var(--text-muted);
12311231
display: grid; gap: 4px;
12321232
}
1233+
.iptv-source-status-line {
1234+
min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
1235+
}
12331236
.iptv-status-error { color: #ff7a7a; }
12341237
.iptv-category-row {
12351238
display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;

0 commit comments

Comments
 (0)