@microcosmmoney/portal-react 3.13.5 → 3.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main-portal/components/auctions/AuctionsPage.js +2 -2
- package/dist/main-portal/components/income/ManagerIncomePage.js +1 -16
- package/dist/main-portal/components/layout/AppSidebar.js +1 -1
- package/dist/main-portal/components/layout/TerminalSidebar.js +1 -1
- package/dist/main-portal/components/mining/MiningModal.js +113 -81
- package/dist/main-portal/components/profile/ProfilePage.js +2 -2
- package/dist/main-portal/components/queue/QueueStatusPage.js +2 -71
- package/dist/main-portal/components/stations/StationDetailPage.js +1 -3
- package/dist/main-portal/components/stations/StationListPage.js +2 -4
- package/dist/main-portal/components/stations/StationsPage.js +2 -5
- package/dist/main-portal/config/menu-config.d.ts +0 -2
- package/dist/main-portal/config/menu-config.js +14 -67
- package/dist/main-portal/hooks/useAuth.d.ts +1 -2
- package/dist/main-portal/hooks/useAuth.js +0 -2
- package/dist/main-portal/lib/api/blockchain.d.ts +0 -44
- package/dist/main-portal/lib/api/blockchain.js +0 -195
- package/dist/main-portal/lib/api/services/index.d.ts +0 -1
- package/dist/main-portal/lib/api/services/index.js +0 -1
- package/dist/main-portal/lib/api/services/mining.d.ts +15 -5
- package/dist/main-portal/lib/api/services/mining.js +1 -1
- package/dist/main-portal/lib/api/services/organization.d.ts +1 -6
- package/dist/main-portal/lib/api/services/organization.js +0 -12
- package/dist/main-portal/lib/oauth-config.js +3 -3
- package/dist/main-portal/lib/types/common.types.d.ts +0 -32
- package/dist/main-portal/lib/types/user.types.d.ts +1 -33
- package/package.json +2 -2
- package/dist/main-portal/hooks/useStrategies.d.ts +0 -134
- package/dist/main-portal/hooks/useStrategies.js +0 -28
- package/dist/main-portal/lib/api/services/ai.d.ts +0 -139
- package/dist/main-portal/lib/api/services/ai.js +0 -214
- package/dist/main-portal/lib/order-id-generator.d.ts +0 -19
- package/dist/main-portal/lib/order-id-generator.js +0 -97
- package/dist/main-portal/lib/strategy/defaults.d.ts +0 -2
- package/dist/main-portal/lib/strategy/defaults.js +0 -58
- package/dist/main-portal/lib/strategy/index.d.ts +0 -3
- package/dist/main-portal/lib/strategy/index.js +0 -20
- package/dist/main-portal/lib/strategy/tooltips.d.ts +0 -1
- package/dist/main-portal/lib/strategy/tooltips.js +0 -50
- package/dist/main-portal/lib/strategy/types.d.ts +0 -74
- package/dist/main-portal/lib/strategy/types.js +0 -2
|
@@ -19,21 +19,16 @@ const lucide_react_1 = require("lucide-react");
|
|
|
19
19
|
const next_intl_1 = require("next-intl");
|
|
20
20
|
function QueueStatusPage() {
|
|
21
21
|
const t = (0, next_intl_1.useTranslations)('queueStatus');
|
|
22
|
-
const {
|
|
22
|
+
const { user } = (0, useAuth_1.useAuth)();
|
|
23
23
|
const [userQueue, setUserQueue] = (0, react_1.useState)(null);
|
|
24
|
-
const [adminQueue, setAdminQueue] = (0, react_1.useState)(null);
|
|
25
|
-
const [expansionCheck, setExpansionCheck] = (0, react_1.useState)(null);
|
|
26
24
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
27
25
|
const [refreshing, setRefreshing] = (0, react_1.useState)(false);
|
|
28
26
|
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
29
27
|
const [showJoinDialog, setShowJoinDialog] = (0, react_1.useState)(false);
|
|
30
28
|
const [showLeaveDialog, setShowLeaveDialog] = (0, react_1.useState)(false);
|
|
31
29
|
const [showCancelDialog, setShowCancelDialog] = (0, react_1.useState)(false);
|
|
32
|
-
const [showProcessDialog, setShowProcessDialog] = (0, react_1.useState)(false);
|
|
33
|
-
const [showExpansionDialog, setShowExpansionDialog] = (0, react_1.useState)(false);
|
|
34
30
|
const [preferredStation, setPreferredStation] = (0, react_1.useState)('');
|
|
35
31
|
const [leaveReason, setLeaveReason] = (0, react_1.useState)('');
|
|
36
|
-
const [batchSize, setBatchSize] = (0, react_1.useState)(50);
|
|
37
32
|
const USER_LEVEL_INFO = {
|
|
38
33
|
miner: { label: t('miner'), labelEn: 'Miner', icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Gem, { className: "w-5 h-5" }), color: 'text-cyan-300', bgColor: 'bg-cyan-900/30' },
|
|
39
34
|
commander: { label: t('commander'), labelEn: 'Commander', icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Star, { className: "w-5 h-5" }), color: 'text-cyan-300', bgColor: 'bg-cyan-900/30' },
|
|
@@ -61,26 +56,6 @@ function QueueStatusPage() {
|
|
|
61
56
|
catch (e) {
|
|
62
57
|
console.warn('[QueueStatus] Failed to fetch user queue status:', e);
|
|
63
58
|
}
|
|
64
|
-
if (isAdmin()) {
|
|
65
|
-
try {
|
|
66
|
-
const adminRes = await (0, api_service_1.getAdminQueueStatus)();
|
|
67
|
-
if (adminRes.success) {
|
|
68
|
-
setAdminQueue(adminRes);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch (e) {
|
|
72
|
-
console.warn('[QueueStatus] Failed to fetch admin queue status:', e);
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
const expansionRes = await (0, api_service_1.checkExpansionNeeded)();
|
|
76
|
-
if (expansionRes.success) {
|
|
77
|
-
setExpansionCheck(expansionRes);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
console.warn('[QueueStatus] Failed to fetch expansion check:', e);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
59
|
}
|
|
85
60
|
catch (error) {
|
|
86
61
|
console.error('[QueueStatus] Failed to load data:', error);
|
|
@@ -178,46 +153,6 @@ function QueueStatusPage() {
|
|
|
178
153
|
setSubmitting(false);
|
|
179
154
|
}
|
|
180
155
|
};
|
|
181
|
-
const handleProcessQueue = async () => {
|
|
182
|
-
try {
|
|
183
|
-
setSubmitting(true);
|
|
184
|
-
const result = await (0, api_service_1.processQueue)(batchSize);
|
|
185
|
-
if (result.success) {
|
|
186
|
-
sonner_1.toast.success(t('processComplete', { assigned: result.assigned, processed: result.processed }));
|
|
187
|
-
setShowProcessDialog(false);
|
|
188
|
-
loadData();
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
sonner_1.toast.error(t('processFailed'));
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
catch (error) {
|
|
195
|
-
sonner_1.toast.error(error instanceof Error ? error.message : t('processFailed'));
|
|
196
|
-
}
|
|
197
|
-
finally {
|
|
198
|
-
setSubmitting(false);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
const handleTriggerExpansion = async () => {
|
|
202
|
-
try {
|
|
203
|
-
setSubmitting(true);
|
|
204
|
-
const result = await (0, api_service_1.triggerExpansion)();
|
|
205
|
-
if (result.success) {
|
|
206
|
-
sonner_1.toast.success(result.message || t('expansionSuccess', { territory: result.new_territory_id ?? '' }));
|
|
207
|
-
setShowExpansionDialog(false);
|
|
208
|
-
loadData();
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
sonner_1.toast.error(result.error || t('expansionFailed'));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
catch (error) {
|
|
215
|
-
sonner_1.toast.error(error instanceof Error ? error.message : t('expansionFailed'));
|
|
216
|
-
}
|
|
217
|
-
finally {
|
|
218
|
-
setSubmitting(false);
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
156
|
const getQueueStatusBadge = (status) => {
|
|
222
157
|
switch (status) {
|
|
223
158
|
case 'pending':
|
|
@@ -237,9 +172,5 @@ function QueueStatusPage() {
|
|
|
237
172
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto font-mono space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-3xl font-bold text-white", children: t('title') }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 mt-1", children: t('subtitle') })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: handleRefresh, disabled: refreshing, className: "bg-neutral-800 hover:bg-neutral-700 text-white", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCw, { className: `w-4 h-4 mr-2 ${refreshing ? 'animate-spin' : ''}` }), t('refresh')] })] }), (0, jsx_runtime_1.jsxs)(card_1.Card, { className: "bg-black border-neutral-800 dash-card", children: [(0, jsx_runtime_1.jsxs)(card_1.CardHeader, { children: [(0, jsx_runtime_1.jsxs)(card_1.CardTitle, { className: "text-white flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Users, { className: "w-5 h-5" }), t('myStatus')] }), (0, jsx_runtime_1.jsx)(card_1.CardDescription, { className: "text-neutral-400", children: t('myStatusDesc') })] }), (0, jsx_runtime_1.jsx)(card_1.CardContent, { children: loading ? ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-8", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-8 h-8 animate-spin mx-auto text-neutral-400" }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 mt-2", children: t('loading') })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(() => {
|
|
238
173
|
const levelInfo = getUserLevelInfo(userQueue?.user_type);
|
|
239
174
|
return ((0, jsx_runtime_1.jsx)("div", { className: `rounded-lg p-4 border border-neutral-800 ${levelInfo.bgColor}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `rounded-full p-2 ${levelInfo.color}`, children: levelInfo.icon }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('currentPosition') }), (0, jsx_runtime_1.jsxs)("p", { className: `text-lg font-semibold ${levelInfo.color}`, children: [levelInfo.label, (0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-500 text-sm ml-2", children: ["(", levelInfo.labelEn, ")"] })] })] })] }), (0, jsx_runtime_1.jsxs)(badge_1.Badge, { className: `${levelInfo.bgColor} ${levelInfo.color} border-current`, children: ["Lv.", Object.keys(USER_LEVEL_INFO).indexOf(userQueue?.user_type?.toLowerCase() || 'miner') + 3] })] }) }));
|
|
240
|
-
})(), userQueue?.is_onboarded ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-700/50", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400/10 rounded-full p-3", children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, { className: "w-6 h-6 text-white" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('onboarded') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('onboardedTo', { station: userQueue.station_name || userQueue.territory_id || '' }) })] })] }), (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-white/20 text-white border-neutral-700", children: t('active') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 rounded-lg p-4 text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-xl font-bold text-white font-mono", children: userQueue.territory_id }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('territoryId') })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: () => setShowLeaveDialog(true), className: "bg-neutral-800 hover:bg-neutral-700 text-neutral-300 h-full", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.LogOut, { className: "w-4 h-4 mr-2" }), t('applyLeave')] })] })] })) : userQueue?.in_queue ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400/10 rounded-full p-3", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Timer, { className: "w-6 h-6 text-cyan-300" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('inQueue') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('waitingAssignment') })] })] }), getQueueStatusBadge(userQueue.status)] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white font-mono", children: userQueue.position || '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('currentPos') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white font-mono", children: userQueue.estimated_wait_minutes || '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('estimatedWait') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-semibold text-white truncate", children: userQueue.preferred_territory_id || t('autoAssign') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('preferredTerritory') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-semibold text-white", children: userQueue.joined_at ? new Date(userQueue.joined_at).toLocaleString() : '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('joinedAt') })] })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: () => setShowCancelDialog(true), className: "w-full bg-neutral-800 hover:bg-neutral-700 text-white", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.XCircle, { className: "w-4 h-4 mr-2" }), t('cancelQueue')] })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-800 rounded-full p-3", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Building2, { className: "w-6 h-6 text-neutral-400" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('notOnboarded') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('notOnboardedDesc') })] })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: () => setShowJoinDialog(true), className: "w-full bg-white/20 hover:bg-neutral-800 text-white border border-neutral-700", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.LogIn, { className: "w-4 h-4 mr-2" }), t('joinNow')] })] }))] })) })] }),
|
|
241
|
-
? new Date(adminQueue.oldest_pending).toLocaleString()
|
|
242
|
-
: '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('oldestPending') })] })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: () => setShowProcessDialog(true), disabled: adminQueue.pending_count === 0, className: "w-full bg-cyan-900/50 hover:bg-cyan-900/70 text-cyan-300 border border-cyan-800", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Play, { className: "w-4 h-4 mr-2" }), t('processQueue')] })] })] })), isAdmin() && expansionCheck && ((0, jsx_runtime_1.jsxs)(card_1.Card, { className: "bg-black border-neutral-800 dash-card", children: [(0, jsx_runtime_1.jsxs)(card_1.CardHeader, { children: [(0, jsx_runtime_1.jsxs)(card_1.CardTitle, { className: "text-white flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { className: "w-5 h-5" }), t('expansionTitle')] }), (0, jsx_runtime_1.jsx)(card_1.CardDescription, { className: "text-neutral-400", children: t('expansionDesc') })] }), (0, jsx_runtime_1.jsxs)(card_1.CardContent, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mb-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-4 border border-neutral-800 text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white font-mono", children: expansionCheck.current_stats.total_stations }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('totalTerritories') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-4 border border-neutral-800 text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white font-mono", children: expansionCheck.current_stats.full_stations }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('fullTerritories') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-4 border border-neutral-800 text-center", children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-3xl font-bold text-white font-mono", children: [(expansionCheck.current_stats.avg_occupancy * 100).toFixed(1), "%"] }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('avgOccupancy') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-4 border border-neutral-800 text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white font-mono", children: expansionCheck.current_stats.pending_queue }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('queueWaiting') })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between p-4 bg-neutral-950 rounded-lg border border-neutral-800 mb-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-3", children: expansionCheck.needs_expansion ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.AlertTriangle, { className: "w-6 h-6 text-cyan-300" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { className: "text-white font-semibold", children: t('needsExpansion') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: expansionCheck.reason })] })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, { className: "w-6 h-6 text-white" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { className: "text-white font-semibold", children: t('capacitySufficient') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('noExpansionNeeded') })] })] })) }), (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: expansionCheck.needs_expansion
|
|
243
|
-
? 'bg-cyan-400/20 text-cyan-300 border-cyan-400/30'
|
|
244
|
-
: 'bg-white/20 text-white border-neutral-700', children: expansionCheck.needs_expansion ? t('suggestExpansion') : t('normal') })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: () => setShowExpansionDialog(true), className: "w-full bg-cyan-400/20 hover:bg-cyan-400/30 text-cyan-300 border border-cyan-400/30", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { className: "w-4 h-4 mr-2" }), t('triggerExpansion')] })] })] })), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: showJoinDialog, onOpenChange: setShowJoinDialog, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-800", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white", children: t('joinDialogTitle') }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: t('joinDialogDesc') })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-4 py-4", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-neutral-300", children: t('preferredStationLabel') }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: preferredStation, onChange: (e) => setPreferredStation(e.target.value), placeholder: t('preferredStationPlaceholder'), className: "bg-neutral-800 border-neutral-700 text-white mt-1" }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: t('preferredStationHint') })] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setShowJoinDialog(false), disabled: submitting, className: "bg-neutral-800 hover:bg-neutral-700 text-white border-neutral-700", children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleJoinQueue, disabled: submitting, className: "bg-cyan-400/20 hover:bg-cyan-400/30 text-cyan-300 border border-cyan-400/30", children: submitting ? t('submitting') : t('joinQueue') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleJoinStation, disabled: submitting, className: "bg-white/20 hover:bg-neutral-800 text-white border border-neutral-700", children: submitting ? t('submitting') : t('immediateJoin') })] })] }) }), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: showLeaveDialog, onOpenChange: setShowLeaveDialog, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-800", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white", children: t('leaveDialogTitle') }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: t('leaveDialogDesc') })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-4 py-4", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-neutral-300", children: t('leaveReasonLabel') }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: leaveReason, onChange: (e) => setLeaveReason(e.target.value), placeholder: t('leaveReasonPlaceholder'), className: "bg-neutral-800 border-neutral-700 text-white mt-1" })] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setShowLeaveDialog(false), disabled: submitting, className: "bg-neutral-800 hover:bg-neutral-700 text-white border-neutral-700", children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleLeaveStation, disabled: submitting, className: "bg-red-900/50 hover:bg-red-900/70 text-red-400 border border-red-800", children: submitting ? t('submitting') : t('confirmLeave') })] })] }) }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialog, { open: showCancelDialog, onOpenChange: setShowCancelDialog, children: (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogContent, { className: "bg-neutral-900 border-neutral-800", children: [(0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogHeader, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogTitle, { className: "text-white", children: t('cancelQueueTitle') }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogDescription, { className: "text-neutral-400", children: t('cancelQueueDesc') })] }), (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogFooter, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogCancel, { disabled: submitting, className: "bg-neutral-800 hover:bg-neutral-700 text-white border-neutral-700", children: t('goBack') }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogAction, { onClick: handleCancelQueue, disabled: submitting, className: "bg-red-900/50 hover:bg-red-900/70 text-red-400 border border-red-800", children: submitting ? t('submitting') : t('confirmCancel') })] })] }) }), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: showProcessDialog, onOpenChange: setShowProcessDialog, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-800", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white", children: t('processDialogTitle') }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: t('processDialogDesc') })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-4 py-4", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-neutral-300", children: t('batchSize') }), (0, jsx_runtime_1.jsx)(input_1.Input, { type: "number", value: batchSize, onChange: (e) => setBatchSize(parseInt(e.target.value) || 50), min: 1, max: 200, className: "bg-neutral-800 border-neutral-700 text-white mt-1" }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: t('batchSizeHint') })] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setShowProcessDialog(false), disabled: submitting, className: "bg-neutral-800 hover:bg-neutral-700 text-white border-neutral-700", children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleProcessQueue, disabled: submitting, className: "bg-cyan-900/50 hover:bg-cyan-900/70 text-cyan-300 border border-cyan-800", children: submitting ? t('submitting') : t('startProcessing') })] })] }) }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialog, { open: showExpansionDialog, onOpenChange: setShowExpansionDialog, children: (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogContent, { className: "bg-neutral-900 border-neutral-800", children: [(0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogHeader, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogTitle, { className: "text-white", children: t('expansionDialogTitle') }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogDescription, { className: "text-neutral-400", children: t('expansionDialogDesc') })] }), (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogFooter, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogCancel, { disabled: submitting, className: "bg-neutral-800 hover:bg-neutral-700 text-white border-neutral-700", children: t('cancel') }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogAction, { onClick: handleTriggerExpansion, disabled: submitting, className: "bg-cyan-400/20 hover:bg-cyan-400/30 text-cyan-300 border border-cyan-400/30", children: submitting ? t('submitting') : t('confirmExpansion') })] })] }) })] }));
|
|
175
|
+
})(), userQueue?.is_onboarded ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-700/50", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400/10 rounded-full p-3", children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, { className: "w-6 h-6 text-white" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('onboarded') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('onboardedTo', { station: userQueue.station_name || userQueue.territory_id || '' }) })] })] }), (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-white/20 text-white border-neutral-700", children: t('active') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 rounded-lg p-4 text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-xl font-bold text-white font-mono", children: userQueue.territory_id }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('territoryId') })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: () => setShowLeaveDialog(true), className: "bg-neutral-800 hover:bg-neutral-700 text-neutral-300 h-full", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.LogOut, { className: "w-4 h-4 mr-2" }), t('applyLeave')] })] })] })) : userQueue?.in_queue ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400/10 rounded-full p-3", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Timer, { className: "w-6 h-6 text-cyan-300" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('inQueue') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('waitingAssignment') })] })] }), getQueueStatusBadge(userQueue.status)] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white font-mono", children: userQueue.position || '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('currentPos') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white font-mono", children: userQueue.estimated_wait_minutes || '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('estimatedWait') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-semibold text-white truncate", children: userQueue.preferred_territory_id || t('autoAssign') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('preferredTerritory') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-semibold text-white", children: userQueue.joined_at ? new Date(userQueue.joined_at).toLocaleString() : '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('joinedAt') })] })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: () => setShowCancelDialog(true), className: "w-full bg-neutral-800 hover:bg-neutral-700 text-white", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.XCircle, { className: "w-4 h-4 mr-2" }), t('cancelQueue')] })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-800 rounded-full p-3", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Building2, { className: "w-6 h-6 text-neutral-400" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('notOnboarded') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('notOnboardedDesc') })] })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { onClick: () => setShowJoinDialog(true), className: "w-full bg-white/20 hover:bg-neutral-800 text-white border border-neutral-700", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.LogIn, { className: "w-4 h-4 mr-2" }), t('joinNow')] })] }))] })) })] }), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: showJoinDialog, onOpenChange: setShowJoinDialog, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-800", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white", children: t('joinDialogTitle') }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: t('joinDialogDesc') })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-4 py-4", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-neutral-300", children: t('preferredStationLabel') }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: preferredStation, onChange: (e) => setPreferredStation(e.target.value), placeholder: t('preferredStationPlaceholder'), className: "bg-neutral-800 border-neutral-700 text-white mt-1" }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: t('preferredStationHint') })] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setShowJoinDialog(false), disabled: submitting, className: "bg-neutral-800 hover:bg-neutral-700 text-white border-neutral-700", children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleJoinQueue, disabled: submitting, className: "bg-cyan-400/20 hover:bg-cyan-400/30 text-cyan-300 border border-cyan-400/30", children: submitting ? t('submitting') : t('joinQueue') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleJoinStation, disabled: submitting, className: "bg-white/20 hover:bg-neutral-800 text-white border border-neutral-700", children: submitting ? t('submitting') : t('immediateJoin') })] })] }) }), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: showLeaveDialog, onOpenChange: setShowLeaveDialog, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-800", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white", children: t('leaveDialogTitle') }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: t('leaveDialogDesc') })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-4 py-4", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-neutral-300", children: t('leaveReasonLabel') }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: leaveReason, onChange: (e) => setLeaveReason(e.target.value), placeholder: t('leaveReasonPlaceholder'), className: "bg-neutral-800 border-neutral-700 text-white mt-1" })] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setShowLeaveDialog(false), disabled: submitting, className: "bg-neutral-800 hover:bg-neutral-700 text-white border-neutral-700", children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleLeaveStation, disabled: submitting, className: "bg-red-900/50 hover:bg-red-900/70 text-red-400 border border-red-800", children: submitting ? t('submitting') : t('confirmLeave') })] })] }) }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialog, { open: showCancelDialog, onOpenChange: setShowCancelDialog, children: (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogContent, { className: "bg-neutral-900 border-neutral-800", children: [(0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogHeader, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogTitle, { className: "text-white", children: t('cancelQueueTitle') }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogDescription, { className: "text-neutral-400", children: t('cancelQueueDesc') })] }), (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogFooter, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogCancel, { disabled: submitting, className: "bg-neutral-800 hover:bg-neutral-700 text-white border-neutral-700", children: t('goBack') }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogAction, { onClick: handleCancelQueue, disabled: submitting, className: "bg-red-900/50 hover:bg-red-900/70 text-red-400 border border-red-800", children: submitting ? t('submitting') : t('confirmCancel') })] })] }) })] }));
|
|
245
176
|
}
|
|
@@ -17,7 +17,6 @@ const input_1 = require("../ui/input");
|
|
|
17
17
|
const label_1 = require("../ui/label");
|
|
18
18
|
const dialog_1 = require("../ui/dialog");
|
|
19
19
|
const sonner_1 = require("sonner");
|
|
20
|
-
const useAuth_1 = require("../../hooks/useAuth");
|
|
21
20
|
const api_service_1 = require("../../lib/api-service");
|
|
22
21
|
const services_1 = require("../../lib/api/services");
|
|
23
22
|
const StationIncomeChart_1 = __importDefault(require("./StationIncomeChart"));
|
|
@@ -63,7 +62,6 @@ const getTechBonusPercentage = (type) => {
|
|
|
63
62
|
};
|
|
64
63
|
function StationDetailPage({ stationId }) {
|
|
65
64
|
const router = (0, navigation_1.useRouter)();
|
|
66
|
-
const { isAdmin } = (0, useAuth_1.useAuth)();
|
|
67
65
|
const [unit, setUnit] = (0, react_1.useState)(null);
|
|
68
66
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
69
67
|
const [metrics, setMetrics] = (0, react_1.useState)(null);
|
|
@@ -228,5 +226,5 @@ function StationDetailPage({ stationId }) {
|
|
|
228
226
|
return null;
|
|
229
227
|
}
|
|
230
228
|
const isQualified = metrics ? (metrics.occupancy_rate >= 90) : false;
|
|
231
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto px-3 py-4 space-y-3 xs:px-4 xs:space-y-4 sm:px-6 sm:py-6 sm:space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-4", children: (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "ghost", className: "text-neutral-400 hover:text-white hover:bg-transparent", onClick: () => router.push('/user-system/territory'), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeft, { className: "w-4 h-4 mr-2" }), "\u8FD4\u56DE\u5217\u8868"] }) }), isAdmin() && ((0, jsx_runtime_1.jsxs)(button_1.Button, { size: "sm", className: "bg-cyan-700 hover:bg-cyan-600 text-white", onClick: () => setIsEditDialogOpen(true), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Edit, { className: "w-4 h-4 mr-1" }), "\u7F16\u8F91"] }))] }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card", children: (0, jsx_runtime_1.jsx)(card_1.CardContent, { className: "pt-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col md:flex-row gap-6", children: [territoryNft ? ((0, jsx_runtime_1.jsx)("div", { className: "w-32 h-32 bg-neutral-800 rounded-lg border border-neutral-700 flex-shrink-0 overflow-hidden", children: (0, jsx_runtime_1.jsx)("img", { src: territoryNft.image || '/placeholder-nft.png', alt: territoryNft.name, className: "w-full h-full object-cover" }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "w-32 h-32 bg-neutral-800 rounded-lg border border-neutral-700 flex flex-col items-center justify-center flex-shrink-0 cursor-pointer hover:border-cyan-400/50 dash-card", onClick: () => setIsMintDialogOpen(true), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Image, { className: "w-8 h-8 text-neutral-500 mb-2" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "\u94F8\u9020 NFT" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-start justify-between", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)("div", { className: getUnitTypeColor(unit.unit_type), children: getUnitTypeIcon(unit.unit_type) }), (0, jsx_runtime_1.jsx)("h1", { className: "text-lg sm:text-2xl font-bold text-white tracking-wider", children: unit.unit_name }), unit.short_id && ((0, jsx_runtime_1.jsx)("span", { className: "text-sm font-mono text-neutral-300 bg-neutral-800 px-2 py-0.5 rounded", children: unit.short_id })), (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: isQualified ? "bg-white/20 text-white" : "bg-neutral-500/20 text-neutral-300", children: isQualified ? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, { className: "w-3 h-3 mr-1" }), "\u5DF2\u8FBE\u6807"] }) : (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.XCircle, { className: "w-3 h-3 mr-1" }), "\u672A\u8FBE\u6807"] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400", children: getUnitTypeLabel(unit.unit_type) }), unit.full_path && ((0, jsx_runtime_1.jsx)("span", { className: "text-xs font-mono text-neutral-500", children: unit.full_path }))] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mt-6", children: [unit.location && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.MapPin, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: unit.location })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Calendar, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-sm", children: ["\u521B\u5EFA\u4E8E ", (0, jsx_runtime_1.jsx)(time_remaining_1.FormattedDate, { dateTime: unit.created_at })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Users, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-sm", children: ["\u5BB9\u91CF: ", (0, jsx_runtime_1.jsx)("span", { className: "font-mono", children: unit.capacity || 1000 })] })] })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [(0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Users, { className: "w-8 h-8 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "\u6210\u5458\u6570\u91CF" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-2xl font-bold text-white font-mono", children: metrics?.member_count ?? 0 }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-neutral-500 mt-1", children: ["\u5BB9\u91CF: ", (0, jsx_runtime_1.jsx)("span", { className: "font-mono", children: metrics?.max_capacity ?? 1000 })] })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Vault, { className: "w-8 h-8 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "\u91D1\u5E93\u4F59\u989D" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-2xl font-bold text-white font-mono", children: (metrics?.vault_mcd ?? 0).toLocaleString() }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "MCD (\u79EF\u5206)" })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Zap, { className: "w-8 h-8 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "\u79D1\u6280\u52A0\u6210" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-2xl font-bold text-white font-mono", children: ["+", getTechBonusPercentage(unit.unit_type), "%"] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "\u94F8\u9020\u4EA7\u51FA\u52A0\u6210" })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.DollarSign, { className: "w-8 h-8 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "\u5165\u9A7B\u7387" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-2xl font-bold text-white font-mono", children: metrics ? `${metrics.occupancy_rate.toFixed(1)}%` : '0%' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "\u6210\u5458/\u5BB9\u91CF" })] }) })] }), metrics && ((0, jsx_runtime_1.jsxs)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card", children: [(0, jsx_runtime_1.jsxs)(card_1.CardHeader, { children: [(0, jsx_runtime_1.jsx)(card_1.CardTitle, { className: "text-sm font-medium text-neutral-300 tracking-wider", children: "KPI \u8FDB\u5EA6" }), (0, jsx_runtime_1.jsxs)(card_1.CardDescription, { className: "text-neutral-400", children: ["\u5347\u7EA7\u5230 ", unit.unit_type === 'station' ? 'Matrix' : '更高等级', " \u7684\u8981\u6C42"] })] }), (0, jsx_runtime_1.jsx)(card_1.CardContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between text-sm mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "\u6210\u5458\u6570\u91CF" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-mono", children: [metrics.member_count, " / ", metrics.max_capacity] })] }), (0, jsx_runtime_1.jsx)("div", { className: "w-full bg-neutral-800 rounded-full h-2 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400 h-2 rounded-full transition-all", style: { width: `${Math.min(metrics.occupancy_rate, 100)}%` } }) }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-neutral-500 mt-1 font-mono", children: [metrics.occupancy_rate.toFixed(1), "% \u5B8C\u6210"] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between text-sm mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "\u91D1\u5E93\u4F59\u989D" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-mono", children: [metrics.vault_mcd.toLocaleString(), " MCD"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "w-full bg-neutral-800 rounded-full h-2 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400 h-2 rounded-full transition-all", style: { width: `${Math.min(100, metrics.vault_mcd / 100)}%` } }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "\u5F53\u524D\u91D1\u5E93\u8D44\u91D1" })] })] }) })] })), (0, jsx_runtime_1.jsxs)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card", children: [(0, jsx_runtime_1.jsx)(card_1.CardHeader, { children: (0, jsx_runtime_1.jsxs)(card_1.CardTitle, { className: "text-sm font-medium text-neutral-300 tracking-wider flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Settings, { className: "w-5 h-5" }), "\u5206\u914D\u673A\u5236"] }) }), (0, jsx_runtime_1.jsx)(card_1.CardContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "p-3 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsx)("h4", { className: "font-semibold text-white mb-2", children: "\u81EA\u52A8\u6309\u52B3\u5206\u914D" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: "\u91D1\u5E93 MCD \u6BCF\u65E5\u81EA\u52A8\u53D1\u653E\u4F59\u989D\u7684 1%\uFF0C\u6309\u5F53\u65E5\u4EA7\u77FF\u91CF\u5360\u6BD4\u5206\u914D\u7ED9\u77FF\u5DE5\u3002" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 text-xs text-neutral-500", children: "\u5206\u914D\u6BD4\u4F8B\uFF1A\u77FF\u5DE5 100%\uFF08\u6309\u52B3\u5206\u914D\uFF09" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsx)(StationIncomeChart_1.default, { stationId: stationId }), (0, jsx_runtime_1.jsx)(StationMemberRanking_1.default, { stationId: stationId })] }), (0, jsx_runtime_1.jsx)(StationKPIHistory_1.default, {}), (0, jsx_runtime_1.jsx)(MiningDistributionHistory_1.MiningDistributionHistory, { territoryId: stationId, title: "\u672C\u9886\u5730\u94F8\u9020\u4EA7\u51FA\u5386\u53F2", description: "\u663E\u793A\u5F52\u5C5E\u672C Station \u7684\u7528\u6237\u94F8\u9020\u4EA7\u51FA\u8BB0\u5F55", showUserColumn: true, limit: 15 }), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: isEditDialogOpen, onOpenChange: setIsEditDialogOpen, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white tracking-wider", children: "\u7F16\u8F91\u9886\u5730" }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: "\u4FEE\u6539\u9886\u5730\u4FE1\u606F" })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-4 py-4", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-xs text-neutral-400 tracking-wider", children: "\u9886\u5730\u540D\u79F0 *" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: formData.unit_name, onChange: (e) => setFormData({ ...formData, unit_name: e.target.value }), className: "bg-neutral-800 border-neutral-600 text-white placeholder-neutral-400 mt-1" })] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setIsEditDialogOpen(false), disabled: submitting, className: "border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent", children: "\u53D6\u6D88" }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleEdit, disabled: submitting, className: "bg-cyan-700 hover:bg-cyan-600 text-white", children: submitting ? '更新中...' : '更新' })] })] }) }), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: isMintDialogOpen, onOpenChange: setIsMintDialogOpen, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white tracking-wider", children: "\u94F8\u9020 Territory NFT" }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogDescription, { className: "text-neutral-400", children: ["\u4E3A ", (0, jsx_runtime_1.jsx)("span", { className: "text-white font-semibold", children: unit.unit_name }), " \u94F8\u9020\u94FE\u4E0A NFT\uFF0C\u53EF\u7528\u4E8E\u501F\u8D37\u62B5\u62BC\u6216\u8F6C\u8BA9\u3002"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 py-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-3 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "\u9886\u5730\u7C7B\u578B" }), (0, jsx_runtime_1.jsx)("span", { className: "text-white font-semibold", children: getUnitTypeLabel(unit.unit_type) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "NFT \u7C7B\u578B" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-semibold font-mono", children: [unit.unit_type.charAt(0).toUpperCase() + unit.unit_type.slice(1), " NFT"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "\u62B5\u62BC\u4EF7\u503C" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-semibold font-mono", children: [unit.unit_type === 'station' && '1,000 MCC', unit.unit_type === 'matrix' && '15,000 MCC', unit.unit_type === 'sector' && '200,000 MCC', unit.unit_type === 'system' && '2,500,000 MCC'] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-neutral-800 rounded border border-neutral-700", children: (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: "\u94F8\u9020 NFT \u540E\uFF0C\u60A8\u53EF\u4EE5\u5C06\u5176\u7528\u4E8E MCC \u501F\u8D37\u534F\u8BAE\u7684\u62B5\u62BC\u54C1\uFF0C\u6216\u5728\u5E02\u573A\u4E0A\u8F6C\u8BA9\u3002" }) })] }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setIsMintDialogOpen(false), disabled: minting, className: "border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent", children: "\u53D6\u6D88" }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleMintNft, disabled: minting, className: "bg-cyan-700 hover:bg-cyan-600 text-white", children: minting ? '铸造中...' : '确认铸造' })] })] }) })] }));
|
|
229
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto px-3 py-4 space-y-3 xs:px-4 xs:space-y-4 sm:px-6 sm:py-6 sm:space-y-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-4", children: (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "ghost", className: "text-neutral-400 hover:text-white hover:bg-transparent", onClick: () => router.push('/user-system/territory'), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeft, { className: "w-4 h-4 mr-2" }), "\u8FD4\u56DE\u5217\u8868"] }) }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card", children: (0, jsx_runtime_1.jsx)(card_1.CardContent, { className: "pt-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col md:flex-row gap-6", children: [territoryNft ? ((0, jsx_runtime_1.jsx)("div", { className: "w-32 h-32 bg-neutral-800 rounded-lg border border-neutral-700 flex-shrink-0 overflow-hidden", children: (0, jsx_runtime_1.jsx)("img", { src: territoryNft.image || '/placeholder-nft.png', alt: territoryNft.name, className: "w-full h-full object-cover" }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "w-32 h-32 bg-neutral-800 rounded-lg border border-neutral-700 flex flex-col items-center justify-center flex-shrink-0 cursor-pointer hover:border-cyan-400/50 dash-card", onClick: () => setIsMintDialogOpen(true), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Image, { className: "w-8 h-8 text-neutral-500 mb-2" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "\u94F8\u9020 NFT" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-start justify-between", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)("div", { className: getUnitTypeColor(unit.unit_type), children: getUnitTypeIcon(unit.unit_type) }), (0, jsx_runtime_1.jsx)("h1", { className: "text-lg sm:text-2xl font-bold text-white tracking-wider", children: unit.unit_name }), unit.short_id && ((0, jsx_runtime_1.jsx)("span", { className: "text-sm font-mono text-neutral-300 bg-neutral-800 px-2 py-0.5 rounded", children: unit.short_id })), (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: isQualified ? "bg-white/20 text-white" : "bg-neutral-500/20 text-neutral-300", children: isQualified ? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, { className: "w-3 h-3 mr-1" }), "\u5DF2\u8FBE\u6807"] }) : (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.XCircle, { className: "w-3 h-3 mr-1" }), "\u672A\u8FBE\u6807"] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400", children: getUnitTypeLabel(unit.unit_type) }), unit.full_path && ((0, jsx_runtime_1.jsx)("span", { className: "text-xs font-mono text-neutral-500", children: unit.full_path }))] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mt-6", children: [unit.location && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.MapPin, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: unit.location })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Calendar, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-sm", children: ["\u521B\u5EFA\u4E8E ", (0, jsx_runtime_1.jsx)(time_remaining_1.FormattedDate, { dateTime: unit.created_at })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Users, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-sm", children: ["\u5BB9\u91CF: ", (0, jsx_runtime_1.jsx)("span", { className: "font-mono", children: unit.capacity || 1000 })] })] })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [(0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Users, { className: "w-8 h-8 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "\u6210\u5458\u6570\u91CF" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-2xl font-bold text-white font-mono", children: metrics?.member_count ?? 0 }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-neutral-500 mt-1", children: ["\u5BB9\u91CF: ", (0, jsx_runtime_1.jsx)("span", { className: "font-mono", children: metrics?.max_capacity ?? 1000 })] })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Vault, { className: "w-8 h-8 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "\u91D1\u5E93\u4F59\u989D" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-2xl font-bold text-white font-mono", children: (metrics?.vault_mcd ?? 0).toLocaleString() }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "MCD (\u79EF\u5206)" })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Zap, { className: "w-8 h-8 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "\u79D1\u6280\u52A0\u6210" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-2xl font-bold text-white font-mono", children: ["+", getTechBonusPercentage(unit.unit_type), "%"] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "\u94F8\u9020\u4EA7\u51FA\u52A0\u6210" })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.DollarSign, { className: "w-8 h-8 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "\u5165\u9A7B\u7387" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-2xl font-bold text-white font-mono", children: metrics ? `${metrics.occupancy_rate.toFixed(1)}%` : '0%' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "\u6210\u5458/\u5BB9\u91CF" })] }) })] }), metrics && ((0, jsx_runtime_1.jsxs)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card", children: [(0, jsx_runtime_1.jsxs)(card_1.CardHeader, { children: [(0, jsx_runtime_1.jsx)(card_1.CardTitle, { className: "text-sm font-medium text-neutral-300 tracking-wider", children: "KPI \u8FDB\u5EA6" }), (0, jsx_runtime_1.jsxs)(card_1.CardDescription, { className: "text-neutral-400", children: ["\u5347\u7EA7\u5230 ", unit.unit_type === 'station' ? 'Matrix' : '更高等级', " \u7684\u8981\u6C42"] })] }), (0, jsx_runtime_1.jsx)(card_1.CardContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between text-sm mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "\u6210\u5458\u6570\u91CF" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-mono", children: [metrics.member_count, " / ", metrics.max_capacity] })] }), (0, jsx_runtime_1.jsx)("div", { className: "w-full bg-neutral-800 rounded-full h-2 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400 h-2 rounded-full transition-all", style: { width: `${Math.min(metrics.occupancy_rate, 100)}%` } }) }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-neutral-500 mt-1 font-mono", children: [metrics.occupancy_rate.toFixed(1), "% \u5B8C\u6210"] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between text-sm mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "\u91D1\u5E93\u4F59\u989D" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-mono", children: [metrics.vault_mcd.toLocaleString(), " MCD"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "w-full bg-neutral-800 rounded-full h-2 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400 h-2 rounded-full transition-all", style: { width: `${Math.min(100, metrics.vault_mcd / 100)}%` } }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "\u5F53\u524D\u91D1\u5E93\u8D44\u91D1" })] })] }) })] })), (0, jsx_runtime_1.jsxs)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card", children: [(0, jsx_runtime_1.jsx)(card_1.CardHeader, { children: (0, jsx_runtime_1.jsxs)(card_1.CardTitle, { className: "text-sm font-medium text-neutral-300 tracking-wider flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Settings, { className: "w-5 h-5" }), "\u5206\u914D\u673A\u5236"] }) }), (0, jsx_runtime_1.jsx)(card_1.CardContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "p-3 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsx)("h4", { className: "font-semibold text-white mb-2", children: "\u81EA\u52A8\u6309\u52B3\u5206\u914D" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: "\u91D1\u5E93 MCD \u6BCF\u65E5\u81EA\u52A8\u53D1\u653E\u4F59\u989D\u7684 1%\uFF0C\u6309\u5F53\u65E5\u4EA7\u77FF\u91CF\u5360\u6BD4\u5206\u914D\u7ED9\u77FF\u5DE5\u3002" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 text-xs text-neutral-500", children: "\u5206\u914D\u6BD4\u4F8B\uFF1A\u77FF\u5DE5 100%\uFF08\u6309\u52B3\u5206\u914D\uFF09" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsx)(StationIncomeChart_1.default, { stationId: stationId }), (0, jsx_runtime_1.jsx)(StationMemberRanking_1.default, { stationId: stationId })] }), (0, jsx_runtime_1.jsx)(StationKPIHistory_1.default, {}), (0, jsx_runtime_1.jsx)(MiningDistributionHistory_1.MiningDistributionHistory, { territoryId: stationId, title: "\u672C\u9886\u5730\u94F8\u9020\u4EA7\u51FA\u5386\u53F2", description: "\u663E\u793A\u5F52\u5C5E\u672C Station \u7684\u7528\u6237\u94F8\u9020\u4EA7\u51FA\u8BB0\u5F55", showUserColumn: true, limit: 15 }), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: isEditDialogOpen, onOpenChange: setIsEditDialogOpen, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white tracking-wider", children: "\u7F16\u8F91\u9886\u5730" }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: "\u4FEE\u6539\u9886\u5730\u4FE1\u606F" })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-4 py-4", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-xs text-neutral-400 tracking-wider", children: "\u9886\u5730\u540D\u79F0 *" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: formData.unit_name, onChange: (e) => setFormData({ ...formData, unit_name: e.target.value }), className: "bg-neutral-800 border-neutral-600 text-white placeholder-neutral-400 mt-1" })] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setIsEditDialogOpen(false), disabled: submitting, className: "border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent", children: "\u53D6\u6D88" }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleEdit, disabled: submitting, className: "bg-cyan-700 hover:bg-cyan-600 text-white", children: submitting ? '更新中...' : '更新' })] })] }) }), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: isMintDialogOpen, onOpenChange: setIsMintDialogOpen, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white tracking-wider", children: "\u94F8\u9020 Territory NFT" }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogDescription, { className: "text-neutral-400", children: ["\u4E3A ", (0, jsx_runtime_1.jsx)("span", { className: "text-white font-semibold", children: unit.unit_name }), " \u94F8\u9020\u94FE\u4E0A NFT\uFF0C\u53EF\u7528\u4E8E\u501F\u8D37\u62B5\u62BC\u6216\u8F6C\u8BA9\u3002"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 py-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-3 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "\u9886\u5730\u7C7B\u578B" }), (0, jsx_runtime_1.jsx)("span", { className: "text-white font-semibold", children: getUnitTypeLabel(unit.unit_type) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "NFT \u7C7B\u578B" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-semibold font-mono", children: [unit.unit_type.charAt(0).toUpperCase() + unit.unit_type.slice(1), " NFT"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "\u62B5\u62BC\u4EF7\u503C" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-semibold font-mono", children: [unit.unit_type === 'station' && '1,000 MCC', unit.unit_type === 'matrix' && '15,000 MCC', unit.unit_type === 'sector' && '200,000 MCC', unit.unit_type === 'system' && '2,500,000 MCC'] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-neutral-800 rounded border border-neutral-700", children: (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: "\u94F8\u9020 NFT \u540E\uFF0C\u60A8\u53EF\u4EE5\u5C06\u5176\u7528\u4E8E MCC \u501F\u8D37\u534F\u8BAE\u7684\u62B5\u62BC\u54C1\uFF0C\u6216\u5728\u5E02\u573A\u4E0A\u8F6C\u8BA9\u3002" }) })] }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setIsMintDialogOpen(false), disabled: minting, className: "border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent", children: "\u53D6\u6D88" }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleMintNft, disabled: minting, className: "bg-cyan-700 hover:bg-cyan-600 text-white", children: minting ? '铸造中...' : '确认铸造' })] })] }) })] }));
|
|
232
230
|
}
|
|
@@ -75,7 +75,7 @@ const cropToSquare = (file, size) => {
|
|
|
75
75
|
function StationListPage() {
|
|
76
76
|
const t = (0, next_intl_1.useTranslations)('stationList');
|
|
77
77
|
const router = (0, navigation_1.useRouter)();
|
|
78
|
-
const {
|
|
78
|
+
const { user } = (0, useAuth_1.useAuth)();
|
|
79
79
|
const [units, setUnits] = (0, react_1.useState)([]);
|
|
80
80
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
81
81
|
const [filter, setFilter] = (0, react_1.useState)('all');
|
|
@@ -178,8 +178,6 @@ function StationListPage() {
|
|
|
178
178
|
(unit.full_path?.toLowerCase().includes(lowerSearch));
|
|
179
179
|
});
|
|
180
180
|
const canEditUnit = (unit) => {
|
|
181
|
-
if (isAdmin())
|
|
182
|
-
return true;
|
|
183
181
|
if (user?.uid && (unit.manager_uid === user.uid || unit.manager_id === user.uid))
|
|
184
182
|
return true;
|
|
185
183
|
return false;
|
|
@@ -334,7 +332,7 @@ function StationListPage() {
|
|
|
334
332
|
setEditingUnit(null);
|
|
335
333
|
setImageFile(null);
|
|
336
334
|
setImagePreview(null);
|
|
337
|
-
} }, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700 max-w-lg", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white tracking-wider", children: t('editTitle') }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", asChild: true, children: (0, jsx_runtime_1.jsx)("div", { children: editingUnit && ((0, jsx_runtime_1.jsxs)("span", { className: "text-xs font-mono mt-1 block", children: [getUnitTypeLabel(editingUnit.unit_type), " ", t('coordinate'), ": ", editingUnit.full_path || editingUnit.short_id || editingUnit.territory_id] })) }) })] }), editingUnit && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 py-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 items-start", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-shrink-0 flex flex-col items-center justify-center self-center space-y-1.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-28 h-28 rounded border border-neutral-700 bg-neutral-800 overflow-hidden cursor-pointer hover:border-cyan-400/50 transition-colors relative group/img", onClick: () => fileInputRef.current?.click(), children: (imagePreview || editingUnit.image_url) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: imagePreview || editingUnit.image_url, alt: "", className: "w-full h-full object-cover" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover/img:opacity-100 transition-opacity flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "w-5 h-5 text-white" }) })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "w-full h-full flex flex-col items-center justify-center text-neutral-500 gap-1", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ImageIcon, { className: "w-6 h-6" }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px]", children: t('clickToUpload') })] })) }), (0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-500 text-center", children: "512x512 \u00B7 \u22642MB" }),
|
|
335
|
+
} }, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700 max-w-lg", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white tracking-wider", children: t('editTitle') }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", asChild: true, children: (0, jsx_runtime_1.jsx)("div", { children: editingUnit && ((0, jsx_runtime_1.jsxs)("span", { className: "text-xs font-mono mt-1 block", children: [getUnitTypeLabel(editingUnit.unit_type), " ", t('coordinate'), ": ", editingUnit.full_path || editingUnit.short_id || editingUnit.territory_id] })) }) })] }), editingUnit && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 py-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 items-start", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-shrink-0 flex flex-col items-center justify-center self-center space-y-1.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-28 h-28 rounded border border-neutral-700 bg-neutral-800 overflow-hidden cursor-pointer hover:border-cyan-400/50 transition-colors relative group/img", onClick: () => fileInputRef.current?.click(), children: (imagePreview || editingUnit.image_url) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: imagePreview || editingUnit.image_url, alt: "", className: "w-full h-full object-cover" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover/img:opacity-100 transition-opacity flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "w-5 h-5 text-white" }) })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "w-full h-full flex flex-col items-center justify-center text-neutral-500 gap-1", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ImageIcon, { className: "w-6 h-6" }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px]", children: t('clickToUpload') })] })) }), (0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-500 text-center", children: "512x512 \u00B7 \u22642MB" }), (0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-yellow-400/80 text-center", children: t('needsReview') }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-1 flex-wrap", children: [editingUnit.image_status && editingUnit.image_status !== 'approved' && getImageStatusBadge(editingUnit.image_status), editingUnit.image_status === 'approved' && editingUnit.image_url && ((0, jsx_runtime_1.jsxs)(badge_1.Badge, { className: "bg-green-400/20 text-green-400 text-[10px]", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, { className: "w-2.5 h-2.5 mr-0.5" }), t('approved')] })), imageFile && (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-cyan-400/20 text-cyan-400 text-[10px]", children: t('newImage') })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 space-y-3 min-w-0", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-1", children: "unit_name *" }), (0, jsx_runtime_1.jsx)("input", { value: editFormData.unit_name, onChange: (e) => setEditFormData({ ...editFormData, unit_name: e.target.value }), className: "w-full bg-neutral-800 border border-neutral-600 text-white px-3 py-2 rounded text-sm focus:border-cyan-400 focus:outline-none" }), (0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-500 mt-1", children: t('nameChangeHint') })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-1", children: "description" }), (0, jsx_runtime_1.jsx)("textarea", { value: editFormData.description, onChange: (e) => setEditFormData({ ...editFormData, description: e.target.value }), rows: 3, className: "w-full bg-neutral-800 border border-neutral-600 text-white px-3 py-2 rounded text-sm focus:border-cyan-400 focus:outline-none resize-none" })] })] })] }), (0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, type: "file", accept: "image/png,image/jpeg,image/webp", onChange: handleFileSelect, className: "hidden" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-3 p-3 rounded bg-neutral-800/50 border border-neutral-700", children: (() => {
|
|
338
336
|
const mgr = getManagerDisplay(editingUnit);
|
|
339
337
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(hover_avatar_1.HoverAvatar, { src: mgr.avatar, fallback: mgr.title, size: 32, fallbackClassName: "bg-cyan-400/20 text-cyan-400" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 min-w-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm text-white truncate", children: mgr.title }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: mgr.subtitle })] })] }));
|
|
340
338
|
})() })] })), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", size: "sm", className: "border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent", onClick: () => { setIsEditDialogOpen(false); setEditingUnit(null); setImageFile(null); setImagePreview(null); }, disabled: submitting || uploadingImage, children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { size: "sm", onClick: handleEdit, disabled: submitting || uploadingImage, className: "bg-cyan-700 hover:bg-cyan-600 text-white", children: (submitting || uploadingImage) ? t('saving') : t('save') })] })] }) })] }));
|
|
@@ -13,7 +13,6 @@ const input_1 = require("../ui/input");
|
|
|
13
13
|
const label_1 = require("../ui/label");
|
|
14
14
|
const dialog_1 = require("../ui/dialog");
|
|
15
15
|
const sonner_1 = require("sonner");
|
|
16
|
-
const useAuth_1 = require("../../hooks/useAuth");
|
|
17
16
|
const api_service_1 = require("../../lib/api-service");
|
|
18
17
|
const utils_1 = require("../../lib/utils");
|
|
19
18
|
const lucide_react_1 = require("lucide-react");
|
|
@@ -58,10 +57,8 @@ const distributionPlans = [
|
|
|
58
57
|
{ id: 'weighted_rank', name: '等级加权', description: '根据用户等级加权分配' },
|
|
59
58
|
{ id: 'weighted_contribution', name: '贡献加权', description: '根据交易量贡献加权分配' },
|
|
60
59
|
{ id: 'hybrid', name: '混合模式', description: '等级50% + 贡献50%' },
|
|
61
|
-
{ id: 'manager_bonus', name: '管理员奖励', description: '管理员额外10%奖励' },
|
|
62
60
|
];
|
|
63
61
|
function StationsPage() {
|
|
64
|
-
const { isAdmin } = (0, useAuth_1.useAuth)();
|
|
65
62
|
const [units, setUnits] = (0, react_1.useState)([]);
|
|
66
63
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
67
64
|
const [refreshing, setRefreshing] = (0, react_1.useState)(false);
|
|
@@ -226,7 +223,7 @@ function StationsPage() {
|
|
|
226
223
|
setNameStatus(null);
|
|
227
224
|
setNewName('');
|
|
228
225
|
}
|
|
229
|
-
}, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogTitle, { className: "text-white tracking-wider", children: ["rename_territory ", selectedUnit?.unit_id?.toString().slice(0, 8)] }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: "\u4FEE\u6539\u9886\u5730\u540D\u79F0\uFF08\u6BCF90\u5929\u53EF\u4FEE\u6539\u4E00\u6B21\uFF09" })] }), nameLoading ? ((0, jsx_runtime_1.jsxs)("div", { className: "py-8 text-center text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-6 h-6 animate-spin mx-auto mb-2" }), "\u52A0\u8F7D\u4E2D..."] })) : nameStatus ? ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 py-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-3 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-2", children: "current_name" }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg text-white font-medium", children: nameStatus.current_name })] }), !nameStatus.can_modify && ((0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-neutral-800 rounded border border-neutral-700", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Clock, { className: "w-5 h-5 text-cyan-400 mt-0.5" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white font-medium", children: "\u4FEE\u6539\u51B7\u5374\u4E2D" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-sm text-neutral-400 mt-1", children: ["\u8FD8\u9700\u7B49\u5F85 ", (0, jsx_runtime_1.jsx)("span", { className: "font-bold font-mono", children: nameStatus.remaining_days }), " \u5929", nameStatus.next_modify_date && ((0, jsx_runtime_1.jsxs)("span", { className: "ml-1", children: ["\uFF08", nameStatus.next_modify_date, " \u53EF\u4FEE\u6539\uFF09"] }))] })] })] }) })), nameStatus.is_team_managed && ((0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-neutral-800 rounded border border-neutral-700", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.AlertCircle, { className: "w-5 h-5 text-cyan-400 mt-0.5" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white font-medium", children: "\u56E2\u961F\u4EE3\u7BA1\u9886\u5730" }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-neutral-400 mt-1", children: "\u9886\u5730\u5F53\u524D\u7531\u56E2\u961F\u4EE3\u7BA1\uFF0C\u4EFB\u4F55\u5DF2\u767B\u5F55\u7528\u6237\u90FD\u53EF\u4EE5\u4FEE\u6539\u540D\u79F0" })] })] }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-xs text-neutral-400 tracking-wider", children: "new_name *" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: newName, onChange: (e) => setNewName(e.target.value), placeholder: "\u8F93\u5165\u65B0\u7684\u9886\u5730\u540D\u79F0", className: "bg-neutral-800 border-neutral-600 text-white placeholder-neutral-400 mt-1", maxLength: 50, disabled: !nameStatus.can_modify
|
|
226
|
+
}, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogTitle, { className: "text-white tracking-wider", children: ["rename_territory ", selectedUnit?.unit_id?.toString().slice(0, 8)] }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: "\u4FEE\u6539\u9886\u5730\u540D\u79F0\uFF08\u6BCF90\u5929\u53EF\u4FEE\u6539\u4E00\u6B21\uFF09" })] }), nameLoading ? ((0, jsx_runtime_1.jsxs)("div", { className: "py-8 text-center text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-6 h-6 animate-spin mx-auto mb-2" }), "\u52A0\u8F7D\u4E2D..."] })) : nameStatus ? ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 py-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-3 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-2", children: "current_name" }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg text-white font-medium", children: nameStatus.current_name })] }), !nameStatus.can_modify && ((0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-neutral-800 rounded border border-neutral-700", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Clock, { className: "w-5 h-5 text-cyan-400 mt-0.5" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white font-medium", children: "\u4FEE\u6539\u51B7\u5374\u4E2D" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-sm text-neutral-400 mt-1", children: ["\u8FD8\u9700\u7B49\u5F85 ", (0, jsx_runtime_1.jsx)("span", { className: "font-bold font-mono", children: nameStatus.remaining_days }), " \u5929", nameStatus.next_modify_date && ((0, jsx_runtime_1.jsxs)("span", { className: "ml-1", children: ["\uFF08", nameStatus.next_modify_date, " \u53EF\u4FEE\u6539\uFF09"] }))] })] })] }) })), nameStatus.is_team_managed && ((0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-neutral-800 rounded border border-neutral-700", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.AlertCircle, { className: "w-5 h-5 text-cyan-400 mt-0.5" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white font-medium", children: "\u56E2\u961F\u4EE3\u7BA1\u9886\u5730" }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-neutral-400 mt-1", children: "\u9886\u5730\u5F53\u524D\u7531\u56E2\u961F\u4EE3\u7BA1\uFF0C\u4EFB\u4F55\u5DF2\u767B\u5F55\u7528\u6237\u90FD\u53EF\u4EE5\u4FEE\u6539\u540D\u79F0" })] })] }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(label_1.Label, { className: "text-xs text-neutral-400 tracking-wider", children: "new_name *" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: newName, onChange: (e) => setNewName(e.target.value), placeholder: "\u8F93\u5165\u65B0\u7684\u9886\u5730\u540D\u79F0", className: "bg-neutral-800 border-neutral-600 text-white placeholder-neutral-400 mt-1", maxLength: 50, disabled: !nameStatus.can_modify }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-1 font-mono", children: [newName.length, "/50 \u5B57\u7B26\uFF08\u81F3\u5C112\u4E2A\u5B57\u7B26\uFF09"] })] }), nameStatus.last_modified_at && ((0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 border-t border-neutral-700 pt-3", children: [(0, jsx_runtime_1.jsxs)("div", { children: ["\u4E0A\u6B21\u4FEE\u6539: ", nameStatus.last_modified_at] }), nameStatus.last_modified_by && ((0, jsx_runtime_1.jsxs)("div", { children: ["\u4FEE\u6539\u4EBA: ", (0, jsx_runtime_1.jsxs)("span", { className: "font-mono", children: [nameStatus.last_modified_by.slice(0, 8), "..."] })] }))] }))] })) : ((0, jsx_runtime_1.jsx)("div", { className: "py-8 text-center text-neutral-500", children: "\u52A0\u8F7D\u540D\u79F0\u72B6\u6001\u5931\u8D25" })), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", size: "sm", className: "border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent", onClick: () => {
|
|
230
227
|
setIsNameEditDialogOpen(false);
|
|
231
228
|
setSelectedUnit(null);
|
|
232
229
|
setNameStatus(null);
|
|
@@ -235,5 +232,5 @@ function StationsPage() {
|
|
|
235
232
|
!newName.trim() ||
|
|
236
233
|
newName.trim().length < 2 ||
|
|
237
234
|
newName === nameStatus?.current_name ||
|
|
238
|
-
|
|
235
|
+
!nameStatus?.can_modify, className: "bg-cyan-700 hover:bg-cyan-600 text-white", children: submitting ? '更新中...' : '确认修改' })] })] }) })] }));
|
|
239
236
|
}
|
|
@@ -12,11 +12,9 @@ export interface MenuItem {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const userMenuItems: MenuItem[];
|
|
14
14
|
export declare const agentMenuItems: MenuItem[];
|
|
15
|
-
export declare const adminMenuItems: MenuItem[];
|
|
16
15
|
export declare function filterMenuByRole(menuItems: MenuItem[], userRole: UserRole): MenuItem[];
|
|
17
16
|
export declare function getUserMenus(userRole: UserRole): {
|
|
18
17
|
userMenu: MenuItem[];
|
|
19
18
|
agentMenu: MenuItem[];
|
|
20
|
-
adminMenu: MenuItem[];
|
|
21
19
|
};
|
|
22
20
|
export declare function isMenuItemActive(itemHref: string, currentPath: string): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.agentMenuItems = exports.userMenuItems = void 0;
|
|
4
4
|
exports.filterMenuByRole = filterMenuByRole;
|
|
5
5
|
exports.getUserMenus = getUserMenus;
|
|
6
6
|
exports.isMenuItemActive = isMenuItemActive;
|
|
@@ -11,130 +11,78 @@ exports.userMenuItems = [
|
|
|
11
11
|
titleKey: "overview",
|
|
12
12
|
href: "/user-system/dashboard",
|
|
13
13
|
icon: lucide_react_1.LayoutDashboard,
|
|
14
|
-
roles: ["user"
|
|
14
|
+
roles: ["user"],
|
|
15
15
|
descriptionKey: "overviewDesc"
|
|
16
16
|
},
|
|
17
|
-
{ titleKey: "blockchainSection", href: "#blockchain", icon: lucide_react_1.Coins, roles: ["user"
|
|
17
|
+
{ titleKey: "blockchainSection", href: "#blockchain", icon: lucide_react_1.Coins, roles: ["user"], isSection: true },
|
|
18
18
|
{
|
|
19
19
|
titleKey: "mint",
|
|
20
20
|
href: "/mcc/mining",
|
|
21
21
|
icon: lucide_react_1.Pickaxe,
|
|
22
|
-
roles: ["user"
|
|
22
|
+
roles: ["user"],
|
|
23
23
|
descriptionKey: "mintDesc"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
titleKey: "wallet",
|
|
27
27
|
href: "/mcc/wallet",
|
|
28
28
|
icon: lucide_react_1.Wallet,
|
|
29
|
-
roles: ["user"
|
|
29
|
+
roles: ["user"],
|
|
30
30
|
descriptionKey: "walletDesc"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
titleKey: "mcdCredits",
|
|
34
34
|
href: "/mcc/mcd",
|
|
35
35
|
icon: lucide_react_1.Ticket,
|
|
36
|
-
roles: ["user"
|
|
36
|
+
roles: ["user"],
|
|
37
37
|
descriptionKey: "mcdCreditsDesc"
|
|
38
38
|
},
|
|
39
|
-
{ titleKey: "web3osSection", href: "#web3os", icon: lucide_react_1.Users, roles: ["user"
|
|
39
|
+
{ titleKey: "web3osSection", href: "#web3os", icon: lucide_react_1.Users, roles: ["user"], isSection: true },
|
|
40
40
|
{
|
|
41
41
|
titleKey: "auctionMarket",
|
|
42
42
|
href: "/mcc/auctions",
|
|
43
43
|
icon: lucide_react_1.Gift,
|
|
44
|
-
roles: ["user"
|
|
44
|
+
roles: ["user"],
|
|
45
45
|
descriptionKey: "auctionMarketDesc"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
titleKey: "territoryManagement",
|
|
49
49
|
href: "/user-system/territory",
|
|
50
50
|
icon: lucide_react_1.Building2,
|
|
51
|
-
roles: ["user"
|
|
51
|
+
roles: ["user"],
|
|
52
52
|
descriptionKey: "territoryManagementDesc"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
titleKey: "nftFragments",
|
|
56
56
|
href: "/mcc/fragment",
|
|
57
57
|
icon: lucide_react_1.Puzzle,
|
|
58
|
-
roles: ["user"
|
|
58
|
+
roles: ["user"],
|
|
59
59
|
descriptionKey: "nftFragmentsDesc"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
titleKey: "lending",
|
|
63
63
|
href: "/mcc/lending",
|
|
64
64
|
icon: lucide_react_1.Landmark,
|
|
65
|
-
roles: ["user"
|
|
65
|
+
roles: ["user"],
|
|
66
66
|
descriptionKey: "lendingDesc"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
titleKey: "communityVoting",
|
|
70
70
|
href: "/mcc/voting",
|
|
71
71
|
icon: lucide_react_1.Vote,
|
|
72
|
-
roles: ["user"
|
|
72
|
+
roles: ["user"],
|
|
73
73
|
descriptionKey: "communityVotingDesc"
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
titleKey: "orgStructure",
|
|
77
77
|
href: "/user-system/organization",
|
|
78
78
|
icon: lucide_react_1.Users,
|
|
79
|
-
roles: ["user"
|
|
79
|
+
roles: ["user"],
|
|
80
80
|
descriptionKey: "orgStructureDesc"
|
|
81
81
|
}
|
|
82
82
|
];
|
|
83
83
|
exports.agentMenuItems = [];
|
|
84
|
-
exports.adminMenuItems = [
|
|
85
|
-
{
|
|
86
|
-
titleKey: "systemAddresses",
|
|
87
|
-
href: "/admin/system-addresses",
|
|
88
|
-
icon: lucide_react_1.Server,
|
|
89
|
-
roles: ["admin"],
|
|
90
|
-
descriptionKey: "systemAddressesDesc"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
titleKey: "projectReview",
|
|
94
|
-
href: "/admin/project-applications",
|
|
95
|
-
icon: lucide_react_1.FileText,
|
|
96
|
-
roles: ["admin"],
|
|
97
|
-
descriptionKey: "projectReviewDesc"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
titleKey: "userManagement",
|
|
101
|
-
href: "/admin/members",
|
|
102
|
-
icon: lucide_react_1.UserCog,
|
|
103
|
-
roles: ["admin"],
|
|
104
|
-
descriptionKey: "userManagementDesc"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
titleKey: "alertCenter",
|
|
108
|
-
href: "/admin/alerts",
|
|
109
|
-
icon: lucide_react_1.Bell,
|
|
110
|
-
roles: ["admin"],
|
|
111
|
-
descriptionKey: "alertCenterDesc"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
titleKey: "simulationEngine",
|
|
115
|
-
href: "/admin/simulation",
|
|
116
|
-
icon: lucide_react_1.Bot,
|
|
117
|
-
roles: ["admin"],
|
|
118
|
-
descriptionKey: "simulationEngineDesc"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
titleKey: "mccHolders",
|
|
122
|
-
href: "/admin/mcc-holders",
|
|
123
|
-
icon: lucide_react_1.Eye,
|
|
124
|
-
roles: ["admin"],
|
|
125
|
-
descriptionKey: "mccHoldersDesc"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
titleKey: "aiManagement",
|
|
129
|
-
href: "/admin/ai-management",
|
|
130
|
-
icon: lucide_react_1.Bot,
|
|
131
|
-
roles: ["admin"],
|
|
132
|
-
descriptionKey: "aiManagementDesc"
|
|
133
|
-
}
|
|
134
|
-
];
|
|
135
84
|
function filterMenuByRole(menuItems, userRole) {
|
|
136
85
|
const roleHierarchy = {
|
|
137
|
-
admin: ["admin", "agent", "user"],
|
|
138
86
|
agent: ["agent", "user"],
|
|
139
87
|
user: ["user"]
|
|
140
88
|
};
|
|
@@ -151,8 +99,7 @@ function filterMenuByRole(menuItems, userRole) {
|
|
|
151
99
|
function getUserMenus(userRole) {
|
|
152
100
|
return {
|
|
153
101
|
userMenu: filterMenuByRole(exports.userMenuItems, userRole),
|
|
154
|
-
agentMenu: filterMenuByRole(exports.agentMenuItems, userRole)
|
|
155
|
-
adminMenu: filterMenuByRole(exports.adminMenuItems, userRole)
|
|
102
|
+
agentMenu: filterMenuByRole(exports.agentMenuItems, userRole)
|
|
156
103
|
};
|
|
157
104
|
}
|
|
158
105
|
function isMenuItemActive(itemHref, currentPath) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type NativeUser } from '../lib/auth-service';
|
|
2
|
-
export type UserRole = '
|
|
2
|
+
export type UserRole = 'agent' | 'user';
|
|
3
3
|
export interface WalletEntry {
|
|
4
4
|
wallet_address: string;
|
|
5
5
|
is_primary?: boolean;
|
|
@@ -22,7 +22,6 @@ export declare const useAuth: () => {
|
|
|
22
22
|
loading: boolean;
|
|
23
23
|
error: string | null;
|
|
24
24
|
isAuthenticated: () => boolean;
|
|
25
|
-
isAdmin: () => boolean;
|
|
26
25
|
isAgent: () => boolean;
|
|
27
26
|
isTrader: () => boolean;
|
|
28
27
|
hasPermission: (requiredRole: UserRole) => boolean;
|
|
@@ -8,7 +8,6 @@ const auth_service_1 = require("../lib/auth-service");
|
|
|
8
8
|
const core_1 = require("../lib/api/core");
|
|
9
9
|
const getCurrentUserProfile = () => (0, core_1.fetchApi)('/users/profile');
|
|
10
10
|
const ROLE_HIERARCHY = {
|
|
11
|
-
'admin': ['admin', 'agent', 'user'],
|
|
12
11
|
'agent': ['agent', 'user'],
|
|
13
12
|
'user': ['user']
|
|
14
13
|
};
|
|
@@ -126,7 +125,6 @@ const useAuth = () => {
|
|
|
126
125
|
loading,
|
|
127
126
|
error,
|
|
128
127
|
isAuthenticated: () => user !== null && userInfo !== null,
|
|
129
|
-
isAdmin: () => hasPermission('admin'),
|
|
130
128
|
isAgent: () => hasPermission('agent'),
|
|
131
129
|
isTrader: () => hasPermission('agent'),
|
|
132
130
|
hasPermission,
|