feat: can remove favorite

This commit is contained in:
0xzion
2023-10-14 20:00:44 +08:00
parent fe0b786e64
commit db7176f83c
3 changed files with 12 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ import { Box } from '@fower/react'
import { Trash2 } from 'lucide-react'
import { Button, ColumnsType, Table } from 'uikit'
import { Doc, DocService } from '@penx/domain'
import { store } from '@penx/store'
interface Props {
docs: Doc[]
@@ -44,7 +45,16 @@ export const AllDocsTable = ({ docs }: Props) => {
render(_, item) {
return (
<Box toCenterY gap1>
<Button size={28} variant="ghost" colorScheme="gray500" isSquare>
<Button
size={28}
variant="ghost"
colorScheme="gray500"
isSquare
onClick={async (e) => {
e.stopPropagation()
await store.trashDoc(item.id)
}}
>
<Trash2 />
</Button>
</Box>

View File

@@ -6,7 +6,7 @@ import { useDoc } from '@penx/hooks'
interface Props {}
export const FavoriteButton: FC<PropsWithChildren<Props>> = () => {
const { doc, docService } = useDoc()
const { docService } = useDoc()
const isFavorite = docService.isFavorite()
return (
<Button

View File

@@ -28,8 +28,6 @@ export const MorePopover = () => {
<MenuItem
gap2
onClick={async () => {
// await store.trashDoc(doc.id)
console.log('docId:', doc.id, store.getDoc().id)
await store.trashDoc(store.getDoc().id)
}}
>