Files
nocodb/packages/nc-gui/components/cell/attachment/Preview/Pdf.vue
Ramesh Mane 2a2a4c9cf0 Nc fix/integration bug fixes (#9150)
* fix(nc-gui): always show edit connection tab on clicking data source

* fix(nc-gui): show deleted workspace user info in connection list

* fix(nc-gui): show tooltip on hover deleted user details

* fix(nc-gui): some review changes

* fix(nc-gui): sync modal cleanup

* fix: supported docs label

* fix(nc-gui): pg icon issue in data source list

* fix(nc-gui): new integration page ui changes

* fix(nc-gui): handle upvote

* fix(nc-gui): add integration category icons

* fix(nc-gui): add request new integration in other category

* fix(nc-gui): focus request integration input on open

* fix(nc-gui): integration tab left spacing issue

* fix(nc-gui): integration tab list center aligned

* misc: minor changes

* fix(nc-gui): user should able to upvote on cliking tiles

* fix(nc-gui): add remaining integrations

* fix(nc-gui): add missing integration icons

* fix(nc-gui): trigger test connection on adding new connection from create source

* fix(nc-gui): integration list modal ui changes

* fix(nc-gui): remove integration type badge border

* fix(nc-gui): show colored integration icon on hover

* fix(nc-gui): integration upvote btn shadow issue

* fix(nc-gui): some pr review changes

* fix(nc-gui): move logic part in script

* chore(nc-gui): lint

---------

Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
2024-08-07 14:53:23 +05:30

64 lines
1.6 KiB
Vue

<script setup lang="ts">
interface Props {
src: string[]
class?: string
}
const props = defineProps<Props>()
const currentIndex = ref(0)
const handleError = () => {
if (currentIndex.value < props.src.length - 1) {
currentIndex.value = currentIndex.value + 1
} else {
currentIndex.value = -1
}
}
const openMethod = ref<'browser' | 'google' | undefined>()
</script>
<template>
<div v-if="!openMethod" :class="props.class" class="flex flex-col text-white gap-2 items-center justify-center">
<GeneralIcon class="w-28 h-28" icon="pdfFile" />
<div class="flex items-center justify-center gap-2">
<NcButton class="!w-52" type="secondary" @click="openMethod = 'browser'">
<div class="flex items-center gap-1">
<GeneralIcon icon="globe" class="!text-gray-700" />
Open in browser
</div>
</NcButton>
<NcButton type="secondary" class="!w-52" @click="openMethod = 'google'">
<div class="flex items-center gap-1">
<GeneralIcon class="w-4 h-4" icon="googleDocs" />
Open with Google Docs
</div>
</NcButton>
</div>
</div>
<pdf-object
v-if="openMethod === 'browser'"
:class="props.class"
:url="src[currentIndex]"
class="w-full h-full"
@error="handleError"
/>
<iframe
v-else-if="openMethod === 'google'"
:class="props.class"
type="application/pdf"
:src="`https://docs.google.com/viewer?url=${encodeURIComponent(src[currentIndex])}&embedded=true`"
width="100%"
height="100%"
frameborder="0"
@error="handleError"
></iframe>
</template>
<style scoped lang="scss"></style>