anycoder-fe7641c3 / index.html
makilic's picture
Upload folder using huggingface_hub
7213af7 verified
Raw History Blame Contribute Delete
21.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modern Kanban Board & Python Logic</title>
<!-- Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--bg-color: #0f172a;
--card-bg: #1e293b;
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--accent: #38bdf8;
--accent-hover: #0ea5e9;
--glass-border: rgba(255, 255, 255, 0.1);
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--font-family: 'Inter', system-ui, -apple-system, sans-serif;
--code-font: 'Fira Code', monospace;
}
* {
box-sizing: box-box;
margin: 0;
padding: 0;
}
body {
background-color: var(--bg-color);
color: var(--text-primary);
font-family: var(--font-family);
line-height: 1.6;
min-height: 100vh;
display: flex;
flex-direction: column;
overflow-x: hidden;
}
/* Header & Nav */
header {
background: rgba(15, 23, 42, 0.95);
border-bottom: 1px solid var(--glass-border);
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.brand {
font-size: 1.25rem;
font-weight: 700;
color: var(--accent);
letter-spacing: -0.5px;
display: flex;
align-items: center;
gap: 10px;
}
.brand span {
color: var(--text-primary);
font-weight: 400;
}
.controls {
display: flex;
gap: 1rem;
align-items: center;
}
button {
background: var(--card-bg);
color: var(--text-primary);
border: 1px solid var(--glass-border);
padding: 0.5rem 1rem;
border-radius: 6px;
cursor: pointer;
font-size: 0.875rem;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 8px;
}
button:hover {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}
button.active {
background: var(--accent);
color: #fff;
}
/* Main Layout */
main {
flex: 1;
padding: 2rem;
display: flex;
gap: 2rem;
overflow: hidden;
position: relative;
}
/* Kanban Board Area */
.board-container {
flex: 2;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1.5rem;
height: 100%;
overflow-x: auto;
}
.column {
background: rgba(30, 41, 59, 0.5);
border-radius: 12px;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 1rem;
min-width: 280px;
border: 1px solid var(--glass-border);
transition: transform 0.2s;
}
.column-header {
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.8rem;
color: var(--text-secondary);
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--glass-border);
display: flex;
justify-content: space-between;
}
.task-card {
background: var(--card-bg);
padding: 1rem;
border-radius: 8px;
border-left: 4px solid var(--accent);
cursor: grab;
transition: all 0.2s;
box-shadow: var(--shadow);
position: relative;
overflow: hidden;
}
.task-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.task-card:active {
cursor: grabbing;
}
.task-title {
font-weight: 600;
margin-bottom: 0.5rem;
color: var(--text-primary);
}
.task-meta {
font-size: 0.75rem;
color: var(--text-secondary);
display: flex;
justify-content: space-between;
margin-top: 0.8rem;
}
.tag {
background: rgba(56, 189, 248, 0.2);
color: var(--accent);
padding: 2px 6px;
rounded: 4px;
font-size: 0.7rem;
border-radius: 4px;
}
/* Code Viewer Area */
.code-viewer {
flex: 1;
background: #000;
border-radius: 12px;
padding: 1.5rem;
font-family: var(--code-font);
font-size: 0.85rem;
color: #a5b3ce;
border: 1px solid var(--glass-border);
overflow-y: auto;
max-height: 80vh;
display: none;
/* Hidden by default */
opacity: 0;
transition: opacity 0.3s ease;
flex-direction: column;
}
.code-viewer.visible {
display: flex;
opacity: 1;
}
.code-content {
margin-bottom: 1rem;
flex-grow: 1;
overflow-y: auto;
white-space: pre-wrap;
font-family: var(--code-font);
line-height: 1.5;
}
.py-keyword {
color: #c084fc;
}
.py-string {
color: #6366f1;
}
.py-comment {
color: #64748b;
}
.py-func {
color: #38bdf8;
}
/* Python Console Input */
.console-container {
background: #111;
border-radius: 6px;
padding: 10px;
border: 1px solid #333;
margin-top: 10px;
}
.console-label {
font-size: 0.7rem;
color: var(--text-secondary);
margin-bottom: 5px;
display: block;
}
.console-input {
width: 100%;
background: transparent;
border: none;
color: #fff;
font-family: var(--code-font);
font-size: 0.8rem;
outline: none;
resize: none;
height: 60px;
}
.console-input::placeholder {
color: #555;
}
.console-actions {
display: flex;
justify-content: flex-end;
margin-top: 5px;
gap: 8px;
}
.run-btn {
background: #38bdf8;
color: #000;
border: none;
padding: 4px 12px;
font-size: 0.75rem;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
}
.run-btn:hover {
background: #0ea5e9;
}
.download-btn {
background: #222;
color: #a5b3ce;
border: 1px solid #333;
padding: 4px 12px;
font-size: 0.75rem;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
display: flex;
align-items: center;
gap: 5px;
}
.download-btn:hover {
background: #333;
color: #fff;
}
/* Modal */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
z-index: 200;
display: none;
justify-content: center;
align-items: center;
}
.modal {
background: var(--card-bg);
padding: 2rem;
width: 400px;
border-radius: 12px;
border: 1px solid var(--glass-border);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
.modal h2 {
margin-bottom: 1rem;
color: var(--text-primary);
}
.input-group {
margin-bottom: 1rem;
}
.input-group label {
display: block;
margin-bottom: 0.5rem;
color: var(--text-secondary);
font-size: 0.8rem;
}
.input-group input,
.input-group select {
width: 100%;
padding: 0.8rem;
background: var(--bg-color);
border: 1px solid var(--glass-border);
color: var(--text-primary);
border-radius: 6px;
outline: none;
}
.input-group input:focus {
border-color: var(--accent);
}
.modal-actions {
display: flex;
justify-content: flex-end;
gap: 1rem;
}
/* Responsive */
@media (max-width: 900px) {
main {
flex-direction: column;
}
.board-container {
grid-template-columns: 1fr;
}
.code-viewer {
max-height: 400px;
}
}
</style>
</head>
<body>
<!-- Header -->
<header>
<div class="brand">
<i class="fa-solid fa-layer-group"></i>
Kanban<span>Pro</span>
</div>
<div class="controls">
<button onclick="openModal()">
<i class="fa-solid fa-plus"></i> New Task
</button>
<button id="codeToggleBtn" onclick="toggleCodeView()">
<i class="fa-brands fa-python"></i> Python Console
</button>
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank"
style="text-decoration: none; color: var(--text-secondary); font-size: 0.8rem;">
Built with anycoder
</a>
</div>
</header>
<!-- Main Content -->
<main>
<!-- Kanban Board -->
<div class="board-container">
<!-- Todo Column -->
<div class="column" id="todo-col">
<div class="column-header">
<span>To Do</span>
<span class="tag">0</span>
</div>
<div class="tasks-list" id="todo-list">
<!-- Tasks injected here -->
</div>
</div>
<!-- In Progress Column -->
<div class="column" id="progress-col">
<div class="column-header">
<span>In Progress</span>
<span class="tag">0</span>
</div>
<div class="tasks-list" id="progress-list">
<!-- Tasks injected here -->
</div>
</div>
<!-- Done Column -->
<div class="column" id="done-col">
<div class="column-header">
<span>Done</span>
<span class="tag">0</span>
</div>
<div class="tasks-list" id="done-list">
<!-- Tasks injected here -->
</div>
</div>
</div>
<!-- Python Code Viewer & Console -->
<div class="code-viewer" id="codeViewer">
<div style="margin-bottom: 1rem; color: var(--accent); font-weight: bold; display: flex; justify-content: space-between;">
<span><i class="fa-solid fa-terminal"></i> Python Backend Logic Console</span>
<!-- Download Button Added Here -->
<button class="download-btn" onclick="downloadPythonCode()">
<i class="fa-solid fa-download"></i> Download Code
</button>
</div>
<div class="code-content" id="codeContent">
<!-- Python code injected here -->
</div>
<!-- Interactive Console Input -->
<div class="console-container">
<label class="console-label">Execute Python Command:</label>
<textarea class="console-input" id="pythonInput" placeholder="e.g. tasks.move(1, 'done')"></textarea>
<div class="console-actions">
<button class="run-btn" onclick="executePython()">
<i class="fa-solid fa-play"></i> Run
</button>
</div>
<div id="consoleOutput" style="font-size: 0.7rem; color: #666; margin-top: 5px;"></div>
</div>
</div>
</main>
<!-- Modal for Adding Task -->
<div class="modal-overlay" id="modalOverlay">
<div class="modal">
<h2>Create New Task</h2>
<div class="input-group">
<label>Task Title</label>
<input type="text" id="taskTitle" placeholder="e.g. Fix API Bug">
</div>
<div class="input-group">
<label>Priority</label>
<select id="taskPriority">
<option value="Low">Low</option>
<option value="Medium">Medium</option>
<option value="High">High</option>
</select>
</div>
<div class="modal-actions">
<button onclick="closeModal()" style="background: transparent; border: none;">Cancel</button>
<button onclick="addTask()" class="active">Create</button>
</div>
</div>
</div>
<script>
// --- State Management ---
let tasks = [
{ id: 1, title: "Design Database Schema", status: "todo", priority: "High" },
{ id: 2, title: "Setup Python Environment", status: "todo", priority: "Medium" },
{ id: 3, title: "Write Unit Tests", status: "progress", priority: "Low" }
];
// --- Render Functions ---
function renderTasks() {
const todoList = document.getElementById('todo-list');
const progressList = document.getElementById('progress-list');
const doneList = document.getElementById('done-list');
// Clear lists
todoList.innerHTML = '';
progressList.innerHTML = '';
doneList.innerHTML = '';
// Counters
let counts = { todo: 0, progress: 0, done: 0 };
tasks.forEach(task => {
counts[task.status]++;
const card = createTaskCard(task);
if (task.status === 'todo') todoList.appendChild(card);
else if (task.status === 'progress') progressList.appendChild(card);
else if (task.status === 'done') doneList.appendChild(card);
});
// Update headers
document.querySelector('#todo-col .tag').innerText = counts.todo;
document.querySelector('#progress-col .tag').innerText = counts.progress;
document.querySelector('#done-col .tag').innerText = counts.done;
}
function createTaskCard(task) {
const div = document.createElement('div');
div.className = 'task-card';
div.draggable = true;
div.innerHTML = `
<div class="task-title">${task.title}</div>
<div class="task-meta">
<span class="tag">${task.priority}</span>
<span><i class="fa-solid fa-code"></i> ID: ${task.id}</span>
</div>
`;
// Drag Events
div.addEventListener('dragstart', (e) => {
e.dataTransfer.setData('text/plain', task.id);
div.style.opacity = '0.5';
});
div.addEventListener('dragend', (e) => {
div.style.opacity = '1';
});
return div;
}
// --- Python Code Injection ---
const pythonCode = `
<span class="py-comment"># Python Class Structure for Task Management</span>
<span class="py-keyword">class</span> TaskManager:
<span class="py-keyword">def</span> <span class="py-func">__init__</span>(self):
self.tasks = []
self.statuses = ['todo', 'progress', 'done']
<span class="py-keyword">def</span> <span class="py-func">create_task</span>(self, title, priority):
task_id = <span class="py-func">len</span>(self.tasks) + 1
new_task = {
'id': task_id,
'title': title,
'status': 'todo',
'priority': priority
}
self.tasks.append(new_task)
<span class="py-keyword">return</span> new_task
<span class="py-keyword">def</span> <span class="py-func">move_task</span>(self, task_id, new_status):
<span class="py-keyword">for</span> task in self.tasks:
<span class="py-keyword">if</span> task['id'] == task_id:
task['status'] = new_status
<span class="py-keyword">return</span> True
<span class="py-keyword">return</span> False
<span class="py-keyword">def</span> <span class="py-func">delete_task</span>(self, task_id):
self.tasks = [t <span class="py-keyword">for</span> t in self.tasks <span class="py-keyword">if</span> t['id'] != task_id]
<span class="py-keyword">def</span> <span class="py-func">get_dashboard_stats</span>(self):
stats = {}
<span class="py-keyword">for</span> status in self.statuses:
stats[status] = <span class="py-keyword">len</span>([t <span class="py-keyword">for</span> t in self.tasks <span class="py-keyword">if</span> t['status'] == status])
<span class="py-keyword">return</span> stats
`;
document.getElementById('codeContent').innerHTML = pythonCode;
// --- Interaction Logic ---
function toggleCodeView() {
const viewer = document.getElementById('codeViewer');
const btn = document.getElementById('codeToggleBtn');
if (viewer.classList.contains('visible')) {
viewer.classList.remove('visible');
btn.classList.remove('active');
} else {
viewer.classList.add('visible');
btn.classList.add('active');
}
}
function openModal() {
document.getElementById('modalOverlay').style.display = 'flex';
}
function closeModal() {
document.getElementById('modalOverlay').style.display = 'none';
}
function addTask() {
const title = document.getElementById('taskTitle').value;
const priority = document.getElementById('taskPriority').value;
if (!title) return alert("Please enter a title");
const newTask = {
id: tasks.length + 1,
title: title,
status: 'todo',
priority: priority
};
tasks.push(newTask);
renderTasks();
closeModal();
// Clear inputs
document.getElementById('taskTitle').value = '';
}
// --- Drag and Drop Logic ---
const columns = ['todo-list', 'progress-list', 'done-list'];
columns.forEach(colId => {
const col = document.getElementById(colId);
col.addEventListener('dragover', (e) => {
e.preventDefault();
col.style.background = 'rgba(30, 41, 59, 0.8);';
});
col.addEventListener('dragleave', (e) => {
col.style.background = 'rgba(30, 41, 59, 0.5);';
});
col.addEventListener('drop', (e) => {
e.preventDefault();
col.style.background = 'rgba(30, 41, 59, 0.5);';
const id = parseInt(e.dataTransfer.getData('text/plain'));
// Determine new status based on column
let newStatus = 'todo';
if (colId === 'progress-list') newStatus = 'progress';
if (colId === 'done-list') newStatus = 'done';
// Update state
const task = tasks.find(t => t.id === id);
if (task) {
task.status = newStatus;
renderTasks();
}
});
});
// --- Python Console Logic ---
function executePython() {
const input = document.getElementById('pythonInput').value.trim();
const outputDiv = document.getElementById('consoleOutput');
if (!input) return;
// Simulate Python parsing
try {
// Simple parser for demo purposes
if (input.includes('tasks.move')) {
const match = input.match(/tasks\.move\((\d+),\s*['"](\w+)['"]/);
if (match) {
const id = parseInt(match[1]);
const status = match[2];
const task = tasks.find(t => t.id === id);
if (task) {
task.status = status;
renderTasks();
outputDiv.innerHTML = `<span style="color:#38bdf8">Success:</span> Task ${id} moved to ${status}`;
} else {
outputDiv.innerHTML = `<span style="color:#ef4444">Error:</span> Task ID ${id} not found`;
}
} else {
outputDiv.innerHTML = `<span style="color:#ef4444">Syntax Error:</span> Expected tasks.move(id, 'status')`;
}
} else if (input.includes('tasks.delete')) {
const match = input.match(/tasks\.delete\((\d+)\)/);
if (match) {
const id = parseInt(match[1]);
tasks = tasks.filter(t => t.id !== id);
renderTasks();
outputDiv.innerHTML = `<span style="color:#38bdf8">Success:</span> Task ${id} deleted`;
} else {
outputDiv.innerHTML = `<span style="color:#ef4444">Syntax Error:</span> Expected tasks.delete(id)`;
}
} else if (input.includes('tasks.create')) {
const match = input.match(/tasks\.create\(['"](.+)['"],\s*['"](\w+)['"]/);
if (match) {
const title = match[1];
const priority = match[2];
const newTask = { id: tasks.length + 1, title: title, status: 'todo', priority: priority };
tasks.push(newTask);
renderTasks();
outputDiv.innerHTML = `<span style="color:#38bdf8">Success:</span> Task created: ${title}`;
} else {
outputDiv.innerHTML = `<span style="color:#ef4444">Syntax Error:</span> Expected tasks.create('title', 'priority')`;
}
} else {
outputDiv.innerHTML = `<span style="color:#ef4444">Command Not Recognized:</span> Try tasks.move, tasks.delete, or tasks.create`;
}
} catch (e) {
outputDiv.innerHTML = `<span style="color:#ef4444">Runtime Error:</span> ${e.message}`;
}
}
// --- Python Code Download Logic ---
function downloadPythonCode() {
// Get the raw text content from the code viewer
const codeContainer = document.getElementById('codeContent');
// We extract text from the span elements to remove HTML tags
let textContent = "";
const lines = codeContainer.querySelectorAll('.code-line');
lines.forEach(line => {
textContent += line.innerText + "\n";
});
// If no lines, fallback to innerText
if(!textContent) textContent = codeContainer.innerText;
// Create a blob
const blob = new Blob([textContent], { type: 'text/plain' });
// Create a download link
const anchor = document.createElement('a');
anchor.href = window.URL.createObjectURL(blob);
anchor.download = 'task_manager.py';
anchor.style.display = 'none';
// Trigger download
document.body.appendChild(anchor);
anchor.click();
// Cleanup
document.body.removeChild(anchor);
// Optional: Show success in console output
const outputDiv = document.getElementById('consoleOutput');
outputDiv.innerHTML = `<span style="color:#38bdf8">Download:</span> task_manager.py downloaded successfully`;
}
// Initial Render
renderTasks();
</script>
</body>
</html>