update mico module

This commit is contained in:
Jiao77
2026-03-01 21:30:26 +08:00
parent 0c20c16c7a
commit d2312afc2b
12 changed files with 1120 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
import { useState, useCallback } from 'react';
import MicroList from './MicroList';
import MicroComposer from './MicroComposer';
import Heatmap from './Heatmap';
interface MicroPageProps {
apiBaseUrl?: string;
}
const API_BASE = typeof window !== 'undefined'
? (import.meta.env.VITE_API_BASE || 'http://localhost:8080/api')
: 'http://localhost:8080/api';
export default function MicroPage({ apiBaseUrl }: MicroPageProps) {
const baseUrl = apiBaseUrl || API_BASE;
const [refreshKey, setRefreshKey] = useState(0);
const [heatmapKey, setHeatmapKey] = useState(0);
const handlePostSuccess = useCallback(() => {
setRefreshKey(prev => prev + 1);
setHeatmapKey(prev => prev + 1);
}, []);
return (
<div className="grid grid-cols-1 xl:grid-cols-3 gap-8">
<div className="xl:col-span-2">
<div className="mb-8">
<MicroComposer
apiBaseUrl={baseUrl}
onSuccess={handlePostSuccess}
/>
</div>
<MicroList
key={refreshKey}
apiBaseUrl={baseUrl}
/>
</div>
<div className="xl:col-span-1">
<div className="sticky top-24 space-y-6">
<div className="card">
<Heatmap
key={heatmapKey}
apiBaseUrl={baseUrl}
/>
</div>
<div className="card">
<h3 className="text-lg font-semibold text-foreground mb-4"></h3>
<p className="text-sm text-muted-foreground leading-relaxed">
</p>
</div>
</div>
</div>
</div>
);
}