fix: support chat elevated only on PDP, rx button opens modal instantly, and hide pet badge when not logged in
Deploy Canina / deploy (push) Failing after 21s
Deploy Canina / deploy (push) Failing after 21s
This commit is contained in:
1 parent
b54338f91f
commit
6a37f2f4c7
3 files changed
+14
-7
No files matched your search
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
import { FormEvent, useEffect, useRef, useState } from 'react';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
type PersistedMessage = { role: 'user' | 'assistant'; content: string };
|
||||
|
||||
@@ -42,6 +43,8 @@ export default function SupportChat() {
|
||||
const pending = useRef<AbortController | null>(null);
|
||||
const chatScrollRef = useRef<HTMLDivElement | null>(null);
|
||||
const historyKey = useRef('');
|
||||
const pathname = usePathname();
|
||||
const isPdpPage = pathname?.startsWith('/shop/') && pathname !== '/shop';
|
||||
|
||||
useEffect(() => {
|
||||
identity.current = token();
|
||||
@@ -194,7 +197,7 @@ export default function SupportChat() {
|
||||
if (!config?.enabled) return configError ? <span role="status" className="sr-only">تنظیمات پشتیبان هوشمند در دسترس نیست.</span> : null;
|
||||
const botIcon = { chat: '💬', paw: '🐾', bot: '🤖' }[config.icon];
|
||||
return (
|
||||
<aside dir="rtl" className="fixed bottom-24 sm:bottom-6 left-4 sm:left-6 z-30 max-w-[calc(100vw-2.5rem)] font-vazir select-none pb-[env(safe-area-inset-bottom,0px)]">
|
||||
<aside dir="rtl" className={`fixed ${isPdpPage ? "bottom-[138px]" : "bottom-24"} sm:bottom-6 left-4 sm:left-6 z-30 max-w-[calc(100vw-2.5rem)] font-vazir select-none pb-[env(safe-area-inset-bottom,0px)]`}>
|
||||
{/* Floating Launcher Button */}
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in new issue
Block a user