added move to top button for task presets

This commit is contained in:
2026-01-17 15:53:33 -05:00
parent 23d2f9475b
commit 3dbdc79b54
4 changed files with 27 additions and 17 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
AGENTS.md
**/*.crx
**/*.pem
**/*.zip

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "WWCompanion",
"version": "0.2.2",
"version": "0.2.3",
"description": "AI companion for WaterlooWorks job postings.",
"permissions": ["storage", "activeTab"],
"host_permissions": ["https://waterlooworks.uwaterloo.ca/*"],

View File

@@ -209,13 +209,6 @@ button:active {
justify-content: flex-end;
}
.icon-btn {
width: 34px;
padding: 6px 0;
font-weight: 700;
line-height: 1;
}
.icon-btn.delete {
.task-actions .delete {
color: #c0392b;
}

View File

@@ -70,22 +70,28 @@ function buildTaskCard(task) {
const actions = document.createElement("div");
actions.className = "task-actions";
const moveTopBtn = document.createElement("button");
moveTopBtn.type = "button";
moveTopBtn.className = "ghost move-top";
moveTopBtn.textContent = "Top";
moveTopBtn.setAttribute("aria-label", "Move task to top");
moveTopBtn.setAttribute("title", "Move to top");
const moveUpBtn = document.createElement("button");
moveUpBtn.type = "button";
moveUpBtn.className = "ghost icon-btn move-up";
moveUpBtn.textContent = "";
moveUpBtn.className = "ghost move-up";
moveUpBtn.textContent = "Up";
moveUpBtn.setAttribute("aria-label", "Move task up");
moveUpBtn.setAttribute("title", "Move up");
const moveDownBtn = document.createElement("button");
moveDownBtn.type = "button";
moveDownBtn.className = "ghost icon-btn move-down";
moveDownBtn.textContent = "";
moveDownBtn.className = "ghost move-down";
moveDownBtn.textContent = "Down";
moveDownBtn.setAttribute("aria-label", "Move task down");
moveDownBtn.setAttribute("title", "Move down");
const addBelowBtn = document.createElement("button");
addBelowBtn.type = "button";
addBelowBtn.className = "ghost icon-btn add-below";
addBelowBtn.textContent = "";
addBelowBtn.className = "ghost add-below";
addBelowBtn.textContent = "Add";
addBelowBtn.setAttribute("aria-label", "Add task below");
addBelowBtn.setAttribute("title", "Add below");
const duplicateBtn = document.createElement("button");
@@ -96,11 +102,18 @@ function buildTaskCard(task) {
duplicateBtn.setAttribute("title", "Duplicate");
const deleteBtn = document.createElement("button");
deleteBtn.type = "button";
deleteBtn.className = "ghost icon-btn delete";
deleteBtn.textContent = "🗑";
deleteBtn.className = "ghost delete";
deleteBtn.textContent = "Delete";
deleteBtn.setAttribute("aria-label", "Delete task");
deleteBtn.setAttribute("title", "Delete");
moveTopBtn.addEventListener("click", () => {
const first = tasksContainer.firstElementChild;
if (!first || first === card) return;
tasksContainer.insertBefore(card, first);
updateTaskControls();
});
moveUpBtn.addEventListener("click", () => {
const previous = card.previousElementSibling;
if (!previous) return;
@@ -137,6 +150,7 @@ function buildTaskCard(task) {
updateTaskControls();
});
actions.appendChild(moveTopBtn);
actions.appendChild(moveUpBtn);
actions.appendChild(moveDownBtn);
actions.appendChild(addBelowBtn);
@@ -153,8 +167,10 @@ function buildTaskCard(task) {
function updateTaskControls() {
const cards = [...tasksContainer.querySelectorAll(".task-card")];
cards.forEach((card, index) => {
const moveTopBtn = card.querySelector(".move-top");
const moveUpBtn = card.querySelector(".move-up");
const moveDownBtn = card.querySelector(".move-down");
if (moveTopBtn) moveTopBtn.disabled = index === 0;
if (moveUpBtn) moveUpBtn.disabled = index === 0;
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
});