fix pargar and login

This commit is contained in:
2026-08-01 14:04:26 +03:30
parent 5b0bb45e52
commit 0cd3772517
5 changed files with 227 additions and 71 deletions
+15 -3
View File
@@ -94,6 +94,7 @@ import { getDisplayAppVersion } from '@/config/config-cache'
import { computed, defineAsyncComponent, h, onMounted, ref, watch } from 'vue' import { computed, defineAsyncComponent, h, onMounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { showBrowserNotification } from '@/utils/browserNotification'
import img_topGradiant from '@/views/login/assets/img/gr_top_white.svg' import img_topGradiant from '@/views/login/assets/img/gr_top_white.svg'
import img_pattern from '@/views/login/assets/img/pattern.svg' import img_pattern from '@/views/login/assets/img/pattern.svg'
import { LoadingOutlined } from '@ant-design/icons-vue' import { LoadingOutlined } from '@ant-design/icons-vue'
@@ -231,9 +232,20 @@ watch(latestIncomingNotification, (payload) => {
if (!payload) return if (!payload) return
if (payload.at === lastSupportToastAt) return if (payload.at === lastSupportToastAt) return
lastSupportToastAt = payload.at lastSupportToastAt = payload.at
message.info({
content: `پیام جدید پشتیبانی: ${payload.body}`, // فقط وقتی خارج از صفحهٔ چت (گیت داخل chat.ts)؛ داخل چت نوتیف نمی‌آید
duration: 3, if (typeof document === 'undefined' || document.visibilityState === 'visible') {
message.info({
content: `پیام جدید پشتیبانی: ${payload.body}`,
duration: 3,
})
}
void showBrowserNotification({
title: payload.title || 'پشتیبانی',
body: payload.body || 'پیام جدید',
tag: 'support-chat-message',
url: '/support',
}) })
}) })
@@ -173,8 +173,9 @@
<div class="support-composer__row flex items-end gap-2"> <div class="support-composer__row flex items-end gap-2">
<BasicButton <BasicButton
type="primary"
:disabled="disabled || isRecording || (!modelValue.trim() && attachments.length === 0)" :disabled="disabled || isRecording || (!modelValue.trim() && attachments.length === 0)"
class="support-send-btn !h-12 !w-12 shrink-0 items-center justify-center rounded-2xl transition hover:scale-[1.03] disabled:cursor-not-allowed disabled:opacity-50" class="support-send-btn !h-12 !w-12 shrink-0 !p-0"
@mousedown.prevent @mousedown.prevent
@click="submit" @click="submit"
> >
@@ -577,14 +578,14 @@ watch(
<style scoped lang="less"> <style scoped lang="less">
.support-composer { .support-composer {
position: sticky; position: relative;
bottom: 0;
z-index: 3; z-index: 3;
padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); padding: 10px 12px 12px;
background: color-mix(in srgb, var(--bg, #fff) 92%, transparent); background: color-mix(in srgb, var(--bg, #fff) 82%, transparent);
border-top: 1px solid rgb(var(--colorPrimaryRGB, 37 99 235) / 0.1); border-top: 1px solid color-mix(in srgb, var(--colorPrimary, #2563eb) 12%, transparent);
box-shadow: 0 -8px 28px rgb(15 23 42 / 0.04); box-shadow: none;
backdrop-filter: blur(14px); backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
font-family: var(--font-family, iran-sans), serif; font-family: var(--font-family, iran-sans), serif;
} }
@@ -664,9 +665,9 @@ watch(
} }
.support-textarea-shell { .support-textarea-shell {
background: var(--bg2, #f4f6f8); background: var(--bg, #fff);
border: 1px solid rgb(var(--colorPrimaryRGB, 37 99 235) / 0.1); border: 1px solid color-mix(in srgb, var(--colorPrimary, #2563eb) 16%, transparent);
box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.55); box-shadow: 0 6px 16px color-mix(in srgb, var(--colorPrimary, #2563eb) 8%, transparent);
} }
.composer-textarea { .composer-textarea {
@@ -708,14 +709,27 @@ watch(
} }
.support-send-btn { .support-send-btn {
border-radius: 16px !important;
background: var(--colorPrimary, #2563eb) !important; background: var(--colorPrimary, #2563eb) !important;
color: var(--color6, #fff) !important; border-color: var(--colorPrimary, #2563eb) !important;
box-shadow: 0 8px 18px rgb(var(--colorPrimaryRGB, 37 99 235) / 0.28); color: #fff !important;
box-shadow: 0 10px 22px color-mix(in srgb, var(--colorPrimary, #2563eb) 34%, transparent) !important;
} }
.support-send-btn:disabled { .support-send-btn.ant-btn-primary:not(:disabled):not(.ant-btn-disabled) {
opacity: 0.45; background: var(--colorPrimary, #2563eb) !important;
box-shadow: none; border-color: var(--colorPrimary, #2563eb) !important;
color: #fff !important;
}
.support-send-btn:disabled,
.support-send-btn.ant-btn-disabled,
.support-send-btn.ant-btn-primary:disabled {
opacity: 1 !important;
background: color-mix(in srgb, var(--colorPrimary, #2563eb) 38%, #fff) !important;
border-color: transparent !important;
color: #fff !important;
box-shadow: none !important;
} }
.support-drop-zone { .support-drop-zone {
@@ -800,7 +814,13 @@ watch(
@media (min-width: 768px) { @media (min-width: 768px) {
.support-composer { .support-composer {
padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); padding: 12px 16px 14px;
}
}
@media (max-width: 767px) {
.support-composer {
padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
} }
} }
</style> </style>
@@ -5,7 +5,14 @@
<BasicIcon icon="vuesax-linear:arrow-right" /> <BasicIcon icon="vuesax-linear:arrow-right" />
</div> </div>
<div class="support-header__icon"> <div class="support-header__icon">
<img
v-if="logoUrl"
:src="logoUrl"
alt=""
class="support-header__logo"
/>
<svg <svg
v-else
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="support-header__icon-svg" class="support-header__icon-svg"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@@ -23,19 +30,23 @@
<div class="support-header__content"> <div class="support-header__content">
<h1 class="support-header__title">{{ title }}</h1> <h1 class="support-header__title">{{ title }}</h1>
</div> </div>
</div> </div>
</header> </header>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue' import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import { useConfigStore } from '@/store/configStore'
defineProps<{ defineProps<{
title: string title: string
subtitle?: string subtitle?: string
}>() }>()
const config = useConfigStore()
const logoUrl = computed(() => String(config.config?.avatar || '').trim())
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@@ -43,14 +54,15 @@ defineProps<{
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 2; z-index: 2;
border-bottom: 1px solid rgb(var(--colorPrimaryRGB, 37 99 235) / 0.16); border-bottom: 1px solid color-mix(in srgb, var(--colorPrimary, #2563eb) 10%, transparent);
background: linear-gradient( background: linear-gradient(
180deg, 180deg,
rgb(var(--colorPrimaryRGB, 37 99 235) / 0.08), color-mix(in srgb, var(--bg, #fff) 55%, transparent) 0%,
rgb(var(--colorPrimaryRGB, 37 99 235) / 0.03) color-mix(in srgb, var(--bg, #fff) 22%, transparent) 70%,
), transparent 100%
var(--bg, #fff); );
backdrop-filter: blur(10px); backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
} }
.support-header__inner { .support-header__inner {
@@ -68,12 +80,24 @@ defineProps<{
justify-content: center; justify-content: center;
width: 52px; width: 52px;
height: 52px; height: 52px;
flex: 0 0 52px;
overflow: hidden;
border-radius: 18px; border-radius: 18px;
background: var(--bg2, #0a1b37); background: var(--bg2, #0a1b37);
color: var(--colorText, #fff); color: var(--colorText, #fff);
box-shadow: 0 10px 24px rgb(var(--colorPrimaryRGB, 37 99 235) / 0.16); box-shadow: 0 10px 24px rgb(var(--colorPrimaryRGB, 37 99 235) / 0.16);
} }
.support-header__logo {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
object-position: center;
padding: 6px;
background: #fff;
}
.support-header__icon-svg { .support-header__icon-svg {
width: 22px; width: 22px;
height: 22px; height: 22px;
@@ -124,6 +148,7 @@ defineProps<{
.support-header__icon { .support-header__icon {
width: 48px; width: 48px;
height: 48px; height: 48px;
flex-basis: 48px;
border-radius: 16px; border-radius: 16px;
} }
} }
@@ -11,7 +11,12 @@
class="support-jump-badge-wrap" class="support-jump-badge-wrap"
> >
<button type="button" class="support-jump-button" @click="handleJumpToBottom"> <button type="button" class="support-jump-button" @click="handleJumpToBottom">
<BasicIcon icon="vuesax-linear:arrow-down-1" class="text-black" /> <BasicIcon
icon="vuesax-linear:arrow-down-1"
size="20"
color="#fff"
stroke-width="2.6"
/>
</button> </button>
</a-badge> </a-badge>
</div> </div>
@@ -102,7 +107,14 @@
@pointercancel="onMessagePointerCancel" @pointercancel="onMessagePointerCancel"
> >
<div v-if="message.sender === 'support'" class="support-avatar"> <div v-if="message.sender === 'support'" class="support-avatar">
<img
v-if="supportLogoUrl"
:src="supportLogoUrl"
alt=""
class="support-avatar__logo"
/>
<svg <svg
v-else
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="support-avatar__svg" class="support-avatar__svg"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@@ -280,7 +292,14 @@
<div v-if="supportTyping" class="support-row support-row--support"> <div v-if="supportTyping" class="support-row support-row--support">
<div class="support-row__inner support-row__inner--support"> <div class="support-row__inner support-row__inner--support">
<div class="support-avatar"> <div class="support-avatar">
<img
v-if="supportLogoUrl"
:src="supportLogoUrl"
alt=""
class="support-avatar__logo"
/>
<svg <svg
v-else
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="support-avatar__svg" class="support-avatar__svg"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@@ -315,6 +334,7 @@ import { computed, nextTick, ref, watch, onBeforeUnmount } from 'vue'
import type { ChatMessage } from '@/models/support' import type { ChatMessage } from '@/models/support'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue' import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import BasicButton from '@/components/BasicPacks/BasicButton.vue' import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import { useConfigStore } from '@/store/configStore'
const props = defineProps<{ const props = defineProps<{
messages: ChatMessage[] messages: ChatMessage[]
@@ -331,6 +351,9 @@ const emit = defineEmits<{
(e: 'bottom-state-change', value: boolean): void (e: 'bottom-state-change', value: boolean): void
}>() }>()
const config = useConfigStore()
const supportLogoUrl = computed(() => String(config.config?.avatar || '').trim())
const scrollContainer = ref<HTMLElement | null>(null) const scrollContainer = ref<HTMLElement | null>(null)
const previewImageUrl = ref('') const previewImageUrl = ref('')
@@ -817,9 +840,10 @@ defineExpose({
.support-jump-wrap { .support-jump-wrap {
position: absolute; position: absolute;
right: 0; inset-inline-start: 12px;
bottom: 18px; right: auto;
transform: translateX(-50%); bottom: 14px;
transform: none;
z-index: 4; z-index: 4;
} }
@@ -1030,17 +1054,26 @@ defineExpose({
} }
} }
.support-jump-button { .support-jump-button {
width: 46px; width: 44px;
height: 46px; height: 44px;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border: 1px solid rgb(var(--colorPrimaryRGB) / 0.18); border: 1.5px solid color-mix(in srgb, var(--colorPrimary, #2563eb) 45%, transparent);
background: rgb(var(--colorPrimaryRGB) / 0.12); background: color-mix(in srgb, var(--colorPrimary, #2563eb) 42%, transparent);
color: var(--colorPrimary, #2563eb); color: #fff;
border-radius: 999px; border-radius: 999px;
box-shadow: 0 10px 15px rgb(var(--colorPrimaryRGB) / 0.12); box-shadow:
backdrop-filter: blur(5px); 0 10px 24px color-mix(in srgb, var(--colorPrimary, #2563eb) 28%, transparent),
inset 0 1px 0 rgb(255 255 255 / 0.28);
backdrop-filter: blur(14px) saturate(1.2);
-webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.support-jump-button :deep(svg),
.support-jump-button :deep(i),
.support-jump-button :deep(.iconify) {
color: #fff !important;
} }
.support-jump-badge-wrap :deep(.ant-badge-count) { .support-jump-badge-wrap :deep(.ant-badge-count) {
@@ -1069,15 +1102,9 @@ defineExpose({
overflow-x: hidden; overflow-x: hidden;
overscroll-behavior: contain; overscroll-behavior: contain;
padding: 16px 12px 16px; padding: 16px 12px 16px;
background: radial-gradient( background: transparent;
circle at top right,
rgb(var(--colorPrimaryRGB) / 0.08),
transparent 22%
),
radial-gradient(circle at bottom left, rgb(var(--colorPrimaryRGB) / 0.05), transparent 24%),
var(--bg, #fafafa);
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: #cfcfd4 #f3f3f5; scrollbar-color: #cfcfd4 transparent;
} }
.support-chat-scroll::-webkit-scrollbar { .support-chat-scroll::-webkit-scrollbar {
@@ -1102,13 +1129,13 @@ defineExpose({
} }
.support-day-group { .support-day-group {
display: block; display: contents;
} }
.support-day-sticky { .support-day-sticky {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 2; z-index: 6;
display: flex; display: flex;
justify-content: center; justify-content: center;
pointer-events: none; pointer-events: none;
@@ -1177,17 +1204,28 @@ defineExpose({
min-width: 34px !important; min-width: 34px !important;
height: 34px !important; height: 34px !important;
padding: 0 !important; padding: 0 !important;
border: 1px solid rgb(var(--colorPrimaryRGB) / 0.18) !important; border: 1px solid color-mix(in srgb, var(--colorPrimary, #2563eb) 18%, transparent) !important;
border-radius: 999px !important; border-radius: 999px !important;
background: color-mix(in srgb, var(--bg, #fff) 92%, transparent) !important; background: color-mix(in srgb, var(--bg, #fff) 92%, transparent) !important;
color: var(--colorPrimary, #2563eb) !important; color: var(--colorPrimary, #2563eb) !important;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: 0 8px 18px rgb(var(--colorPrimaryRGB) / 0.1); box-shadow: 0 8px 18px color-mix(in srgb, var(--colorPrimary, #2563eb) 10%, transparent);
backdrop-filter: blur(8px); backdrop-filter: blur(8px);
opacity: 0;
pointer-events: none;
transform: scale(0.92);
transition:
opacity 0.15s ease,
transform 0.15s ease;
}
.support-row:hover .support-reply-button,
.support-row:focus-within .support-reply-button {
opacity: 1; opacity: 1;
transform: scale(0.96); pointer-events: auto;
transform: scale(1);
} }
.support-reply-button--user { .support-reply-button--user {
@@ -1200,16 +1238,30 @@ defineExpose({
.support-avatar { .support-avatar {
margin-bottom: 4px; margin-bottom: 4px;
width: 32px; width: 34px;
height: 32px; height: 34px;
flex: 0 0 32px; flex: 0 0 34px;
border-radius: 16px; overflow: hidden;
border: 1px solid rgb(var(--colorPrimaryRGB) / 0.18); border-radius: 999px;
background: rgb(var(--colorPrimaryRGB) / 0.08); border: 1.5px solid color-mix(in srgb, var(--colorPrimary, #2563eb) 28%, transparent);
background: #fff;
color: var(--colorPrimary, #2563eb); color: var(--colorPrimary, #2563eb);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow:
0 6px 14px color-mix(in srgb, var(--colorPrimary, #2563eb) 16%, transparent),
inset 0 0 0 1px rgb(255 255 255 / 0.7);
}
.support-avatar__logo {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
object-position: center;
padding: 4px;
background: #fff;
} }
.support-avatar__svg { .support-avatar__svg {
@@ -1225,8 +1277,8 @@ defineExpose({
overflow: hidden; overflow: hidden;
border-radius: 24px; border-radius: 24px;
padding: 12px 16px; padding: 12px 16px;
background: var(--color6, #fff); background: var(--bg2, #fff);
box-shadow: 0 8px 18px rgb(var(--colorPrimaryRGB) / 0.08); box-shadow: 0 8px 18px rgb(var(--colorPrimaryRGB, 37 99 235) / 0.08);
direction: rtl; direction: rtl;
text-align: right; text-align: right;
} }
@@ -1235,6 +1287,17 @@ defineExpose({
min-width: min(260px, 72vw); min-width: min(260px, 72vw);
} }
.support-bubble--user {
border-bottom-right-radius: 10px;
background: var(--colorPrimary, #2563eb);
color: #fff;
border: none;
box-shadow:
0 0 0 1px color-mix(in srgb, var(--colorPrimary, #2563eb) 24%, transparent),
0 12px 32px color-mix(in srgb, var(--colorPrimary, #2563eb) 38%, transparent),
0 4px 12px color-mix(in srgb, var(--colorPrimary, #2563eb) 22%, transparent);
}
.support-bubble--user .support-bubble__image-wrap { .support-bubble--user .support-bubble__image-wrap {
background: rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.12);
} }
@@ -1243,7 +1306,10 @@ defineExpose({
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
background: var(--bg2, #fff); background: var(--bg2, #fff);
color: var(--colorText, #111827); color: var(--colorText, #111827);
border: 1px solid var(--colorPrimary, #2563eb); border: 1px solid color-mix(in srgb, var(--colorPrimary, #2563eb) 28%, transparent);
box-shadow:
0 10px 24px color-mix(in srgb, var(--colorPrimary, #2563eb) 12%, transparent),
0 2px 6px color-mix(in srgb, var(--colorPrimary, #2563eb) 8%, transparent);
} }
.support-bubble__reply { .support-bubble__reply {
@@ -1566,12 +1632,16 @@ defineExpose({
} }
.support-avatar { .support-avatar {
width: 28px; width: 30px;
height: 28px; height: 30px;
flex: 0 0 28px; flex: 0 0 30px;
margin-bottom: 2px; margin-bottom: 2px;
} }
.support-avatar__logo {
padding: 3px;
}
.support-avatar__svg { .support-avatar__svg {
width: 15px; width: 15px;
height: 15px; height: 15px;
@@ -1646,15 +1716,20 @@ defineExpose({
display: none; display: none;
} }
.support-reply-button {
opacity: 1;
pointer-events: auto;
transform: scale(1);
}
.support-jump-wrap { .support-jump-wrap {
right: 10px; inset-inline-start: 10px;
bottom: 14px; bottom: 12px;
transform: none;
} }
.support-jump-button { .support-jump-button {
width: 44px; width: 40px;
height: 44px; height: 40px;
} }
} }
+25 -1
View File
@@ -51,6 +51,10 @@ import {
setSupportChatPageOpen setSupportChatPageOpen
} from '@/utils/chat' } from '@/utils/chat'
import { useSettingsStore } from '@/store/settingsStore' import { useSettingsStore } from '@/store/settingsStore'
import {
canRequestBrowserNotification,
requestBrowserNotificationPermission,
} from '@/utils/browserNotification'
const draft = ref('') const draft = ref('')
const isSending = ref(false) const isSending = ref(false)
@@ -509,6 +513,10 @@ const messages = computed<ChatMessage[]>(() => {
onMounted(async () => { onMounted(async () => {
setSupportChatPageOpen(true) setSupportChatPageOpen(true)
if (canRequestBrowserNotification()) {
void requestBrowserNotificationPermission()
}
try { try {
const existing = getExistingChatSession() const existing = getExistingChatSession()
@@ -681,7 +689,23 @@ const sendMessage = async (payload: ComposerSendPayload) => {
display: grid; display: grid;
grid-template-rows: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto;
overflow: hidden; overflow: hidden;
background: var(--bg, #fff); background:
radial-gradient(
ellipse 110% 70% at 100% -5%,
color-mix(in srgb, var(--colorPrimary, #2563eb) 28%, transparent),
transparent 68%
),
radial-gradient(
ellipse 95% 60% at -5% 105%,
color-mix(in srgb, var(--colorPrimary, #2563eb) 18%, transparent),
transparent 62%
),
radial-gradient(
circle at 50% 45%,
color-mix(in srgb, var(--colorPrimary, #2563eb) 8%, transparent),
transparent 55%
),
var(--bg, #f7f8fb);
border: 0; border: 0;
border-radius: 0; border-radius: 0;
box-shadow: none; box-shadow: none;