feat: context menu (#3180)

Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
Nivedin
2023-08-02 20:52:16 +05:30
committed by GitHub
parent d1a564d5b8
commit 8970ff5c68
22 changed files with 1447 additions and 77 deletions

View File

@@ -84,6 +84,13 @@
:show="savingRequest"
@hide-modal="onSaveModalClose"
/>
<AppContextMenu
v-if="contextMenu.show"
:show="contextMenu.show"
:position="contextMenu.position"
:text="contextMenu.text"
@hide-modal="contextMenu.show = false"
/>
</div>
</template>
@@ -138,6 +145,24 @@ const reqName = ref<string>("")
const t = useI18n()
const toast = useToast()
type PopupDetails = {
show: boolean
position: {
top: number
left: number
}
text: string | null
}
const contextMenu = ref<PopupDetails>({
show: false,
position: {
top: 0,
left: 0,
},
text: null,
})
const tabs = getActiveTabs()
const confirmSync = useReadonlyStream(currentSyncingStatus$, {
@@ -365,6 +390,22 @@ function oAuthURL() {
})
}
defineActionHandler("contextmenu.open", ({ position, text }) => {
if (text) {
contextMenu.value = {
show: true,
position,
text,
}
} else {
contextMenu.value = {
show: false,
position,
text,
}
}
})
setupTabStateSync()
bindRequestToURLParams()
oAuthURL()