opnform-host-nginx/client/app.vue

147 lines
3.5 KiB
Vue
Raw Normal View History

2023-12-09 15:47:03 +01:00
<template>
<div
id="app"
class="bg-white dark:bg-notion-dark"
>
<transition
enter-active-class="linear duration-200 overflow-hidden"
enter-from-class="max-h-0"
enter-to-class="max-h-screen"
leave-active-class="linear duration-200 overflow-hidden"
leave-from-class="max-h-screen"
leave-to-class="max-h-0"
2023-12-09 15:47:03 +01:00
>
<div
v-if="announcement && !isIframe"
class="bg-nt-blue text-white text-center p-3 relative"
>
<a
class="text-white font-semibold"
href=""
target="_blank"
>🚨 OpnForm beta is over 🚨</a>
<div
role="button"
class="text-white absolute right-0 top-0 p-3 cursor-pointer"
@click="announcement = false"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
clip-rule="evenodd"
2023-12-09 15:47:03 +01:00
/>
</svg>
</div>
</div>
</transition>
<NuxtLoadingIndicator color="#2563eb" />
2023-12-19 16:45:23 +01:00
<NuxtLayout>
<NuxtPage />
2023-12-19 16:45:23 +01:00
</NuxtLayout>
<ToolsStopImpersonation />
<NotificationsWrapper />
<feature-base />
<SubscriptionModal />
Re-login modal (#717) * Implement quick login/register flow with global event handling - Add QuickRegister component with improved modal management - Integrate quick login/register with app store state - Implement custom event handling for login/registration flow - Update OAuth callback to support quick login in popup windows - Refactor authentication-related components to use global events * Refactor authentication flow with centralized useAuth composable - Create new useAuth composable to centralize login, registration, and social login logic - Simplify authentication methods in LoginForm and RegisterForm - Add event-based login/registration flow with quick login support - Remove redundant API calls and consolidate authentication processes - Improve error handling and analytics tracking for authentication events * Enhance QuickRegister and RegisterForm components with unauthorized error handling - Add closeable functionality to modals based on unauthorized error state - Implement logout button in QuickRegister for unauthorized users - Reset unauthorized error state on component unmount - Update styling for "OR" text in RegisterForm for consistency - Set unauthorized error flag in app store upon 401 response in API calls * Refactor Authentication Flow and Remove Unused Callback Views - Deleted unused callback views for Notion and OAuth to streamline the codebase. - Updated QuickRegister and LoginForm components to remove the after-login event emission, replacing it with a window message system for better communication between components. - Enhanced the RegisterForm and other components to utilize the new window message system for handling login completion, improving reliability and maintainability. - Added a verifyAuthentication method in the useAuth composable to ensure user data is loaded correctly after social logins, including retry logic for fetching user data. These changes aim to simplify the authentication process and improve the overall user experience by ensuring a more robust handling of login events. * Add eslint-disable comment to useWindowMessage composable for linting control * Refactor QuickRegister.vue for improved template structure and clarity - Adjusted the rendering of horizontal dividers and the "or" text for better semantic HTML. - Added a compact-header prop to the modal for enhanced layout control. These changes aim to enhance the readability and maintainability of the QuickRegister component. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-25 10:41:11 +01:00
<QuickRegister />
2023-12-09 15:47:03 +01:00
</div>
</template>
<script>
import { computed } from "vue"
import { useAppStore } from "~/stores/app"
import FeatureBase from "~/components/vendor/FeatureBase.vue"
2023-12-09 15:47:03 +01:00
export default {
el: "#app",
2023-12-09 15:47:03 +01:00
name: "OpnForm",
2023-12-09 15:47:03 +01:00
components: { FeatureBase },
2023-12-09 15:47:03 +01:00
setup() {
2024-01-12 15:59:01 +01:00
const config = useRuntimeConfig()
useOpnSeoMeta({
2024-06-17 19:25:12 +02:00
title: "Beautiful forms & Surveys",
description:
"Create beautiful forms for free. Unlimited fields, unlimited submissions. It's free and it takes less than 1 minute to create your first form.",
ogImage: "/img/social-preview.jpg",
2024-01-12 15:59:01 +01:00
robots: () => {
return config.public.env === "production" ? null : "noindex, nofollow"
},
})
useHead({
titleTemplate: (titleChunk) => {
return titleChunk ? `${titleChunk} - OpnForm` : "OpnForm"
},
meta: [
{
name: 'apple-mobile-web-app-capable',
content: 'yes'
},
{
name: 'apple-mobile-web-app-status-bar-style',
content: 'black-translucent'
},
],
link: [
{
rel: 'apple-touch-icon',
type: 'image/png',
href: '/favicon.ico'
}
],
htmlAttrs: () => ({
dir: 'ltr'
})
})
2023-12-09 15:47:03 +01:00
const appStore = useAppStore()
2023-12-09 15:47:03 +01:00
return {
layout: computed(() => appStore.layout),
isIframe: useIsIframe(),
2023-12-09 15:47:03 +01:00
}
},
data: () => ({
announcement: false,
alert: {
type: null,
autoClose: 0,
message: "",
2023-12-09 15:47:03 +01:00
confirmationProceed: null,
confirmationCancel: null,
2023-12-09 15:47:03 +01:00
},
navbarHidden: false,
2023-12-09 15:47:03 +01:00
}),
computed: {
isOnboardingPage() {
return this.$route.name === "onboarding"
2023-12-09 15:47:03 +01:00
},
},
mounted() {
useCrisp().onCrispInit()
useCrisp().showChat()
},
2023-12-09 15:47:03 +01:00
methods: {
workspaceAdded() {
this.$router.push({ name: "home" })
2023-12-09 15:47:03 +01:00
},
hideNavbar(hidden = true) {
this.navbarHidden = hidden
},
},
2023-12-09 15:47:03 +01:00
}
</script>