|
|
@@ -4,6 +4,9 @@ import LayoutSistema from "../../layout/LayoutSistema.vue";
|
|
|
import ModalMidia from "../../components/ModalMidia.vue";
|
|
|
import BaseBadge from "../../components/base/BaseBadge.vue";
|
|
|
import ChatBubble from "../../components/base/ChatBubble.vue";
|
|
|
+import BaseIcon from "../../components/base/BaseIcon.vue";
|
|
|
+import ConfirmDialog from "../../components/base/ConfirmDialog.vue";
|
|
|
+import { MessageCircle, Trash2, ArrowLeft, Mic, Play, Sparkles, RefreshCw, X, TriangleAlert } from "lucide-vue-next";
|
|
|
import { useConversas } from "../../composables/useConversas.js";
|
|
|
import { useAuth } from "../../composables/useAuth.js";
|
|
|
import { useToast } from "../../composables/useToast.js";
|
|
|
@@ -251,9 +254,7 @@ onUnmounted(() => {
|
|
|
{{ conversasError }}
|
|
|
</div>
|
|
|
<div v-else-if="!conversas.length" class="flex flex-1 flex-col items-center justify-center gap-2 p-4 text-center">
|
|
|
- <svg class="h-8 w-8 text-gray-300 dark:text-gray-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
|
- <path stroke-linecap="round" stroke-linejoin="round" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.86 9.86 0 0 1-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8Z" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="MessageCircle" class="h-8 w-8 text-gray-300 dark:text-gray-600" strokeWidth="1.5" />
|
|
|
<p class="text-sm text-muted-foreground">Nenhuma conversa ainda.</p>
|
|
|
<p class="text-xs text-muted-foreground">Mande uma mensagem para o número de teste no WhatsApp.</p>
|
|
|
</div>
|
|
|
@@ -305,34 +306,9 @@ onUnmounted(() => {
|
|
|
aria-label="Excluir conversa"
|
|
|
@click="confirmandoExclusao = c.Id"
|
|
|
>
|
|
|
- <svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
|
- <path stroke-linecap="round" stroke-linejoin="round" d="m19 7-.867 12.142A2 2 0 0 1 16.138 21H7.862a2 2 0 0 1-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v3M4 7h16" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="Trash2" class="h-4 w-4" />
|
|
|
</button>
|
|
|
|
|
|
- <div
|
|
|
- v-if="confirmandoExclusao === c.Id"
|
|
|
- class="absolute inset-0 flex flex-col items-center justify-center gap-2 rounded-xl bg-background p-3 dark:bg-abyss-900"
|
|
|
- >
|
|
|
- <span class="text-xs text-muted-foreground">Excluir esta conversa?</span>
|
|
|
- <div class="flex items-center gap-1.5">
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- class="rounded-lg bg-red-600 px-3 py-1 text-xs font-medium text-white disabled:opacity-50"
|
|
|
- :disabled="excluindo === c.Id"
|
|
|
- @click="onExcluir(c.Id)"
|
|
|
- >
|
|
|
- Confirmar
|
|
|
- </button>
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- class="rounded-lg border border-gray-300 px-3 py-1 text-xs font-medium text-gray-700 dark:border-gray-600 dark:text-gray-300"
|
|
|
- @click="confirmandoExclusao = null"
|
|
|
- >
|
|
|
- Cancelar
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -357,9 +333,7 @@ onUnmounted(() => {
|
|
|
title="Voltar para a lista"
|
|
|
@click="fecharConversa"
|
|
|
>
|
|
|
- <svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
|
- <path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="ArrowLeft" class="h-4 w-4" />
|
|
|
</button>
|
|
|
<div
|
|
|
v-if="conversaAtiva"
|
|
|
@@ -398,9 +372,7 @@ onUnmounted(() => {
|
|
|
<ChatBubble :own="m.Direcao === 'saida'">
|
|
|
<template v-if="ehAudio(midiaInfo(m))">
|
|
|
<div class="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
|
|
|
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
|
- <path stroke-linecap="round" stroke-linejoin="round" d="M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="Mic" class="h-3.5 w-3.5" />
|
|
|
Mensagem de áudio
|
|
|
</div>
|
|
|
<audio v-if="midiaUrls[m.Id]" controls preload="none" :src="midiaUrls[m.Id]" class="mt-1.5 h-9 w-64 max-w-full"></audio>
|
|
|
@@ -446,9 +418,7 @@ onUnmounted(() => {
|
|
|
<video :src="midiaUrls[m.Id]" preload="metadata" muted class="max-h-80 max-w-full rounded-lg object-contain"></video>
|
|
|
<div class="absolute inset-0 flex items-center justify-center bg-black/20">
|
|
|
<div class="flex h-11 w-11 items-center justify-center rounded-full bg-white/85 text-gray-900">
|
|
|
- <svg class="h-5 w-5 translate-x-0.5" viewBox="0 0 24 24" fill="currentColor">
|
|
|
- <path d="M8 5v14l11-7z" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="Play" class="h-5 w-5 translate-x-0.5" fill="currentColor" stroke="none" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -484,9 +454,7 @@ onUnmounted(() => {
|
|
|
<div class="mb-1.5 flex items-center justify-between gap-2">
|
|
|
<div class="flex min-w-0 items-center gap-2">
|
|
|
<span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/15 text-primary dark:bg-primary/25">
|
|
|
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
|
- <path d="M12 3v4M12 17v4M3 12h4M17 12h4M6.34 6.34l1.42 1.42M16.24 16.24l1.42 1.42M6.34 17.66l1.42-1.42M16.24 7.76l1.42-1.42" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="Sparkles" class="h-3.5 w-3.5" />
|
|
|
</span>
|
|
|
<span class="truncate text-[11px] font-semibold uppercase tracking-wide text-primary">Sugestão do star-atendente</span>
|
|
|
</div>
|
|
|
@@ -499,9 +467,7 @@ onUnmounted(() => {
|
|
|
:disabled="sugestaoLoading"
|
|
|
@click="buscarSugestao"
|
|
|
>
|
|
|
- <svg class="h-3.5 w-3.5" :class="{ 'animate-spin': sugestaoLoading }" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
|
- <path d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="RefreshCw" class="h-3.5 w-3.5" :class="{ 'animate-spin': sugestaoLoading }" />
|
|
|
</button>
|
|
|
<button
|
|
|
type="button"
|
|
|
@@ -510,9 +476,7 @@ onUnmounted(() => {
|
|
|
aria-label="Descartar sugestão"
|
|
|
@click="descartarSugestao"
|
|
|
>
|
|
|
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
|
- <path d="M18 6L6 18M6 6l12 12" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="X" class="h-3.5 w-3.5" />
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -533,9 +497,7 @@ onUnmounted(() => {
|
|
|
</div>
|
|
|
<div v-else-if="sugestaoLoading" class="mx-3 mb-2 flex items-center gap-2 rounded-xl border border-primary/30 bg-primary/5 p-3 dark:border-primary/40 dark:bg-primary/10">
|
|
|
<span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/15 text-primary dark:bg-primary/25">
|
|
|
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
|
- <path d="M12 3v4M12 17v4M3 12h4M17 12h4M6.34 6.34l1.42 1.42M16.24 16.24l1.42 1.42M6.34 17.66l1.42-1.42M16.24 7.76l1.42-1.42" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="Sparkles" class="h-3.5 w-3.5" />
|
|
|
</span>
|
|
|
<span class="flex items-center gap-1">
|
|
|
<span class="h-1.5 w-1.5 animate-bounce rounded-full bg-primary" style="animation-delay: 0ms" />
|
|
|
@@ -545,9 +507,7 @@ onUnmounted(() => {
|
|
|
<span class="text-xs text-muted-foreground">Gerando sugestão...</span>
|
|
|
</div>
|
|
|
<div v-else-if="sugestaoError" class="mx-3 mb-2 flex items-start gap-2 rounded-xl border border-red-200 bg-red-50 p-3 dark:border-red-900/40 dark:bg-red-900/20">
|
|
|
- <svg class="mt-0.5 h-4 w-4 shrink-0 text-red-500 dark:text-red-400" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
|
- <path d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z" />
|
|
|
- </svg>
|
|
|
+ <BaseIcon :icon="TriangleAlert" class="mt-0.5 h-4 w-4 shrink-0 text-red-500 dark:text-red-400" />
|
|
|
<div class="min-w-0 flex-1">
|
|
|
<p class="text-xs text-red-800 dark:text-red-300">Não foi possível gerar a sugestão: {{ sugestaoError }}</p>
|
|
|
<button
|
|
|
@@ -591,6 +551,15 @@ onUnmounted(() => {
|
|
|
:tipo="mediaViewer.tipo"
|
|
|
@close="mediaViewer = null"
|
|
|
/>
|
|
|
+
|
|
|
+ <ConfirmDialog
|
|
|
+ :open="!!confirmandoExclusao"
|
|
|
+ title="Excluir conversa"
|
|
|
+ message="Excluir esta conversa? Esta ação não pode ser desfeita."
|
|
|
+ :loading="excluindo === confirmandoExclusao"
|
|
|
+ @confirm="onExcluir(confirmandoExclusao)"
|
|
|
+ @cancel="confirmandoExclusao = null"
|
|
|
+ />
|
|
|
</LayoutSistema>
|
|
|
</template>
|
|
|
|