Skip to content

Commit ad87c12

Browse files
author
GeorgeZhang2035
committed
perf(sheet): ui of group optimized!
1 parent dd67dfe commit ad87c12

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

src/components/editor/operator/sheet/SheetGroup.tsx

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Button,
44
Divider,
55
H5,
6+
H6,
67
InputGroup,
78
Intent,
89
} from '@blueprintjs/core'
@@ -11,7 +12,6 @@ import { useAtom } from 'jotai'
1112
import { isEqual, omit } from 'lodash-es'
1213
import { useMemo, useState } from 'react'
1314
import { UseFieldArrayRemove, UseFormSetError } from 'react-hook-form'
14-
import { useEvent } from 'react-use'
1515

1616
import { AppToaster } from 'components/Toaster'
1717
import { CopilotDocV1 } from 'models/copilot.schema'
@@ -200,16 +200,34 @@ const SheetGroup = ({
200200
[coverGroup?.name],
201201
)
202202

203+
const GroupCount = useMemo(
204+
() => (
205+
<H6 className="my-2 text-center">
206+
已显示全部 {existedGroups.length} 个干员组
207+
</H6>
208+
),
209+
[existedGroups.length],
210+
)
211+
203212
return (
204213
<>
205214
{FavCoverAlert}
206215
<div className="flex px-1">
207-
<div className="flex-1 sticky top-0 max-h-screen flex flex-col">
208-
<div className="grow h-full overflow-y-auto py-1">
209-
<SheetContainerSkeleton title="已设置的分组" icon="cog" mini>
216+
<div className="flex-1 sticky top-0 h-screen flex flex-col">
217+
<div className="grow overflow-y-auto">
218+
<SheetContainerSkeleton
219+
title="添加干员组"
220+
icon="add"
221+
mini
222+
className="sticky top-0 z-10 backdrop-blur-lg py-1"
223+
>
224+
<EditorGroupName {...{ eventHandleProxy }} />
225+
</SheetContainerSkeleton>
226+
<SheetContainerSkeleton title="已设置的干员组" icon="cog" mini>
210227
<div>
211-
{existedGroups.length
212-
? existedGroups.map((item) => (
228+
{existedGroups.length ? (
229+
<>
230+
{existedGroups.map((item) => (
213231
<GroupItem
214232
key={item.name}
215233
existedGroup={existedGroups}
@@ -220,14 +238,15 @@ const SheetGroup = ({
220238
pinned={checkGroupPinned(item)}
221239
eventHandleProxy={eventHandleProxy}
222240
/>
223-
))
224-
: GroupNoData}
241+
))}
242+
{GroupCount}
243+
</>
244+
) : (
245+
GroupNoData
246+
)}
225247
</div>
226248
</SheetContainerSkeleton>
227249
</div>
228-
<SheetContainerSkeleton title="添加干员组" icon="add" mini>
229-
<EditorGroupName {...{ eventHandleProxy }} />
230-
</SheetContainerSkeleton>
231250
</div>
232251
<Divider />
233252
<div className="flex-1">

src/components/editor/operator/sheet/SheetOperator.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const SheetOperator = ({
257257
className="cursor-pointer mx-auto text-sm text-gray-500 hover:text-inherit hover:underline"
258258
onClick={() => setPageIndex(pageIndex + 1)}
259259
>
260-
显示更多干员({operatorsGroupedBySubProf.length - lastIndex})
260+
显示更多干员(剩余{operatorsGroupedBySubProf.length - lastIndex})
261261
</H6>
262262
)}
263263
</div>
@@ -313,8 +313,8 @@ const SheetOperator = ({
313313
<H4
314314
key={subProf.id}
315315
className={clsx(
316-
'truncate cursor-pointer my-3 opacity-50 hover:underline hover:text-black hover:opacity-75',
317-
subProf.id === selectedSubProf.id && 'opacity-100 underline',
316+
'truncate cursor-pointer my-3 opacity-50 hover:underline hover:opacity-90',
317+
subProf.id === selectedSubProf.id && '!opacity-100 underline',
318318
)}
319319
onClick={() => setSelectedSubProf(subProf)}
320320
>

0 commit comments

Comments
 (0)