feat: add publish workspace page list and workspace page

This commit is contained in:
DiamondThree
2023-01-11 23:54:25 +08:00
parent d979acbba7
commit 753c59b534
9 changed files with 94 additions and 56 deletions
+26 -16
View File
@@ -67,10 +67,12 @@ export const PageList = ({
pageList,
showFavoriteTag = false,
isTrash = false,
isPublic = false,
}: {
pageList: PageMeta[];
showFavoriteTag?: boolean;
isTrash?: boolean;
isPublic?: boolean;
}) => {
const router = useRouter();
const { currentWorkspace } = useAppState();
@@ -98,9 +100,15 @@ export const PageList = ({
<StyledTableRow
key={`${pageMeta.id}-${index}`}
onClick={() => {
router.push(
`/workspace/${currentWorkspace?.id}/${pageMeta.id}`
);
if (isPublic) {
router.push(
`/public-workspace/${router.query.workspaceId}/${pageMeta.id}`
);
} else {
router.push(
`/workspace/${currentWorkspace?.id}/${pageMeta.id}`
);
}
}}
>
<TableCell>
@@ -124,19 +132,21 @@ export const PageList = ({
dateKey={isTrash ? 'trashDate' : 'updatedDate'}
backupKey={isTrash ? 'trashDate' : 'createDate'}
/>
<TableCell
style={{ padding: 0 }}
data-testid={`more-actions-${pageMeta.id}`}
onClick={e => {
e.stopPropagation();
}}
>
{isTrash ? (
<TrashOperationCell pageMeta={pageMeta} />
) : (
<OperationCell pageMeta={pageMeta} />
)}
</TableCell>
{!isPublic ? (
<TableCell
style={{ padding: 0 }}
data-testid={`more-actions-${pageMeta.id}`}
onClick={e => {
e.stopPropagation();
}}
>
{isTrash ? (
<TrashOperationCell pageMeta={pageMeta} />
) : (
<OperationCell pageMeta={pageMeta} />
)}
</TableCell>
) : null}
</StyledTableRow>
);
})}