From 49683ddc42e0c066d41b59b6a79e822801f7c56c Mon Sep 17 00:00:00 2001 From: Guan <821143943@qq.com> Date: Wed, 3 Apr 2024 21:18:28 +0800 Subject: [PATCH 1/5] fix: page navigating when clicking buttons in item cards (#275) Also updated the layout of OperationCard and OperationSetCard in list layout --- src/components/OperationCard.tsx | 125 ++++++++------- src/components/OperationSetCard.tsx | 144 +++++++++--------- .../operation-set/AddToOperationSet.tsx | 9 +- 3 files changed, 137 insertions(+), 141 deletions(-) diff --git a/src/components/OperationCard.tsx b/src/components/OperationCard.tsx index 45345c6..23dd3df 100644 --- a/src/components/OperationCard.tsx +++ b/src/components/OperationCard.tsx @@ -1,6 +1,7 @@ import { Button, Card, Elevation, H4, H5, Icon, Tag } from '@blueprintjs/core' import { Tooltip2 } from '@blueprintjs/popover2' +import clsx from 'clsx' import { handleCopyShortCode, handleDownloadJSON } from 'services/operation' import { ReLink } from 'components/ReLink' @@ -19,22 +20,21 @@ export const NeoOperationCard = ({ operation }: { operation: Operation }) => { const { data: levels } = useLevels() return ( - - + +
-

+

{operation.parsedContent.doc.title}

-
@@ -105,8 +105,10 @@ export const NeoOperationCard = ({ operation }: { operation: Operation }) => {
-
-
+ + + + ) } @@ -114,11 +116,12 @@ export const OperationCard = ({ operation }: { operation: Operation }) => { const { data: levels } = useLevels() return ( - - +
{/* title */}
@@ -126,7 +129,6 @@ export const OperationCard = ({ operation }: { operation: Operation }) => {

{operation.parsedContent.doc.title}

-
{
-
+
{/* meta */} -
-
-
- - +
+
+ + +
+ + +
+ + {operation.views}
+
- -
- - {operation.views} -
-
+
+ + +
+
- - + + {operation.uploader}
-
-
- -
- - {operation.uploader} -
-
-
+
@@ -195,8 +194,13 @@ export const OperationCard = ({ operation }: { operation: Operation }) => {
- - + + + + ) } @@ -230,16 +234,15 @@ const OperatorTags = ({ operation }: { operation: Operation }) => { ) } -const CardActions = ({ operation }: { operation: Operation }) => { +const CardActions = ({ + className, + operation, +}: { + className?: string + operation: Operation +}) => { return ( - // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -
{ - // 避免点击按钮时触发卡片的链接跳转 - e.stopPropagation() - }} - > +
{
@@ -80,8 +68,13 @@ export const NeoOperationSetCard = ({
- - + + + + ) } @@ -91,11 +84,15 @@ export const OperationSetCard = ({ operationSet: OperationSetListItem }) => { return ( - - +
{/* title */}
@@ -103,53 +100,29 @@ export const OperationSetCard = ({

{operationSet.name}

- - 复制神秘代码 -
- } - > -
-
+
{/* meta */} -
-
-
- - {operationSet.copilotIds.length}份作业 +
+
+ + {operationSet.copilotIds.length}份作业 - - -
-
-
- -
- - {operationSet.creator} -
-
+ +
+ +
+ + {operationSet.creator} +
+
@@ -161,7 +134,40 @@ export const OperationSetCard = ({ />
- - + + + + + ) +} + +const CardActions = ({ + className, + operationSet, +}: { + className?: string + operationSet: OperationSetListItem +}) => { + return ( +
+ 复制神秘代码
+ } + > +
) } diff --git a/src/components/operation-set/AddToOperationSet.tsx b/src/components/operation-set/AddToOperationSet.tsx index fe840c9..0eeb202 100644 --- a/src/components/operation-set/AddToOperationSet.tsx +++ b/src/components/operation-set/AddToOperationSet.tsx @@ -33,14 +33,7 @@ export function AddToOperationSetButton({ return ( <> -
- {/*
作业描述
*/}
-
+
- {/*
作业描述
*/} Date: Wed, 3 Apr 2024 22:02:30 +0800 Subject: [PATCH 4/5] fix: unable to submit in operation set editor --- .../operation-set/OperationSetEditor.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/operation-set/OperationSetEditor.tsx b/src/components/operation-set/OperationSetEditor.tsx index abe26e0..4a79b38 100644 --- a/src/components/operation-set/OperationSetEditor.tsx +++ b/src/components/operation-set/OperationSetEditor.tsx @@ -180,7 +180,7 @@ function OperationSetForm({ operationSet, onSubmit }: FormProps) { control, handleSubmit, setError, - formState: { errors, isDirty, isSubmitting }, + formState: { errors, isSubmitting }, } = useForm({ defaultValues: operationSet || { name: '', @@ -220,7 +220,7 @@ function OperationSetForm({ operationSet, onSubmit }: FormProps) {
@@ -302,7 +302,7 @@ function OperationSetForm({ operationSet, onSubmit }: FormProps) { )}