fix: share disabled condition

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-07-21 22:34:24 +08:00
parent bf202f3200
commit bd96a006c4
+11 -3
View File
@@ -27,8 +27,7 @@ export const useCollect = (entry: Nullable<CombinedEntryModel>) =>
export const useUnCollect = (entry: Nullable<CombinedEntryModel>) =>
useMutation({
mutationFn: async () =>
entry &&
entryActions.markStar(entry.entries.id, false),
entry && entryActions.markStar(entry.entries.id, false),
onSuccess: () => {
toast.success("Unstarred.", {
@@ -179,9 +178,18 @@ export const useEntryActions = ({
{
name: "Share",
className: "i-mgc-share-forward-cute-re",
disabled:
!window.electron || !navigator.share,
onClick: () => {
if (!populatedEntry.entries.url) return
tipcClient?.showShareMenu(populatedEntry.entries.url)
if (window.electron) {
return tipcClient?.showShareMenu(populatedEntry.entries.url)
} else {
navigator.share({
url: populatedEntry.entries.url,
})
}
},
},
{