Skip to content

Commit 5f34b64

Browse files
Merge pull request #276 from MaaAssistantArknights/dev
Release
2 parents 6165655 + 6172b1d commit 5f34b64

File tree

6 files changed

+151
-151
lines changed

6 files changed

+151
-151
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## 2024-04-03
22

33
- 修复了因部分作业缺少动作列表而渲染失败的问题
4+
- 修复了点击作业(集)卡片上的按钮时会跳转到详情页的问题
5+
- 修复了作业集编辑器的保存按钮失效的问题
6+
- 优化了一些界面布局
47

58
## 2024-04-01
69

src/components/OperationCard.tsx

Lines changed: 61 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Button, Card, Elevation, H4, H5, Icon, Tag } from '@blueprintjs/core'
22
import { Tooltip2 } from '@blueprintjs/popover2'
33

4+
import clsx from 'clsx'
45
import { handleCopyShortCode, handleDownloadJSON } from 'services/operation'
56

67
import { ReLink } from 'components/ReLink'
@@ -19,22 +20,21 @@ export const NeoOperationCard = ({ operation }: { operation: Operation }) => {
1920
const { data: levels } = useLevels()
2021

2122
return (
22-
<ReLink search={{ op: operation.id }} className="no-underline">
23-
<Card
24-
interactive={true}
25-
elevation={Elevation.TWO}
26-
className="flex flex-col gap-2"
27-
>
23+
<Card
24+
interactive={true}
25+
elevation={Elevation.TWO}
26+
className="relative flex flex-col gap-2"
27+
>
28+
<ReLink search={{ op: operation.id }} className="block no-underline">
2829
<div className="flex">
2930
<Tooltip2
3031
content={operation.parsedContent.doc.title}
3132
className="grow flex-1 whitespace-nowrap overflow-hidden text-ellipsis"
3233
>
33-
<H4 className="p-0 m-0 whitespace-nowrap overflow-hidden text-ellipsis">
34+
<H4 className="p-0 m-0 mr-20 whitespace-nowrap overflow-hidden text-ellipsis">
3435
{operation.parsedContent.doc.title}
3536
</H4>
3637
</Tooltip2>
37-
<CardActions operation={operation} />
3838
</div>
3939
<div className="flex items-center text-slate-900">
4040
<div className="flex flex-wrap">
@@ -105,28 +105,30 @@ export const NeoOperationCard = ({ operation }: { operation: Operation }) => {
105105
</Tooltip2>
106106
</div>
107107
</div>
108-
</Card>
109-
</ReLink>
108+
</ReLink>
109+
110+
<CardActions className="absolute top-4 right-4" operation={operation} />
111+
</Card>
110112
)
111113
}
112114

113115
export const OperationCard = ({ operation }: { operation: Operation }) => {
114116
const { data: levels } = useLevels()
115117

116118
return (
117-
<ReLink
118-
search={{ op: operation.id }}
119-
className="block mb-4 sm:mb-2 last:mb-0 no-underline"
119+
<Card
120+
interactive={true}
121+
elevation={Elevation.TWO}
122+
className="relative mb-4 sm:mb-2 last:mb-0"
120123
>
121-
<Card interactive={true} elevation={Elevation.TWO}>
124+
<ReLink search={{ op: operation.id }} className="block no-underline">
122125
<div className="flex flex-wrap mb-4 sm:mb-2">
123126
{/* title */}
124127
<div className="flex flex-col gap-3">
125128
<div className="flex gap-2">
126129
<H4 className="inline-block pb-1 border-b-2 border-zinc-200 border-solid mb-2">
127130
{operation.parsedContent.doc.title}
128131
</H4>
129-
<CardActions operation={operation} />
130132
</div>
131133
<H5 className="flex items-center text-slate-900 -mt-3">
132134
<EDifficultyLevel
@@ -141,48 +143,44 @@ export const OperationCard = ({ operation }: { operation: Operation }) => {
141143
</H5>
142144
</div>
143145

144-
<div className="lg:flex-1 hidden" />
146+
<div className="grow basis-full xl:basis-0" />
145147

146148
{/* meta */}
147-
<div className="flex flex-col flex-1 gap-y-1.5 gap-x-4">
148-
<div className="flex flex-wrap sm:justify-end items-center gap-x-4 gap-y-1 text-zinc-500">
149-
<div className="flex items-center gap-1.5">
150-
<Icon icon="star" />
151-
<OperationRating
152-
className="text-sm"
153-
operation={operation}
154-
layout="horizontal"
155-
/>
149+
<div className="flex flex-wrap items-start gap-x-4 gap-y-1 text-zinc-500">
150+
<div className="flex items-center gap-1.5">
151+
<Icon icon="star" />
152+
<OperationRating
153+
className="text-sm"
154+
operation={operation}
155+
layout="horizontal"
156+
/>
157+
</div>
158+
159+
<Tooltip2 placement="top" content={`访问量:${operation.views}`}>
160+
<div>
161+
<Icon icon="eye-open" className="mr-1.5" />
162+
<span>{operation.views}</span>
156163
</div>
164+
</Tooltip2>
157165

158-
<Tooltip2 placement="top" content={`访问量:${operation.views}`}>
159-
<div>
160-
<Icon icon="eye-open" className="mr-1.5" />
161-
<span>{operation.views}</span>
162-
</div>
163-
</Tooltip2>
166+
<div>
167+
<Icon icon="time" className="mr-1.5" />
168+
<RelativeTime
169+
Tooltip2Props={{ placement: 'top' }}
170+
moment={operation.uploadTime}
171+
/>
172+
</div>
164173

174+
<Tooltip2 placement="top" content={`作者:${operation.uploader}`}>
165175
<div>
166-
<Icon icon="time" className="mr-1.5" />
167-
<RelativeTime
168-
Tooltip2Props={{ placement: 'top' }}
169-
moment={operation.uploadTime}
170-
/>
176+
<Icon icon="user" className="mr-1.5" />
177+
<span>{operation.uploader}</span>
171178
</div>
172-
</div>
173-
<div className="text-zinc-500 self-end">
174-
<Tooltip2 placement="top" content={`作者:${operation.uploader}`}>
175-
<div>
176-
<Icon icon="user" className="mr-1.5" />
177-
<span>{operation.uploader}</span>
178-
</div>
179-
</Tooltip2>
180-
</div>
179+
</Tooltip2>
181180
</div>
182181
</div>
183182
<div className="flex md:flex-row flex-col gap-4">
184183
<div className="text-gray-700 leading-normal md:w-1/2">
185-
{/* <div className="text-sm text-zinc-600 mb-2 font-bold">作业描述</div> */}
186184
<Paragraphs
187185
content={operation.parsedContent.doc.details}
188186
limitHeight={21 * 13.5} // 13 lines, 21px per line; the extra 0.5 line is intentional so the `mask` effect is obvious
@@ -195,8 +193,13 @@ export const OperationCard = ({ operation }: { operation: Operation }) => {
195193
<OperatorTags operation={operation} />
196194
</div>
197195
</div>
198-
</Card>
199-
</ReLink>
196+
</ReLink>
197+
198+
<CardActions
199+
className="absolute top-4 xl:top-12 right-[18px]"
200+
operation={operation}
201+
/>
202+
</Card>
200203
)
201204
}
202205

@@ -230,16 +233,15 @@ const OperatorTags = ({ operation }: { operation: Operation }) => {
230233
)
231234
}
232235

233-
const CardActions = ({ operation }: { operation: Operation }) => {
236+
const CardActions = ({
237+
className,
238+
operation,
239+
}: {
240+
className?: string
241+
operation: Operation
242+
}) => {
234243
return (
235-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
236-
<div
237-
className="flex gap-1"
238-
onClick={(e) => {
239-
// 避免点击按钮时触发卡片的链接跳转
240-
e.stopPropagation()
241-
}}
242-
>
244+
<div className={clsx('flex gap-1', className)}>
243245
<Tooltip2
244246
placement="bottom"
245247
content={
@@ -249,10 +251,7 @@ const CardActions = ({ operation }: { operation: Operation }) => {
249251
<Button
250252
small
251253
icon="download"
252-
onClick={(e) => {
253-
e.stopPropagation()
254-
handleDownloadJSON(operation.parsedContent)
255-
}}
254+
onClick={() => handleDownloadJSON(operation.parsedContent)}
256255
/>
257256
</Tooltip2>
258257
<Tooltip2
@@ -264,10 +263,7 @@ const CardActions = ({ operation }: { operation: Operation }) => {
264263
<Button
265264
small
266265
icon="clipboard"
267-
onClick={(e) => {
268-
e.stopPropagation()
269-
handleCopyShortCode(operation)
270-
}}
266+
onClick={() => handleCopyShortCode(operation)}
271267
/>
272268
</Tooltip2>
273269
<Tooltip2

0 commit comments

Comments
 (0)