mirror of https://github.com/nocodb/nocodb
Raju Udava
2 years ago
committed by
GitHub
22 changed files with 377 additions and 442 deletions
@ -1,36 +0,0 @@
|
||||
<script setup lang="ts"> |
||||
import { ref, useGlobal } from '#imports' |
||||
|
||||
const { feedbackForm } = useGlobal() |
||||
|
||||
const showForm = ref(false) |
||||
|
||||
// todo: why this timeout? |
||||
setTimeout(() => (showForm.value = true), 60000) |
||||
</script> |
||||
|
||||
<template> |
||||
<div v-if="showForm && feedbackForm && !feedbackForm.isHidden" class="nc-feedback-form-wrapper mt-6"> |
||||
<MaterialSymbolsCloseRounded class="nc-close-icon" @click="feedbackForm.isHidden = true" /> |
||||
|
||||
<iframe :src="feedbackForm.url" width="100%" height="500" frameborder="0" marginheight="0" marginwidth="0">Loading… </iframe> |
||||
</div> |
||||
<div v-else /> |
||||
</template> |
||||
|
||||
<style scoped lang="scss"> |
||||
.nc-feedback-form-wrapper { |
||||
width: 100%; |
||||
position: relative; |
||||
|
||||
iframe { |
||||
margin: 0 auto; |
||||
} |
||||
|
||||
.nc-close-icon { |
||||
position: absolute; |
||||
top: 5px; |
||||
right: 10px; |
||||
} |
||||
} |
||||
</style> |
@ -1,41 +0,0 @@
|
||||
import dayjs from 'dayjs' |
||||
import { defineNuxtPlugin, useGlobal, useNuxtApp } from '#imports' |
||||
|
||||
const handleFeedbackForm = async () => { |
||||
let { feedbackForm: currentFeedbackForm } = $(useGlobal()) |
||||
|
||||
if (!currentFeedbackForm) return |
||||
|
||||
const { $api } = useNuxtApp() |
||||
|
||||
const isFirstTimePolling = !currentFeedbackForm.lastFormPollDate |
||||
|
||||
const now = dayjs() |
||||
|
||||
const lastFormPolledDate = dayjs(currentFeedbackForm.lastFormPollDate) |
||||
|
||||
if (isFirstTimePolling || dayjs.duration(now.diff(lastFormPolledDate)).days() > 0) { |
||||
$api.instance |
||||
.get('/api/v1/feedback_form') |
||||
.then((response) => { |
||||
try { |
||||
const { data: feedbackForm } = response |
||||
if (!feedbackForm.error) { |
||||
const isFetchedFormDuplicate = currentFeedbackForm.url === feedbackForm.url |
||||
|
||||
currentFeedbackForm = { |
||||
url: feedbackForm.url, |
||||
lastFormPollDate: now.toISOString(), |
||||
createdAt: feedbackForm.created_at, |
||||
isHidden: isFetchedFormDuplicate ? currentFeedbackForm.isHidden : false, |
||||
} |
||||
} |
||||
} catch (e) {} |
||||
}) |
||||
.catch(() => {}) |
||||
} |
||||
} |
||||
|
||||
export default defineNuxtPlugin(() => { |
||||
handleFeedbackForm() |
||||
}) |
Loading…
Reference in new issue