From 75cdae594a6dfee6ceaf79821fdeb36935f7b205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=9A=D1=80=D1=83?= =?UTF-8?q?=D0=B3=D0=BB=D0=B8=D1=86=D0=BA=D0=B8=D0=B9?= Date: Tue, 26 Nov 2024 18:01:19 +0300 Subject: [PATCH] update --- app.config.ts | 8 ++ components/app-footer.vue | 7 +- components/app-header.vue | 8 +- components/homepage/any-questions.vue | 5 +- components/homepage/how-it-works.vue | 3 +- components/homepage/tariff.vue | 3 +- components/info-button.vue | 4 +- components/phone-number.vue | 5 +- components/ui/notification/notification.vue | 128 ------------------- components/ui/notification/notify.ts | 132 -------------------- components/ui/notification/types.ts | 33 ----- composables/use-checkbox.ts | 44 ------- composables/use-notify.ts | 3 - composables/use-radio.ts | 40 ------ plugins/notify.ts | 7 -- styles/index.scss | 1 - styles/typography.scss | 22 ---- 17 files changed, 29 insertions(+), 424 deletions(-) create mode 100644 app.config.ts delete mode 100644 components/ui/notification/notification.vue delete mode 100644 components/ui/notification/notify.ts delete mode 100644 components/ui/notification/types.ts delete mode 100644 composables/use-checkbox.ts delete mode 100644 composables/use-notify.ts delete mode 100644 composables/use-radio.ts delete mode 100644 plugins/notify.ts delete mode 100644 styles/typography.scss diff --git a/app.config.ts b/app.config.ts new file mode 100644 index 0000000..afc6132 --- /dev/null +++ b/app.config.ts @@ -0,0 +1,8 @@ +export default defineAppConfig({ + instagramUrl: 'https://www.instagram.com/samatk7/?igsh=Mm9keGxnbXBrdGQ4', + telegramUrl: 'https://t.me/+vOQDGC3VoUJmY2Qy', + whatsappUrl: 'https://api.whatsapp.com/send/?phone=7077407714&text&type=phone_number&app_absent=0', + phoneNumber: '+7 (705) 400 20 66', + email: 'support@quantumbot.kz', + appUrl: 'https://app.quantumbot.kz', +}) diff --git a/components/app-footer.vue b/components/app-footer.vue index 3beb399..a710218 100644 --- a/components/app-footer.vue +++ b/components/app-footer.vue @@ -13,13 +13,13 @@ @@ -35,6 +35,7 @@ diff --git a/components/ui/notification/notify.ts b/components/ui/notification/notify.ts deleted file mode 100644 index e4f872f..0000000 --- a/components/ui/notification/notify.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { createVNode, render } from 'vue' -import { defu } from 'defu' -import NotificationConstructor from './notification.vue' -import type { - NotificationOptions, - NotificationPlacement, - NotificationQueue, -} from './types' - -const notifications: Record = { - 'top-left': [], - 'top-right': [], - 'bottom-left': [], - 'bottom-right': [], -} - -const GAP_SIZE = 16 -let SEED = 1 - -const DEFAULT_OPTIONS: NotificationOptions = { - text: '', - placement: 'top-right', - duration: 5000, - onClose: () => {}, -} - -const notify = function (options: NotificationOptions, context = null) { - // if (process.server) return { close: () => undefined }; - - options = defu(options, DEFAULT_OPTIONS) - - const orientedNotifications = notifications[options.placement!] - const id = options.id - ? `${options.placement!}_${options.id}` - : `notification_${SEED++}` - - const idx = orientedNotifications.findIndex( - ({ vm }) => vm.component?.props.id === id, - ) - if (idx > -1) - return - - let verticalOffset = options.offset || 0 - notifications[options.placement!].forEach(({ vm }) => { - verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE - }) - verticalOffset += GAP_SIZE - - const userOnClose = options.onClose - const props = { - ...options, - offset: verticalOffset, - id, - onClose: () => { - close(id, options.placement!, userOnClose) - }, - } - - const container = document.createElement('div') - - const vm = createVNode( - NotificationConstructor, - props, - options.text - ? { - default: () => options.text, - } - : null, - ) - vm.appContext = context ?? notify._context - vm.props!.onDestroy = () => { - render(null, container) - } - - render(vm, container) - notifications[options.placement!].push({ vm }) - document.body.appendChild(container.firstElementChild!) - - return { - close: () => { - vm.component!.exposed!.close() - }, - } -} - -export function close( - id: NotificationOptions['id'], - placement: NotificationOptions['placement'], - userOnClose: NotificationOptions['onClose'], -) { - const orientedNotifications = notifications[placement!] - const idx = orientedNotifications.findIndex( - ({ vm }) => vm.component?.props.id === id, - ) - if (idx === -1) - return - - const { vm } = orientedNotifications[idx] - - if (!vm) - return - - userOnClose?.(vm) - - const removedHeight = vm.el!.offsetHeight - const verticalPos = placement!.split('-')[0] - orientedNotifications.splice(idx, 1) - - if (orientedNotifications.length < 1) - return - - for (let i = idx; i < orientedNotifications.length; i++) { - const { el, component } = orientedNotifications[i].vm - const styles = getComputedStyle(el as Element) - const pos = Number.parseInt(styles.getPropertyValue(verticalPos), 10) - - component!.props.offset = pos - removedHeight - GAP_SIZE - } -} - -export function closeAll() { - for (const orientedNotifications of Object.values(notifications)) { - orientedNotifications.forEach(({ vm }) => { - vm.component!.exposed!.close() - }) - } -} - -notify.closeAll = closeAll -notify._context = null - -export default notify diff --git a/components/ui/notification/types.ts b/components/ui/notification/types.ts deleted file mode 100644 index 08e57ee..0000000 --- a/components/ui/notification/types.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { VNode } from 'vue' - -export const NOTIFICATION_TYPES = [ - 'neutral', - 'positive', - 'warning', - 'negative', -] as const - -export type NotificationType = (typeof NOTIFICATION_TYPES)[number] - -export type NotificationPlacement = - | 'top-right' - | 'top-left' - | 'bottom-right' - | 'bottom-left' - -export interface NotificationOptions { - type?: NotificationType - text: string - title?: string - duration?: number - placement?: NotificationPlacement - id?: string | number - offset?: number - onClose?: (vm?: VNode) => void -} - -export interface NotificationItem { - vm: VNode -} - -export type NotificationQueue = NotificationItem[] diff --git a/composables/use-checkbox.ts b/composables/use-checkbox.ts deleted file mode 100644 index 7a4580f..0000000 --- a/composables/use-checkbox.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { useField } from 'vee-validate' -import { computed, ref, toRef } from 'vue' -import type { ComponentInternalInstance } from 'vue' - -interface Props { - id: string - label?: string - disabled?: boolean - modelValue?: boolean | string | number - trueValue?: boolean | string | number - falseValue?: boolean | string | number - required?: boolean -} - -export default (props: Props, slots: ComponentInternalInstance['slots']) => { - const { checked, errorMessage, handleChange } = useField( - toRef(props, 'id'), - computed(() => ({ - required: props.required, - })), - { - type: 'checkbox', - initialValue: props.modelValue, - checkedValue: props.trueValue ?? true, - uncheckedValue: props.falseValue ?? false, - syncVModel: true, - }, - ) - - const focused = ref(false) - - const active = computed(() => !props.disabled) - const invalid = computed(() => active.value && !!errorMessage.value) - const hasLabel = computed(() => !!props.label || slots.default) - - return { - focused, - checked, - active, - invalid, - hasLabel, - handleChange, - } -} diff --git a/composables/use-notify.ts b/composables/use-notify.ts deleted file mode 100644 index 50ae45f..0000000 --- a/composables/use-notify.ts +++ /dev/null @@ -1,3 +0,0 @@ -import notify from '../components/ui/notification/notify' - -export default () => notify diff --git a/composables/use-radio.ts b/composables/use-radio.ts deleted file mode 100644 index 5d1f7b0..0000000 --- a/composables/use-radio.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { useField } from 'vee-validate' -import { computed, ref, toRef } from 'vue' -import type { ComponentInternalInstance } from 'vue' - -interface Props { - id: string - value: string | number - label?: string - disabled?: boolean - modelValue?: string | number - required?: boolean -} - -export default (props: Props, slots: ComponentInternalInstance['slots']) => { - const { checked, handleChange } = useField( - toRef(props, 'id'), - computed(() => ({ - required: props.required, - })), - { - type: 'radio', - initialValue: props.modelValue, - checkedValue: props.value, - syncVModel: true, - }, - ) - - const focused = ref(false) - - const active = computed(() => !props.disabled) - const hasLabel = computed(() => !!props.label || slots.default) - - return { - focused, - active, - checked, - hasLabel, - handleChange, - } -} diff --git a/plugins/notify.ts b/plugins/notify.ts deleted file mode 100644 index 24d8c3b..0000000 --- a/plugins/notify.ts +++ /dev/null @@ -1,7 +0,0 @@ -import notify from '../components/ui/notification/notify' - -export default defineNuxtPlugin((nuxtApp) => { - notify._context = nuxtApp.vueApp._context - - return {} -}) diff --git a/styles/index.scss b/styles/index.scss index 9dbc7eb..952fe64 100644 --- a/styles/index.scss +++ b/styles/index.scss @@ -4,7 +4,6 @@ @use 'mixins'; @use "normalize"; @use "utility"; -@use "typography"; @use "floating-vue"; *, diff --git a/styles/typography.scss b/styles/typography.scss deleted file mode 100644 index 3aa697d..0000000 --- a/styles/typography.scss +++ /dev/null @@ -1,22 +0,0 @@ -@use "./mixins" as *; - -p, h1, h2, h3, h4, h5, h6 { - margin: 0; -} - -//a { -// @include font(18px, 500, 23px); -// -// color: inherit; -// text-decoration: none; -// transition: color .2s ease-out; -// text-underline-offset: 2px; -// -// &:hover { -// color: #EE6A32; -// } -// -// &:active { -// color: #F57B47; -// } -//} \ No newline at end of file