@forge-kit/plugin-source-map-prase 0.0.1 → 0.0.2

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.
@@ -3,6 +3,7 @@ import {Box, Button, Flex, Text} from "@forge-kit/component";
3
3
  import {DndContext, PointerSensor, closestCenter, useSensor, useSensors, type DragEndEvent} from "@dnd-kit/core";
4
4
  import {SortableContext, arrayMove, useSortable, verticalListSortingStrategy} from "@dnd-kit/sortable";
5
5
  import {CSS} from "@dnd-kit/utilities";
6
+ import {PanelCard} from "@/components/panel-card";
6
7
  import "./index.less";
7
8
 
8
9
  interface TraceChainNode {
@@ -113,14 +114,6 @@ export const TraceChain: React.FC<TraceChainProps> = (props) => {
113
114
  const {slots = [], data = [], onReorder, onDelete, className} = props
114
115
  const sensors = useSensors(useSensor(PointerSensor, {activationConstraint: {distance: 6}}))
115
116
 
116
- if (slots.length === 0) {
117
- return (
118
- <Box className={className || "trace-chain-root"}>
119
- <Flex className="trace-chain-empty" align="center" justify="center">暂无解析链路,上传 map 并点击“解析链路”。</Flex>
120
- </Box>
121
- )
122
- }
123
-
124
117
  const handleDragEnd = (event: DragEndEvent) => {
125
118
  const {active, over} = event
126
119
  if (!over || active.id === over.id) return
@@ -132,20 +125,26 @@ export const TraceChain: React.FC<TraceChainProps> = (props) => {
132
125
  }
133
126
 
134
127
  return (
135
- <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
136
- <SortableContext items={slots.map((item) => item.id)} strategy={verticalListSortingStrategy}>
137
- <Box className={className || "trace-chain-root"}>
138
- {slots.map((slot, index) => (
139
- <SortableTraceChainItem
140
- key={slot.id}
141
- slot={slot}
142
- hop={data[index]}
143
- index={index}
144
- onDelete={onDelete}
145
- />
146
- ))}
147
- </Box>
148
- </SortableContext>
149
- </DndContext>
128
+ <PanelCard title="TRACE CHAIN" className="trace-panel-card">
129
+ <Flex className="trace-panel-content">
130
+ {Boolean(!slots.length) && (
131
+ <Box className={className || "trace-chain-root"}>
132
+ <Flex className="trace-chain-empty" align="center" justify="center">暂无解析链路,上传 map
133
+ 并点击“解析链路”。</Flex>
134
+ </Box>
135
+ )}
136
+ {Boolean(slots.length) && (
137
+ <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
138
+ <SortableContext items={slots.map((item) => item.id)} strategy={verticalListSortingStrategy}>
139
+ <Box className={className || "trace-chain-root"}>
140
+ {slots.map((slot, index) => {
141
+ return <SortableTraceChainItem key={slot.id} slot={slot} hop={data[index]} index={index} onDelete={onDelete}/>
142
+ })}
143
+ </Box>
144
+ </SortableContext>
145
+ </DndContext>
146
+ )}
147
+ </Flex>
148
+ </PanelCard>
150
149
  )
151
150
  }