@impakers/debug 1.4.15 → 1.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js CHANGED
@@ -2159,6 +2159,14 @@ async function fetchFeedbacks(endpoint, url, options = {}) {
2159
2159
  return data.tasks || [];
2160
2160
  }, options);
2161
2161
  }
2162
+ async function fetchAllFeedbacks(endpoint, options = {}) {
2163
+ const cacheKey = getAllFeedbacksCacheKey();
2164
+ return readWithCache(cacheKey, async () => {
2165
+ const res = await apiFetch(`${endpoint}?url=__all__`);
2166
+ const data = await res.json();
2167
+ return data.tasks || [];
2168
+ }, options);
2169
+ }
2162
2170
  async function revalidateFeedbacks(endpoint, url) {
2163
2171
  const cacheKey = getFeedbacksCacheKey(url);
2164
2172
  return revalidateCache(cacheKey, async () => {
@@ -2478,16 +2486,18 @@ var styles_module_default3 = classNames3;
2478
2486
 
2479
2487
  // src/components/comment-thread/index.tsx
2480
2488
  var import_jsx_runtime4 = require("react/jsx-runtime");
2481
- function timeAgo(dateStr) {
2482
- const diff = Date.now() - new Date(dateStr).getTime();
2489
+ function formatTime(dateStr) {
2490
+ const date = new Date(dateStr);
2491
+ const diff = Date.now() - date.getTime();
2492
+ const pad = (n) => String(n).padStart(2, "0");
2493
+ const abs = `${pad(date.getMonth() + 1)}.${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
2483
2494
  const m = Math.floor(diff / 6e4);
2484
- if (m < 1) return "just now";
2485
- if (m < 60) return `${m}m`;
2495
+ if (m < 1) return `${abs} (just now)`;
2496
+ if (m < 60) return `${abs} (${m}m)`;
2486
2497
  const h = Math.floor(m / 60);
2487
- if (h < 24) return `${h}h`;
2498
+ if (h < 24) return `${abs} (${h}h)`;
2488
2499
  const d = Math.floor(h / 24);
2489
- if (d < 30) return `${d}d`;
2490
- return new Date(dateStr).toLocaleDateString("ko-KR", { month: "short", day: "numeric" });
2500
+ return `${abs} (${d}d)`;
2491
2501
  }
2492
2502
  function getInitials(name) {
2493
2503
  return name.slice(0, 1).toUpperCase();
@@ -2666,7 +2676,7 @@ function CommentThread({
2666
2676
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles_module_default3.headerInfo, children: [
2667
2677
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles_module_default3.headerTop, children: [
2668
2678
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles_module_default3.authorName, children: task.authorName || currentUserName }),
2669
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles_module_default3.timestamp, children: timeAgo(task.createdAt) })
2679
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles_module_default3.timestamp, children: formatTime(task.createdAt) })
2670
2680
  ] }),
2671
2681
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles_module_default3.title, children: feedbackTitle })
2672
2682
  ] }),
@@ -2679,7 +2689,7 @@ function CommentThread({
2679
2689
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles_module_default3.commentContent, children: [
2680
2690
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles_module_default3.commentTop, children: [
2681
2691
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles_module_default3.commentAuthor, children: comment.authorName }),
2682
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles_module_default3.commentTime, children: timeAgo(comment.createdAt) })
2692
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles_module_default3.commentTime, children: formatTime(comment.createdAt) })
2683
2693
  ] }),
2684
2694
  comment.content && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles_module_default3.commentText, children: comment.content }),
2685
2695
  comment.imageUrl && comment.imageUrl !== "loading..." && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
@@ -3072,16 +3082,18 @@ function FilePreviewModal({
3072
3082
  ] }) })
3073
3083
  ] }) });
3074
3084
  }
3075
- function timeAgo2(dateStr) {
3076
- const diff = Date.now() - new Date(dateStr).getTime();
3085
+ function formatTime2(dateStr) {
3086
+ const date = new Date(dateStr);
3087
+ const diff = Date.now() - date.getTime();
3088
+ const pad = (n) => String(n).padStart(2, "0");
3089
+ const abs = `${pad(date.getMonth() + 1)}.${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
3077
3090
  const m = Math.floor(diff / 6e4);
3078
- if (m < 1) return "just now";
3079
- if (m < 60) return `${m}m`;
3091
+ if (m < 1) return `${abs} (just now)`;
3092
+ if (m < 60) return `${abs} (${m}m)`;
3080
3093
  const h = Math.floor(m / 60);
3081
- if (h < 24) return `${h}h`;
3094
+ if (h < 24) return `${abs} (${h}h)`;
3082
3095
  const d = Math.floor(h / 24);
3083
- if (d < 30) return `${d}d`;
3084
- return new Date(dateStr).toLocaleDateString("ko-KR", { month: "short", day: "numeric" });
3096
+ return `${abs} (${d}d)`;
3085
3097
  }
3086
3098
  function getInitials2(name) {
3087
3099
  return name.slice(0, 1).toUpperCase();
@@ -3198,7 +3210,7 @@ function InboxPanel({
3198
3210
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
3199
3211
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles_module_default5.cardMeta, children: [
3200
3212
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.cardAuthor, children: selectedItem.authorName }),
3201
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.cardTime, children: timeAgo2(selectedItem.createdAt) })
3213
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.cardTime, children: formatTime2(selectedItem.createdAt) })
3202
3214
  ] }),
