1033 lines
44 KiB
HTML
1033 lines
44 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="fa" dir="rtl">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>مدیریت محصولات</title>
|
||
<script src="https://d3js.org/d3.v7.min.js"></script>
|
||
<style>
|
||
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
|
||
|
||
:root {
|
||
--primary: #1a365d;
|
||
--primary-light: #2c5282;
|
||
--primary-dark: #0f2341;
|
||
--accent: #c9a961;
|
||
--accent-dark: #a8893f;
|
||
--accent-light: #e0c789;
|
||
--bg: #f5f7fa;
|
||
--board-bg: #e2e8f0;
|
||
--card-bg: #ffffff;
|
||
--panel-bg: #ffffff;
|
||
--text: #1a202c;
|
||
--text-muted: #4a5568;
|
||
--text-light: #718096;
|
||
--border: #cbd5e0;
|
||
--border-light: #e2e8f0;
|
||
--success: #38a169;
|
||
--danger: #e53e3e;
|
||
--warning: #dd6b20;
|
||
--info: #3182ce;
|
||
--shadow: 0 4px 6px rgba(0, 0, 0, 0.08), 0 10px 20px rgba(26, 54, 93, 0.1);
|
||
--shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
|
||
--shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
|
||
--radius: 10px;
|
||
--radius-sm: 6px;
|
||
--sidebar-width: 280px;
|
||
--header-height: 64px;
|
||
--tabs-height: 48px;
|
||
--footer-height: 36px;
|
||
}
|
||
|
||
[data-theme="dark"] {
|
||
--primary: #2c5282;
|
||
--primary-light: #3b6fb5;
|
||
--primary-dark: #1a365d;
|
||
--accent: #e0c789;
|
||
--accent-dark: #c9a961;
|
||
--accent-light: #f0d9a0;
|
||
--bg: #1a202c;
|
||
--board-bg: #2d3748;
|
||
--card-bg: #2d3748;
|
||
--panel-bg: #1f2937;
|
||
--text: #e2e8f0;
|
||
--text-muted: #cbd5e0;
|
||
--text-light: #a0aec0;
|
||
--border: #4a5568;
|
||
--border-light: #374151;
|
||
--shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 10px 20px rgba(0, 0, 0, 0.4);
|
||
--shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||
--shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
|
||
}
|
||
|
||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||
|
||
body {
|
||
font-family: 'Vazirmatn', Tahoma, sans-serif;
|
||
background: var(--bg);
|
||
color: var(--text);
|
||
height: 100vh;
|
||
overflow: hidden;
|
||
font-size: 14px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
transition: background 0.3s, color 0.3s;
|
||
}
|
||
|
||
.app-header {
|
||
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
|
||
color: white;
|
||
padding: 0 20px;
|
||
height: var(--header-height);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
border-bottom: 3px solid var(--accent);
|
||
box-shadow: var(--shadow);
|
||
z-index: 100;
|
||
flex-shrink: 0;
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
.app-header::before {
|
||
content: '';
|
||
position: absolute;
|
||
top: -50%;
|
||
left: -10%;
|
||
width: 300px;
|
||
height: 300px;
|
||
background: radial-gradient(circle, rgba(201, 169, 97, 0.15) 0%, transparent 70%);
|
||
border-radius: 50%;
|
||
pointer-events: none;
|
||
}
|
||
.app-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
|
||
.app-logo {
|
||
width: 44px; height: 44px; background: var(--accent); border-radius: 10px;
|
||
display: flex; align-items: center; justify-content: center; font-size: 22px;
|
||
font-weight: 800; color: var(--primary-dark); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); flex-shrink: 0;
|
||
}
|
||
.app-brand-text { display: flex; flex-direction: column; gap: 2px; }
|
||
.app-title { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; color: white; }
|
||
.app-subtitle { font-size: 11px; opacity: 0.85; color: rgba(255, 255, 255, 0.9); }
|
||
|
||
.btn {
|
||
background: linear-gradient(135deg, var(--primary-light), var(--primary));
|
||
color: white; border: none; padding: 8px 14px; border-radius: var(--radius-sm);
|
||
cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
|
||
display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s;
|
||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); white-space: nowrap;
|
||
}
|
||
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); filter: brightness(1.1); }
|
||
.btn:active { transform: translateY(0); }
|
||
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: var(--primary-dark); font-weight: 700; }
|
||
.btn-ghost { background: rgba(26, 54, 93, 0.08); border: 1px solid var(--border); color: var(--primary); font-weight: 600; }
|
||
.btn-ghost:hover { background: rgba(26, 54, 93, 0.15); border-color: var(--primary-light); }
|
||
[data-theme="dark"] .btn-ghost { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.25); color: white; }
|
||
[data-theme="dark"] .btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }
|
||
.btn-danger { background: linear-gradient(135deg, var(--danger), #c53030); color: white; }
|
||
.btn-sm { padding: 4px 10px; font-size: 11px; }
|
||
.btn-xs { padding: 2px 6px; font-size: 10px; }
|
||
.btn-icon {
|
||
width: 32px; height: 32px; padding: 0;
|
||
display: inline-flex; align-items: center; justify-content: center;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.app-main { flex: 1; display: flex; overflow: hidden; position: relative; flex-direction: row; }
|
||
|
||
.sidebar {
|
||
order: -1; width: var(--sidebar-width); background: var(--panel-bg);
|
||
border-right: 1px solid var(--border); display: flex; flex-direction: column;
|
||
transition: width 0.3s ease; box-shadow: var(--shadow); overflow: hidden;
|
||
flex-shrink: 0; z-index: 50;
|
||
}
|
||
.sidebar.collapsed { width: 0; overflow: hidden; }
|
||
.sidebar-header {
|
||
background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white;
|
||
padding: 12px; display: flex; align-items: center; justify-content: space-between;
|
||
border-bottom: 2px solid var(--accent); min-height: 48px;
|
||
}
|
||
.sidebar-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
|
||
.sidebar.collapsed .sidebar-title { display: none; }
|
||
.sidebar-body { flex: 1; overflow-y: auto; padding: 8px; }
|
||
.sidebar.collapsed .sidebar-body { display: none; }
|
||
.sidebar-group { margin-bottom: 6px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); overflow: hidden; background: var(--card-bg); }
|
||
.sidebar-group-header {
|
||
background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white;
|
||
padding: 10px 12px; cursor: pointer; display: flex; align-items: center;
|
||
justify-content: space-between; font-size: 13px; font-weight: 700;
|
||
user-select: none; transition: all 0.2s; position: relative;
|
||
}
|
||
.sidebar-group-header:hover { filter: brightness(1.1); }
|
||
.sidebar-group-header .group-icon { display: flex; align-items: center; gap: 8px; flex: 1; overflow: hidden; }
|
||
.sidebar-group-header .group-arrow { transition: transform 0.3s; font-size: 12px; flex-shrink: 0; }
|
||
.sidebar-group.collapsed .group-arrow { transform: rotate(90deg); }
|
||
.sidebar-group.collapsed .sidebar-group-body { display: none; }
|
||
.sidebar-group-body { padding: 6px; display: flex; flex-direction: column; gap: 4px; }
|
||
.sidebar-btn {
|
||
background: var(--card-bg); border: 1px solid var(--border-light); color: var(--text);
|
||
padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit;
|
||
font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 8px;
|
||
transition: all 0.2s; text-align: right; width: 100%; position: relative;
|
||
}
|
||
.sidebar-btn:hover { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; border-color: var(--primary); transform: translateX(-2px); }
|
||
.sidebar-btn .btn-icon-emoji { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
|
||
.sidebar-btn .btn-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||
|
||
[data-tooltip] { position: relative; }
|
||
[data-tooltip]::after {
|
||
content: attr(data-tooltip); position: absolute; right: calc(100% + 10px); top: 50%;
|
||
transform: translateY(-50%); background: var(--primary-dark); color: white;
|
||
padding: 8px 12px; border-radius: 6px; font-size: 11px; font-weight: 500;
|
||
white-space: normal; opacity: 0; pointer-events: none; transition: opacity 0.2s;
|
||
z-index: 1000; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); max-width: 250px; line-height: 1.5;
|
||
}
|
||
[data-tooltip]::before {
|
||
content: ''; position: absolute; right: calc(100% + 5px); top: 50%;
|
||
transform: translateY(-50%); border: 5px solid transparent;
|
||
border-left-color: var(--primary-dark); opacity: 0; pointer-events: none;
|
||
transition: opacity 0.2s; z-index: 1000;
|
||
}
|
||
[data-tooltip]:hover::after, [data-tooltip]:hover::before { opacity: 1; }
|
||
[data-theme="dark"] [data-tooltip]::after { background: var(--accent-dark); color: var(--primary-dark); }
|
||
[data-theme="dark"] [data-tooltip]::before { border-left-color: var(--accent-dark); }
|
||
|
||
.tabs-bar {
|
||
background: linear-gradient(135deg, #0f1724 0%, #1a2a44 100%);
|
||
border-bottom: 2px solid var(--accent);
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 0 12px;
|
||
min-height: var(--tabs-height);
|
||
box-shadow: var(--shadow-sm);
|
||
flex-shrink: 0;
|
||
gap: 10px;
|
||
position: relative;
|
||
flex-wrap: wrap;
|
||
}
|
||
.toolbar-controls { display: flex; gap: 6px; margin-left: 8px; }
|
||
.toolbar-icon-btn {
|
||
background: rgba(255, 255, 255, 0.08);
|
||
border: 1px solid rgba(255, 255, 255, 0.15);
|
||
color: white;
|
||
width: 34px; height: 34px; border-radius: 6px; cursor: pointer;
|
||
font-size: 15px; display: flex; align-items: center; justify-content: center;
|
||
transition: all 0.2s; padding: 0;
|
||
}
|
||
.toolbar-icon-btn:hover:not(:disabled) { background: var(--accent); color: var(--primary-dark); border-color: var(--accent); transform: translateY(-1px); }
|
||
.toolbar-search { flex: 1; min-width: 180px; max-width: 320px; position: relative; display: flex; align-items: center; }
|
||
.search-icon { position: absolute; right: 10px; font-size: 13px; opacity: 0.7; pointer-events: none; }
|
||
.search-input {
|
||
width: 100%; padding: 7px 32px 7px 12px;
|
||
background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15);
|
||
border-radius: 6px; color: white; font-family: inherit; font-size: 13px; transition: all 0.2s;
|
||
}
|
||
.search-input::placeholder { color: rgba(255, 255, 255, 0.5); }
|
||
.search-input:focus { outline: none; background: rgba(255, 255, 255, 0.12); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(201, 169, 97, 0.2); }
|
||
.toolbar-filters { display: flex; gap: 8px; }
|
||
.filter-dropdown {
|
||
position: relative; display: flex; align-items: center; gap: 6px;
|
||
background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15);
|
||
border-radius: 6px; padding: 0 10px; transition: all 0.2s;
|
||
}
|
||
.filter-dropdown:hover { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.12); }
|
||
.filter-icon { font-size: 13px; opacity: 0.9; }
|
||
.filter-select {
|
||
background: transparent; border: none; color: white; font-family: inherit;
|
||
font-size: 12px; font-weight: 600; padding: 7px 4px; cursor: pointer; outline: none; min-width: 110px;
|
||
}
|
||
.filter-select option { background: var(--primary-dark); color: white; }
|
||
.toolbar-stats { display: flex; gap: 12px; margin-right: auto; padding-right: 8px; border-right: 1px solid rgba(255, 255, 255, 0.1); }
|
||
.stat-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: rgba(255, 255, 255, 0.85); white-space: nowrap; }
|
||
.stat-icon { font-size: 13px; }
|
||
.stat-label { font-weight: 500; }
|
||
.stat-value {
|
||
font-weight: 800; color: var(--accent); background: rgba(201, 169, 97, 0.15);
|
||
padding: 2px 7px; border-radius: 10px; font-size: 11px; min-width: 22px; text-align: center;
|
||
}
|
||
|
||
@media (max-width: 900px) {
|
||
.tabs-bar { flex-wrap: wrap; padding: 8px; gap: 8px; }
|
||
.toolbar-stats { order: 3; width: 100%; margin-right: 0; padding-right: 0; border-right: none; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 8px; justify-content: center; }
|
||
.toolbar-search { order: 2; }
|
||
}
|
||
|
||
.board-area { flex: 1; overflow: auto; padding: 24px; background: var(--board-bg); transition: background 0.3s; }
|
||
|
||
.modal-overlay { position: fixed; inset: 0; background: rgba(26, 54, 93, 0.6); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; animation: fadeIn 0.2s; }
|
||
.modal-overlay.active { display: flex; }
|
||
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
||
.modal { background: var(--panel-bg); color: var(--text); border-radius: 12px; width: 100%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideUp 0.25s; }
|
||
.modal-lg { max-width: 800px; }
|
||
.modal-xl { max-width: 1000px; }
|
||
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
|
||
.modal-header { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--accent); }
|
||
.modal-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
|
||
.modal-close { background: rgba(255, 255, 255, 0.15); border: none; color: white; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; transition: all 0.2s; }
|
||
.modal-close:hover { background: var(--danger); }
|
||
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
|
||
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--border-light); }
|
||
|
||
/* Galaxy Graph Styles */
|
||
#galaxy-graph-container {
|
||
width: 100%;
|
||
height: 600px;
|
||
background: radial-gradient(ellipse at center, #1a1a2e 0%, #0f0f1e 100%);
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
position: relative;
|
||
}
|
||
|
||
.galaxy-node {
|
||
cursor: pointer;
|
||
}
|
||
|
||
.galaxy-node circle {
|
||
transition: all 0.3s;
|
||
}
|
||
|
||
.galaxy-node:hover circle {
|
||
filter: brightness(1.3);
|
||
}
|
||
|
||
.galaxy-link {
|
||
stroke-opacity: 0.4;
|
||
transition: all 0.3s;
|
||
}
|
||
|
||
.galaxy-link:hover {
|
||
stroke-opacity: 0.8;
|
||
stroke-width: 2;
|
||
}
|
||
|
||
.galaxy-tooltip {
|
||
position: absolute;
|
||
background: rgba(0, 0, 0, 0.9);
|
||
color: white;
|
||
padding: 10px 14px;
|
||
border-radius: 6px;
|
||
font-size: 12px;
|
||
pointer-events: none;
|
||
opacity: 0;
|
||
transition: opacity 0.2s;
|
||
z-index: 1000;
|
||
max-width: 250px;
|
||
line-height: 1.5;
|
||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
|
||
}
|
||
|
||
.galaxy-tooltip.visible {
|
||
opacity: 1;
|
||
}
|
||
|
||
.galaxy-controls {
|
||
position: absolute;
|
||
top: 20px;
|
||
right: 20px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
z-index: 100;
|
||
}
|
||
|
||
.galaxy-legend {
|
||
position: absolute;
|
||
bottom: 20px;
|
||
right: 20px;
|
||
background: rgba(0, 0, 0, 0.8);
|
||
color: white;
|
||
padding: 12px;
|
||
border-radius: 6px;
|
||
font-size: 11px;
|
||
z-index: 100;
|
||
}
|
||
|
||
.galaxy-legend-item {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-bottom: 6px;
|
||
}
|
||
|
||
.galaxy-legend-color {
|
||
width: 14px;
|
||
height: 14px;
|
||
border-radius: 50%;
|
||
}
|
||
|
||
.app-footer {
|
||
background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white;
|
||
padding: 8px 20px; font-size: 11px; display: flex; justify-content: space-between;
|
||
align-items: center; border-top: 2px solid var(--accent); flex-shrink: 0;
|
||
}
|
||
.footer-brand { color: var(--accent); font-weight: 700; }
|
||
|
||
.form-input[readonly], .form-textarea[readonly] { background: var(--border-light); color: var(--text-muted); cursor: not-allowed; opacity: 0.85; border-style: dashed; }
|
||
.readonly-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; color: var(--text-muted); background: var(--border-light); border: 1px solid var(--border); padding: 2px 8px; border-radius: 10px; margin-right: 6px; }
|
||
.readonly-badge::before { content: '🔒'; font-size: 10px; }
|
||
.readonly-info { background: linear-gradient(to left, #ebf8ff, #e6f6ff); border: 1px solid #90cdf4; border-right: 4px solid var(--info); padding: 10px 14px; border-radius: 6px; font-size: 11px; color: var(--text-muted); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
|
||
[data-theme="dark"] .readonly-info { background: rgba(49, 130, 206, 0.12); border-color: rgba(49, 130, 206, 0.3); border-right-color: var(--info); }
|
||
|
||
::-webkit-scrollbar { width: 8px; height: 8px; }
|
||
::-webkit-scrollbar-track { background: transparent; }
|
||
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
|
||
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<header class="app-header">
|
||
<div class="app-brand">
|
||
<div class="app-logo">📊</div>
|
||
<div class="app-brand-text">
|
||
<div class="app-title" id="headerTitle">مدیریت محصولات</div>
|
||
<div class="app-subtitle" id="headerSubtitle">مدیریت نسخهها و نیازمندیهای محصولات</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<div class="tabs-bar" id="advancedToolbar">
|
||
<div class="toolbar-controls">
|
||
<button class="toolbar-icon-btn" id="sidebarToggle" title="باز/بسته کردن سایدبار">
|
||
<span id="sidebarIcon">✕</span>
|
||
</button>
|
||
<button class="toolbar-icon-btn" id="themeToggle" title="تغییر تم">
|
||
<span id="themeIcon">🌙</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="toolbar-search">
|
||
<span class="search-icon"></span>
|
||
<input type="text" class="search-input" id="toolbarSearch" placeholder="جستجو...">
|
||
</div>
|
||
|
||
<div class="toolbar-filters">
|
||
<div class="filter-dropdown">
|
||
<span class="filter-icon">🏷️</span>
|
||
<select class="filter-select" id="filterType">
|
||
<option value="">همه انواع</option>
|
||
<option value="backend">بکاند</option>
|
||
<option value="frontend">فرانتاند</option>
|
||
<option value="service">میکروسرویس</option>
|
||
<option value="database">پایگاه داده</option>
|
||
<option value="mobile">موبایل</option>
|
||
<option value="infrastructure">زیرساخت</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="filter-dropdown">
|
||
<span class="filter-icon">🌐</span>
|
||
<select class="filter-select" id="filterEnvironment">
|
||
<option value="">همه محیطها</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="toolbar-stats">
|
||
<div class="stat-item">
|
||
<span class="stat-icon">📋</span>
|
||
<span class="stat-label">کل:</span>
|
||
<span class="stat-value" id="statTotal">0</span>
|
||
</div>
|
||
<div class="stat-item">
|
||
<span class="stat-icon">📦</span>
|
||
<span class="stat-label">محصول:</span>
|
||
<span class="stat-value" id="statProjects">0</span>
|
||
</div>
|
||
<div class="stat-item">
|
||
<span class="stat-icon">🌿</span>
|
||
<span class="stat-label">پروژه:</span>
|
||
<span class="stat-value" id="statSubProjects">0</span>
|
||
</div>
|
||
<div class="stat-item">
|
||
<span class="stat-icon"></span>
|
||
<span class="stat-label">وابستگی:</span>
|
||
<span class="stat-value" id="statDependencies">0</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="app-main">
|
||
<aside class="sidebar" id="sidebar">
|
||
<div class="sidebar-header">
|
||
<div class="sidebar-title">🛠️ ابزارها</div>
|
||
</div>
|
||
<div class="sidebar-body" id="sidebarBody"></div>
|
||
</aside>
|
||
|
||
<main class="board-area" id="boardArea">
|
||
<div style="text-align: center; padding: 40px; color: var(--text-muted);">
|
||
<p>برای مشاهده نمودار کهکشانی، از منوی ابزارها گزینه "نمودار کهکشانی" را انتخاب کنید</p>
|
||
</div>
|
||
</main>
|
||
</div>
|
||
|
||
<footer class="app-footer" id="appFooter">
|
||
<div>
|
||
<span class="footer-brand">طراح و توسعهدهنده:</span> هادی خزاعی اصل
|
||
<span style="margin: 0 10px;">|</span>
|
||
<span class="footer-brand">شرکت:</span> رایان پرداز کاوش
|
||
</div>
|
||
<div>
|
||
<span class="footer-brand">نسخه:</span> 1.5.0
|
||
</div>
|
||
</footer>
|
||
|
||
<!-- Galaxy Graph Modal -->
|
||
<div class="modal-overlay" id="galaxyGraphModal">
|
||
<div class="modal modal-xl">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>🌌</span>
|
||
<span>نمودار کهکشانی محصولات</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="galaxy-graph-container"></div>
|
||
<div class="galaxy-legend" id="galaxy-legend"></div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-ghost" data-close-modal>بستن</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="toast-container" id="toastContainer"></div>
|
||
|
||
<script>
|
||
const projectData = {
|
||
projectId: '550e8400-e29b-41d4-a716-446655440000',
|
||
projectName: 'xDependencies',
|
||
projectTitle: 'مدیریت محصولات',
|
||
description: 'مدیریت نسخهها و نیازمندیهای محصولات',
|
||
version: '1.5.0',
|
||
developer: 'هادی خزاعی اصل',
|
||
company: 'رایان پرداز کاوش',
|
||
metadata: {
|
||
createdAt: '2026-09-13T00:00:00Z',
|
||
updatedAt: '2026-09-14T00:00:00Z',
|
||
tags: ['release-management', 'architecture', 'product-management'],
|
||
customFields: {}
|
||
},
|
||
webhook: { url: '', clientId: '', enabled: false },
|
||
toolGroups: [
|
||
{
|
||
id: 'product-management', title: 'محصول', icon: '📦', description: 'مدیریت چرخه حیات محصول',
|
||
tools: [
|
||
{ id: 'product-settings', title: 'تنظیمات', icon: '⚙️', action: 'openProductSettings', shortcut: null, description: 'پیکربندی تنظیمات' },
|
||
{ id: 'save-product', title: 'ذخیره', icon: '💾', action: 'saveProduct', shortcut: null, description: 'دانلود دادههای محصول' },
|
||
{ id: 'load-product', title: 'بارگذاری', icon: '📂', action: 'loadProduct', shortcut: null, description: 'بارگذاری از فایل JSON' },
|
||
{ id: 'clear-all', title: 'پاکسازی', icon: '🗑️', action: 'clearAll', shortcut: null, description: 'پاکسازی کامل همه موارد' },
|
||
],
|
||
},
|
||
{
|
||
id: 'reports', title: 'گزارشها', icon: '📊', description: 'تحلیل و گزارشگیری',
|
||
tools: [
|
||
{ id: 'galaxy-graph', title: 'نمودار کهکشانی', icon: '🌌', action: 'showGalaxyGraph', shortcut: null, description: 'نمایش نمودار کهکشانی محصولات' },
|
||
{ id: 'view-reports', title: 'نمایش گزارشها', icon: '📈', action: 'viewReports', shortcut: null, description: 'آمار کلی محصول' },
|
||
{ id: 'dependency-graph', title: 'نمودار وابستگی', icon: '🕸️', action: 'showDependencyGraph', shortcut: null, description: 'نمایش بصری وابستگیها' },
|
||
],
|
||
},
|
||
],
|
||
appData: {
|
||
environments: [
|
||
{ id: 'env-prod-001', name: 'Production', description: 'محیط عملیاتی اصلی', backgroundColor: '#38a169', textColor: '#ffffff' },
|
||
{ id: 'env-stage-002', name: 'Staging', description: 'محیط پیش از تولید', backgroundColor: '#dd6b20', textColor: '#ffffff' },
|
||
{ id: 'env-dev-003', name: 'Development', description: 'محیط توسعه', backgroundColor: '#3182ce', textColor: '#ffffff' },
|
||
],
|
||
products: [
|
||
{
|
||
id: 'prod-1001', title: 'سامانه فروشگاه آنلاین', description: 'پلتفرم جامع فروش محصولات',
|
||
metadata: { createdAt: '2026-09-01T00:00:00Z', owner: 'تیم توسعه محصول', customFields: {} },
|
||
projects: [
|
||
{ id: 'proj-1001-01', title: 'Backend API Service', description: 'سرویس بکاند اصلی', type: 'backend', dependencies: [] },
|
||
{ id: 'proj-1001-02', title: 'Frontend Web Application', description: 'اپلیکیشن فرانتاند', type: 'frontend', dependencies: ['proj-1001-01'] },
|
||
{ id: 'proj-1001-03', title: 'Payment Gateway Service', description: 'سرویس درگاه پرداخت', type: 'service', dependencies: ['proj-1001-01'] },
|
||
],
|
||
},
|
||
{
|
||
id: 'prod-2001', title: 'سامانه بانکداری اینترنتی', description: 'پلتفرم بانکداری آنلاین',
|
||
metadata: { createdAt: '2026-03-01T00:00:00Z', owner: 'تیم بانکداری دیجیتال', customFields: {} },
|
||
projects: [
|
||
{ id: 'proj-2001-01', title: 'Core Banking API', description: 'API اصلی بانکداری', type: 'backend', dependencies: [] },
|
||
{ id: 'proj-2001-02', title: 'Web Banking Portal', description: 'پورتال وب بانکداری', type: 'frontend', dependencies: ['proj-2001-01'] },
|
||
{ id: 'proj-2001-03', title: 'Authentication Service', description: 'سرویس احراز هویت', type: 'service', dependencies: [] },
|
||
],
|
||
},
|
||
{
|
||
id: 'prod-3001', title: 'سامانه پرونده الکترونیک سلامت', description: 'سیستم مدیریت پرونده پزشکی',
|
||
metadata: { createdAt: '2026-01-10T00:00:00Z', owner: 'تیم سلامت دیجیتال', customFields: {} },
|
||
projects: [
|
||
{ id: 'proj-3001-01', title: 'EHR Backend', description: 'بکاند پرونده سلامت', type: 'backend', dependencies: [] },
|
||
{ id: 'proj-3001-02', title: 'Doctor Portal', description: 'پورتال پزشکان', type: 'frontend', dependencies: ['proj-3001-01'] },
|
||
{ id: 'proj-3001-03', title: 'Patient Mobile App', description: 'اپلیکیشن بیماران', type: 'mobile', dependencies: ['proj-3001-01'] },
|
||
],
|
||
},
|
||
],
|
||
},
|
||
};
|
||
|
||
const VALID_PROJECT_TYPES = [
|
||
{ value: 'backend', label: 'بکاند', icon: '🖥️', color: '#3182ce' },
|
||
{ value: 'frontend', label: 'فرانتاند', icon: '🌐', color: '#38a169' },
|
||
{ value: 'service', label: 'میکروسرویس', icon: '⚙️', color: '#dd6b20' },
|
||
{ value: 'database', label: 'پایگاه داده', icon: '🗄️', color: '#97266d' },
|
||
{ value: 'mobile', label: 'موبایل', icon: '📱', color: '#553c9a' },
|
||
{ value: 'infrastructure', label: 'زیرساخت', icon: '️', color: '#9c4221' }
|
||
];
|
||
|
||
function validateAppDataStructure(data) {
|
||
if (!data || typeof data !== 'object') return false;
|
||
if (!Array.isArray(data.environments)) return false;
|
||
if (!Array.isArray(data.products)) return false;
|
||
return true;
|
||
}
|
||
|
||
const ModalManager = {
|
||
open(id) { const m = document.getElementById(id); if (m) m.classList.add('active'); },
|
||
close(id) { const m = document.getElementById(id); if (m) m.classList.remove('active'); },
|
||
closeAll() { document.querySelectorAll('.modal-overlay.active').forEach(m => m.classList.remove('active')); },
|
||
init() {
|
||
document.querySelectorAll('[data-close-modal]').forEach(btn => {
|
||
btn.addEventListener('click', (e) => {
|
||
e.stopPropagation();
|
||
const modal = e.target.closest('.modal-overlay');
|
||
if (modal) modal.classList.remove('active');
|
||
});
|
||
});
|
||
document.querySelectorAll('.modal-overlay').forEach(overlay => {
|
||
overlay.addEventListener('click', (e) => {
|
||
if (e.target === overlay) overlay.classList.remove('active');
|
||
});
|
||
});
|
||
document.addEventListener('keydown', (e) => {
|
||
if (e.key === 'Escape') this.closeAll();
|
||
});
|
||
}
|
||
};
|
||
|
||
const ToolbarManager = {
|
||
currentFilters: { query: '', typeFilter: '', envFilter: '' },
|
||
init() {
|
||
this.populateEnvironmentFilter();
|
||
this.bindEvents();
|
||
this.updateStats();
|
||
},
|
||
populateEnvironmentFilter() {
|
||
const select = document.getElementById('filterEnvironment');
|
||
if (!select) return;
|
||
const envs = projectData.appData.environments || [];
|
||
select.innerHTML = '<option value="">همه محیطها</option>' +
|
||
envs.map(e => `<option value="${e.id}">${e.name}</option>`).join('');
|
||
},
|
||
bindEvents() {
|
||
const searchInput = document.getElementById('toolbarSearch');
|
||
const filterType = document.getElementById('filterType');
|
||
const filterEnv = document.getElementById('filterEnvironment');
|
||
if (searchInput) searchInput.addEventListener('input', () => { this.applyFilters(); });
|
||
if (filterType) filterType.addEventListener('change', () => { this.applyFilters(); });
|
||
if (filterEnv) filterEnv.addEventListener('change', () => { this.applyFilters(); });
|
||
},
|
||
applyFilters() {
|
||
this.currentFilters = {
|
||
query: (document.getElementById('toolbarSearch')?.value || '').trim().toLowerCase(),
|
||
typeFilter: document.getElementById('filterType')?.value || '',
|
||
envFilter: document.getElementById('filterEnvironment')?.value || ''
|
||
};
|
||
this.updateStats();
|
||
},
|
||
updateStats() {
|
||
const products = projectData.appData.products || [];
|
||
let totalProjects = 0;
|
||
let totalDeps = 0;
|
||
products.forEach(p => {
|
||
const projects = p.projects || [];
|
||
projects.forEach(pr => {
|
||
totalProjects++;
|
||
totalDeps += (pr.dependencies || []).length;
|
||
});
|
||
});
|
||
const set = (id, val) => { const el = document.getElementById(id); if (el) el.textContent = val; };
|
||
set('statTotal', products.length + totalProjects);
|
||
set('statProjects', products.length);
|
||
set('statSubProjects', totalProjects);
|
||
set('statDependencies', totalDeps);
|
||
}
|
||
};
|
||
|
||
const ActionRegistry = {
|
||
openProductSettings() { openSettingsModal(); },
|
||
saveProduct() {
|
||
projectData.metadata.updatedAt = new Date().toISOString();
|
||
const jsonString = JSON.stringify(projectData.appData, null, 2);
|
||
const blob = new Blob([jsonString], { type: 'application/json;charset=utf-8' });
|
||
const url = URL.createObjectURL(blob);
|
||
const a = document.createElement('a');
|
||
a.href = url;
|
||
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
||
a.download = `${projectData.projectName}_v${projectData.version}_${timestamp}.json`;
|
||
document.body.appendChild(a); a.click(); document.body.removeChild(a);
|
||
URL.revokeObjectURL(url);
|
||
showToast(` دادههای محصول دانلود شد`, 'success', 4000);
|
||
},
|
||
loadProduct() {
|
||
const input = document.createElement('input');
|
||
input.type = 'file'; input.accept = '.json,application/json';
|
||
input.addEventListener('change', (e) => {
|
||
const file = e.target.files[0];
|
||
if (!file) return;
|
||
const reader = new FileReader();
|
||
reader.onload = (ev) => {
|
||
try {
|
||
const loaded = JSON.parse(ev.target.result);
|
||
if (!validateAppDataStructure(loaded)) return showToast('❌ ساختار فایل نامعتبر است', 'error', 5000);
|
||
projectData.appData = loaded;
|
||
projectData.metadata.updatedAt = new Date().toISOString();
|
||
updateProductUI();
|
||
renderToolGroups();
|
||
ToolbarManager.populateEnvironmentFilter();
|
||
ToolbarManager.updateStats();
|
||
showToast(` محصول بارگذاری شد`, 'success', 4000);
|
||
} catch (err) { showToast('❌ خطا در خواندن فایل: ' + err.message, 'error', 5000); }
|
||
};
|
||
reader.readAsText(file);
|
||
});
|
||
input.click();
|
||
},
|
||
clearAll() {
|
||
if (!confirm('⚠️ هشدار: آیا از پاکسازی کامل همه موارد اطمینان دارید؟\n\nاین عمل غیرقابل بازگشت است!')) return;
|
||
if (!confirm('️ تأیید نهایی: تمام دادهها حذف خواهند شد. آیا مطمئن هستید؟')) return;
|
||
projectData.appData = { environments: [], products: [] };
|
||
ToolbarManager.populateEnvironmentFilter();
|
||
ToolbarManager.updateStats();
|
||
showToast('️ تمام موارد با موفقیت پاکسازی شدند', 'success', 4000);
|
||
},
|
||
showGalaxyGraph() { showGalaxyGraphModal(); },
|
||
viewReports() {
|
||
const p = projectData.appData.products.length;
|
||
const s = projectData.appData.products.reduce((x, p) => x + p.projects.length, 0);
|
||
const e = projectData.appData.environments.length;
|
||
showToast(`📊 محصولات: ${p} | پروژهها: ${s} | محیطها: ${e}`, 'info', 5000);
|
||
},
|
||
showDependencyGraph() { showToast(`🕸️ نمودار وابستگی...`, 'info', 3000); },
|
||
defaultAction(tool) { showToast(`ابزار: ${tool.title}`, 'info', 3000); }
|
||
};
|
||
|
||
function showToast(message, type = 'info', duration = 3000) {
|
||
const container = document.getElementById('toastContainer');
|
||
const toast = document.createElement('div');
|
||
toast.className = `toast ${type}`;
|
||
const icons = { success: '✅', error: '❌', warning: '⚠️', info: 'ℹ️' };
|
||
toast.innerHTML = `<span>${icons[type] || 'ℹ️'}</span><span>${message}</span>`;
|
||
container.appendChild(toast);
|
||
setTimeout(() => {
|
||
toast.style.transition = 'opacity 0.3s, transform 0.3s';
|
||
toast.style.opacity = '0';
|
||
toast.style.transform = 'translateX(-30px)';
|
||
setTimeout(() => toast.remove(), 300);
|
||
}, duration);
|
||
}
|
||
|
||
// Galaxy Graph Implementation
|
||
function showGalaxyGraphModal() {
|
||
ModalManager.open('galaxyGraphModal');
|
||
setTimeout(() => {
|
||
renderGalaxyGraph();
|
||
}, 100);
|
||
}
|
||
|
||
function renderGalaxyGraph() {
|
||
const container = document.getElementById('galaxy-graph-container');
|
||
container.innerHTML = '';
|
||
|
||
const width = container.clientWidth;
|
||
const height = container.clientHeight;
|
||
|
||
// Prepare data
|
||
const nodes = [];
|
||
const links = [];
|
||
const nodeMap = new Map();
|
||
|
||
// Add product nodes (center of galaxies)
|
||
projectData.appData.products.forEach((product, index) => {
|
||
const angle = (index / projectData.appData.products.length) * 2 * Math.PI;
|
||
const radius = Math.min(width, height) * 0.25;
|
||
const x = width / 2 + radius * Math.cos(angle);
|
||
const y = height / 2 + radius * Math.sin(angle);
|
||
|
||
const node = {
|
||
id: product.id,
|
||
name: product.title,
|
||
type: 'product',
|
||
description: product.description,
|
||
projectCount: (product.projects || []).length,
|
||
x: x,
|
||
y: y,
|
||
radius: 30
|
||
};
|
||
|
||
nodes.push(node);
|
||
nodeMap.set(product.id, node);
|
||
|
||
// Add project nodes (orbiting around product)
|
||
(product.projects || []).forEach((project, projIndex) => {
|
||
const projAngle = (projIndex / Math.max(product.projects.length, 1)) * 2 * Math.PI + angle;
|
||
const projRadius = 120;
|
||
const px = x + projRadius * Math.cos(projAngle);
|
||
const py = y + projRadius * Math.sin(projAngle);
|
||
|
||
const typeInfo = VALID_PROJECT_TYPES.find(t => t.value === project.type);
|
||
|
||
const projNode = {
|
||
id: project.id,
|
||
name: project.title,
|
||
type: 'project',
|
||
projectType: project.type,
|
||
description: project.description,
|
||
product: product.title,
|
||
x: px,
|
||
y: py,
|
||
radius: 15,
|
||
color: typeInfo?.color || '#718096'
|
||
};
|
||
|
||
nodes.push(projNode);
|
||
nodeMap.set(project.id, projNode);
|
||
|
||
// Create link between product and project
|
||
links.push({
|
||
source: product.id,
|
||
target: project.id,
|
||
value: 1
|
||
});
|
||
});
|
||
});
|
||
|
||
// Create SVG
|
||
const svg = d3.select('#galaxy-graph-container')
|
||
.append('svg')
|
||
.attr('width', '100%')
|
||
.attr('height', '100%')
|
||
.attr('viewBox', [0, 0, width, height]);
|
||
|
||
// Add zoom behavior
|
||
const g = svg.append('g');
|
||
svg.call(d3.zoom()
|
||
.extent([[0, 0], [width, height]])
|
||
.scaleExtent([0.1, 4])
|
||
.on('zoom', (event) => g.attr('transform', event.transform)));
|
||
|
||
// Add glow filter
|
||
const defs = svg.append('defs');
|
||
const filter = defs.append('filter')
|
||
.attr('id', 'glow');
|
||
filter.append('feGaussianBlur')
|
||
.attr('stdDeviation', '3')
|
||
.attr('result', 'coloredBlur');
|
||
const feMerge = filter.append('feMerge');
|
||
feMerge.append('feMergeNode').attr('in', 'coloredBlur');
|
||
feMerge.append('feMergeNode').attr('in', 'SourceGraphic');
|
||
|
||
// Add links
|
||
const link = g.append('g')
|
||
.attr('class', 'galaxy-links')
|
||
.selectAll('line')
|
||
.data(links)
|
||
.join('line')
|
||
.attr('class', 'galaxy-link')
|
||
.attr('stroke', '#666')
|
||
.attr('stroke-width', 1.5)
|
||
.attr('stroke-opacity', 0.4);
|
||
|
||
// Add nodes
|
||
const node = g.append('g')
|
||
.attr('class', 'galaxy-nodes')
|
||
.selectAll('circle')
|
||
.data(nodes)
|
||
.join('circle')
|
||
.attr('class', 'galaxy-node')
|
||
.attr('r', d => d.radius)
|
||
.attr('fill', d => d.type === 'product' ? '#c9a961' : d.color)
|
||
.attr('stroke', '#fff')
|
||
.attr('stroke-width', 2)
|
||
.attr('filter', 'url(#glow)')
|
||
.call(drag(simulation));
|
||
|
||
// Add labels
|
||
const labels = g.append('g')
|
||
.attr('class', 'galaxy-labels')
|
||
.selectAll('text')
|
||
.data(nodes)
|
||
.join('text')
|
||
.attr('x', d => d.x)
|
||
.attr('y', d => d.y + d.radius + 15)
|
||
.attr('text-anchor', 'middle')
|
||
.text(d => d.name)
|
||
.style('font-size', d => d.type === 'product' ? '12px' : '10px')
|
||
.style('fill', 'white')
|
||
.style('font-weight', d => d.type === 'product' ? 'bold' : 'normal')
|
||
.style('pointer-events', 'none');
|
||
|
||
// Force simulation
|
||
const simulation = d3.forceSimulation(nodes)
|
||
.force('link', d3.forceLink(links).id(d => d.id).distance(100))
|
||
.force('charge', d3.forceManyBody().strength(-200))
|
||
.force('center', d3.forceCenter(width / 2, height / 2))
|
||
.force('collision', d3.forceCollide().radius(d => d.radius + 10));
|
||
|
||
// Update positions on tick
|
||
simulation.on('tick', () => {
|
||
link
|
||
.attr('x1', d => d.source.x)
|
||
.attr('y1', d => d.source.y)
|
||
.attr('x2', d => d.target.x)
|
||
.attr('y2', d => d.target.y);
|
||
|
||
node
|
||
.attr('cx', d => d.x)
|
||
.attr('cy', d => d.y);
|
||
|
||
labels
|
||
.attr('x', d => d.x)
|
||
.attr('y', d => d.y + d.radius + 15);
|
||
});
|
||
|
||
// Drag behavior
|
||
function drag(simulation) {
|
||
function dragstarted(event, d) {
|
||
if (!event.active) simulation.alphaTarget(0.3).restart();
|
||
d.fx = d.x;
|
||
d.fy = d.y;
|
||
}
|
||
|
||
function dragged(event, d) {
|
||
d.fx = event.x;
|
||
d.fy = event.y;
|
||
}
|
||
|
||
function dragended(event, d) {
|
||
if (!event.active) simulation.alphaTarget(0);
|
||
d.fx = null;
|
||
d.fy = null;
|
||
}
|
||
|
||
return d3.drag()
|
||
.on('start', dragstarted)
|
||
.on('drag', dragged)
|
||
.on('end', dragended);
|
||
}
|
||
|
||
// Tooltip
|
||
const tooltip = d3.select('#galaxy-graph-container')
|
||
.append('div')
|
||
.attr('class', 'galaxy-tooltip');
|
||
|
||
node.on('mouseover', (event, d) => {
|
||
tooltip.transition().duration(200).style('opacity', 1);
|
||
let html = `<strong>${d.name}</strong><br/>`;
|
||
if (d.type === 'product') {
|
||
html += `تعداد پروژهها: ${d.projectCount}<br/>`;
|
||
} else {
|
||
html += `نوع: ${d.projectType}<br/>`;
|
||
html += `محصول: ${d.product}<br/>`;
|
||
}
|
||
if (d.description) {
|
||
html += `${d.description}`;
|
||
}
|
||
tooltip.html(html)
|
||
.style('left', (event.pageX + 10) + 'px')
|
||
.style('top', (event.pageY - 28) + 'px');
|
||
})
|
||
.on('mouseout', () => {
|
||
tooltip.transition().duration(500).style('opacity', 0);
|
||
});
|
||
|
||
// Legend
|
||
const legend = d3.select('#galaxy-legend');
|
||
legend.html('<strong>راهنما:</strong><br/>');
|
||
|
||
VALID_PROJECT_TYPES.forEach(type => {
|
||
legend.append('div')
|
||
.attr('class', 'galaxy-legend-item')
|
||
.html(`<div class="galaxy-legend-color" style="background: ${type.color};"></div><span>${type.label}</span>`);
|
||
});
|
||
|
||
legend.append('div')
|
||
.attr('class', 'galaxy-legend-item')
|
||
.html(`<div class="galaxy-legend-color" style="background: #c9a961;"></div><span>محصول</span>`);
|
||
}
|
||
|
||
function openSettingsModal() {
|
||
ModalManager.open('settingsModal');
|
||
}
|
||
|
||
function updateProductUI() {
|
||
document.title = projectData.projectTitle;
|
||
document.getElementById('headerTitle').textContent = projectData.projectTitle;
|
||
document.getElementById('headerSubtitle').textContent = projectData.description;
|
||
document.getElementById('appFooter').innerHTML = `
|
||
<div>
|
||
<span class="footer-brand">طراح و توسعهدهنده:</span> ${projectData.developer}
|
||
<span style="margin: 0 10px;">|</span>
|
||
<span class="footer-brand">شرکت:</span> ${projectData.company}
|
||
</div>
|
||
<div><span class="footer-brand">نسخه:</span> ${projectData.version}</div>
|
||
`;
|
||
}
|
||
|
||
const sidebarToggle = document.getElementById('sidebarToggle');
|
||
const sidebar = document.getElementById('sidebar');
|
||
const sidebarIcon = document.getElementById('sidebarIcon');
|
||
function updateSidebarIcon() { if (!sidebarIcon) return; sidebarIcon.textContent = sidebar.classList.contains('collapsed') ? '☰' : '✕'; }
|
||
if (sidebarToggle) { sidebarToggle.addEventListener('click', () => { sidebar.classList.toggle('collapsed'); updateSidebarIcon(); }); }
|
||
updateSidebarIcon();
|
||
|
||
const sidebarBody = document.getElementById('sidebarBody');
|
||
function renderToolGroups() {
|
||
sidebarBody.innerHTML = '';
|
||
projectData.toolGroups.forEach(group => {
|
||
const groupEl = document.createElement('div');
|
||
groupEl.className = 'sidebar-group';
|
||
const headerEl = document.createElement('div');
|
||
headerEl.className = 'sidebar-group-header';
|
||
if (group.description) headerEl.setAttribute('data-tooltip', group.description);
|
||
headerEl.innerHTML = `<div class="group-icon"><span>${group.icon || ''}</span><span>${group.title}</span></div><span class="group-arrow">▼</span>`;
|
||
const bodyEl = document.createElement('div');
|
||
bodyEl.className = 'sidebar-group-body';
|
||
group.tools.forEach(tool => {
|
||
const btn = document.createElement('button');
|
||
btn.className = 'sidebar-btn';
|
||
btn.title = tool.description;
|
||
btn.innerHTML = `<span class="btn-icon-emoji">${tool.icon || '🔧'}</span><span class="btn-title">${tool.title}</span>`;
|
||
btn.addEventListener('click', () => {
|
||
const actionHandler = ActionRegistry[tool.action] || ActionRegistry.defaultAction;
|
||
actionHandler();
|
||
});
|
||
bodyEl.appendChild(btn);
|
||
});
|
||
headerEl.addEventListener('click', () => groupEl.classList.toggle('collapsed'));
|
||
groupEl.appendChild(headerEl);
|
||
groupEl.appendChild(bodyEl);
|
||
sidebarBody.appendChild(groupEl);
|
||
});
|
||
}
|
||
|
||
document.addEventListener('keydown', (e) => {
|
||
if (!(e.ctrlKey || e.metaKey)) return;
|
||
const key = e.key.toLowerCase();
|
||
for (const group of projectData.toolGroups) {
|
||
const tool = group.tools.find(t => t.shortcut && t.shortcut.toLowerCase().replace('ctrl+', '') === key);
|
||
if (tool) { e.preventDefault(); break; }
|
||
}
|
||
});
|
||
|
||
ModalManager.init();
|
||
renderToolGroups();
|
||
updateProductUI();
|
||
ToolbarManager.init();
|
||
setTimeout(() => showToast(`${projectData.projectTitle} (نسخه ${projectData.version}) آماده است`, 'success'), 500);
|
||
</script>
|
||
</body>
|
||
</html> |