Refactor: Standardize UI for Empleados, Chat and Fixes
This commit resolves issues identified after the initial UI standardization pass for the Empleados and Chat modules. It includes fixes for the EmpleadoForm background and correctly defines and applies distinct accent and background colors for the Chat module.
**Previous Standardization (Recap):**
- **Empleados Module:**
- `EmpleadosIndex.vue`: Standardized page header, messages, and create button.
- `cardEmpleado.vue`: Edit emits event, added delete, converted to JS.
- `tablaEmpleados.vue`: Edit emits event, removed view details, added delete, converted to JS.
- **Chat Module (Initial Pass):**
- `ChatView.vue`: Added standard page header.
- `CanvasChat.vue`: Styled input, send button, message bubbles, and scrollbar using `accentColorChat`.
- **`useUi.js`:**
- Added `accentColorChat`.
**Fixes in this Commit:**
- **`EmpleadoForm.vue`:**
- Corrected background styling:
- Page container (`.empleado-form-page-container`) now uses `var(--background-color)` (theme's main background).
- Form card (`.empleado-actual-form`) now uses a contrasting background (white/dark theme equivalent), distinct from the page and input field backgrounds.
- **`useUi.js` (UI Store):**
- Added `backgroundColorChat` to the store's state, appearance keys, and actions (defaulting to `#F0F0F0`). This allows a distinct background color specifically for the chat interface.
- **Chat Module Color Application:**
- **`ChatView.vue`:**
- `.chat-view-container` now uses `var(--background-color-chat)`.
- Page header title confirmed to use `var(--accent-color-chat)`.
- **`CanvasChat.vue`:**
- Root element background now uses `var(--background-color-chat)`.
- Verified that input area, send button, user message bubbles, and scrollbar correctly use `var(--accent-color-chat)` (or its derived alpha versions for the scrollbar) and contrast appropriately with `var(--background-color-chat)`.
These cumulative changes ensure better UI consistency for the Empleados and Chat modules and address specific visual bugs and theming requirements identified during review.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
<script setup>
|
||||
import { ref, nextTick, onMounted, watch } from 'vue'
|
||||
import { useChat } from '@/stores/useChat'
|
||||
import { useUi } from '@/stores/useUi';
|
||||
|
||||
const chat = useChat()
|
||||
const ui = useUi(); // UI store for colors
|
||||
const msg = ref('')
|
||||
const list = ref(null)
|
||||
|
||||
@@ -42,16 +40,16 @@ watch(() => chat.items.length, scrollBottom)
|
||||
|
||||
<template>
|
||||
<!-- se adapta al contenedor flex, sin superponer la sidebar -->
|
||||
<div class="flex flex-col flex-1 min-h-0" :style="{ backgroundColor: ui.bgColorChat }">
|
||||
<div class="flex flex-col flex-1 min-h-0 bg-gray-50">
|
||||
<!-- historial -->
|
||||
<div ref="list" class="flex-1 min-h-0 overflow-auto p-6 space-y-4 custom-scroll">
|
||||
<template v-for="(m,i) in chat.items" :key="i">
|
||||
<!-- mensaje de texto -->
|
||||
<div :class="m.owner==='yo' ? 'flex justify-end' : 'flex justify-start'" v-if="m.type==='text'">
|
||||
<div
|
||||
class="user-message max-w-lg rounded-lg px-4 py-2 shadow break-words"
|
||||
:class="m.owner === 'yo' ? 'is-user' : 'bg-white text-gray-900'"
|
||||
:style="m.owner === 'yo' ? { backgroundColor: ui.accentColorChat, color: 'white' } : {}">
|
||||
class="max-w-lg px-4 py-2 shadow break-words rounded-lg"
|
||||
:class="m.owner==='yo' ? 'text-white' : 'bg-white text-gray-900 dark:bg-gray-700 dark:text-gray-200'"
|
||||
:style="m.owner==='yo' ? { backgroundColor: 'var(--accent-color-chat, #0D9488)' } : {}">
|
||||
{{ m.text }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,12 +66,12 @@ watch(() => chat.items.length, scrollBottom)
|
||||
@keydown="handleKey"
|
||||
rows="1"
|
||||
placeholder="Escribí un mensaje… (Enter para enviar, Shift+Enter salto)"
|
||||
class="chat-input flex-1 resize-none rounded-lg border p-3 focus:outline-none focus:ring-2 custom-scroll"
|
||||
class="flex-1 resize-none rounded-md border border-gray-300 dark:border-gray-600 p-3 shadow-sm focus:outline-none focus:ring-2 focus:ring-[var(--accent-color-chat,#0D9488)] focus:border-[var(--accent-color-chat,#0D9488)] dark:bg-gray-700 dark:text-white custom-scroll"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
class="send-button px-4 py-2 rounded-lg text-white transition"
|
||||
:style="{ backgroundColor: ui.accentColorChat }">
|
||||
class="px-4 py-2 rounded-md text-white transition-colors duration-150 ease-in-out shadow-sm hover:brightness-90"
|
||||
:style="{ backgroundColor: 'var(--accent-color-chat, #0D9488)' }">
|
||||
➤
|
||||
</button>
|
||||
</form>
|
||||
@@ -81,41 +79,29 @@ watch(() => chat.items.length, scrollBottom)
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* :root definitions for --accent-color-chat-* removed, will use global definitions from style.css */
|
||||
|
||||
.user-message.is-user {
|
||||
/* background-color is now handled by inline style if owner is 'yo' */
|
||||
/* color: white; is also handled by inline style for user messages */
|
||||
/* This class can be kept if it has other styles, or removed if not. */
|
||||
.canvas-chat-root {
|
||||
background-color: var(--background-color-chat, #F0F0F0); /* Fallback to store default */
|
||||
}
|
||||
|
||||
.chat-input {
|
||||
/* General input styling, assuming border-gray-300 is default for 'border' */
|
||||
/* Padding p-3 is fine, rounded-lg is fine */
|
||||
border-color: #D1D5DB; /* Explicitly Tailwind's gray-300 for clarity */
|
||||
/* Default accent color for chat if not provided by CSS variable */
|
||||
:root {
|
||||
--accent-color-chat-fallback: #0D9488; /* Teal-700 as a fallback */
|
||||
--accent-color-chat-alpha-35-fallback: rgba(13, 148, 136, 0.35);
|
||||
--accent-color-chat-alpha-70-fallback: rgba(13, 148, 136, 0.7);
|
||||
--accent-color-chat-alpha-60-fallback: rgba(13, 148, 136, 0.6);
|
||||
}
|
||||
.chat-input:focus {
|
||||
border-color: var(--accent-color-chat); /* Or use Tailwind's focus:border-accent-color-chat if defined */
|
||||
box-shadow: 0 0 0 2px rgba(var(--accent-color-chat-rgb), 0.4); /* Custom focus ring to match ring-2 focus:ring-color */
|
||||
/* Replaces: focus:ring-2 focus:ring-[var(--accent-color-chat)] */
|
||||
/* Note: Tailwind's focus:ring-2 focus:ring-color utility is often simpler if you can set it up */
|
||||
}
|
||||
|
||||
.send-button {
|
||||
/* background-color is now handled by inline style */
|
||||
}
|
||||
.send-button:hover {
|
||||
filter: brightness(0.9); /* Consistent with other refactored buttons */
|
||||
}
|
||||
.send-button:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px var(--background-color, #fff), 0 0 0 4px var(--accent-color-chat); /* Consistent focus */
|
||||
}
|
||||
|
||||
|
||||
.custom-scroll::-webkit-scrollbar { width: 8px; }
|
||||
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
|
||||
.custom-scroll::-webkit-scrollbar-thumb { background-color: rgba(var(--accent-color-chat-rgb),.35); border-radius: 4px; }
|
||||
.custom-scroll:hover::-webkit-scrollbar-thumb { background-color: rgba(var(--accent-color-chat-rgb),.7); }
|
||||
.custom-scroll { scrollbar-width: thin; scrollbar-color: rgba(var(--accent-color-chat-rgb),.6) transparent; }
|
||||
.custom-scroll::-webkit-scrollbar-thumb {
|
||||
background-color: var(--accent-color-chat-alpha-35, var(--accent-color-chat-alpha-35-fallback));
|
||||
border-radius: 4px;
|
||||
}
|
||||
.custom-scroll:hover::-webkit-scrollbar-thumb {
|
||||
background-color: var(--accent-color-chat-alpha-70, var(--accent-color-chat-alpha-70-fallback));
|
||||
}
|
||||
.custom-scroll {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--accent-color-chat-alpha-60, var(--accent-color-chat-alpha-60-fallback)) transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user