mirror of
https://github.com/sotam0316/drawNET.git
synced 2026-04-25 03:58:37 +09:00
Initial commit: drawNET Alpha v1.0 - Professional Topology Designer with Full i18n and Performance Optimizations
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { state } from '../state.js';
|
||||
import { markDirty } from '../persistence.js';
|
||||
import { t } from '../i18n.js';
|
||||
|
||||
/**
|
||||
* ui/header.js - Logic for the application header (Project Name, Search, etc.)
|
||||
*/
|
||||
export function initHeader() {
|
||||
const titleEl = document.getElementById('project-title');
|
||||
if (!titleEl) return;
|
||||
|
||||
// Set initial title from state
|
||||
titleEl.innerText = state.projectName || t('untitled_project');
|
||||
|
||||
// Direct editing by clicking
|
||||
titleEl.addEventListener('click', () => {
|
||||
const currentName = state.projectName || titleEl.innerText;
|
||||
const newName = prompt(t('rename_project_prompt'), currentName);
|
||||
|
||||
if (newName && newName.trim() !== "" && newName !== currentName) {
|
||||
state.projectName = newName.trim();
|
||||
titleEl.innerText = state.projectName;
|
||||
markDirty();
|
||||
|
||||
// Log for context
|
||||
console.log(`Project renamed to: ${state.projectName}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Hover effect class (optional, but good for UX)
|
||||
titleEl.style.cursor = 'pointer';
|
||||
titleEl.title = t('rename_project_tooltip');
|
||||
}
|
||||
Reference in New Issue
Block a user