Files
PolyWeather/frontend/components/dashboard/DashboardMap.module.css
T
2569718930@qq.com 00e1845f2c 全面修复前端 UI 设计审查问题:消除工程债务、统一 token 体系、提升可维护性
- 消除 !important 滥用:134 → 49(仅保留 Leaflet/图表所必需项),浅色主题使用 html.light 选择器获得更高优先级
- 修复 font-weight:13 个文件中所有 760/850/860/880/950 等非标准值已映射为 Inter 支持的 300–800
- 移除未加载的 Geist 字体声明,替换为 Inter
- 添加全局 :focus-visible 轮廓环、跳过链接、Tab ARIA 属性(role/aria-selected)
- 统一断点体系:18 → 10(480/640/768/960/1024/1200/1280/1360/1440/1680)
- 创建 scan-root-styles.ts 桶文件,将 22 个 CSS Module 导入合并为 1 个
- Token 迁移:10 个文件中数百处硬编码颜色(#4DA3FF/#E6EDF3/#9FB2C7/#6B7A90)已替换为 CSS 变量
- 去重 @keyframes:spin 4→1、loading-spin 2→0、pulse-pending 已移至 globals.css
- 添加统一的 empty/error/retry 状态组件
- 添加全局 prefers-reduced-motion 支持
- 修复 accent-primary 与 accent-secondary 相同值的问题
- 修复 accent-green 类错误渲染为蓝色
- 添加 CSS 渐变品牌 Logo
- 移除死代码(1,697 行):public/static/style.css + public/legacy/index.html
- Dashboard.module.css 本地变量已桥接至全局 token
- 提升文字对比度:#6B7A90 → #7D8FA3

Fixed: !important-134-to-49, font-weight-13-files, Geist-removal, focus-visible, breakpoints-18-to-10, CSS-module-barrel, token-migration-10-files, keyframe-dedup, dead-code-removal, accent-color-fix, contrast-improvement
Scope: frontend CSS architecture, design tokens, accessibility, responsive breakpoints
Tested: npx tsc --noEmit
2026-05-10 14:21:10 +08:00

839 lines
17 KiB
CSS

/* ── Map ── */
.root :global(.map) {
position: absolute;
top: calc(var(--header-height) + 16px);
right: 392px;
bottom: 164px;
left: calc(var(--sidebar-width) + 22px);
z-index: 1;
overflow: hidden;
border: 1px solid rgba(115, 137, 161, 0.16);
border-radius: 24px;
background: #040912;
box-shadow:
0 32px 100px rgba(0, 0, 0, 0.5),
inset 0 1px 0 rgba(255, 255, 255, 0.04),
inset 0 0 0 1px rgba(0, 224, 164, 0.04);
}
.weatherAura {
position: absolute;
inset: 0;
z-index: 2;
pointer-events: none;
opacity: 0.96;
mix-blend-mode: screen;
overflow: hidden;
}
.weatherAura :global(canvas) {
width: 100%;
height: 100%;
display: block;
opacity: 0.94;
filter: saturate(1.05) blur(0.3px);
}
.weatherAuraScrim {
position: absolute;
inset: 0;
background:
linear-gradient(
180deg,
rgba(3, 8, 19, 0.64) 0%,
rgba(5, 10, 20, 0.16) 24%,
rgba(4, 8, 18, 0.1) 54%,
rgba(3, 6, 14, 0.42) 100%
),
radial-gradient(
circle at 50% 60%,
rgba(0, 224, 164, 0.08) 0%,
rgba(123, 97, 255, 0) 48%
);
}
.weatherAura[data-reduced-motion="true"] :global(canvas) {
display: none;
}
.root :global(.map .leaflet-tile),
.root :global(.map .leaflet-marker-icon),
.root :global(.map .leaflet-marker-shadow),
.root :global(.map .leaflet-container img),
.root :global(.map .leaflet-container svg) {
max-width: none !important;
max-height: none !important;
}
.root :global(.map .leaflet-tile) {
width: 256px !important;
height: 256px !important;
}
/* Remove Leaflet default styling for cleaner look */
.root :global(.leaflet-control-attribution) {
background: var(--bg-glass) !important;
color: var(--text-muted) !important;
backdrop-filter: blur(8px);
border: 1px solid var(--border-subtle) !important;
font-size: 10px !important;
border-radius: 6px !important;
padding: 2px 8px !important;
}
.root :global(.leaflet-control-attribution a) {
color: var(--text-secondary) !important;
}
.root :global(.leaflet-control-zoom) {
border: none !important;
box-shadow: var(--shadow-lg) !important;
}
.root :global(.leaflet-control-zoom a) {
background: var(--bg-glass) !important;
color: var(--text-primary) !important;
backdrop-filter: blur(12px) !important;
border: 1px solid var(--border-glass) !important;
width: 36px !important;
height: 36px !important;
line-height: 36px !important;
font-size: 16px !important;
border-radius: 8px !important;
transition: var(--transition);
}
.root :global(.leaflet-control-zoom a:hover) {
background: rgba(99, 102, 241, 0.2) !important;
border-color: var(--accent-blue) !important;
}
/* ── Custom Map Markers ── */
.root :global(.city-marker) {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
/* Remove transition: transform to avoid fighting with Leaflet's own positioning */
}
.root :global(.city-marker:hover) {
transform: scale(1.15);
z-index: 1000 !important;
}
.root :global(.marker-bubble) {
min-width: 44px;
padding: 4px 10px;
border-radius: 14px;
font-family: "Inter", sans-serif;
font-size: 13px;
font-weight: 700;
text-align: center;
color: white;
white-space: nowrap;
position: relative;
box-shadow:
0 6px 18px rgba(0, 0, 0, 0.42),
0 0 0 1px rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.14);
}
.root :global(.marker-bubble::after) {
content: "";
position: absolute;
bottom: -6px;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid;
border-top-color: inherit;
}
.root :global(.marker-bubble.risk-high) {
background: linear-gradient(135deg, #991b1b, #fb7185);
border-color: rgba(251, 113, 133, 0.42);
box-shadow:
0 6px 18px rgba(0, 0, 0, 0.42),
0 0 22px rgba(251, 113, 133, 0.18);
}
.root :global(.marker-bubble.risk-high::after) {
border-top-color: var(--color-signal-danger);
}
.root :global(.marker-bubble.risk-medium) {
background: linear-gradient(135deg, #9a3412, #f59e0b);
border-color: rgba(245, 158, 11, 0.42);
box-shadow:
0 6px 18px rgba(0, 0, 0, 0.42),
0 0 22px rgba(245, 158, 11, 0.16);
}
.root :global(.marker-bubble.risk-medium::after) {
border-top-color: var(--color-signal-warning);
}
.root :global(.marker-bubble.risk-low) {
background: linear-gradient(135deg, #065f46, #22c55e);
border-color: rgba(74, 222, 128, 0.42);
box-shadow:
0 6px 18px rgba(0, 0, 0, 0.42),
0 0 22px rgba(74, 222, 128, 0.14);
}
.root :global(.marker-bubble.risk-low::after) {
border-top-color: var(--color-signal-success);
}
.root :global(.marker-name) {
font-size: 10px;
font-weight: 600;
color: rgba(255, 255, 255, 0.85);
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
margin-top: 2px;
white-space: nowrap;
}
/* Marker glow animation for selected city */
.root :global(.city-marker.selected .marker-bubble) {
animation: markerGlow 2s ease-in-out infinite;
}
@keyframes markerGlow {
0%,
100% {
box-shadow:
0 6px 18px rgba(0, 0, 0, 0.42),
0 0 24px rgba(34, 211, 238, 0.12);
}
50% {
box-shadow:
0 6px 26px rgba(0, 0, 0, 0.46),
0 0 20px rgba(34, 211, 238, 0.24),
0 0 46px rgba(34, 211, 238, 0.14);
}
}
/* ── Loading Overlay ── */
.root :global(.loading-overlay) {
position: fixed;
inset: 0;
z-index: 2000;
background: radial-gradient(
circle at 50% 50%,
rgba(8, 14, 32, 0.76) 0%,
rgba(4, 8, 22, 0.9) 44%,
rgba(2, 6, 20, 0.96) 100%
);
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(12px);
}
.root :global(.loading-card) {
display: flex;
flex-direction: column;
align-items: center;
gap: 22px;
min-width: 240px;
padding: 28px 32px;
border-radius: 28px;
background: linear-gradient(
180deg,
rgba(10, 18, 36, 0.78) 0%,
rgba(8, 14, 30, 0.62) 100%
);
border: 1px solid rgba(92, 142, 255, 0.16);
box-shadow:
0 24px 90px rgba(0, 0, 0, 0.42),
inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.root :global(.loading-clouds) {
position: relative;
width: 220px;
height: 26px;
overflow: hidden;
}
.root :global(.loading-cloud) {
position: absolute;
top: 0;
height: 18px;
border-radius: 999px;
background:
radial-gradient(
circle at 30% 50%,
rgba(186, 230, 253, 0.22),
transparent 54%
),
linear-gradient(
180deg,
rgba(148, 163, 184, 0.28) 0%,
rgba(71, 85, 105, 0.1) 100%
);
filter: blur(0.3px);
box-shadow:
0 6px 24px rgba(56, 189, 248, 0.06),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
animation: cloud-drift 6.8s ease-in-out infinite;
}
.root :global(.loading-cloud-1) {
left: 12px;
width: 76px;
}
.root :global(.loading-cloud-2) {
right: 8px;
top: 7px;
width: 98px;
opacity: 0.75;
animation-delay: -2.6s;
}
.root :global(.loading-windfield) {
position: relative;
width: 220px;
height: 30px;
overflow: hidden;
opacity: 0.9;
}
.root :global(.loading-windline) {
position: absolute;
left: -28%;
height: 1px;
border-radius: 999px;
background: linear-gradient(
90deg,
rgba(34, 211, 238, 0) 0%,
rgba(103, 232, 249, 0.5) 22%,
rgba(125, 211, 252, 0.9) 55%,
rgba(34, 211, 238, 0) 100%
);
filter: blur(0.2px);
animation: wind-shift 2.8s linear infinite;
}
.root :global(.loading-windline-1) {
top: 4px;
width: 124px;
}
.root :global(.loading-windline-2) {
top: 13px;
width: 176px;
animation-delay: -0.9s;
opacity: 0.82;
}
.root :global(.loading-windline-3) {
top: 22px;
width: 142px;
animation-delay: -1.6s;
opacity: 0.66;
}
.root :global(.loading-copy) {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
text-align: center;
}
.root :global(.loading-copy strong) {
font-size: 13px;
font-weight: 700;
letter-spacing: 0.22em;
text-transform: uppercase;
color: rgba(103, 232, 249, 0.92);
}
.root :global(.loading-copy span) {
max-width: 240px;
font-size: 13px;
font-weight: 500;
line-height: 1.55;
color: rgba(203, 213, 225, 0.82);
}
.root :global(.loading-radar) {
position: relative;
width: 108px;
height: 108px;
border-radius: 50%;
background: radial-gradient(
circle,
rgba(22, 78, 99, 0.16) 0%,
rgba(7, 18, 36, 0.08) 48%,
rgba(5, 10, 22, 0.02) 76%,
transparent 100%
);
box-shadow:
inset 0 0 0 1px rgba(56, 189, 248, 0.12),
0 0 40px rgba(34, 211, 238, 0.08);
}
.root :global(.loading-radar-core) {
position: absolute;
top: 50%;
left: 50%;
width: 14px;
height: 14px;
border-radius: 50%;
background: radial-gradient(circle, var(--color-accent-secondary) 0%, #0891b2 100%);
transform: translate(-50%, -50%);
box-shadow:
0 0 12px rgba(34, 211, 238, 0.65),
0 0 28px rgba(59, 130, 246, 0.25);
}
.root :global(.loading-radar-ring) {
position: absolute;
inset: 0;
border-radius: 50%;
border: 1px solid rgba(56, 189, 248, 0.14);
}
.root :global(.loading-radar-ring-1) {
transform: scale(0.62);
}
.root :global(.loading-radar-ring-2) {
transform: scale(0.88);
}
.root :global(.loading-radar-sweep) {
position: absolute;
inset: 6px;
border-radius: 50%;
background: conic-gradient(
from 90deg,
rgba(34, 211, 238, 0) 0deg,
rgba(34, 211, 238, 0) 260deg,
rgba(34, 211, 238, 0.3) 312deg,
rgba(96, 165, 250, 0.06) 360deg
);
mask: radial-gradient(circle, transparent 0 22px, #000 23px);
animation: radar-sweep 2.4s linear infinite;
}
.root :global(.loading-radar-blip) {
position: absolute;
width: 8px;
height: 8px;
border-radius: 50%;
background: rgba(253, 224, 71, 0.92);
box-shadow: 0 0 12px rgba(253, 224, 71, 0.45);
animation: radar-blip 1.8s ease-in-out infinite;
}
.root :global(.loading-radar-blip-1) {
top: 26px;
right: 24px;
animation-delay: 0.15s;
}
.root :global(.loading-radar-blip-2) {
bottom: 25px;
left: 20px;
background: rgba(74, 222, 128, 0.9);
box-shadow: 0 0 12px rgba(74, 222, 128, 0.4);
animation-delay: 0.9s;
}
.root :global(.loading-thermals) {
display: flex;
align-items: end;
gap: 8px;
height: 28px;
}
.root :global(.loading-thermal) {
width: 10px;
border-radius: 999px;
background: linear-gradient(
180deg,
rgba(251, 191, 36, 0.15) 0%,
rgba(251, 146, 60, 0.8) 55%,
rgba(239, 68, 68, 0.9) 100%
);
box-shadow: 0 0 18px rgba(251, 146, 60, 0.18);
animation: thermal-rise 1.5s ease-in-out infinite;
transform-origin: center bottom;
}
.root :global(.loading-thermal-1) {
height: 11px;
animation-delay: 0s;
}
.root :global(.loading-thermal-2) {
height: 22px;
animation-delay: 0.2s;
}
.root :global(.loading-thermal-3) {
height: 16px;
animation-delay: 0.42s;
}
.root :global(.loading-thermal-4) {
height: 25px;
animation-delay: 0.68s;
}
.root :global(.loading-drizzle) {
position: relative;
width: 220px;
height: 26px;
overflow: hidden;
opacity: 0.88;
}
.root :global(.loading-drizzle-drop) {
position: absolute;
top: -2px;
width: 2px;
height: 16px;
border-radius: 999px;
background: linear-gradient(
180deg,
rgba(125, 211, 252, 0) 0%,
rgba(125, 211, 252, 0.9) 100%
);
box-shadow: 0 0 8px rgba(56, 189, 248, 0.12);
animation: drizzle-fall 1.35s linear infinite;
}
.root :global(.loading-drizzle-drop-1) {
left: 38px;
animation-delay: -0.1s;
}
.root :global(.loading-drizzle-drop-2) {
left: 76px;
height: 18px;
animation-delay: -0.52s;
}
.root :global(.loading-drizzle-drop-3) {
left: 112px;
height: 14px;
animation-delay: -0.92s;
}
.root :global(.loading-drizzle-drop-4) {
left: 156px;
height: 17px;
animation-delay: -0.38s;
}
.root :global(.loading-drizzle-drop-5) {
left: 192px;
height: 13px;
animation-delay: -0.74s;
}
.root :global(.loading-overlay.hidden) {
display: none;
}
.root :global(.loading-spinner) {
width: 48px;
height: 48px;
border: 2px solid rgba(34, 211, 238, 0.1);
border-top-color: var(--accent-cyan);
border-radius: 50%;
animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
box-shadow: 0 0 15px rgba(34, 211, 238, 0.1);
}
@keyframes city-loading-pulse {
0% {
transform: scale(0.92);
box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.44);
}
70% {
transform: scale(1);
box-shadow: 0 0 0 10px rgba(34, 211, 238, 0);
}
100% {
transform: scale(0.92);
box-shadow: 0 0 0 0 rgba(34, 211, 238, 0);
}
}
@keyframes radar-sweep {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes radar-blip {
0%,
100% {
opacity: 0.2;
transform: scale(0.72);
}
40% {
opacity: 1;
transform: scale(1);
}
60% {
opacity: 0.9;
transform: scale(1.18);
}
}
@keyframes wind-shift {
from {
transform: translateX(0);
opacity: 0;
}
18% {
opacity: 0.9;
}
82% {
opacity: 0.78;
}
to {
transform: translateX(145%);
opacity: 0;
}
}
@keyframes thermal-rise {
0%,
100% {
transform: scaleY(0.78);
opacity: 0.72;
}
50% {
transform: scaleY(1.14);
opacity: 1;
}
}
@keyframes cloud-drift {
0%,
100% {
transform: translateX(0);
opacity: 0.7;
}
50% {
transform: translateX(12px);
opacity: 0.95;
}
}
@keyframes drizzle-fall {
0% {
transform: translateY(-3px);
opacity: 0;
}
20% {
opacity: 0.9;
}
100% {
transform: translateY(18px);
opacity: 0;
}
}
/* ── Nearby Stations (Premium Glassmorphism) ── */
.root :global(.nearby-marker-premium) {
display: flex;
align-items: center;
gap: 10px;
background: rgba(10, 14, 26, 0.75);
backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 999px; /* Pill shape */
padding: 5px 14px 5px 10px;
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.4),
inset 0 1px 1px rgba(255, 255, 255, 0.05);
pointer-events: none;
white-space: nowrap;
}
.root :global(.nearby-marker-shell) {
display: inline-block;
will-change: transform;
}
@keyframes nearby-fade-in {
from {
opacity: 0;
transform: scale(0.9) translateY(4px);
}
to {
opacity: 1;
transform: scale(1) translateY(0);
}
}
.root :global(.nearby-pulse) {
position: relative;
width: 12px;
height: 12px;
flex-shrink: 0;
}
.root :global(.pulse-core) {
position: absolute;
top: 50%;
left: 50%;
width: 6px;
height: 6px;
background: var(--accent-cyan);
border-radius: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 0 8px var(--accent-cyan);
}
.root :global(.pulse-ring) {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
border: 1.5px solid var(--accent-cyan);
border-radius: 50%;
transform: translate(-50%, -50%);
opacity: 0.3;
box-shadow: 0 0 10px rgba(34, 211, 238, 0.18);
}
.root :global(.nearby-content) {
display: flex;
flex-direction: column;
line-height: 1.1;
}
.root :global(.nearby-label) {
font-size: 9px;
font-weight: 700;
text-transform: uppercase;
color: var(--text-muted);
letter-spacing: 0.05em;
}
.root :global(.nearby-stats) {
display: flex;
align-items: baseline;
gap: 2px;
}
.root :global(.nearby-temp-val) {
font-size: 13px;
font-weight: 800;
color: var(--text-primary);
text-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}
.root :global(.nearby-temp-unit) {
font-size: 10px;
color: var(--text-muted);
}
.root :global(.nearby-time) {
display: flex;
align-items: center;
gap: 4px;
margin-top: 3px;
font-size: 11px;
font-weight: 700;
color: rgba(203, 213, 225, 0.95);
white-space: nowrap;
}
.root :global(.nearby-time span + span)::before {
content: "·";
margin-right: 4px;
color: rgba(148, 163, 184, 0.55);
}
.root :global(.nearby-time.is-stale) {
color: var(--color-signal-warning);
}
.root :global(.nearby-wind) {
display: flex;
align-items: center;
gap: 4px;
padding-left: 10px;
margin-left: 2px;
border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.root :global(.nearby-wind .wind-arrow) {
font-size: 12px;
color: var(--accent-cyan);
text-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}
.root :global(.nearby-wind .wind-val) {
font-size: 11px;
font-weight: 600;
color: var(--text-secondary);
}
/* ── Trend badge ── */
.root :global(.trend-badge) {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 10px;
border-radius: 6px;
font-size: 11px;
font-weight: 600;
}
.root :global(.trend-badge.rising) {
background: rgba(34, 197, 94, 0.12);
color: var(--accent-green);
border: 1px solid rgba(34, 197, 94, 0.25);
}
.root :global(.trend-badge.falling) {
background: rgba(248, 113, 113, 0.12);
color: var(--accent-red);
border: 1px solid rgba(248, 113, 113, 0.25);
}
.root :global(.trend-badge.stagnant) {
background: rgba(251, 191, 36, 0.12);
color: var(--accent-yellow);
border: 1px solid rgba(251, 191, 36, 0.25);
}
.root :global(.trend-badge.mixed) {
background: rgba(167, 139, 250, 0.12);
color: var(--accent-purple);
border: 1px solid rgba(167, 139, 250, 0.25);
}
.root :global(.dead-market) {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 10px;
border-radius: 6px;
font-size: 11px;
font-weight: 700;
background: rgba(248, 113, 113, 0.15);
color: var(--accent-red);
border: 1px solid rgba(248, 113, 113, 0.3);
animation: deadPulse 2s ease-in-out infinite;
}
@keyframes deadPulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.6;
}
}