feat(dashboard): Redesign and implement analytics dashboard

This commit introduces a complete overhaul of the analytics dashboard, replacing the previous simple layout with a modern, data-rich interface.

The new dashboard is built using Tailwind CSS for styling and Chart.js for interactive data visualizations. It provides a more comprehensive and user-friendly view of bot analytics with key metrics, charts for user growth and satisfaction, and a detailed feedback table.

Additionally, this commit fixes a mobile viewport height (`vh`) rendering issue on the chat page to prevent layout shifts on mobile browsers.
This commit is contained in:
2025-07-17 09:18:04 +07:00
parent 4ce725d333
commit 158b6d0886
6 changed files with 960 additions and 508 deletions

View File

@@ -1,421 +1,497 @@
/* Floating circles background for frosted glass effect */
/* Reset CSS */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Struktur dasar */
body {
display: flex;
flex-direction: column;
min-height: 100vh;
background: linear-gradient(135deg, #0077b6, #023e8a);
color: #ffffff; /* Warna teks putih */
text-shadow: 0 1px 3px rgba(0,0,0,0.5); /* Bayangan teks */
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
overflow-y: auto; /* Scroll di seluruh halaman */
padding: 0 20px; /* Tambahan padding horizontal */
}
/* Universal Header (works for both desktop and mobile) */
header {
position: sticky;
top: 0;
z-index: 1000;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(35px);
border-radius: 0 0 20px 20px;
margin: 0;
padding: 20px 25px; /* Increased vertical padding */
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
min-height: 110px; /* Significantly taller header */
width: 100%;
max-width: 100%;
display: flex;
flex-wrap: wrap; /* Allow elements to wrap on smaller screens */
justify-content: space-between;
align-items: center;
gap: 15px; /* Consistent spacing between elements */
}
/* Universal Header Elements */
.mobile-header-user-info {
display: flex;
align-items: center;
gap: 15px;
min-width: 50%; /* Ensure proper wrapping behavior */
}
.mobile-header-title {
font-size: 28px; /* Consistent size for all devices */
font-weight: bold;
line-height: 1.3;
}
.mobile-header-icon svg {
width: 36px; /* Slightly larger for visibility */
height: 36px;
}
.mobile-header-right {
display: flex;
align-items: center;
gap: 15px;
position: relative;
}
.dropdown-menu {
position: absolute;
top: 100%;
right: 0;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(20px);
border-radius: 12px;
padding: 10px;
z-index: 100;
min-width: 200px;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
display: none;
}
.dropdown-menu.visible {
display: block;
}
.dropdown-menu button {
width: 100%;
text-align: left;
padding: 10px 15px;
border-radius: 8px;
}
.dropdown-menu button:hover {
background: rgba(255, 255, 255, 0.3);
}
.mobile-header-menu-button {
background: rgba(255, 255, 255, 0.2);
border: none;
border-radius: 12px;
padding: 12px;
display: flex;
align-items: center;
justify-content: center;
min-height: 54px; /* Generous touch target */
min-width: 54px;
}
.mobile-header-menu-button svg {
width: 36px; /* Consistent icon size */
height: 36px;
}
.mobile-header-avatar {
width: 54px; /* Consistent avatar size */
height: 54px;
border-radius: 50%;
background-size: cover;
background-position: center;
}
/* Konten kiri header */
header .user-info {
display: flex;
align-items: center;
gap: 15px;
}
/* Konten kanan header */
header .header-right {
display: flex;
align-items: center;
gap: 20px; /* Jarak antar ikon/avatar */
}
/* Area konten tanpa scroll sendiri */
main {
flex: 1;
padding: 20px;
height: auto; /* Tinggi disesuaikan dengan konten */
}
/* Kontainer konten */
.layout-content-container {
max-width: 1200px;
margin: 0 auto;
padding: 15px;
}
/* Peningkatan kontras teks */
h1, h2, h3, h4, h5, h6,
p, span, div, td, th, li {
color: #F0F8FF !important; /* AliceBlue, off-white for softer look */
text-shadow: none !important; /* Remove text shadow */
}
/* Kartu dan elemen UI */
.card, .bg-\[\#ededed\] {
background: rgba(255, 255, 255, 0.25);
backdrop-filter: blur(25px);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 16px;
margin: 15px 0;
padding: 20px;
color: #ffffff;
}
/* Tombol */
button {
background: rgba(0, 150, 199, 0.7);
border: 1px solid rgba(255, 255, 255, 0.4);
backdrop-filter: blur(12px);
border-radius: 12px;
transition: all 0.3s ease;
color: #000 !important;
font-weight: bold;
padding: 10px 20px;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 150, 199, 0.4);
}
/* Tabel */
table {
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(10px);
border-radius: 15px;
overflow: hidden;
width: 100%;
table-layout: fixed; /* Ensure proportional columns */
}
th, td {
padding: 12px 15px;
color: #F0F8FF;
}
/* Proportional Columns */
th:nth-child(1), td:nth-child(1) { width: 50%; }
th:nth-child(2), td:nth-child(2) { width: 20%; }
th:nth-child(3), td:nth-child(3) { width: 30%; }
/* Floating circles background */
.floating-circles {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: -1;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: -1;
}
.floating-circles li {
position: absolute;
position: absolute;
display: block;
list-style: none;
width: 20px;
height: 20px;
background: rgba(72, 202, 228, 0.5);
animation: floating 25s linear infinite;
bottom: -150px;
border-radius: 50%;
z-index: 1;
animation-fill-mode: both;
}
/* Floating animation */
@keyframes floating {
0% {
transform: translate(0, 0) rotate(0deg);
opacity: 0.7;
}
25% {
transform: translate(-50px, -250px) rotate(90deg);
opacity: 0.5;
}
50% {
transform: translate(50px, -500px) rotate(180deg);
opacity: 0.3;
}
75% {
transform: translate(-30px, -750px) rotate(270deg);
opacity: 0.5;
}
100% {
transform: translate(0, -1000px) rotate(360deg);
opacity: 0;
}
}
/* Responsivitas */
@media (max-width: 768px) {
body {
padding: 0 10px;
}
/* Removed mobile-specific scaling as we now have universal styles */
/* Stat Cards */
#stat-cards, #secondary-stats {
flex-direction: column;
gap: 15px;
}
main {
padding: 10px;
height: calc(100vh - 120px);
}
.layout-content-container {
padding: 10px;
}
.card, .bg-\[\#ededed\] {
padding: 15px;
margin: 10px 0;
}
button {
padding: 8px 15px;
font-size: 14px;
}
}
/* Definitive Vertical Layout */
.controls-container,
.card-container {
display: block;
list-style: none;
width: 20px;
height: 20px;
background: rgba(72, 202, 228, 0.15);
border-radius: 50%;
animation: float 25s linear infinite;
bottom: -150px;
z-index: -1;
}
@keyframes float {
0% {
transform: translateY(0) rotate(0deg);
opacity: 0.7;
}
100% {
transform: translateY(-1000px) rotate(720deg);
opacity: 0;
}
}
/* Configure floating circles */
.floating-circles li:nth-child(1) { left: 25%; width: 80px; height: 80px; animation-delay: 0s; }
.floating-circles li:nth-child(2) { left: 10%; width: 20px; height: 20px; animation-delay: 2s; animation-duration: 12s; }
.floating-circles li:nth-child(3) { left: 70%; width: 20px; height: 20px; animation-delay: 4s; }
.floating-circles li:nth-child(4) { left: 40%; width: 60px; height: 60px; animation-delay: 0s; animation-duration: 18s; }
.floating-circles li:nth-child(5) { left: 65%; width: 20px; height: 20x; animation-delay: 0s; }
.floating-circles li:nth-child(6) { left: 75%; width: 110px; height: 110px; animation-delay: 3s; }
.floating-circles li:nth-child(7) { left: 35%; width: 150px; height: 150px; animation-delay: 7s; }
.floating-circles li:nth-child(8) { left: 50%; width: 25px; height: 25px; animation-delay: 15s; animation-duration: 45s; }
.floating-circles li:nth-child(9) { left: 20%; width: 15px; height: 15px; animation-delay: 2s; animation-duration: 35s; }
.floating-circles li:nth-child(10) { left: 85%; width: 150px; height: 150px; animation-delay: 0s; animation-duration: 11s; }
/* Reset CSS */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
/* Color Variables */
:root {
--dark-blue: #03045e;
--blue: #023e8a;
--light-blue: #0077b6;
--accent-blue: #0096c7;
--bright-blue: #48cae4;
--pale-blue: #ade8f4;
--white: #ffffff;
--light-gray: #f5f5f5;
--text-dark: #333333;
}
body {
display: flex;
min-height: 100vh;
background: linear-gradient(135deg, #0077b6, #023e8a);
margin: 0;
padding: 0;
overflow: hidden;
}
/* Sidebar dan main content sebagai anak langsung body */
.sidebar {
width: 250px;
height: 100vh;
background: var(--white);
color: var(--dark-blue);
display: flex;
flex-direction: column;
transition: transform 0.3s ease;
z-index: 100;
border-right: 1px solid rgba(0, 0, 0, 0.1);
}
.main-content {
flex: 1;
display: flex;
flex-direction: column;
height: 100vh;
overflow-y: auto;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(20px);
}
/* Sidebar Styles */
.sidebar {
width: 250px;
background: var(--white);
color: var(--dark-blue);
display: flex;
flex-direction: column;
transition: width 0.3s ease, transform 0.3s ease;
z-index: 100;
border-right: 1px solid rgba(0, 0, 0, 0.1);
}
.sidebar-header {
padding: 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.logo {
font-size: 1.5rem;
font-weight: bold;
color: var(--dark-blue);
}
.sidebar-nav {
flex: 1;
padding: 20px 0;
}
.nav-item {
display: flex;
align-items: center;
padding: 12px 20px;
color: var(--dark-blue);
text-decoration: none;
transition: all 0.3s ease;
}
.nav-item i {
margin-right: 10px;
font-size: 1.2rem;
}
.nav-item.active {
background: var(--pale-blue);
color: var(--dark-blue);
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.nav-item:hover:not(.active) {
background-color: rgba(255, 255, 255, 0.1);
color: var(--white);
}
.sidebar-footer {
padding: 20px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.logout-btn {
color: var(--dark-blue);
font-weight: bold;
}
.logout-btn:hover {
color: var(--blue);
}
/* Main Content Styles */
.main-content {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
background: transparent;
backdrop-filter: none;
}
.greeting-section {
padding: 20px;
display: flex;
justify-content: center;
align-items: flex-start; /* Pindahkan ke atas */
}
.greeting-card {
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(20px);
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
padding: 20px;
width: 95%;
max-width: 1000px;
/* Definitive Horizontal Layout for Stat Cards */
#stat-cards, #secondary-stats {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.profile-column {
display: flex;
align-items: center;
gap: 20px;
}
.profile-pic {
width: 100px;
height: 100px;
border-radius: 50%;
overflow: hidden;
border: 3px solid white;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
#stat-cards > div, #secondary-stats > div {
flex: 1; /* Ensure cards share space equally */
}
.profile-pic img {
width: 100%;
height: 100%;
object-fit: cover;
/* Ensure cards within the container stack vertically */
.card-container > div {
margin-bottom: 20px; /* Add space between vertical cards */
}
.user-info h2 {
font-size: 1.8rem;
color: white;
margin-bottom: 5px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
/* Force dark text in knowledge table for readability */
.knowledge-table,
.knowledge-table * {
color: #333333 !important;
}
.user-info p {
font-size: 1.1rem;
color: var(--pale-blue);
}
.actions-column {
/* Style the top buttons container */
.controls-inner-container {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 15px;
justify-content: space-between;
gap: 20px;
}
.datetime-small {
text-align: right;
/* Definitive Compact Bar Chart Styling */
.compact-bar-chart {
display: grid;
grid-template-columns: auto 1fr; /* Label and bar */
gap: 0.5rem 1rem; /* Vertical and horizontal gap */
align-items: center;
padding: 1rem 0;
}
#date {
font-size: 0.9rem;
color: white;
margin-bottom: 5px;
.bar-wrapper {
background-color: rgba(0, 0, 0, 0.1);
border-radius: 4px;
height: 8px; /* Wrapper height */
}
#time {
font-size: 1.2rem;
color: white;
.bar {
background-color: #ededed;
height: 100%;
border-radius: 4px;
}
/* RAG Section Styling */
.rag-section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.upload-button {
background-color: #0077b6;
color: white !important;
}
.status-active {
color: #28a745 !important; /* Green */
font-weight: bold;
}
.icons-container {
.status-inactive {
color: #dc3545 !important; /* Red */
}
.action-buttons {
display: flex;
gap: 10px;
}
.icon-btn {
background: none;
border: none;
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
transition: background 0.3s ease;
color: white;
font-size: 1.2rem;
.view-button, .delete-button {
padding: 2px 10px; /* Shorter buttons */
font-size: 12px;
min-width: 60px;
}
.icon-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
/* Card Grid Styles */
.card-grid {
display: flex;
flex-wrap: wrap;
gap: 20px;
/* Clean RAG Section Styling */
.knowledge-table {
width: 100%;
}
.card {
flex: 1 1 300px;
background: var(--white);
border-radius: 16px;
padding: 20px;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
justify-content: space-between;
transition: all 0.3s ease;
position: relative;
border-collapse: collapse;
background: #FFFFFF; /* Solid white background */
border-radius: 15px;
overflow: hidden;
z-index: 2;
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}
.card i {
font-size: 2.5rem;
color: #0096c7;
margin-bottom: 15px;
.knowledge-table th, .knowledge-table td {
padding: 12px 15px;
text-align: left;
color: #333333; /* Dark text for contrast */
}
.card h3 {
font-size: 1.2rem;
color: #023e8a;
margin-bottom: 10px;
.table-header-row th {
background: #f5f5f5;
padding: 0;
}
.card .card-value {
font-size: 2rem;
.knowledge-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
}
.knowledge-header h2 {
font-size: 22px;
font-weight: bold;
color: #03045e;
color: #333333;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
.upload-button {
background: #0077b6;
color: white;
border: none;
border-radius: 12px;
padding: 10px 20px;
font-weight: bold;
cursor: pointer;
}
.placeholder-card {
background-color: var(--white);
border-radius: 10px;
padding: 30px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
.knowledge-table th {
background: #f0f0f0;
font-weight: bold;
color: #333333;
}
.knowledge-table tr {
border-bottom: 1px solid #e0e0e0;
}
.knowledge-table tr:last-child {
border-bottom: none;
}
.rag-table tr {
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.rag-table tr:last-child {
border-bottom: none;
}
/* Enhanced status badges */
.status-badge {
padding: 4px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: bold;
display: inline-block;
text-align: center;
}
.placeholder-card p {
font-size: 1.2rem;
color: var(--light-blue);
.status-active {
background-color: rgba(40, 167, 69, 0.2);
color: #28a745 !important;
}
/* Hamburger button styles */
.hamburger-btn {
background: none;
.status-inactive {
background-color: rgba(220, 53, 69, 0.2);
color: #dc3545 !important;
}
.action-buttons {
display: flex;
gap: 10px;
}
.view-button, .delete-button {
padding: 8px 16px;
font-size: 13px;
min-width: 80px;
border: none;
color: var(--dark-blue);
font-size: 1.5rem;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
display: none;
display: flex;
justify-content: center;
align-items: center;
gap: 6px;
transition: all 0.2s ease;
}
.mobile-only {
display: none;
.view-button:hover, .delete-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
/* Responsive Design */
@media (max-width: 768px) {
.mobile-only {
display: block;
}
.hamburger-btn {
display: block;
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
z-index: 101;
}
.sidebar .hamburger-btn {
right: 15px;
top: 20px;
color: var(--dark-blue);
}
.sidebar {
position: fixed;
height: 100%;
transform: translate极(-100%);
transition: transform 0.3s ease;
}
.sidebar.active {
transform: translateX(0);
}
.logo span, .nav-item span {
display: none;
}
.nav-item {
justify-content: center;
padding: 15px;
}
.nav-item i {
margin-right: 0;
font-size: 1.5rem;
}
.logout-btn span {
display: none;
}
.greeting-card {
flex-direction: column;
gap: 20px;
}
.actions-column {
align-items: center;
width: 100%;
}
.datetime-small {
text-align: center;
width: 100%;
}
.icons-container {
justify-content: center;
width: 100%;
}
.view-button {
background-color: #007bff;
color: white;
}
.delete-button {
background-color: #dc3545;
color: white;
}