Build a committee workflows board.
- User
Build a committee workflows board.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Build a committee workflows board.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
1. Understand the Goal: The user wants a "Committee Workflows Board." This is a specific type of project management or organizational tool used to track the progress of tasks, decisions, or proposals within a committee setting.
2. Identify Key Features & Requirements:
3. Determine the Approach: I will build a single-page application (SPA) prototype.
4. Drafting the Design (Mental Mockup):
5. Step-by-Step Implementation Plan:
6. Refinement & Code Construction (Self-Correction during the process):
dragstart, dragover, drop, and dragend events correctly to update the underlying data model, not just move the DOM element.7. Finalizing the Code Structure:
state object to hold tasks.render() function.drag functions.modal functions.8. Writing the Code (Mental Draft & Refinement):
9. Final Review of the Output: Does it meet the prompt? Yes. Is it functional? Yes (Drag & Drop works). Is it readable? Yes, code is commented.
10. Constructing the Explanation: Explain how to run it (save as .html), how it works (drag/drop, add items), and suggest future enhancements (backend integration, persistence).
(Self-Correction during code generation): I initially forgot to add a way to distinguish user avatars. I'll add a simple function to generate a consistent color based on the name string so it looks nice. I also need to make sure the "Add Task" button actually works to demonstrate the workflow starting.
Let's generate the code. I will create a modern, interactive Committee Workflows Board using HTML, Tailwind CSS, and Vanilla JavaScript.
Features included:
You can save the following code as an .html file (e.g., committee-board.html) and open it in any browser.
index.html.tasks array and a columns definition. This makes it easy to later hook up to a real database.flex and overflow-x-auto, meaning on mobile devices you can scroll the board horizontally.<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Committee Workflows Board</title>
<!-- Tailwind CSS for styling -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Lucide Icons for UI elements -->
<script src="https://unpkg.com/lucide@latest"></script>
<style>
/* Custom smooth scrolling and drag styles */
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.task-card { transition: transform 0.2s, box-shadow 0.2s; }
.task-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.dragging { opacity: 0.5; transform: rotate(3deg); }
.column-drop-zone { min-height: 400px; transition: background-color 0.2s; }
.drag-over { background-color: rgba(226, 232, 240, 0.5); border: 2px dashed #94a3b8; }
</style>
</head>
<body class="bg-slate-100 text-slate-800 min-h-screen">
<!-- Header -->
<header class="bg-white border-b border-slate-200 shadow-sm sticky top-0 z-40">
<div class="container mx-auto px-6 py-4 flex justify-between items-center">
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-indigo-600 rounded-lg flex items-center justify-center text-white font-bold">
<i data-lucide="layout-grid" class="w-6 h-6"></i>
</div>
<div>
<h1 class="text-xl font-bold text-slate-900">Committee Workflow</h1>
<p class="text-xs text-slate-500">Strategic Planning Board</p>
</div>
</div>
<div class="flex items-center gap-4">
<button onclick="openModal()" class="flex items-center gap-2 bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition">
<i data-lucide="plus" class="w-4 h-4"></i>
New Proposal
</button>
<div class="flex -space-x-2">
<img src="https://i.pravatar.cc/32?img=1" class="w-8 h-8 rounded-full border-2 border-white" alt="User">
<img src="https://i.pravatar.cc/32?img=2" class="w-8 h-8 rounded-full border-2 border-white" alt="User">
<div class="w-8 h-8 rounded-full border-2 border-white bg-slate-200 flex items-center justify-center text-xs text-slate-600 font-bold">+3</div>
</div>
</div>
</div>
</header>
<!-- Main Board -->
<main class="p-6 overflow-x-auto">
<div id="board" class="flex gap-6 items-start">
<!-- Columns will be generated by JS -->
</div>
</main>
<!-- New Proposal Modal -->
<div id="modal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden items-center justify-center z-50">
<div class="bg-white rounded-xl shadow-2xl w-full max-w-md p-6 m-4 relative">
<button onclick="closeModal()" class="absolute top-4 right-4 text-slate-400 hover:text-slate-600">
<i data-lucide="x" class="w-5 h-5"></i>
</button>
<h2 class="text-lg font-bold mb-4">Submit New Proposal</h2>
<form onsubmit="addTask(event)">
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Title</label>
<input type="text" id="inputTitle" required class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 outline-none" placeholder="e.g., Q4 Budget Allocation">
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Description</label>
<textarea id="inputDesc" rows="3" class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 outline-none" placeholder="Brief summary..."></textarea>
</div>
<div class="flex gap-3">
<div class="flex-1">
<label class="block text-sm font-medium text-slate-700 mb-1">Type</label>
<select id="inputType" class="w-full border border-slate-300 rounded-lg px-3 py-2 outline-none">
<option value="Budget">Budget</option>
<option value="Policy">Policy</option>
<option value="Event">Event</option>
<option value="Hiring">Hiring</option>
</select>
</div>
<div class="flex-1">
<label class="block text-sm font-medium text-slate-700 mb-1">Priority</label>
<select id="inputPriority" class="w-full border border-slate-300 rounded-lg px-3 py-2 outline-none">
<option value="High">High</option>
<option value="Medium" selected>Medium</option>
<option value="Low">Low</option>
</select>
</div>
</div>
</div>
<div class="mt-6 flex justify-end gap-3">
<button type="button" onclick="closeModal()" class="px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-100 rounded-lg">Cancel</button>
<button type="submit" class="px-4 py-2 text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 rounded-lg">Create Task</button>
</div>
</form>
</div>
</div>
<script>
// --- Data Model ---
const columns = [
{ id: 'incoming', name: 'Incoming', icon: 'inbox', color: 'bg-slate-200' },
{ id: 'review', name: 'Under Review', icon: 'search', color: 'bg-blue-100' },
{ id: 'discussion', name: 'Discussion', icon: 'message-circle', color: 'bg-yellow-100' },
{ id: 'decision', name: 'Decision', icon: 'check-circle', color: 'bg-green-100' },
{ id: 'done', name: 'Archived', icon: 'archive', color: 'bg-slate-300' }
];
let tasks = [
{ id: 1, title: '2025 Annual Budget', desc: 'Reviewing financial projections.', type: 'Budget', priority: 'High', column: 'review', assignee: 1 },
{ id: 2, title: 'New Remote Work Policy', desc: 'Drafting guidelines for remote work.', type: 'Policy', priority: 'Medium', column: 'discussion', assignee: 2 },
{ id: 3, title: 'Summer Gala Planning', desc: 'Venue and catering selection.', type: 'Event', priority: 'Low', column: 'incoming', assignee: 3 },
{ id: 4, title: 'Hiring: Senior Dev', desc: 'Interviews scheduled for next week.', type: 'Hiring', priority: 'High', column: 'decision', assignee: 1 },
];
let taskIdCounter = 5;
// --- Helper Functions ---
const getTagColor = (type) => {
switch(type) {
case 'Budget': return 'bg-green-100 text-green-800';
case 'Policy': return 'bg-purple-100 text-purple-800';
case 'Event': return 'bg-pink-100 text-pink-800';
case 'Hiring': return 'bg-blue-100 text-blue-800';
default: return 'bg-slate-100 text-slate-800';
}
};
const getPriorityIcon = (p) => {
if(p === 'High') return `<span class="w-2 h-2 rounded-full bg-red-500 inline-block mr-1"></span>`;
if(p === 'Medium') return `<span class="w-2 h-2 rounded-full bg-yellow-500 inline-block mr-1"></span>`;
return '';
};
// --- Rendering ---
function renderBoard() {
const board = document.getElementById('board');
board.innerHTML = '';
columns.forEach(col => {
const columnTasks = tasks.filter(t => t.column === col.id);
const colEl = document.createElement('div');
colEl.className = 'w-72 flex-shrink-0';
colEl.innerHTML = `
<div class="flex items-center justify-between mb-3 px-1">
<div class="flex items-center gap-2">
<i data-lucide="${col.icon}" class="w-4 h-4 text-slate-500"></i>
<h3 class="font-semibold text-slate-700 text-sm">${col.name}</h3>
<span class="text-xs font-bold text-slate-400 bg-slate-200 px-2 py-0.5 rounded-full">${columnTasks.length}</span>
</div>
<button class="text-slate-400 hover:text-slate-600">
<i data-lucide="plus" class="w-4 h-4"></i>
</button>
</div>
<div class="column-drop-zone rounded-xl p-2 flex flex-col gap-3 ${col.color}"
ondragover="handleDragOver(event)"
ondrop="handleDrop(event, '${col.id}')"
ondragleave="handleDragLeave(event)">
<!-- Tasks appended here -->
</div>
`;
const taskContainer = colEl.querySelector('.column-drop-zone');
columnTasks.forEach(task => {
const taskEl = document.createElement('div');
taskEl.className = 'task-card bg-white p-4 rounded-lg border border-slate-200 shadow-sm cursor-grab active:cursor-grabbing';
taskEl.setAttribute('draggable', true);
taskEl.setAttribute('ondragstart', `handleDragStart(event, ${task.id})`);
taskEl.setAttribute('ondragend', `handleDragEnd(event)`);
taskEl.innerHTML = `
<div class="flex justify-between items-start mb-2">
<span class="text-xs font-medium px-2 py-1 rounded ${getTagColor(task.type)}">${task.type}</span>
<button class="text-slate-300 hover:text-red-500">
<i data-lucide="trash-2" class="w-3 h-3"></i>
</button>
</div>
<h4 class="font-semibold text-slate-800 text-sm mb-1">${task.title}</h4>
<p class="text-xs text-slate-500 mb-3">${task.desc}</p>
<div class="flex justify-between items-center pt-2 border-t border-slate-100">
<div class="flex items-center text-xs text-slate-500">
${getPriorityIcon(task.priority)} ${task.priority}
</div>
<img src="https://i.pravatar.cc/32?img=${task.assignee}" class="w-6 h-6 rounded-full" alt="Assignee">
</div>
`;
taskContainer.appendChild(taskEl);
});
board.appendChild(colEl);
});
// Re-initialize icons after DOM update
lucide.createIcons();
}
// --- Drag and Drop Logic ---
let draggedTaskId = null;
function handleDragStart(e, id) {
draggedTaskId = id;
e.target.classList.add('dragging');
// Required for Firefox compatibility
e.dataTransfer.effectAllowed = 'move';
}
function handleDragEnd(e) {
e.target.classList.remove('dragging');
document.querySelectorAll('.column-drop-zone').forEach(zone => {
zone.classList.remove('drag-over');
});
}
function handleDragOver(e) {
e.preventDefault();
e.currentTarget.classList.add('drag-over');
}
function handleDragLeave(e) {
e.currentTarget.classList.remove('drag-over');
}
function handleDrop(e, columnId) {
e.preventDefault();
e.currentTarget.classList.remove('drag-over');
// Update the data model
const taskIndex = tasks.findIndex(t => t.id === draggedTaskId);
if (taskIndex !== -1) {
tasks[taskIndex].column = columnId;
renderBoard();
}
}
// --- Modal Logic ---
function openModal() {
document.getElementById('modal').classList.remove('hidden');
document.getElementById('modal').classList.add('flex');
}
function closeModal() {
document.getElementById('modal').classList.add('hidden');
document.getElementById('modal').classList.remove('flex');
document.getElementById('inputTitle').value = '';
document.getElementById('inputDesc').value = '';
}
function addTask(e) {
e.preventDefault();
const title = document.getElementById('inputTitle').value;
const desc = document.getElementById('inputDesc').value;
const type = document.getElementById('inputType').value;
const priority = document.getElementById('inputPriority').value;
const newTask = {
id: taskIdCounter++,
title,
desc,
type,
priority,
column: 'incoming',
assignee: Math.floor(Math.random() * 5) + 1
};
tasks.push(newTask);
renderBoard();
closeModal();
}
// Initialize
window.onload = () => {
lucide.createIcons();
renderBoard();
};
</script>
</body>
</html>