Modals
6 days ago
skeletons
5 months ago
ActionButton.vue
5 months ago
ActionButtonsSection.vue
5 months ago
Banner.vue
6 days ago
FAQ.vue
5 months ago
FormItem.vue
6 days ago
FormsSection.vue
11 months ago
Hero.vue
1 month ago
Integrations.vue
6 days ago
Pagination.vue
11 months ago
PluginEntriesTable.vue
6 days ago
PluginEntry.vue
6 days ago
PluginExpansion.vue
8 months ago
ReachContactsSummary.vue
1 month ago
RecommendedPlugins.vue
6 days ago
SyncStatusLabel.vue
7 months ago
Tabs.vue
10 months ago
Toggle.vue
10 months ago
UsageCard.vue
10 months ago
UsageCardsRow.vue
1 year ago
UsageCardsSection.vue
1 year ago
WooCommerce.vue
1 month ago
WooCommerceEntriesTable.vue
5 months ago
Integrations.vue
77 lines
| 1 | <script setup lang="ts"> |
| 2 | import { computed } from 'vue'; |
| 3 | |
| 4 | import Banner from '@/components/Banner.vue'; |
| 5 | import PluginEntriesTable from '@/components/PluginEntriesTable.vue'; |
| 6 | import RecommendedPlugins from '@/components/RecommendedPlugins.vue'; |
| 7 | import { TABS_KEYS } from '@/data/tabs'; |
| 8 | import { useIntegrationsStore } from '@/stores/integrationsStore'; |
| 9 | import type { Form, Integration } from '@/types/models'; |
| 10 | import { translate } from '@/utils/translate'; |
| 11 | |
| 12 | type IntegrationsProps = { |
| 13 | onBannerButtonClick?: () => void; |
| 14 | }; |
| 15 | |
| 16 | const props = defineProps<IntegrationsProps>(); |
| 17 | |
| 18 | const emit = defineEmits({ |
| 19 | goToPlugin: (_id: string) => true, |
| 20 | disconnectPlugin: (_id: string) => true, |
| 21 | toggleFormStatus: (_form: Form, _status: boolean) => true, |
| 22 | viewForm: (_form: Form) => true, |
| 23 | editForm: (_form: Form) => true, |
| 24 | addForm: (_id: string) => true |
| 25 | }); |
| 26 | |
| 27 | const integrationsStore = useIntegrationsStore(); |
| 28 | |
| 29 | const shouldShowTable = computed( |
| 30 | () => |
| 31 | integrationsStore?.activeIntegrations?.filter((integration) => integration.type === TABS_KEYS.OVERVIEW_TAB_FORMS) |
| 32 | ?.length > 1 || integrationsStore.hasAnyForms(TABS_KEYS.OVERVIEW_TAB_FORMS) |
| 33 | ); |
| 34 | |
| 35 | const isBannerVisible = computed(() => !integrationsStore.isLoading && !shouldShowTable.value); |
| 36 | const isTableVisible = computed(() => integrationsStore.isLoading || shouldShowTable.value); |
| 37 | </script> |
| 38 | |
| 39 | <template> |
| 40 | <div class="integrations"> |
| 41 | <Banner |
| 42 | v-if="isBannerVisible" |
| 43 | :title="translate(`hostinger_reach_forms_banner_title`)" |
| 44 | :description="translate(`hostinger_reach_forms_banner_description`)" |
| 45 | :button-text="translate(`hostinger_reach_forms_banner_button_text`)" |
| 46 | :on-button-click="props.onBannerButtonClick" |
| 47 | :is-button-loading="integrationsStore.isLoading" |
| 48 | > |
| 49 | <template #extra> |
| 50 | <RecommendedPlugins /> |
| 51 | </template> |
| 52 | </Banner> |
| 53 | |
| 54 | <PluginEntriesTable |
| 55 | v-if="isTableVisible" |
| 56 | :integrations="integrationsStore.fromType(TABS_KEYS.OVERVIEW_TAB_FORMS) as Integration[]" |
| 57 | :is-loading="integrationsStore.isLoading" |
| 58 | @go-to-plugin="emit('goToPlugin', $event)" |
| 59 | @disconnect-plugin="emit('disconnectPlugin', $event)" |
| 60 | @toggle-form-status="(form, status) => emit('toggleFormStatus', form, status)" |
| 61 | @view-form="emit('viewForm', $event)" |
| 62 | @edit-form="emit('editForm', $event)" |
| 63 | @add-form="emit('addForm', $event)" |
| 64 | /> |
| 65 | </div> |
| 66 | </template> |
| 67 | |
| 68 | <style scoped lang="scss"> |
| 69 | .integrations { |
| 70 | display: flex; |
| 71 | flex-direction: column; |
| 72 | align-self: stretch; |
| 73 | gap: 20px; |
| 74 | margin-bottom: 40px; |
| 75 | } |
| 76 | </style> |
| 77 |