3 Commits
4 changed files with 386 additions and 4 deletions

No files matched your search

+2 -2
View File
@@ -43,8 +43,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__
releaseName: 'TodoFlow v__VERSION__'
tagName: ${{ github.ref_name }}
releaseName: 'TodoFlow ${{ github.ref_name }}'
releaseBody: 'Release generated automatically by GitHub Actions.'
releaseDraft: true
prerelease: false
+173
View File
@@ -11,6 +11,7 @@ let state = {
apiKey: "widget-token-secure-789",
alwaysOnTop: false,
autostart: false,
opacity: 70,
tasks: [],
pollingInterval: null
};
@@ -38,6 +39,10 @@ const inputAutostart = document.getElementById("setting-autostart");
const btnMinimize = document.getElementById("btn-minimize");
const btnClose = document.getElementById("btn-close");
const inputOpacity = document.getElementById("setting-opacity");
const opacityValue = document.getElementById("opacity-value");
let taskToDeleteId = null;
// --- INITIALISATION ---
document.addEventListener("DOMContentLoaded", async () => {
@@ -48,6 +53,33 @@ document.addEventListener("DOMContentLoaded", async () => {
inputApiUrl.value = state.apiUrl;
inputApiKey.value = state.apiKey;
inputAlwaysOnTop.checked = state.alwaysOnTop;
inputOpacity.value = state.opacity;
opacityValue.textContent = state.opacity;
// Real-time opacity slider updates
inputOpacity.addEventListener("input", () => {
const val = inputOpacity.value;
opacityValue.textContent = val;
document.documentElement.style.setProperty("--widget-opacity", val / 100);
});
// Modal de confirmation de suppression personnalisé
const confirmModal = document.getElementById("confirm-modal");
const btnConfirmCancel = document.getElementById("btn-confirm-cancel");
const btnConfirmDelete = document.getElementById("btn-confirm-delete");
btnConfirmCancel.addEventListener("click", () => {
confirmModal.classList.remove("open");
taskToDeleteId = null;
});
btnConfirmDelete.addEventListener("click", async () => {
if (taskToDeleteId) {
confirmModal.classList.remove("open");
await executeDeleteTask(taskToDeleteId);
taskToDeleteId = null;
}
});
// Événements d'ouverture/fermeture des paramètres
btnSettings.addEventListener("click", () => settingsPanel.classList.add("open"));
@@ -88,6 +120,7 @@ function loadSettingsFromStorage() {
const storedApiUrl = localStorage.getItem("todoflow_api_url");
const storedApiKey = localStorage.getItem("todoflow_api_key");
const storedAlwaysOnTop = localStorage.getItem("todoflow_always_on_top");
const storedOpacity = localStorage.getItem("todoflow_opacity");
if (storedApiUrl) state.apiUrl = storedApiUrl;
if (storedApiKey) state.apiKey = storedApiKey;
@@ -98,6 +131,13 @@ function loadSettingsFromStorage() {
invoke("toggle_always_on_top", { enabled: state.alwaysOnTop }).catch(console.error);
}
}
if (storedOpacity) {
state.opacity = parseInt(storedOpacity);
document.documentElement.style.setProperty("--widget-opacity", state.opacity / 100);
} else {
state.opacity = 70;
document.documentElement.style.setProperty("--widget-opacity", 0.70);
}
}
async function saveSettings() {
@@ -105,14 +145,17 @@ async function saveSettings() {
const newKey = inputApiKey.value.trim();
const newAlwaysOnTop = inputAlwaysOnTop.checked;
const newAutostart = inputAutostart.checked;
const newOpacity = inputOpacity.value;
state.apiUrl = newUrl;
state.apiKey = newKey;
state.alwaysOnTop = newAlwaysOnTop;
state.opacity = parseInt(newOpacity);
localStorage.setItem("todoflow_api_url", newUrl);
localStorage.setItem("todoflow_api_key", newKey);
localStorage.setItem("todoflow_always_on_top", newAlwaysOnTop.toString());
localStorage.setItem("todoflow_opacity", newOpacity.toString());
// Appel des fonctions système Windows natives via Tauri
if (appWindow && invoke) {
@@ -265,6 +308,14 @@ function renderTasksList() {
const card = document.createElement("div");
card.className = `task-card ${isCompleted ? 'completed' : ''}`;
// Clic pour étendre/réduire le titre si long
card.addEventListener("click", (e) => {
if (e.target.closest(".custom-checkbox") || e.target.closest(".btn-task-action") || e.target.closest(".task-edit-input")) {
return;
}
card.classList.toggle("expanded");
});
// Checkbox personnalisée cochable
const checkbox = document.createElement("div");
checkbox.className = `custom-checkbox ${isCompleted ? 'checked' : ''}`;
@@ -294,6 +345,39 @@ function renderTasksList() {
content.appendChild(title);
content.appendChild(date);
// Container d'actions (Edit / Delete)
const actions = document.createElement("div");
actions.className = "task-actions";
// Bouton Modifier
const btnEdit = document.createElement("button");
btnEdit.className = "btn-task-action btn-edit";
btnEdit.title = "Modifier la tâche";
btnEdit.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4z"/></svg>`;
btnEdit.addEventListener("click", (e) => {
e.stopPropagation();
startEditingTask(task.id, card, title, task.title);
});
// Double-clic sur le titre pour éditer également
title.addEventListener("dblclick", (e) => {
e.stopPropagation();
startEditingTask(task.id, card, title, task.title);
});
// Bouton Supprimer
const btnDelete = document.createElement("button");
btnDelete.className = "btn-task-action btn-delete";
btnDelete.title = "Supprimer la tâche";
btnDelete.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>`;
btnDelete.addEventListener("click", (e) => {
e.stopPropagation();
deleteTask(task.id);
});
actions.appendChild(btnEdit);
actions.appendChild(btnDelete);
// Badge de statut (En cours / À faire)
const badge = document.createElement("span");
@@ -314,6 +398,7 @@ function renderTasksList() {
card.appendChild(checkbox);
card.appendChild(content);
card.appendChild(actions);
card.appendChild(badge);
tasksList.appendChild(card);
@@ -337,3 +422,91 @@ function formatDate(dateString) {
return dateString;
}
}
// --- NOUVELLES FONCTIONS DE SUPPRESSION ET MODIFICATION ---
function startEditingTask(taskId, card, titleElement, currentTitle) {
if (card.classList.contains("editing")) return;
card.classList.add("editing");
const input = document.createElement("input");
input.type = "text";
input.className = "task-edit-input";
input.value = currentTitle;
input.maxLength = 100;
titleElement.innerHTML = "";
titleElement.appendChild(input);
input.focus();
input.select();
const finishEditing = async (save) => {
const newTitle = input.value.trim();
card.classList.remove("editing");
if (save && newTitle && newTitle !== currentTitle) {
titleElement.textContent = newTitle;
await updateTaskTitle(taskId, newTitle);
} else {
titleElement.textContent = currentTitle;
}
};
input.addEventListener("keydown", (e) => {
if (e.key === "Enter") {
finishEditing(true);
} else if (e.key === "Escape") {
finishEditing(false);
}
});
input.addEventListener("blur", () => {
finishEditing(true);
});
input.addEventListener("click", (e) => e.stopPropagation());
}
async function updateTaskTitle(taskId, newTitle) {
try {
const response = await fetch(`${state.apiUrl}/api/v1/tasks/${taskId}`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"X-API-Key": state.apiKey
},
body: JSON.stringify({
title: newTitle
})
});
if (!response.ok) throw new Error("Échec de la mise à jour");
fetchTasks();
} catch (error) {
console.error("Erreur de mise à jour du titre :", error);
alert("Impossible de modifier la tâche.");
}
}
function deleteTask(taskId) {
taskToDeleteId = taskId;
const modal = document.getElementById("confirm-modal");
modal.classList.add("open");
}
async function executeDeleteTask(taskId) {
try {
const response = await fetch(`${state.apiUrl}/api/v1/tasks/${taskId}`, {
method: "DELETE",
headers: {
"X-API-Key": state.apiKey
}
});
if (!response.ok) throw new Error("Échec de la suppression");
fetchTasks();
} catch (error) {
console.error("Erreur de suppression de la tâche :", error);
alert("Impossible de supprimer la tâche.");
}
}
+17
View File
@@ -84,6 +84,11 @@
</label>
</div>
<div class="setting-group">
<label for="setting-opacity">Transparence du fond (<span id="opacity-value">70</span>%)</label>
<input type="range" id="setting-opacity" min="20" max="100" value="70" class="slider-opacity">
</div>
<div class="setting-toggle">
<label class="switch-container">
<span class="switch-label">Lancer au démarrage</span>
@@ -102,6 +107,18 @@
// Import dynamique pour supporter l'exécution dans le navigateur pendant le dév
window.__TAURI__ = window.__TAURI__ || null;
</script>
<!-- Modal de confirmation de suppression personnalisé (Thème Glassmorphism) -->
<div class="confirm-modal-overlay" id="confirm-modal">
<div class="confirm-modal-box">
<h3>Supprimer la tâche ?</h3>
<p>Cette action est irréversible et supprimera définitivement la tâche de la base SaaS.</p>
<div class="confirm-modal-actions">
<button class="btn-confirm-cancel" id="btn-confirm-cancel">Annuler</button>
<button class="btn-confirm-delete" id="btn-confirm-delete">Supprimer</button>
</div>
</div>
</div>
<script src="app.js"></script>
</body>
</html>
+194 -2
View File
@@ -1,6 +1,6 @@
/* --- SYSTÈME DE DESIGN & TOKENS --- */
:root {
--bg-widget: rgba(18, 22, 33, 0.70);
--widget-opacity: 0.70;
--bg-widget: rgba(18, 22, 33, var(--widget-opacity));
--bg-card: rgba(255, 255, 255, 0.03);
--bg-card-hover: rgba(255, 255, 255, 0.07);
--border-widget: 1px solid rgba(255, 255, 255, 0.09);
@@ -573,3 +573,195 @@ body {
background: hsl(250, 85%, 58%);
box-shadow: 0 0 10px var(--accent-indigo-glow);
}
/* --- BOUTONS ACTIONS DES TÂCHES (MODIFIER / SUPPRIMER) --- */
.task-actions {
display: flex;
gap: 6px;
margin-right: 8px;
opacity: 0;
transition: opacity 0.2s ease;
}
.task-card:hover .task-actions {
opacity: 1;
}
.btn-task-action {
background: transparent;
border: none;
color: var(--text-secondary);
cursor: pointer;
width: 22px;
height: 22px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.btn-task-action:hover {
background: rgba(255, 255, 255, 0.08);
color: var(--text-primary);
}
.btn-task-action.btn-delete:hover {
background: rgba(239, 68, 68, 0.15);
color: hsl(0, 80%, 65%);
}
.btn-task-action svg {
pointer-events: none; /* Évite d'interférer avec le clic */
}
/* Style de l'input d'édition en ligne */
.task-edit-input {
background: rgba(255, 255, 255, 0.1);
border: 1px solid var(--accent-indigo);
border-radius: 6px;
color: var(--text-primary);
font-size: 13px;
font-family: inherit;
padding: 2px 6px;
width: 100%;
outline: none;
box-shadow: 0 0 8px var(--accent-indigo-glow);
}
/* --- ACCORDION / EXPANDED STATE --- */
.task-card {
cursor: pointer;
}
.task-card.expanded {
background: var(--bg-card-hover);
border-color: rgba(99, 102, 241, 0.3);
}
.task-card.expanded .task-title {
white-space: normal;
overflow: visible;
text-overflow: unset;
display: block;
word-break: break-word;
}
/* --- RANGE SLIDER STYLING --- */
.slider-opacity {
-webkit-appearance: none;
width: 100%;
height: 6px;
border-radius: 5px;
background: rgba(255, 255, 255, 0.1);
outline: none;
transition: background 0.3s;
margin: 6px 0;
}
.slider-opacity::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--accent-indigo);
cursor: pointer;
box-shadow: 0 0 10px var(--accent-indigo-glow);
transition: transform 0.1s;
}
.slider-opacity::-webkit-slider-thumb:hover {
transform: scale(1.2);
}
/* --- CUSTOM CONFIRMATION MODAL OVERLAY --- */
.confirm-modal-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.confirm-modal-overlay.open {
opacity: 1;
pointer-events: auto;
}
.confirm-modal-box {
width: 290px;
background: rgba(18, 22, 33, 0.95);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 14px;
padding: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
transform: scale(0.9);
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
text-align: center;
}
.confirm-modal-overlay.open .confirm-modal-box {
transform: scale(1);
}
.confirm-modal-box h3 {
font-size: 15px;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 8px;
}
.confirm-modal-box p {
font-size: 11.5px;
color: var(--text-secondary);
line-height: 1.5;
margin-bottom: 20px;
}
.confirm-modal-actions {
display: flex;
gap: 10px;
justify-content: center;
}
.confirm-modal-actions button {
padding: 8px 16px;
font-size: 12px;
font-weight: 600;
border-radius: 8px;
border: none;
cursor: pointer;
transition: all 0.2s;
flex: 1;
}
.btn-confirm-cancel {
background: rgba(255, 255, 255, 0.08);
color: var(--text-primary);
}
.btn-confirm-cancel:hover {
background: rgba(255, 255, 255, 0.15);
}
.btn-confirm-delete {
background: hsl(0, 75%, 50%);
color: white;
box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}
.btn-confirm-delete:hover {
background: hsl(0, 75%, 45%);
box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
}