From 8fc4feb10d1b76802d382621922a01210ef32e7a Mon Sep 17 00:00:00 2001 From: yaosanqi137 Date: Thu, 5 Nov 2026 11:39:32 +0800 Subject: [PATCH] refactor: remove status mirror interaction and obsolete dialogs --- src/App.vue | 49 +++++++++++-------------------- src/components/StatusPage.vue | 7 ++--- src/locales/en-US/common.ts | 3 -- src/locales/zh-CN/common.ts | 3 -- src/style.css | 55 ++++++++++++----------------------- 5 files changed, 38 insertions(+), 79 deletions(-) diff --git a/src/App.vue b/src/App.vue index 8cf1339..eafe9b2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,8 +2,8 @@ import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue' import { useI18n } from 'vue-i18n' import { - ArrowRight, ArrowUpRight, CircleHelp, Check, - ExternalLink, Menu, Monitor, Moon, + ArrowRight, CircleHelp, Check, + Menu, Monitor, Moon, Search, Sun, X, } from 'lucide-vue-next' import RollingText from './components/RollingText.vue' @@ -92,37 +92,24 @@ function announcementDate(date: string) { const parts = Object.fromEntries(formatter.formatToParts(new Date(date)).map(part => [part.type, part.value])) return t('mirrors.datePatterns.announcement', { year: parts.year, month: parts.month, day: parts.day }) } -function nextLabel(mirror: Mirror) { - return ['syncing', 'failed', 'paused', 'unknown'].includes(mirror.status) - ? t(`mirrors.status.${mirror.status}`) : relativeTime(mirror.nextSync, true) -} function resetSearch() { search.value = ''; searchInput.value?.focus() } -type Modal = 'about' | 'downloads' | 'mirror' -const dialog = ref() -const modal = ref(null) -const selectedMirror = ref(null) -const modalTitle = computed(() => { - if (modal.value === 'mirror') return selectedMirror.value?.name || '' - const keys = { about: 'common.aboutTitle', downloads: 'announcements.downloadsTitle' } - return modal.value && modal.value in keys ? t(keys[modal.value as keyof typeof keys]) : '' -}) -async function openModal(value: Modal, mirror?: Mirror) { - modal.value = value - selectedMirror.value = mirror || null +const downloadDialog = ref() +const downloadsOpen = ref(false) +async function openDownloads() { + downloadsOpen.value = true mobileOpen.value = false themeOpen.value = false await nextTick() - if (!dialog.value?.open) dialog.value?.showModal() + if (!downloadDialog.value?.open) downloadDialog.value?.showModal() } -function closeModal() { dialog.value?.close() } -function onDialogClose() { modal.value = null; selectedMirror.value = null } -watch(modal, value => { document.body.classList.toggle('dialog-open', value !== null) }) +function closeDownloads() { downloadDialog.value?.close() } +watch(downloadsOpen, value => { document.body.classList.toggle('dialog-open', value) }) function onKeydown(event: KeyboardEvent) { if (event.key === 'Escape') { themeOpen.value = false; mobileOpen.value = false } const target = event.target as HTMLElement - if (!isAdminPage && !isAnnouncementsPage && !isHelpPage && !dialog.value?.open && ((event.key === 'k' && (event.ctrlKey || event.metaKey)) + if (!isAdminPage && !isAnnouncementsPage && !isHelpPage && !downloadDialog.value?.open && ((event.key === 'k' && (event.ctrlKey || event.metaKey)) || (event.key === '/' && !['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName) && !target.isContentEditable))) { event.preventDefault() if (isStatusPage) statusPage.value?.focusSearch() @@ -189,7 +176,7 @@ onBeforeUnmount(() => { - +
@@ -228,11 +215,11 @@ onBeforeUnmount(() => { {{ item.title }} -

{{ t('common.noAnnouncements') }}

+
-

{{ t('announcements.downloads') }}

+

{{ t('announcements.downloads') }}

- -

{{ modalTitle }}

-
- - - + +

{{ t('announcements.downloadsTitle') }}

+
+
diff --git a/src/components/StatusPage.vue b/src/components/StatusPage.vue index 9e03b98..8d8932e 100644 --- a/src/components/StatusPage.vue +++ b/src/components/StatusPage.vue @@ -10,7 +10,6 @@ import MonitoringChart from './MonitoringChart.vue' import RollingText from './RollingText.vue' const props = defineProps<{ mirrors: Mirror[]; now: number; cycle: number; showNextSync: boolean }>() -const emit = defineEmits<{ mirror: [mirror: Mirror] }>() const { t, n } = useI18n({ useScope: 'global' }) const { mirrorSize, relativeTime, fullTime } = useMirrorFormats(toRef(props, 'now')) const range = ref(24) @@ -127,7 +126,7 @@ onBeforeUnmount(() => { sequence++; controller?.abort(); speedController?.abort( - + @@ -175,8 +174,8 @@ onBeforeUnmount(() => { sequence++; controller?.abort(); speedController?.abort( .sync-table :is(th, td):last-child { padding-right: 0; } .sync-table tr[data-status='syncing'] { background: var(--blue-soft); } .sync-table tr[data-status='failed'] { background: var(--red-soft); } -.sync-name { padding: 0; min-height: 30px; color: var(--blue); font: 600 13px ui-monospace, Consolas, monospace; text-align: left; overflow-wrap: anywhere; } -.sync-name:hover, .sync-table a:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; } +.sync-name { display: inline-flex; align-items: center; min-height: 30px; color: var(--ink); font: 600 13px ui-monospace, Consolas, monospace; overflow-wrap: anywhere; } +.sync-table a:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; } .sync-update { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 12px; font-size: 12px; font-variant-numeric: tabular-nums; } .sync-table td[data-column='upstream'] { font-size: 12px; } .sync-table td[data-column='size'] { font-variant-numeric: tabular-nums; white-space: nowrap; } diff --git a/src/locales/en-US/common.ts b/src/locales/en-US/common.ts index 5d3a45a..2c5c13a 100644 --- a/src/locales/en-US/common.ts +++ b/src/locales/en-US/common.ts @@ -40,9 +40,6 @@ export default { "preview": "Interface preview · Demo data", "footer": "MirrorITS is developed and hosted by ITStudio at Ocean University of China.", "studio": "IT Studio", - "source": "Sync engine", - "aboutTitle": "About MirrorITS", - "aboutBody": "MirrorITS provides open-source software downloads and is developed and hosted by ITStudio at Ocean University of China.", "previewBody": "This is an interface prototype. Mirrors and sync jobs use demo data and are not connected to the mirror server. Mirror directories, configuration addresses and downloads will be available after integration.", "emptyValue": "—", "footerLinks": "Related sites", diff --git a/src/locales/zh-CN/common.ts b/src/locales/zh-CN/common.ts index f776953..3e28273 100644 --- a/src/locales/zh-CN/common.ts +++ b/src/locales/zh-CN/common.ts @@ -40,9 +40,6 @@ export default { "preview": "界面预览 · 演示数据", "footer": "爱特开源软件镜像站(MirrorITS)由中国海洋大学爱特工作室开发部署。", "studio": "爱特工作室", - "source": "同步引擎", - "aboutTitle": "关于 MirrorITS", - "aboutBody": "爱特开源软件镜像站(MirrorITS)由中国海洋大学爱特工作室开发部署,为校内外用户提供开源软件下载服务。", "previewBody": "当前为界面原型,镜像与同步任务均为演示数据,尚未连接镜像服务器。正式镜像目录、配置地址与下载服务将在接入后开放。", "emptyValue": "—", "footerLinks": "友情链接", diff --git a/src/style.css b/src/style.css index 134202c..46d3d98 100644 --- a/src/style.css +++ b/src/style.css @@ -3,9 +3,9 @@ /* Palette from itouc.cn. */ --blue: #0969da; --blue-bright: #58a6ff; --blue-soft: rgba(9, 105, 218, .08); --ink: #24292f; --ink-2: #343a40; --ink-3: var(--ink-2); --line: #d0d7de; --line-soft: #d8dee4; - --paper: #fff; --surface: #f6f8fa; --panel: #fff; --panel-blue: var(--surface); + --paper: #fff; --surface: #f6f8fa; --panel: #fff; --on-accent: #fff; --accent-hover: color-mix(in srgb, var(--blue) 88%, #000); - --shadow: 0 4px 12px rgba(140, 149, 159, .15); --dialog-shadow: 0 8px 24px rgba(140, 149, 159, .2); + --shadow: 0 4px 12px rgba(140, 149, 159, .15); --green: #2dba4e; --amber: #b98325; --red: #cf222e; --red-soft: rgba(207, 34, 46, .08); --violet: #8957e5; color-scheme: light; } @@ -15,7 +15,7 @@ --paper: #0d1117; --surface: #161b22; --panel: #161b22; --on-accent: #0d1117; --accent-hover: color-mix(in srgb, var(--blue) 88%, #fff); --green: #6fda83; --amber: #f5b04d; --red: #ff8a80; --red-soft: rgba(255, 138, 128, .12); --violet: #b9a0ff; - --shadow: 0 4px 12px rgba(0, 0, 0, .5); --dialog-shadow: 0 8px 24px rgba(0, 0, 0, .8); + --shadow: 0 4px 12px rgba(0, 0, 0, .5); color-scheme: dark; } * { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--blue) transparent; } @@ -43,7 +43,6 @@ a { color: inherit; text-decoration: none; } .brand { display: inline-flex; align-items: center; min-width: 0; } .brand-logo { display: block; flex-shrink: 0; width: 320px; max-width: 100%; aspect-ratio: 2000 / 433; } .brand-logo img { display: block; width: 100%; height: auto; } -:root[data-theme='dark'] .about-seal { filter: brightness(0) invert(1); opacity: .85; } .desktop-nav { display: flex; flex-shrink: 0; align-items: center; gap: 20px; margin-left: auto; } .nav-link { padding: 14px 0; border-bottom: 2px solid transparent; color: var(--ink-2); font-size: 14px; transition: color .18s, border-color .18s; white-space: nowrap; } .nav-link:hover, .nav-link.active { color: var(--blue); } @@ -97,13 +96,6 @@ h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.04em; } .mirror-name-group { display: flex; align-items: center; gap: 8px; min-width: 0; } .mirror-name-button { display: inline-flex; align-items: center; min-width: 0; min-height: 36px; padding: 0; color: var(--blue); font: 600 16px/1.5 ui-monospace, 'Cascadia Code', Consolas, monospace; text-align: left; overflow-wrap: anywhere; } .mirror-name-button:hover { text-decoration: underline; text-underline-offset: 3px; } -.distro-mark { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 31px; height: 31px; border: 1px solid color-mix(in srgb, var(--distro-color) 31%, var(--line)); border-radius: 7px; background: color-mix(in srgb, var(--distro-color) 10%, var(--panel)); color: var(--distro-color); font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 14px; font-weight: 500; } -.status-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 72px; color: var(--ink-2); font-size: 11px; white-space: nowrap; } -.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); } -.status-chip.success .status-dot { background: var(--green); }.status-chip.syncing .status-dot { background: var(--blue-bright); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-bright) 14%, transparent); }.status-chip.waiting .status-dot { background: var(--amber); }.status-chip.failed .status-dot { background: var(--red); }.status-chip.paused .status-dot { background: var(--violet); } -.status-chip.paused { color: var(--violet); } -.status-list > div[data-status='syncing'] { background: var(--blue-soft); } -.status-list > div[data-status='failed'] { background: var(--red-soft); } .mirror-table :is(.time-cell, .metric-cell) { font-variant-numeric: tabular-nums; } .mirror-table .roll-frame { display: grid; width: 100%; max-width: 100%; } .help-button { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--blue); transition: color 120ms, background-color 120ms; } @@ -133,6 +125,7 @@ h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.04em; } :root[data-theme='dark'] :is(.section-heading, .mirror-table th, .sync-table thead th, .side-heading) { color: #fff; } .sidebar-more { display: inline-flex; align-items: center; flex-shrink: 0; min-height: 32px; padding: 4px 0 4px 8px; color: var(--blue); font-size: 13px; } .sidebar-more:hover { text-decoration: underline; text-underline-offset: 3px; } +.sidebar-empty { color: var(--ink-3); font-size: 11px; line-height: 1.65; } .news-item { display: flex; align-items: baseline; gap: 8px; width: 100%; min-height: 30px; padding: 4px 0; color: var(--blue); font-size: 14px; font-weight: 500; text-align: left; } .news-item time { flex-shrink: 0; font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; } .news-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } @@ -165,22 +158,20 @@ h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.04em; } .footer-affiliation::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to right, transparent var(--wordmark-start), #004098 var(--wordmark-start)); mask: var(--affiliation-image) center / contain no-repeat; pointer-events: none; } :root[data-theme='dark'] .footer-affiliation::after { display: none; } -.content-dialog { width: min(680px, calc(100% - 32px)); max-height: min(710px, calc(100dvh - 44px)); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: var(--dialog-shadow); }.content-dialog::backdrop { background: rgba(0, 0, 0, .57); backdrop-filter: blur(4px); }.dialog-inner { max-height: min(710px, calc(100dvh - 44px)); overflow: auto; }.dialog-heading { position: sticky; z-index: 1; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 22px 25px; border-bottom: 1px solid var(--line); background: var(--panel); }.dialog-heading h2 { font-size: 18px; }.dialog-heading .icon-button { margin: -8px -8px 0 0; }.dialog-content { padding: 25px; }.dialog-lead { margin: 0 0 23px; color: var(--ink-2); font-size: 13px; line-height: 1.75; }.mirror-facts { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px 16px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 11px; }.mirror-facts > span:nth-child(even) { color: var(--ink); }.directory-preview { display: flex; gap: 13px; align-items: flex-start; margin: 23px 0; padding: 18px; border-radius: 8px; background: var(--panel-blue); color: var(--blue); }.directory-preview h3 { margin: -2px 0 4px; color: var(--ink); font-size: 13px; }.directory-preview p { margin: 0; color: var(--ink-2); font-size: 11px; }.dialog-content h3 { margin: 21px 0 7px; font-size: 13px; }.dialog-hint { color: var(--ink-3); font-size: 11px; line-height: 1.65; }.dialog-content pre { overflow: auto; margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb, var(--paper) 80%, var(--panel)); color: var(--blue); font: 11px ui-monospace, 'Cascadia Code', Consolas, monospace; white-space: pre-wrap; }.dialog-actions { display: flex; align-items: center; gap: 18px; }.secondary-button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 6px; background: var(--blue); color: var(--on-accent); font-size: 11px; }.secondary-button:hover { background: var(--accent-hover); }.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }.help-grid button, .article-link, .modal-downloads a { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); font-size: 12px; text-align: left; }.help-grid button:hover, .article-link:hover, .modal-downloads a:hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }.help-grid button span:nth-child(2), .modal-downloads a span:nth-child(2) { flex: 1; }.help-grid button svg, .modal-downloads a svg { margin-left: auto; }.article-date { display: block; margin-bottom: 18px; color: var(--ink-3); font: 10px ui-monospace, 'Cascadia Code', Consolas, monospace; }.article-body { margin: 0; color: var(--ink); font-size: 13px; line-height: 1.9; }.article-link { justify-content: space-between; margin-bottom: 8px; }.article-link span { flex: 1; }.status-list { display: grid; gap: 1px; border-top: 1px solid var(--line); }.status-list > div { display: flex; justify-content: space-between; align-items: center; min-height: 45px; border-bottom: 1px solid var(--line); }.mono { font: 12px ui-monospace, 'Cascadia Code', Consolas, monospace; }.modal-downloads { display: grid; gap: 9px; }.about-seal { display: block; margin: 0 auto 21px; }.about-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }.about-links a { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); font-size: 12px; } - -.content-dialog.download-dialog { --download-dialog-max-height: min(720px, calc(100dvh - 48px)); width: min(960px, calc(100% - 40px)); max-width: none; height: var(--download-dialog-max-height); max-height: var(--download-dialog-max-height); overflow: hidden; border-radius: 2px; border-top: 3px solid var(--blue); background: var(--paper); box-shadow: 0 16px 48px rgba(0, 0, 0, .28); } -.content-dialog.download-dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: none; } -.download-dialog .dialog-inner { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; max-height: calc(var(--download-dialog-max-height) - 4px); overflow: hidden; } -.download-dialog .dialog-heading { position: static; gap: 20px; padding: 22px 24px; border-bottom: 0; background: var(--paper); } -.download-dialog .dialog-heading h2 { color: var(--ink); font-size: 24px; font-weight: 600; line-height: 1.4; } -.download-dialog .dialog-heading .icon-button { flex-shrink: 0; width: 36px; height: 36px; margin: 0 -6px 0 0; border-radius: 2px; color: var(--ink); } -.download-dialog .dialog-content { display: flex; min-width: 0; min-height: 0; overflow: hidden; padding: 0 24px 24px; } -:root[data-theme='dark'] .download-dialog .dialog-heading h2 { color: #fff; } +.download-dialog { --download-dialog-max-height: min(720px, calc(100dvh - 48px)); width: min(960px, calc(100% - 40px)); max-width: none; height: var(--download-dialog-max-height); max-height: var(--download-dialog-max-height); overflow: hidden; padding: 0; border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 2px; background: var(--paper); color: var(--ink); box-shadow: 0 16px 48px rgba(0, 0, 0, .28); } +.download-dialog::backdrop { background: rgba(0, 0, 0, .6); } +.download-dialog-inner { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; max-height: calc(var(--download-dialog-max-height) - 4px); overflow: hidden; } +.download-dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px; } +.download-dialog-heading h2 { min-width: 0; color: var(--ink); font-size: 24px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; } +.download-dialog-heading .icon-button { flex-shrink: 0; width: 36px; height: 36px; margin: 0 -6px 0 0; border-radius: 2px; color: var(--ink); } +.download-dialog-content { display: flex; min-width: 0; min-height: 0; overflow: hidden; padding: 0 24px 24px; } +:root[data-theme='dark'] .download-dialog-heading h2 { color: #fff; } @media (max-width: 640px) { - .content-dialog.download-dialog { --download-dialog-max-height: calc(100dvh - 32px); width: calc(100% - 24px); } - .download-dialog .dialog-heading { gap: 12px; padding: 16px 18px; } - .download-dialog .dialog-heading h2 { font-size: 22px; } - .download-dialog .dialog-heading .icon-button { width: 44px; height: 44px; margin-right: -8px; } - .download-dialog .dialog-content { padding: 4px 18px 22px; } + .download-dialog { --download-dialog-max-height: calc(100dvh - 32px); width: calc(100% - 24px); } + .download-dialog-heading { gap: 12px; padding: 16px 18px; } + .download-dialog-heading h2 { font-size: 22px; } + .download-dialog-heading .icon-button { width: 44px; height: 44px; margin-right: -8px; } + .download-dialog-content { padding: 4px 18px 22px; } } @media (max-width: 1100px) { @@ -236,22 +227,12 @@ h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.04em; } .side-heading h2 { font-size: 20px; } .news-item, .sidebar-more, .download-menu-button, .useful-links a, .useful-links button { min-height: 44px; } .text-button { min-height: 44px; font-size: 13px; } - .dialog-content, .dialog-heading { padding: 18px; } - .dialog-heading { gap: 12px; } - .dialog-heading h2 { min-width: 0; overflow-wrap: anywhere; } - .dialog-heading .icon-button { flex-shrink: 0; width: 44px; height: 44px; margin: -8px; } - .help-grid { grid-template-columns: 1fr; } - .mirror-facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); font-size: 12px; } - .dialog-hint, .directory-preview p { font-size: 12px; overflow-wrap: anywhere; } - .dialog-content pre { overflow-wrap: anywhere; font-size: 12px; } - .dialog-actions { flex-wrap: wrap; gap: 6px 13px; } - .secondary-button { min-height: 44px; font-size: 13px; } + .sidebar-empty { font-size: 12px; overflow-wrap: anywhere; } } @media (max-width: 360px) { .site-header { padding-inline: 12px; } .page-width { width: calc(100% - 24px); } .brand-logo { width: 148px; } - .distro-mark { display: none; } } @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } } :focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 3px; }
{{ t(`monitor.columns.${column}`) }}
{{ mirror.name }}
{{ mirror.upstream }} {{ t(`mirrors.status.${mirror.status}`) }}