3203
3215
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles_module_default5.detailTitle, children: selectedItem.title.replace(/^\[피드백\]\s*/, "") })
3204
3216
  ] })
@@ -3212,7 +3224,7 @@ function InboxPanel({
3212
3224
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles_module_default5.commentBody, children: [
3213
3225
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles_module_default5.commentMeta, children: [
3214
3226
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.commentAuthorName, children: c.authorName }),
3215
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.commentTime, children: timeAgo2(c.createdAt) })
3227
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.commentTime, children: formatTime2(c.createdAt) })
3216
3228
  ] }),
3217
3229
  c.content && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles_module_default5.commentContent, children: c.content }),
3218
3230
  c.imageUrl && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -3341,7 +3353,7 @@ function InboxPanel({
3341
3353
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles_module_default5.cardAvatar, children: getInitials2(item.authorName) }),
3342
3354
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles_module_default5.cardInfo, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles_module_default5.cardMeta, children: [
3343
3355
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.cardAuthor, children: item.authorName }),
3344
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.cardTime, children: timeAgo2(item.createdAt) })
3356
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles_module_default5.cardTime, children: formatTime2(item.createdAt) })
3345
3357
  ] }) })
3346
3358
  ] }),
3347
3359
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles_module_default5.cardTitle, children: item.title.replace(/^\[피드백\]\s*/, "") }),
@@ -3641,6 +3653,7 @@ function DebugWidget({ endpoint, getUser, onHide }) {
3641
3653
  const [activeThread, setActiveThread] = (0, import_react7.useState)(null);
3642
3654
  const [threadComments, setThreadComments] = (0, import_react7.useState)({});
3643
3655
  const [serverTasks, setServerTasks] = (0, import_react7.useState)([]);
3656
+ const [allServerTasks, setAllServerTasks] = (0, import_react7.useState)([]);
3644
3657
  const [showInbox, setShowInbox] = (0, import_react7.useState)(false);
3645
3658
  const [showSettings, setShowSettings] = (0, import_react7.useState)(false);
3646
3659
  const [settings, setSettings] = (0, import_react7.useState)(() => loadSettings());
@@ -3674,6 +3687,8 @@ function DebugWidget({ endpoint, getUser, onHide }) {
3674
3687
  startDelayedCapture();
3675
3688
  } else if (id === "inbox") {
3676
3689
  setShowInbox(true);
3690
+ fetchAllFeedbacks(endpoint, { staleWhileRevalidate: true }).then(setAllServerTasks).catch(() => {
3691
+ });
3677
3692
  if (isActive) {
3678
3693
  setIsActive(false);
3679
3694
  document.documentElement.classList.remove("impakers-selecting");
@@ -4215,32 +4230,16 @@ function DebugWidget({ endpoint, getUser, onHide }) {
4215
4230
  createdAt: task.createdAt,
4216
4231
  commentCount: task.commentCount || 0
4217
4232
  }));
4218
- const allRouteItems = (() => {
4219
- const items = [...allInboxItems];
4220
- try {
4221
- for (let i = 0; i < localStorage.length; i++) {
4222
- const key = localStorage.key(i);
4223
- if (!key?.startsWith(STORAGE_PREFIX)) continue;
4224
- const route = key.slice(STORAGE_PREFIX.length);
4225
- if (route === currentPath) continue;
4226
- const stored = JSON.parse(localStorage.getItem(key) || "[]");
4227
- for (const a of stored) {
4228
- items.push({
4229
- id: a.id,
4230
- title: a.comment || "\uD53C\uB4DC\uBC31",
4231
- status: "todo",
4232
- priority: "medium",
4233
- authorName: getUser?.()?.name ? String(getUser().name) : "\uC775\uBA85",
4234
- feedbackUrl: route,
4235
- createdAt: new Date(a.timestamp).toISOString(),
4236
- commentCount: (threadComments[a.id] || []).length
4237
- });
4238
- }
4239
- }
4240
- } catch {
4241
- }
4242
- return items.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
4243
- })();
4233
+ const allRouteItems = allServerTasks.map((task) => ({
4234
+ id: task.id,
4235
+ title: task.title || "\uD53C\uB4DC\uBC31",
4236
+ status: task.status,
4237
+ priority: task.priority,
4238
+ authorName: task.authorName || "\uC775\uBA85",
4239
+ feedbackUrl: task.feedbackUrl || "",
4240
+ createdAt: task.createdAt,
4241
+ commentCount: task.commentCount || 0
4242
+ }));
4244
4243
  return (0, import_react_dom3.createPortal)(
4245
4244
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { "data-impakers-debug": "", children: [
4246
4245
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(