Skip to content

Commit 5b76e9f

Browse files
This build was committed by a bot.
1 parent edf3b25 commit 5b76e9f

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed
Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,11 +729,18 @@ ${sysPrompt}` }], max_tokens: 20, temperature: 0.2 }) });
729729
return null;
730730
}
731731
};
732-
const threadRow = (t) => `<div class="relative flex items-center gap-2 px-3 py-2 ${t.pinned ? "bg-yellow-50" : ""}"><button data-open-thread="${t.id}" data-type="${t.type || "thread"}" class="flex-1 text-left truncate flex items-center gap-2">${t.type === "folder" ? '<i data-lucide="folder" class="h-4 w-4"></i>' : ""}${t.pinned ? "📌 " : ""}${esc(t.title || "Untitled")}${t.status === "modified" ? "*" : t.status === "new" ? "+" : ""}</button><button data-thread-menu="${t.id}" class="h-8 w-8 rounded hover:bg-gray-100 flex items-center justify-center" title="More"><i data-lucide="more-horizontal" class="h-4 w-4"></i></button></div>`;
732+
const threadRow = (t) => {
733+
const icon = t.type === "folder" ? "folder" : t.type === "file" ? "file-text" : "";
734+
return `<div class="relative flex items-center gap-2 px-3 py-2 ${t.pinned ? "bg-yellow-50" : ""}"><button data-open-thread="${t.id}" data-type="${t.type || "thread"}" class="flex-1 text-left truncate flex items-center gap-2">${icon ? `<i data-lucide="${icon}" class="h-4 w-4"></i>` : ""}${t.pinned ? "📌 " : ""}${esc(t.title || "Untitled")}${t.status === "modified" ? "*" : t.status === "new" ? "+" : ""}</button>${t.type === "file" ? "" : `<button data-thread-menu="${t.id}" class="h-8 w-8 rounded hover:bg-gray-100 flex items-center justify-center" title="More"><i data-lucide="more-horizontal" class="h-4 w-4"></i></button>`}</div>`;
735+
};
733736
let sortedThreads = [], isAddingThreads = false;
734737
const THREAD_PAGE_SIZE = 50;
735738
async function renderThreads() {
736-
sortedThreads = [...THREAD.list].filter((t) => t.status !== "deleted").sort((a, b) => b.pinned - a.pinned || b.updatedAt - a.updatedAt);
739+
sortedThreads = [...THREAD.list].filter((t) => t.status !== "deleted").sort((a, b) => {
740+
if (a.type === "file" && b.type !== "file") return -1;
741+
if (a.type !== "file" && b.type === "file") return 1;
742+
return b.pinned - a.pinned || b.updatedAt - a.updatedAt;
743+
});
737744
el.threadList.innerHTML = sortedThreads.slice(0, THREAD_PAGE_SIZE).map(threadRow).join("");
738745
el.threadList.scrollTop = 0;
739746
isAddingThreads = false;
@@ -765,6 +772,21 @@ $(el.threadList).on("click", async (e) => {
765772
const openBtn = e.target.closest("[data-open-thread]"), menuBtn = e.target.closest("[data-thread-menu]");
766773
if (openBtn) {
767774
const id = openBtn.getAttribute("data-open-thread"), type = openBtn.getAttribute("data-type");
775+
if (type === "file") {
776+
const u2 = el.threadRepoInput.value.trim();
777+
if (u2.startsWith("gh://")) {
778+
const info = parseGhUrl(u2);
779+
try {
780+
await navigator.clipboard.writeText(`${info.owner}/${info.repo}/${id}`);
781+
const old = openBtn.innerHTML;
782+
openBtn.innerHTML = '<i data-lucide="check" class="h-4 w-4 text-green-500"></i> Copied Path';
783+
icons();
784+
setTimeout(() => (openBtn.innerHTML = old, icons()), 1200);
785+
} catch {
786+
}
787+
}
788+
return;
789+
}
768790
if (type === "folder") {
769791
const u2 = el.threadRepoInput.value.trim();
770792
el.threadRepoInput.value = u2 + (u2.endsWith("/") ? "" : "/") + id;
@@ -1427,6 +1449,7 @@ const pullThreads = async () => {
14271449
} else {
14281450
THREAD.list = items.map((i) => {
14291451
if (i.type === "dir") return { id: i.name, title: i.name, type: "folder", updatedAt: 0 };
1452+
if (i.type === "file" && i.name.endsWith(".md")) return { id: i.path, title: i.name, type: "file", updatedAt: 0 };
14301453
const d = deserializeThreadName(i.name);
14311454
return d ? { ...d, status: "synced" } : null;
14321455
}).filter(Boolean);

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<script defer src="https://cdn.jsdelivr.net/npm/cash-dom/dist/cash.min.js"></script>
1313
<script defer src="//unpkg.com/alpinejs"></script>
1414

15-
<script type="module" crossorigin src="/assets/index-CxwhROrW.js"></script>
15+
<script type="module" crossorigin src="/assets/index-zttrb_rF.js"></script>
1616
<link rel="stylesheet" crossorigin href="/assets/index-JLEDB1oP.css">
1717
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
1818
<body class="bg-white text-gray-900 selection:bg-black/10" x-data @click.window="if($event.target.closest('button')) haptic(); if(!document.getElementById('threadPopover').contains($event.target)&&!$event.target.closest('[data-thread-menu]')) hideThreadPopover(); if(!document.getElementById('sunePopover').contains($event.target)&&!$event.target.closest('[data-sune-menu]')) hideSunePopover(); if(!document.getElementById('userMenu').contains($event.target)&&!document.getElementById('userMenuBtn').contains($event.target)) document.getElementById('userMenu').classList.add('hidden')">

dist/sw.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)