dashboard.html/login.html updated
This commit is contained in:
+326
-18
@@ -12,7 +12,7 @@ Organization : OptiHK Limited
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>mxPIC EDA Dashboard</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&family=Varela+Round&family=Inter:wght@400;500&display=swap" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
:root {
|
||||
@@ -42,12 +42,12 @@ Organization : OptiHK Limited
|
||||
--bg-panel: #eef4fa;
|
||||
--text-main: #142235;
|
||||
--text-muted: #5f7085;
|
||||
--accent: #1d4ed8;
|
||||
--accent-hover: #0f766e;
|
||||
--accent: #3b82f6;
|
||||
--accent-hover: #06b6d4;
|
||||
--accent-green: #15803d;
|
||||
--accent-warm: #b45309;
|
||||
--border: #d6e0eb;
|
||||
--border-strong: #b6c4d4;
|
||||
--border: #b8c5d4;
|
||||
--border-strong: #8fa2b8;
|
||||
--panel-soft: #f8fafc;
|
||||
--folder-icon: #38bdf8;
|
||||
--shadow: rgba(37, 99, 235, 0.1);
|
||||
@@ -173,7 +173,6 @@ Organization : OptiHK Limited
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.theme-toggle,
|
||||
.logout-btn,
|
||||
.secondary-btn,
|
||||
.profile-action,
|
||||
@@ -196,7 +195,80 @@ Organization : OptiHK Limited
|
||||
}
|
||||
|
||||
.theme-toggle {
|
||||
min-width: 92px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 78px;
|
||||
height: 34px;
|
||||
padding: 0 7px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
background: var(--panel-soft);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
transition: border-color 0.2s ease, background 0.2s ease;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.theme-toggle .toggle-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
font-size: 21px;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
transition: color 180ms ease, text-shadow 180ms ease;
|
||||
color: var(--text-muted);
|
||||
line-height: 1;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.theme-toggle-thumb {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
width: calc(50% - 3px);
|
||||
height: calc(100% - 4px);
|
||||
border-radius: 999px;
|
||||
background: var(--accent);
|
||||
transition: left 280ms cubic-bezier(0.16, 1, 0.3, 1);
|
||||
z-index: 0;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
|
||||
pointer-events: none;
|
||||
}
|
||||
.theme-toggle[data-theme="dark"] .theme-toggle-thumb {
|
||||
left: calc(50% + 1px);
|
||||
}
|
||||
.theme-toggle[data-theme="bright"] .theme-toggle-thumb {
|
||||
left: 2px;
|
||||
}
|
||||
.theme-toggle[data-theme="dark"] .toggle-moon {
|
||||
color: #ffffff;
|
||||
text-shadow: 0 0 8px rgba(96, 165, 250, 0.6);
|
||||
}
|
||||
.theme-toggle[data-theme="bright"] .toggle-sun {
|
||||
color: #ffffff;
|
||||
text-shadow: 0 0 8px rgba(250, 204, 21, 0.6);
|
||||
}
|
||||
.back-btn {
|
||||
border: 1px solid var(--border);
|
||||
background: var(--panel-soft);
|
||||
color: var(--text-muted);
|
||||
border-radius: 8px;
|
||||
min-height: 36px;
|
||||
padding: 0 12px;
|
||||
cursor: pointer;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
font-size: 0.85rem;
|
||||
transition: border-color 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
.back-btn:hover {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.logout-btn:hover,
|
||||
@@ -209,9 +281,9 @@ Organization : OptiHK Limited
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 1320px;
|
||||
max-width: 1550px;
|
||||
margin: 0 auto;
|
||||
padding: 34px 16px 30px;
|
||||
padding: 34px 8px 30px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
@@ -291,7 +363,7 @@ Organization : OptiHK Limited
|
||||
|
||||
.dashboard-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 300px;
|
||||
grid-template-columns: minmax(0, 1fr) 420px;
|
||||
gap: 18px;
|
||||
align-items: start;
|
||||
}
|
||||
@@ -318,11 +390,91 @@ Organization : OptiHK Limited
|
||||
.panel-title {
|
||||
margin: 0;
|
||||
font-size: 0.86rem;
|
||||
font-family: 'IBM Plex Mono', Consolas, monospace;
|
||||
font-family: 'Varela Round', sans-serif;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
color: #ffffff;
|
||||
}
|
||||
body.light-mode .panel-title {
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.expand-btn {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--panel-soft);
|
||||
color: var(--text-muted);
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.expand-btn:hover {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.panel.activity-expanded {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: min(68vw, 860px);
|
||||
max-height: 72vh;
|
||||
z-index: 101;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
|
||||
var(--bg-elevated);
|
||||
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.activity-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
backdrop-filter: blur(4px);
|
||||
display: none;
|
||||
}
|
||||
|
||||
.activity-backdrop.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body.light-mode .activity-backdrop {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.panel.activity-expanded .panel-body {
|
||||
overflow: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.panel.activity-expanded .activity-list {
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.panel.activity-expanded .expand-btn {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
background: rgba(45, 212, 191, 0.1);
|
||||
}
|
||||
|
||||
body.light-mode .panel.activity-expanded {
|
||||
background:
|
||||
linear-gradient(180deg, rgba(0, 0, 0, 0.02), transparent),
|
||||
var(--bg-elevated);
|
||||
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.panel-body {
|
||||
@@ -420,6 +572,55 @@ Organization : OptiHK Limited
|
||||
font-size: 0.8rem;
|
||||
margin-top: 2px;
|
||||
}
|
||||
body.light-mode .project-subtitle {
|
||||
}
|
||||
|
||||
.edit-project-btn {
|
||||
display: none;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 5px;
|
||||
background: var(--panel-soft);
|
||||
color: var(--text-muted);
|
||||
font-size: 0.95rem;
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
transition: border-color 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
|
||||
.project-card:hover .edit-project-btn {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.edit-project-btn:hover {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.project-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.project-name-input-inline {
|
||||
display: block;
|
||||
font-weight: 700;
|
||||
font-size: inherit;
|
||||
font-family: inherit;
|
||||
color: var(--text-main);
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--accent);
|
||||
border-radius: 4px;
|
||||
padding: 2px 6px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.project-chips {
|
||||
display: flex;
|
||||
@@ -505,7 +706,7 @@ Organization : OptiHK Limited
|
||||
|
||||
.profile-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
@@ -567,6 +768,7 @@ Organization : OptiHK Limited
|
||||
|
||||
.activity-message {
|
||||
color: var(--text-main);
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-size: 0.88rem;
|
||||
line-height: 1.42;
|
||||
overflow-wrap: anywhere;
|
||||
@@ -727,7 +929,7 @@ Organization : OptiHK Limited
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 26px 16px 24px;
|
||||
padding: 26px 8px 24px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
@@ -766,14 +968,18 @@ Organization : OptiHK Limited
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="light-mode">
|
||||
<header>
|
||||
<div class="brand">
|
||||
<div class="brand-mark" aria-hidden="true"></div>
|
||||
MxPic - by <span class="company-wordmark">Opti<span class="company-hk">HK</span></span>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button class="theme-toggle" id="theme-toggle" type="button" aria-label="Switch color theme">Light mode</button>
|
||||
<button class="theme-toggle" id="theme-toggle" type="button" data-theme="bright" aria-label="Toggle color mode" title="Toggle dark/light mode">
|
||||
<span class="theme-toggle-thumb"></span>
|
||||
<span class="toggle-icon toggle-sun">☼</span>
|
||||
<span class="toggle-icon toggle-moon">☾</span>
|
||||
</button>
|
||||
<a href="/logout" class="logout-btn">Logout</a>
|
||||
</div>
|
||||
</header>
|
||||
@@ -845,6 +1051,7 @@ Organization : OptiHK Limited
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2 class="panel-title">Recent Activity</h2>
|
||||
<button class="expand-btn" id="expand-activity" type="button" title="Expand" aria-label="Expand activity panel">↖</button>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="activity-list" id="activity-list" aria-live="polite">
|
||||
@@ -856,6 +1063,7 @@ Organization : OptiHK Limited
|
||||
</div>
|
||||
</section>
|
||||
</aside>
|
||||
<div class="activity-backdrop" id="activity-backdrop" aria-hidden="true"></div>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
@@ -949,7 +1157,7 @@ Organization : OptiHK Limited
|
||||
function applyTheme(mode) {
|
||||
const isLight = mode === 'light';
|
||||
document.body.classList.toggle('light-mode', isLight);
|
||||
themeToggle.textContent = isLight ? 'Dark mode' : 'Light mode';
|
||||
themeToggle.setAttribute('data-theme', isLight ? 'bright' : 'dark');
|
||||
localStorage.setItem('mxpic-theme', mode);
|
||||
}
|
||||
|
||||
@@ -1046,6 +1254,63 @@ Organization : OptiHK Limited
|
||||
window.location.href = `/canvas?project=${encodeURIComponent(name)}`;
|
||||
}
|
||||
|
||||
function startRenameProject(oldName, nameRow, editBtn) {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'text';
|
||||
input.className = 'project-name-input-inline';
|
||||
input.value = oldName;
|
||||
input.spellcheck = false;
|
||||
|
||||
const currentSpan = nameRow.querySelector('.project-name');
|
||||
if (currentSpan) currentSpan.replaceWith(input);
|
||||
editBtn.style.display = 'none';
|
||||
input.focus();
|
||||
input.select();
|
||||
|
||||
const finishRename = async () => {
|
||||
if (!input.parentNode) return;
|
||||
const newName = input.value.trim();
|
||||
if (!newName || newName === oldName) {
|
||||
cancelRename();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const response = await fetch(`/api/projects/${encodeURIComponent(oldName)}/rename`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name: newName })
|
||||
});
|
||||
const data = await response.json();
|
||||
if (!response.ok) {
|
||||
addActivity(data.error || 'Failed to rename project.', 'error');
|
||||
cancelRename();
|
||||
return;
|
||||
}
|
||||
addActivity(`Renamed project "${oldName}" to "${data.name}"`, 'success');
|
||||
loadProjects();
|
||||
} catch {
|
||||
addActivity('Failed to rename project.', 'error');
|
||||
cancelRename();
|
||||
}
|
||||
};
|
||||
|
||||
const cancelRename = () => {
|
||||
if (input.parentNode) {
|
||||
const restored = document.createElement('span');
|
||||
restored.className = 'project-name';
|
||||
restored.textContent = oldName;
|
||||
input.replaceWith(restored);
|
||||
}
|
||||
editBtn.style.display = 'inline-flex';
|
||||
};
|
||||
|
||||
input.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') { e.preventDefault(); finishRename(); }
|
||||
if (e.key === 'Escape') { e.preventDefault(); cancelRename(); }
|
||||
});
|
||||
input.addEventListener('blur', () => finishRename());
|
||||
}
|
||||
|
||||
async function loadActivity() {
|
||||
try {
|
||||
const response = await fetch('/api/logs?limit=8');
|
||||
@@ -1155,15 +1420,33 @@ Organization : OptiHK Limited
|
||||
icon.setAttribute('aria-hidden', 'true');
|
||||
|
||||
const details = document.createElement('div');
|
||||
details.style.minWidth = '0';
|
||||
details.style.flex = '1';
|
||||
|
||||
const nameRow = document.createElement('div');
|
||||
nameRow.className = 'project-name-row';
|
||||
|
||||
const name = document.createElement('span');
|
||||
name.className = 'project-name';
|
||||
name.textContent = project.name;
|
||||
|
||||
const editBtn = document.createElement('button');
|
||||
editBtn.className = 'edit-project-btn';
|
||||
editBtn.type = 'button';
|
||||
editBtn.textContent = '🖊';
|
||||
editBtn.title = 'Rename project';
|
||||
editBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
startRenameProject(project.name, nameRow, editBtn);
|
||||
});
|
||||
|
||||
nameRow.append(name, editBtn);
|
||||
|
||||
const subtitle = document.createElement('div');
|
||||
subtitle.className = 'project-subtitle';
|
||||
subtitle.textContent = 'Photonic layout project';
|
||||
|
||||
details.append(name, subtitle);
|
||||
details.append(nameRow, subtitle);
|
||||
top.append(icon, details);
|
||||
|
||||
const chips = document.createElement('div');
|
||||
@@ -1393,7 +1676,31 @@ Organization : OptiHK Limited
|
||||
applyTheme(document.body.classList.contains('light-mode') ? 'dark' : 'light');
|
||||
});
|
||||
|
||||
applyTheme(localStorage.getItem('mxpic-theme') || 'dark');
|
||||
const expandActivityBtn = document.getElementById('expand-activity');
|
||||
const activityBackdrop = document.getElementById('activity-backdrop');
|
||||
if (expandActivityBtn && activityBackdrop) {
|
||||
expandActivityBtn.addEventListener('click', () => {
|
||||
const panel = expandActivityBtn.closest('.panel');
|
||||
if (panel) {
|
||||
const expanded = !panel.classList.contains('activity-expanded');
|
||||
panel.classList.toggle('activity-expanded', expanded);
|
||||
activityBackdrop.classList.toggle('active', expanded);
|
||||
expandActivityBtn.textContent = expanded ? '↘' : '↖';
|
||||
activityBackdrop.setAttribute('aria-hidden', expanded ? 'false' : 'true');
|
||||
}
|
||||
});
|
||||
activityBackdrop.addEventListener('click', () => {
|
||||
const panel = document.querySelector('.panel.activity-expanded');
|
||||
if (panel) {
|
||||
panel.classList.remove('activity-expanded');
|
||||
activityBackdrop.classList.remove('active');
|
||||
expandActivityBtn.textContent = '↖';
|
||||
activityBackdrop.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
applyTheme(localStorage.getItem('mxpic-theme') || 'light');
|
||||
loadTechnologies();
|
||||
loadProfile();
|
||||
loadProjects();
|
||||
@@ -1402,3 +1709,4 @@ Organization : OptiHK Limited
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user