diff --git a/components/common/CommonDropdown.vue b/components/common/CommonDropdown.vue deleted file mode 100644 index 0ead10d9..00000000 --- a/components/common/CommonDropdown.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/components/common/CommonTooltip.vue b/components/common/CommonTooltip.vue index f80e659c..c1f91025 100644 --- a/components/common/CommonTooltip.vue +++ b/components/common/CommonTooltip.vue @@ -1,5 +1,7 @@ @@ -9,7 +11,9 @@ - + + {{ content }} + diff --git a/components/common/dropdown/Dropdown.vue b/components/common/dropdown/Dropdown.vue new file mode 100644 index 00000000..6a03dc13 --- /dev/null +++ b/components/common/dropdown/Dropdown.vue @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/components/common/dropdown/DropdownItem.vue b/components/common/dropdown/DropdownItem.vue new file mode 100644 index 00000000..f0718c93 --- /dev/null +++ b/components/common/dropdown/DropdownItem.vue @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/components/common/dropdown/ctx.ts b/components/common/dropdown/ctx.ts new file mode 100644 index 00000000..0d2ff469 --- /dev/null +++ b/components/common/dropdown/ctx.ts @@ -0,0 +1,5 @@ +import type { InjectionKey } from 'vue' + +export const dropdownContextKey: InjectionKey<{ + hide: () => void +}> = Symbol('dropdownContextKey') diff --git a/components/status/StatusActionButton.vue b/components/status/StatusActionButton.vue index c0d023d7..794845c0 100644 --- a/components/status/StatusActionButton.vue +++ b/components/status/StatusActionButton.vue @@ -3,8 +3,7 @@ defineProps<{ text?: string | number color: string icon: string - activeIcon: string - tooltip: string + activeIcon?: string hover: string groupHover: string active?: boolean @@ -17,21 +16,15 @@ defineOptions({ - - - - - + + + + - {{ text }} - - - - {{ tooltip }} - - + {{ text }} + diff --git a/components/status/StatusActions.vue b/components/status/StatusActions.vue index 411c073a..9f73aac4 100644 --- a/components/status/StatusActions.vue +++ b/components/status/StatusActions.vue @@ -5,6 +5,12 @@ const { status } = defineProps<{ status: Status }>() +const isAuthor = $computed(() => status.account.id === currentUser.value?.account?.id) + +const clipboard = useClipboard() +const router = useRouter() +const route = useRoute() + // Use different states to let the user press different actions right after the other const isLoading = $ref({ reblogged: false, favourited: false, bookmarked: false }) async function toggleStatusAction(action: 'reblogged' | 'favourited' | 'bookmarked', newStatus: Promise) { @@ -33,57 +39,105 @@ const toggleBookmark = () => toggleStatusAction( 'bookmarked', masto.statuses[status.bookmarked ? 'unbookmark' : 'bookmark'](status.id), ) +const copyLink = async () => { + await clipboard.copy(location.href) +} +const openInOriginal = () => { + window.open(status.url!, '_blank') +} +const deleteStatus = async () => { + // TODO confirm to delete + + await masto.statuses.remove(status.id) + if (route.name === '@user-post') + router.back() + + // TODO when timeline, remove this item +} - + + + + + + + - + - + + + @click="toggleFavourite()" + /> + - + + + - + + + Edit + + + + Delete + + - - --> + +