feat(web): sugestao de comprados anteriormente fechada por padrao com banner de destaque
Painel do historico do cliente no lancamento agora abre sempre fechado,
com banner ambar chamativo ("Este cliente ja comprou N produtos com
voce") e botao Ver produtos - o rep le e escolhe abrir, em vez de a
lista ocupar a tela direto.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,9 +29,12 @@ import {
|
|||||||
CheckCircleOutlined,
|
CheckCircleOutlined,
|
||||||
CloseOutlined,
|
CloseOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
|
DownOutlined,
|
||||||
|
HistoryOutlined,
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
ShoppingCartOutlined,
|
ShoppingCartOutlined,
|
||||||
|
UpOutlined,
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useNavigate, useSearch } from '@tanstack/react-router';
|
import { useNavigate, useSearch } from '@tanstack/react-router';
|
||||||
@@ -768,7 +771,8 @@ function ClientHistoryPanel({
|
|||||||
}) {
|
}) {
|
||||||
const screens = useBreakpoint();
|
const screens = useBreakpoint();
|
||||||
const isMobile = !screens.md;
|
const isMobile = !screens.md;
|
||||||
const [collapsed, setCollapsed] = useState(false);
|
// Sempre fecha ao abrir a tela — o banner chamativo convida o rep a expandir
|
||||||
|
const [collapsed, setCollapsed] = useState(true);
|
||||||
const [qtys, setQtys] = useState<Record<number, number>>({});
|
const [qtys, setQtys] = useState<Record<number, number>>({});
|
||||||
|
|
||||||
const { data: produtos = [], isLoading } = useClientTopProdutos(idCliente, 15);
|
const { data: produtos = [], isLoading } = useClientTopProdutos(idCliente, 15);
|
||||||
@@ -929,40 +933,61 @@ function ClientHistoryPanel({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ marginTop: 16 }}>
|
<div style={{ marginTop: 16 }}>
|
||||||
|
{/* Banner âmbar de destaque — fechado por padrão, convida o rep a abrir */}
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
marginBottom: 8,
|
gap: 10,
|
||||||
|
padding: '10px 14px',
|
||||||
|
background: '#FFF7E6',
|
||||||
|
border: '1px solid #FFD591',
|
||||||
|
borderRadius: collapsed ? 8 : '8px 8px 0 0',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
userSelect: 'none',
|
userSelect: 'none',
|
||||||
}}
|
}}
|
||||||
onClick={() => setCollapsed((c) => !c)}
|
onClick={() => setCollapsed((c) => !c)}
|
||||||
>
|
>
|
||||||
<Text
|
<div style={{ display: 'flex', alignItems: 'center', gap: 10, minWidth: 0 }}>
|
||||||
|
<HistoryOutlined style={{ color: '#D46B08', fontSize: 18, flexShrink: 0 }} />
|
||||||
|
<div style={{ minWidth: 0 }}>
|
||||||
|
<Text
|
||||||
|
strong
|
||||||
|
style={{ color: '#873800', fontSize: 13, display: 'block', lineHeight: 1.3 }}
|
||||||
|
>
|
||||||
|
Este cliente já comprou {produtos.length} produto{produtos.length !== 1 ? 's' : ''}{' '}
|
||||||
|
com você
|
||||||
|
</Text>
|
||||||
|
<Text style={{ color: '#AD6800', fontSize: 11 }}>
|
||||||
|
Veja o histórico e repita itens no pedido com um clique
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
style={{
|
style={{
|
||||||
fontSize: 11,
|
borderColor: '#FFD591',
|
||||||
fontWeight: 700,
|
color: '#D46B08',
|
||||||
letterSpacing: '0.08em',
|
background: '#fff',
|
||||||
textTransform: 'uppercase',
|
fontWeight: 600,
|
||||||
color: '#64748B',
|
flexShrink: 0,
|
||||||
}}
|
}}
|
||||||
|
icon={collapsed ? <DownOutlined /> : <UpOutlined />}
|
||||||
|
iconPosition="end"
|
||||||
>
|
>
|
||||||
Comprados anteriormente · {produtos.length} produto{produtos.length !== 1 ? 's' : ''}
|
{collapsed ? 'Ver produtos' : 'Ocultar'}
|
||||||
</Text>
|
|
||||||
<Button type="link" size="small" style={{ padding: 0, fontSize: 12 }}>
|
|
||||||
{collapsed ? 'exibir' : 'ocultar'}
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!collapsed && (
|
{!collapsed && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
border: '1px solid #EBF0F5',
|
border: '1px solid #FFD591',
|
||||||
borderRadius: 8,
|
borderTop: 'none',
|
||||||
|
borderRadius: '0 0 8px 8px',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
background: '#FAFBFC',
|
background: '#FFFDF7',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Table<TopProduto>
|
<Table<TopProduto>
|
||||||
|
|||||||
Reference in New Issue
Block a user