Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# web
www
# Flowchart Project Manager

A tiny web application for building project plans as a flowchart. Add tasks and define dependencies to visualize how work flows through a project.

## Usage

Open `index.html` in a web browser. Use the form to enter a task name and optionally choose a dependency. Each submission updates the flowchart diagram displayed below the form.
25 changes: 25 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Flowchart Project Manager</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script defer src="script.js"></script>
</head>
<body>
<h1>Flowchart Project Manager</h1>
<form id="task-form">
<input type="text" id="task-name" placeholder="Task name" required>
<select id="task-dependency">
<option value="">No dependency</option>
</select>
<button type="submit">Add Task</button>
</form>
<div id="chart">
<div class="mermaid" id="mermaid-diagram"></div>
</div>
<script>
mermaid.initialize({ startOnLoad: false });
</script>
</body>
</html>
46 changes: 46 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const tasks = [];
const dependencies = [];

const form = document.getElementById('task-form');
const nameInput = document.getElementById('task-name');
const depSelect = document.getElementById('task-dependency');
const diagramEl = document.getElementById('mermaid-diagram');

function sanitize(name) {
return name.replace(/\s+/g, '_');
}

form.addEventListener('submit', (e) => {
e.preventDefault();
const name = nameInput.value.trim();
if (!name) return;

const id = sanitize(name);
tasks.push({ id, name });
const dep = depSelect.value;
if (dep) dependencies.push({ from: dep, to: id });

// update dependency dropdown
const option = document.createElement('option');
option.value = id;
option.textContent = name;
depSelect.appendChild(option);

nameInput.value = '';
depSelect.value = '';
renderChart();
});

function renderChart() {
let def = 'flowchart TD\n';
tasks.forEach(t => {
def += `${t.id}[${t.name}]\n`;
});
dependencies.forEach(d => {
def += `${d.from}-->${d.to}\n`;
});
diagramEl.innerHTML = def;
mermaid.init(undefined, diagramEl);
}

renderChart();