修正几个前端错误
parent
9b0614e7a1
commit
9c79196bf3
|
|
@ -36,7 +36,7 @@ export function Header({
|
|||
<h1 className="text-2xl font-bold text-white tracking-tight drop-shadow-md">Cosmo</h1>
|
||||
{formattedCutoffDate && (
|
||||
<span className="text-xs text-gray-400 font-mono">
|
||||
(截止日期 {formattedCutoffDate})
|
||||
({formattedCutoffDate})
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { ChevronLeft, ChevronRight, ChevronDown, ChevronUp, Search, Globe, Rocket, Moon, Asterisk, Sparkles } from 'lucide-react';
|
||||
import type { CelestialBody } from '../types';
|
||||
|
||||
|
|
@ -15,6 +15,13 @@ export function ProbeList({ probes, planets, onBodySelect, selectedBody, onReset
|
|||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const [expandedGroup, setExpandedGroup] = useState<string | null>(null); // 只允许一个分组展开
|
||||
|
||||
// Auto-collapse when a body is selected (focus mode)
|
||||
useEffect(() => {
|
||||
if (selectedBody) {
|
||||
setIsCollapsed(true);
|
||||
}
|
||||
}, [selectedBody]);
|
||||
|
||||
// Calculate distance for sorting
|
||||
const calculateDistance = (body: CelestialBody) => {
|
||||
const pos = body.positions[0];
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import dayjs from 'dayjs';
|
|||
import isBetween from 'dayjs/plugin/isBetween';
|
||||
import { request } from '../../utils/request';
|
||||
import { useToast } from '../../contexts/ToastContext';
|
||||
import { useDataCutoffDate } from '../../hooks/useDataCutoffDate';
|
||||
|
||||
// Extend dayjs with isBetween plugin
|
||||
dayjs.extend(isBetween);
|
||||
|
|
@ -65,6 +66,9 @@ export function NASADownload() {
|
|||
const [downloadProgress, setDownloadProgress] = useState({ current: 0, total: 0 });
|
||||
const toast = useToast();
|
||||
|
||||
// Get data cutoff date
|
||||
const { cutoffDate } = useDataCutoffDate();
|
||||
|
||||
// Type name mapping
|
||||
const typeNames: Record<string, string> = {
|
||||
star: '恒星',
|
||||
|
|
@ -260,13 +264,16 @@ export function NASADownload() {
|
|||
|
||||
return (
|
||||
<div>
|
||||
<Alert
|
||||
title="数据下载说明"
|
||||
description="选择左侧天体,右侧日历将显示数据可用性。点击未下载的日期可下载该天的位置数据(00:00 UTC)。"
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
{/* Data Cutoff Date Display */}
|
||||
{cutoffDate && (
|
||||
<Alert
|
||||
message={`数据截止日期: ${cutoffDate.getFullYear()}/${String(cutoffDate.getMonth() + 1).padStart(2, '0')}/${String(cutoffDate.getDate()).padStart(2, '0')}`}
|
||||
description="选择左侧天体,右侧日历将显示数据可用性。点击未下载的日期可下载该天的位置数据(00:00 UTC)。"
|
||||
type="success"
|
||||
showIcon
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Row gutter={16}>
|
||||
{/* Left: Body Selection */}
|
||||
|
|
@ -281,7 +288,7 @@ export function NASADownload() {
|
|||
}
|
||||
>
|
||||
<Collapse
|
||||
defaultActiveKey={['planet', 'dwarf_planet']}
|
||||
defaultActiveKey={[]}
|
||||
items={Object.entries(bodies).map(([type, typeBodies]) => ({
|
||||
key: type,
|
||||
label: (
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export function Tasks() {
|
|||
const loadData = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await request.get('/celestial/tasks?limit=50');
|
||||
const res = await request.get('/tasks?limit=50');
|
||||
setData(res.data);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
|
@ -42,10 +42,10 @@ export function Tasks() {
|
|||
// Polling for active tasks
|
||||
useEffect(() => {
|
||||
loadData();
|
||||
|
||||
|
||||
timerRef.current = setInterval(() => {
|
||||
// Silent refresh to avoid table flickering
|
||||
request.get('/celestial/tasks?limit=50').then(res => {
|
||||
request.get('/tasks?limit=50').then(res => {
|
||||
setData(res.data);
|
||||
});
|
||||
}, 3000);
|
||||
|
|
|
|||
Loading…
Reference in New Issue