fix: change adaption rate bg color and logic

This commit is contained in:
MehrdadAdabi 2025-09-29 18:41:28 +03:30
parent ef96cb4778
commit cacf40938f
3 changed files with 356 additions and 326 deletions

View File

@ -2,51 +2,51 @@
@import "tailwindcss"; @import "tailwindcss";
@theme { @theme {
/* Teal color scale */ /* Teal color scale */
--color-teal-50: #f0fdfa; --color-teal-50: #f0fdfa;
--color-teal-100: #ccfbf1; --color-teal-100: #ccfbf1;
--color-teal-200: #99f6e4; --color-teal-200: #99f6e4;
--color-teal-300: #5eead4; --color-teal-300: #5eead4;
--color-teal-400: #2dd4bf; --color-teal-400: #2dd4bf;
--color-teal-500: #14b8a6; --color-teal-500: #14b8a6;
--color-teal-600: #0d9488; --color-teal-600: #0d9488;
--color-teal-700: #0f766e; --color-teal-700: #0f766e;
--color-teal-800: #115e59; --color-teal-800: #115e59;
--color-teal-900: #134e4a; --color-teal-900: #134e4a;
--color-teal-950: #042f2e; --color-teal-950: #042f2e;
/* Slate color scale */ /* Slate color scale */
--color-slate-50: #f8fafc; --color-slate-50: #f8fafc;
--color-slate-100: #f1f5f9; --color-slate-100: #f1f5f9;
--color-slate-200: #e2e8f0; --color-slate-200: #e2e8f0;
--color-slate-300: #cbd5e1; --color-slate-300: #cbd5e1;
--color-slate-400: #94a3b8; --color-slate-400: #94a3b8;
--color-slate-500: #64748b; --color-slate-500: #64748b;
--color-slate-600: #475569; --color-slate-600: #475569;
--color-slate-700: #334155; --color-slate-700: #334155;
--color-slate-800: #1e293b; --color-slate-800: #1e293b;
--color-slate-900: #0f172a; --color-slate-900: #0f172a;
--color-slate-950: #020617; --color-slate-950: #020617;
--color-pr-green: #3aea83; --color-pr-green: #3aea83;
--color-pr-blue: #69c8ea; --color-pr-blue: #69c8ea;
--color-pr-red: #f76276; --color-pr-red: #f76276;
--color-pr-gray: #3f415a; --color-pr-gray: #3f415a;
} }
html, html,
body { body {
@apply bg-background text-foreground; @apply bg-background text-foreground;
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
color-scheme: dark; color-scheme: dark;
} }
} }
body { body {
font-family: IRANYekanX; font-family: IRANYekanX;
direction: rtl; direction: rtl;
background-color: #cdcdcd; background-color: #cdcdcd;
margin: 0; margin: 0;
} }
h1, h1,
h2, h2,
@ -56,378 +56,380 @@ h5,
h6, h6,
input, input,
textarea { textarea {
font-family: IRANYekanX; font-family: IRANYekanX;
} }
/* RTL Support */ /* RTL Support */
html[dir="rtl"] { html[dir="rtl"] {
direction: rtl; direction: rtl;
} }
html[dir="rtl"] body { html[dir="rtl"] body {
text-align: right; text-align: right;
} }
@theme inline { @theme inline {
--radius-sm: calc(var(--radius) - 4px); --radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px); --radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius); --radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px); --radius-xl: calc(var(--radius) + 4px);
--color-background: var(--background); --color-background: var(--background);
--color-foreground: var(--foreground); --color-foreground: var(--foreground);
--color-card: var(--card); --color-card: var(--card);
--color-card-foreground: var(--card-foreground); --color-card-foreground: var(--card-foreground);
--color-popover: var(--popover); --color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground); --color-dark-blue: var(--dark-blue);
--color-primary: var(--primary); --color-popover-foreground: var(--popover-foreground);
--color-primary-foreground: var(--primary-foreground); --color-primary: var(--primary);
--color-secondary: var(--secondary); --color-primary-foreground: var(--primary-foreground);
--color-secondary-foreground: var(--secondary-foreground); --color-secondary: var(--secondary);
--color-muted: var(--muted); --color-secondary-foreground: var(--secondary-foreground);
--color-muted-foreground: var(--muted-foreground); --color-muted: var(--muted);
--color-accent: var(--accent); --color-muted-foreground: var(--muted-foreground);
--color-accent-foreground: var(--accent-foreground); --color-accent: var(--accent);
--color-destructive: var(--destructive); --color-accent-foreground: var(--accent-foreground);
--color-destructive-foreground: var(--destructive-foreground); --color-destructive: var(--destructive);
--color-border: var(--border); --color-destructive-foreground: var(--destructive-foreground);
--color-input: var(--input); --color-border: var(--border);
--color-ring: var(--ring); --color-input: var(--input);
--color-ring: var(--ring);
} }
:root { :root {
--radius: 0.5rem; --radius: 0.5rem;
--color-green: #3aea83; --color-green: #3aea83;
--color-blue: #69c8ea; --color-blue: #69c8ea;
--color-red: #f76276; --color-red: #f76276;
/* primary colors */ /* primary colors */
--color-pr-gray: #3f415a; --color-pr-gray: #3f415a;
--color-pr-green: var(--color-green); --color-pr-green: var(--color-green);
/* Light theme colors */ /* Light theme colors */
--background: #ffffff; --background: #ffffff;
--foreground: #0a0a0a; --foreground: #0a0a0a;
--card: #ffffff; --card: #ffffff;
--card-foreground: #0a0a0a; --card-foreground: #0a0a0a;
--popover: #ffffff; --popover: #ffffff;
--popover-foreground: #0a0a0a; --popover-foreground: #0a0a0a;
--primary: #22c55e; --primary: #22c55e;
--primary-foreground: #ffffff; --primary-foreground: #ffffff;
--secondary: #f5f5f5; --secondary: #f5f5f5;
--secondary-foreground: #0a0a0a; --secondary-foreground: #0a0a0a;
--muted: #f5f5f5; --muted: #f5f5f5;
--muted-foreground: #737373; --muted-foreground: #737373;
--accent: #f5f5f5; --accent: #f5f5f5;
--accent-foreground: #0a0a0a; --accent-foreground: #0a0a0a;
--destructive: #ef4444; --destructive: #ef4444;
--destructive-foreground: #ffffff; --destructive-foreground: #ffffff;
--border: #e5e5e5; --border: #e5e5e5;
--input: #e5e5e5; --input: #e5e5e5;
--ring: #22c55e; --ring: #22c55e;
--dark-blue: #33364d;
/* Primary color scale */ /* Primary color scale */
--color-primary-50: #f0fdf4; --color-primary-50: #f0fdf4;
--color-primary-100: #dcfce7; --color-primary-100: #dcfce7;
--color-primary-200: #bbf7d0; --color-primary-200: #bbf7d0;
--color-primary-300: #86efac; --color-primary-300: #86efac;
--color-primary-400: #4ade80; --color-primary-400: #4ade80;
--color-primary-500: #22c55e; --color-primary-500: #22c55e;
--color-primary-600: #16a34a; --color-primary-600: #16a34a;
--color-primary-700: #15803d; --color-primary-700: #15803d;
--color-primary-800: #166534; --color-primary-800: #166534;
--color-primary-900: #14532d; --color-primary-900: #14532d;
--color-primary-950: #052e16; --color-primary-950: #052e16;
/* Secondary color scale (Blue) */ /* Secondary color scale (Blue) */
--color-secondary-50: #eff6ff; --color-secondary-50: #eff6ff;
--color-secondary-100: #dbeafe; --color-secondary-100: #dbeafe;
--color-secondary-200: #bfdbfe; --color-secondary-200: #bfdbfe;
--color-secondary-300: #93c5fd; --color-secondary-300: #93c5fd;
--color-secondary-400: #60a5fa; --color-secondary-400: #60a5fa;
--color-secondary-500: #3b82f6; --color-secondary-500: #3b82f6;
--color-secondary-600: #2563eb; --color-secondary-600: #2563eb;
--color-secondary-700: #1d4ed8; --color-secondary-700: #1d4ed8;
--color-secondary-800: #1e40af; --color-secondary-800: #1e40af;
--color-secondary-900: #1e3a8a; --color-secondary-900: #1e3a8a;
--color-secondary-950: #172554; --color-secondary-950: #172554;
/* Neutral color scale */ /* Neutral color scale */
--color-neutral-50: #fafafa; --color-neutral-50: #fafafa;
--color-neutral-100: #f5f5f5; --color-neutral-100: #f5f5f5;
--color-neutral-200: #e5e5e5; --color-neutral-200: #e5e5e5;
--color-neutral-300: #d4d4d4; --color-neutral-300: #d4d4d4;
--color-neutral-400: #a3a3a3; --color-neutral-400: #a3a3a3;
--color-neutral-500: #737373; --color-neutral-500: #737373;
--color-neutral-600: #525252; --color-neutral-600: #525252;
--color-neutral-700: #404040; --color-neutral-700: #404040;
--color-neutral-800: #262626; --color-neutral-800: #262626;
--color-neutral-900: #171717; --color-neutral-900: #171717;
--color-neutral-950: #0a0a0a; --color-neutral-950: #0a0a0a;
/* Status colors */ /* Status colors */
--color-success-50: #f0fdf4; --color-success-50: #f0fdf4;
--color-success-100: #dcfce7; --color-success-100: #dcfce7;
--color-success-500: #22c55e; --color-success-500: #22c55e;
--color-success-600: #16a34a; --color-success-600: #16a34a;
--color-success-700: #15803d; --color-success-700: #15803d;
--color-success-900: #14532d; --color-success-900: #14532d;
--color-error-50: #fef2f2; --color-error-50: #fef2f2;
--color-error-100: #fee2e2; --color-error-100: #fee2e2;
--color-error-500: #ef4444; --color-error-500: #ef4444;
--color-error-600: #dc2626; --color-error-600: #dc2626;
--color-error-700: #b91c1c; --color-error-700: #b91c1c;
--color-error-900: #7f1d1d; --color-error-900: #7f1d1d;
--color-warning-50: #fffbeb; --color-warning-50: #fffbeb;
--color-warning-100: #fef3c7; --color-warning-100: #fef3c7;
--color-warning-500: #f59e0b; --color-warning-500: #f59e0b;
--color-warning-600: #d97706; --color-warning-600: #d97706;
--color-warning-700: #b45309; --color-warning-700: #b45309;
--color-warning-900: #78350f; --color-warning-900: #78350f;
--color-info-50: #eff6ff; --color-info-50: #eff6ff;
--color-info-100: #dbeafe; --color-info-100: #dbeafe;
--color-info-500: #3b82f6; --color-info-500: #3b82f6;
--color-info-600: #2563eb; --color-info-600: #2563eb;
--color-info-700: #1d4ed8; --color-info-700: #1d4ed8;
--color-info-900: #1e3a8a; --color-info-900: #1e3a8a;
/* Teal colors */ /* Teal colors */
--color-teal-50: #f0fdfa; --color-teal-50: #f0fdfa;
--color-teal-100: #ccfbf1; --color-teal-100: #ccfbf1;
--color-teal-200: #99f6e4; --color-teal-200: #99f6e4;
--color-teal-300: #5eead4; --color-teal-300: #5eead4;
--color-teal-400: #2dd4bf; --color-teal-400: #2dd4bf;
--color-teal-500: #14b8a6; --color-teal-500: #14b8a6;
--color-teal-600: #0d9488; --color-teal-600: #0d9488;
--color-teal-700: #0f766e; --color-teal-700: #0f766e;
--color-teal-800: #115e59; --color-teal-800: #115e59;
--color-teal-900: #134e4a; --color-teal-900: #134e4a;
/* Dark colors */ /* Dark colors */
--color-dark-50: #f8fafc; --color-dark-50: #f8fafc;
--color-dark-100: #f1f5f9; --color-dark-100: #f1f5f9;
--color-dark-200: #e2e8f0; --color-dark-200: #e2e8f0;
--color-dark-300: #cbd5e1; --color-dark-300: #cbd5e1;
--color-dark-400: #94a3b8; --color-dark-400: #94a3b8;
--color-dark-500: #64748b; --color-dark-500: #64748b;
--color-dark-600: #475569; --color-dark-600: #475569;
--color-dark-700: #334155; --color-dark-700: #334155;
--color-dark-800: #1e293b; --color-dark-800: #1e293b;
--color-dark-900: #0f172a; --color-dark-900: #0f172a;
--color-dark-950: #020617; --color-dark-950: #020617;
/* Login specific colors */ /* Login specific colors */
--color-login-primary: var(--color-green); --color-login-primary: var(--color-green);
--color-login-dark-start: #464861; --color-login-dark-start: #464861;
--color-login-dark-end: #111628; --color-login-dark-end: #111628;
} }
.dark { .dark {
/* Dark theme colors */ /* Dark theme colors */
--background: #020617; --background: #020617;
--foreground: #f8fafc; --foreground: #f8fafc;
--card: #0f172a; --card: #0f172a;
--card-foreground: #f8fafc; --card-foreground: #f8fafc;
--popover: #0f172a; --popover: #0f172a;
--popover-foreground: #f8fafc; --popover-foreground: #f8fafc;
--primary: #22c55e; --primary: #22c55e;
--primary-foreground: #0a0a0a; --primary-foreground: #0a0a0a;
--secondary: #1e293b; --secondary: #1e293b;
--secondary-foreground: #f8fafc; --secondary-foreground: #f8fafc;
--muted: #1e293b; --muted: #1e293b;
--muted-foreground: #94a3b8; --muted-foreground: #94a3b8;
--accent: #1e293b; --accent: #1e293b;
--accent-foreground: #f8fafc; --accent-foreground: #f8fafc;
--destructive: #ef4444; --destructive: #ef4444;
--destructive-foreground: #f8fafc; --destructive-foreground: #f8fafc;
--border: #1e293b; --border: #1e293b;
--input: #1e293b; --input: #1e293b;
--ring: #22c55e; --ring: #22c55e;
} }
@layer base { @layer base {
* { * {
@apply border-border; @apply border-border;
} }
body { body {
@apply bg-background text-foreground; @apply bg-background text-foreground;
} }
} }
/* Persian/Farsi font class */ /* Persian/Farsi font class */
.font-persian { .font-persian {
font-family: "IRANYekanX"; font-family: "IRANYekanX";
} }
/* Custom utility classes */ /* Custom utility classes */
.gradient-primary { .gradient-primary {
background: linear-gradient( background: linear-gradient(
135deg, 135deg,
var(--color-primary-500) 0%, var(--color-primary-500) 0%,
var(--color-primary-600) 100% var(--color-primary-600) 100%
); );
} }
.gradient-secondary { .gradient-secondary {
background: linear-gradient( background: linear-gradient(
135deg, 135deg,
var(--color-secondary-500) 0%, var(--color-secondary-500) 0%,
var(--color-secondary-600) 100% var(--color-secondary-600) 100%
); );
} }
.gradient-background { .gradient-background {
background: linear-gradient( background: linear-gradient(
135deg, 135deg,
var(--color-neutral-50) 0%, var(--color-neutral-50) 0%,
var(--color-neutral-100) 100% var(--color-neutral-100) 100%
); );
} }
.dark .gradient-background { .dark .gradient-background {
background: linear-gradient( background: linear-gradient(
135deg, 135deg,
var(--color-neutral-900) 0%, var(--color-neutral-900) 0%,
var(--color-neutral-800) 100% var(--color-neutral-800) 100%
); );
} }
/* Login page specific styles */ /* Login page specific styles */
.login-page { .login-page {
background: linear-gradient( background: linear-gradient(
135deg, 135deg,
var(--color-login-dark-start) 0%, var(--color-login-dark-start) 0%,
var(--color-login-dark-end) 100% var(--color-login-dark-end) 100%
); );
} }
.login-sidebar { .login-sidebar {
background: var(--color-login-primary); background: var(--color-login-primary);
} }
/* Animation classes */ /* Animation classes */
.animate-fade-in { .animate-fade-in {
animation: fadeIn 0.3s ease-in-out; animation: fadeIn 0.3s ease-in-out;
} }
.animate-slide-up { .animate-slide-up {
animation: slideUp 0.3s ease-out; animation: slideUp 0.3s ease-out;
} }
.animate-slide-down { .animate-slide-down {
animation: slideDown 0.3s ease-out; animation: slideDown 0.3s ease-out;
} }
@keyframes fadeIn { @keyframes fadeIn {
from { from {
opacity: 0; opacity: 0;
} }
to { to {
opacity: 1; opacity: 1;
} }
} }
@keyframes slideUp { @keyframes slideUp {
from { from {
transform: translateY(10px); transform: translateY(10px);
opacity: 0; opacity: 0;
} }
to { to {
transform: translateY(0); transform: translateY(0);
opacity: 1; opacity: 1;
} }
} }
@keyframes slideDown { @keyframes slideDown {
from { from {
transform: translateY(-10px); transform: translateY(-10px);
opacity: 0; opacity: 0;
} }
to { to {
transform: translateY(0); transform: translateY(0);
opacity: 1; opacity: 1;
} }
} }
/* Toast customization for RTL */ /* Toast customization for RTL */
.Toaster__toast { .Toaster__toast {
direction: rtl; direction: rtl;
text-align: right; text-align: right;
} }
/* Form focus styles */ /* Form focus styles */
.form-input:focus-within { .form-input:focus-within {
@apply ring-2 ring-primary/20 border-primary; @apply ring-2 ring-primary/20 border-primary;
} }
/* Button hover effects */ /* Button hover effects */
.btn-hover-scale:hover { .btn-hover-scale:hover {
transform: scale(1.02); transform: scale(1.02);
transition: transform 0.2s ease-in-out; transition: transform 0.2s ease-in-out;
} }
/* Custom shadows */ /* Custom shadows */
.shadow-primary { .shadow-primary {
box-shadow: box-shadow:
0 4px 6px -1px rgb(34 197 94 / 0.1), 0 4px 6px -1px rgb(34 197 94 / 0.1),
0 2px 4px -2px rgb(34 197 94 / 0.1); 0 2px 4px -2px rgb(34 197 94 / 0.1);
} }
.shadow-error { .shadow-error {
box-shadow: box-shadow:
0 4px 6px -1px rgb(239 68 68 / 0.1), 0 4px 6px -1px rgb(239 68 68 / 0.1),
0 2px 4px -2px rgb(239 68 68 / 0.1); 0 2px 4px -2px rgb(239 68 68 / 0.1);
} }
/* Loading states */ /* Loading states */
.loading-shimmer { .loading-shimmer {
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%; background-size: 200% 100%;
animation: shimmer 1.5s infinite; animation: shimmer 1.5s infinite;
} }
.dark .loading-shimmer { .dark .loading-shimmer {
background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%); background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
background-size: 200% 100%; background-size: 200% 100%;
} }
@keyframes shimmer { @keyframes shimmer {
0% { 0% {
background-position: -200% 0; background-position: -200% 0;
} }
100% { 100% {
background-position: 200% 0; background-position: 200% 0;
} }
} }
/* Table/container specific custom dark scrollbar */ /* Table/container specific custom dark scrollbar */
.custom-scrollbar { .custom-scrollbar {
scrollbar-width: thin; /* Firefox */ scrollbar-width: thin; /* Firefox */
scrollbar-color: rgba(100, 116, 139, 0.6) transparent; /* thumb track */ scrollbar-color: rgba(100, 116, 139, 0.6) transparent; /* thumb track */
} }
.custom-scrollbar::-webkit-scrollbar { .custom-scrollbar::-webkit-scrollbar {
width: 2px; width: 2px;
height: 2px; height: 2px;
} }
.custom-scrollbar::-webkit-scrollbar-track { .custom-scrollbar::-webkit-scrollbar-track {
background: rgba(241, 245, 249, 0.6); /* slate-100 */ background: rgba(241, 245, 249, 0.6); /* slate-100 */
} }
.custom-scrollbar::-webkit-scrollbar-thumb { .custom-scrollbar::-webkit-scrollbar-thumb {
background: linear-gradient( background: linear-gradient(
to bottom, to bottom,
rgba(16, 185, 129, 0.6), rgba(16, 185, 129, 0.6),
rgba(16, 185, 129, 0.9) rgba(16, 185, 129, 0.9)
); /* emerald */ ); /* emerald */
border-radius: 9999px; border-radius: 9999px;
border: 0.5px solid transparent; border: 0.5px solid transparent;
background-clip: padding-box; background-clip: padding-box;
} }
.custom-scrollbar:hover::-webkit-scrollbar-thumb { .custom-scrollbar:hover::-webkit-scrollbar-thumb {
@ -443,50 +445,50 @@ html[dir="rtl"] body {
} }
:root { :root {
--form-control-color: #3f415a; --form-control-color: #3f415a;
--form-control-disabled: ##5f6284; --form-control-disabled: ##5f6284;
--form-background: #3aea83; --form-background: #3aea83;
} }
input[type="checkbox"] { input[type="checkbox"] {
-webkit-appearance: none; -webkit-appearance: none;
appearance: none; appearance: none;
margin: 0; margin: 0;
font: inherit; font: inherit;
color: #5f6284; color: #5f6284;
background-color: transparent; background-color: transparent;
width: 1.15em; width: 1.15em;
height: 1.15em; height: 1.15em;
border: 1px solid #5f6284; border: 1px solid #5f6284;
border-radius: 0.15em; border-radius: 0.15em;
transform: translateY(-0.075em); transform: translateY(-0.075em);
display: grid; display: grid;
place-content: center; place-content: center;
cursor: pointer; cursor: pointer;
} }
input[type="checkbox"]::before { input[type="checkbox"]::before {
content: ""; content: "";
width: 0.65em; width: 0.65em;
height: 0.65em; height: 0.65em;
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
transform: scale(0); transform: scale(0);
transform-origin: bottom left; transform-origin: bottom left;
transition: 120ms transform ease-in-out; transition: 120ms transform ease-in-out;
box-shadow: inset 1em 1em var(--form-control-color); box-shadow: inset 1em 1em var(--form-control-color);
} }
input[type="checkbox"]:checked::before { input[type="checkbox"]:checked::before {
transform: scale(1); transform: scale(1);
} }
input[type="checkbox"]:checked { input[type="checkbox"]:checked {
background-color: #3aea83; background-color: #3aea83;
border: 1px solid transparent; border: 1px solid transparent;
} }
input[type="checkbox"]:disabled { input[type="checkbox"]:disabled {
--form-control-color: var(--form-control-disabled); --form-control-color: var(--form-control-disabled);
color: var(--form-control-disabled); color: var(--form-control-disabled);
cursor: not-allowed; cursor: not-allowed;
} }

View File

@ -1,4 +1,4 @@
import { useEffect, useReducer, useState } from "react"; import { useEffect, useReducer, useRef, useState } from "react";
import { import {
Bar, Bar,
BarChart, BarChart,
@ -118,6 +118,7 @@ export function StrategicAlignmentPopup({
}: StrategicAlignmentPopupProps) { }: StrategicAlignmentPopupProps) {
const [data, setData] = useState<StrategicAlignmentData[]>([]); const [data, setData] = useState<StrategicAlignmentData[]>([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const contentRef = useRef<HTMLDivElement | null>(null);
const [state, dispatch] = useReducer(reducer, { const [state, dispatch] = useReducer(reducer, {
isOpen: false, isOpen: false,
selectedValue: "همه مضامین", selectedValue: "همه مضامین",
@ -260,6 +261,25 @@ export function StrategicAlignmentPopup({
}); });
}; };
useEffect(() => {
if (!open) return;
const handleClickOutside = (event: MouseEvent) => {
if (
contentRef.current &&
!contentRef.current.contains(event.target as Node)
) {
dispatch({
type: "CLOSE",
});
}
};
document.addEventListener("mousedown", handleClickOutside);
return () => {
document.removeEventListener("mousedown", handleClickOutside);
};
}, [open]);
return ( return (
<Dialog open={open} onOpenChange={dialogHandler}> <Dialog open={open} onOpenChange={dialogHandler}>
<DialogContent className="w-full max-w-4xl bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] text-white border-none"> <DialogContent className="w-full max-w-4xl bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] text-white border-none">
@ -273,13 +293,19 @@ export function StrategicAlignmentPopup({
> >
<DropdownMenuButton>{state.selectedValue}</DropdownMenuButton> <DropdownMenuButton>{state.selectedValue}</DropdownMenuButton>
<DropdownMenuContent forceMount={true} className="w-56"> <DropdownMenuContent
ref={contentRef}
forceMount={true}
className="w-56"
>
{state.dropDownItems.map((item: string, key: number) => ( {state.dropDownItems.map((item: string, key: number) => (
<div <div
onClick={() => selectItem(item)} onClick={() => selectItem(item)}
key={`${key}-${item}`} key={`${key}-${item}`}
> >
<DropdownMenuItem>{item}</DropdownMenuItem> <DropdownMenuItem selected={state.selectedValue === item}>
{item}
</DropdownMenuItem>
</div> </div>
))} ))}
</DropdownMenuContent> </DropdownMenuContent>

View File

@ -77,13 +77,15 @@ const DropdownMenuItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Item>, React.ElementRef<typeof DropdownMenuPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean; inset?: boolean;
selected?: boolean;
} }
>(({ className, inset, ...props }, ref) => ( >(({ className, inset, selected, ...props }, ref) => (
<DropdownMenuPrimitive.Item <DropdownMenuPrimitive.Item
ref={ref} ref={ref}
className={cn( className={cn(
"cursor-pointer select-none rounded-md px-2 py-1.5 text-sm outline-none transition-colors hover:bg-gray-600 data-[disabled]:pointer-events-none data-[disabled]:opacity-50", "cursor-pointer select-none rounded-md px-2 py-1.5 text-sm outline-none transition-colors hover:bg-dark-blue data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
inset && "pl-8", inset && "pl-8",
selected && "bg-dark-blue text-white",
className className
)} )}
{...props} {...props}