Adds an 8th development stage that lets users keep a free-form journal alongside habit tracking, reusing the existing Google OAuth/DB/PWA infrastructure instead of a separate project. Users organize entries into custom categories, filter by a month calendar with day-detail drill-down, attach photos/videos (served via an authenticated route, never /static), tag entries, and pick multiple emotions per entry from a curated 9-option set. Includes a global journal prompt bank for lightweight guided journaling. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
28 lines
919 B
JavaScript
28 lines
919 B
JavaScript
(function () {
|
|
function initSortable() {
|
|
var list = document.getElementById("journal-category-list");
|
|
if (!list || typeof Sortable === "undefined") return;
|
|
|
|
Sortable.create(list, {
|
|
handle: ".drag-handle",
|
|
animation: 150,
|
|
forceFallback: true, // iOS Safari는 네이티브 HTML5 D&D 터치 지원이 불안정해서 자체 포인터 시뮬레이션을 강제한다
|
|
fallbackTolerance: 3,
|
|
onEnd: function () {
|
|
var ids = Array.from(list.children)
|
|
.map(function (el) { return el.getAttribute("data-category-id"); })
|
|
.filter(Boolean)
|
|
.map(Number);
|
|
|
|
fetch("/api/journal/categories/reorder", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ category_ids: ids }),
|
|
});
|
|
},
|
|
});
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", initSortable);
|
|
})();
|