chore(energy): 恢复能源管理入口,仅隐藏电能 tab
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- 重新启用 EnergyModule 作为侧边栏入口
- EnergyModule 内部隐藏「电能」tab,只保留「氢能」(保留 Electric* 代码)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-29 15:25:37 +08:00
parent ebd82893bc
commit e0c609168e
2 changed files with 16 additions and 26 deletions

View File

@@ -1,11 +1,10 @@
import { useMemo } from 'react'; import { useMemo } from 'react';
import { Truck, Route, Activity } from 'lucide-react'; import { Truck, Route, Activity, Zap } from 'lucide-react';
import { Shell, type ModuleConfig } from './components/Shell'; import { Shell, type ModuleConfig } from './components/Shell';
import AssetsModule from './modules/assets/AssetsModule'; import AssetsModule from './modules/assets/AssetsModule';
import MileageModule from './modules/mileage/MileageModule'; import MileageModule from './modules/mileage/MileageModule';
import SchedulingModule from './modules/scheduling/SchedulingModule'; import SchedulingModule from './modules/scheduling/SchedulingModule';
// 能源管理暂未发布,发版前临时隐藏入口(保留模块代码) import EnergyModule from './modules/energy/EnergyModule';
// import EnergyModule from './modules/energy/EnergyModule';
import AuthProvider from './auth/AuthProvider'; import AuthProvider from './auth/AuthProvider';
import { useAuth } from './auth/useAuth'; import { useAuth } from './auth/useAuth';
import UnauthorizedPage from './auth/UnauthorizedPage'; import UnauthorizedPage from './auth/UnauthorizedPage';
@@ -14,7 +13,7 @@ import { canAccessScheduling } from './shared/auth/roles';
const BASE_MODULES: ModuleConfig[] = [ const BASE_MODULES: ModuleConfig[] = [
{ id: 'assets', label: '资产管理', icon: Truck, component: AssetsModule }, { id: 'assets', label: '资产管理', icon: Truck, component: AssetsModule },
{ id: 'mileage', label: '里程管理', icon: Route, component: MileageModule }, { id: 'mileage', label: '里程管理', icon: Route, component: MileageModule },
// { id: 'energy', label: '能源管理', icon: Zap, component: EnergyModule }, { id: 'energy', label: '能源管理', icon: Zap, component: EnergyModule },
]; ];
const SCHEDULING_MODULE: ModuleConfig = { const SCHEDULING_MODULE: ModuleConfig = {

View File

@@ -1,39 +1,30 @@
import { useState } from 'react'; import { Fuel } from 'lucide-react';
import { Fuel, BatteryCharging } from 'lucide-react';
import { motion } from 'motion/react'; import { motion } from 'motion/react';
import HydrogenView from './HydrogenView'; import HydrogenView from './HydrogenView';
import ElectricView from './ElectricView'; // 电能暂未发布,发版前临时隐藏入口(保留 ElectricView/ElectricOverview/ElectricDaily 代码)
// import { useState } from 'react';
type TopTab = 'hydrogen' | 'electric'; // import { BatteryCharging } from 'lucide-react';
// import ElectricView from './ElectricView';
// type TopTab = 'hydrogen' | 'electric';
export default function EnergyModule() { export default function EnergyModule() {
const [activeTab, setActiveTab] = useState<TopTab>('hydrogen');
return ( return (
<div className="min-h-screen bg-[#F8F9FB] text-gray-800 font-sans p-3 md:p-6 relative" style={{ overflowX: 'clip' }}> <div className="min-h-screen bg-[#F8F9FB] text-gray-800 font-sans p-3 md:p-6 relative" style={{ overflowX: 'clip' }}>
<div className="max-w-6xl mx-auto flex flex-col gap-3 pb-16 landscape:pb-0 landscape:h-full landscape:flex-1 landscape:overflow-hidden"> <div className="max-w-6xl mx-auto flex flex-col gap-3 pb-16 landscape:pb-0 landscape:h-full landscape:flex-1 landscape:overflow-hidden">
<div className="bg-white px-4 py-2 rounded-2xl border border-slate-100 shadow-sm flex items-center gap-6 sticky top-0 z-30"> <div className="bg-white px-4 py-2 rounded-2xl border border-slate-100 shadow-sm flex items-center gap-6 sticky top-0 z-30">
<button <div className="flex items-center gap-2 py-1 relative text-blue-600">
onClick={() => setActiveTab('hydrogen')}
className={`flex items-center gap-2 py-1 transition-all relative ${activeTab === 'hydrogen' ? 'text-blue-600' : 'text-slate-400'}`}
>
<Fuel size={14} /> <Fuel size={14} />
<span className="text-[11px] font-bold"></span> <span className="text-[11px] font-bold"></span>
{activeTab === 'hydrogen' && (
<motion.div layoutId="activeEnergyTopTab" className="absolute -bottom-2 left-0 right-0 h-0.5 bg-blue-600 rounded-full" /> <motion.div layoutId="activeEnergyTopTab" className="absolute -bottom-2 left-0 right-0 h-0.5 bg-blue-600 rounded-full" />
)} </div>
</button> {/*
<button <button onClick={() => setActiveTab('electric')} ...>
onClick={() => setActiveTab('electric')}
className={`flex items-center gap-2 py-1 transition-all relative ${activeTab === 'electric' ? 'text-blue-600' : 'text-slate-400'}`}
>
<BatteryCharging size={14} /> <BatteryCharging size={14} />
<span className="text-[11px] font-bold">电能</span> <span className="text-[11px] font-bold">电能</span>
{activeTab === 'electric' && (
<motion.div layoutId="activeEnergyTopTab" className="absolute -bottom-2 left-0 right-0 h-0.5 bg-blue-600 rounded-full" />
)}
</button> </button>
*/}
</div> </div>
{activeTab === 'hydrogen' ? <HydrogenView /> : <ElectricView />} <HydrogenView />
</div> </div>
</div> </div>
); );