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()
- }}
- >
+
{
{
{
return (
-
-
+
{/* title */}
@@ -27,28 +30,13 @@ export const NeoOperationSetCard = ({
content={operationSet.name}
className="flex-1 whitespace-nowrap overflow-hidden text-ellipsis"
>
-
+
{operationSet.status === 'PRIVATE' && (
私有
)}
{operationSet.name}
- 复制神秘代码
- }
- >
-
@@ -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 (
+
+ 复制神秘代码
+ }
+ >
+