Fix log file sorting in sidebar #20

Merged
probablycorey merged 1 commits from probablycorey/fix-log-sort into main 2026-03-10 18:38:42 +00:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 96aedc8239 - Show all commits

View File

@ -47,7 +47,7 @@ mkdirSync(logsDir, { recursive: true })
function createLogFile(): string {
const timestamp = new Date().toISOString().replace(/[:.]/g, "-")
return `${logsDir}/${releaseSha}_${timestamp}.jsonl`
return `${logsDir}/${timestamp}_${releaseSha}.jsonl`
}
export function listLogFiles(): string[] {

View File

@ -112,7 +112,7 @@ function Sidebar({ files, selectedFile }: { files: string[]; selectedFile?: stri
// Group files by sha, sorted by most recent file in each group
const grouped: Record<string, string[]> = {}
for (const file of files) {
const sha = file.split("_")[0] || "unknown"
const sha = file.replace(".jsonl", "").split("_").pop() || "unknown"
const list = grouped[sha] || (grouped[sha] = [])
list.push(file)
}
@ -130,8 +130,8 @@ function Sidebar({ files, selectedFile }: { files: string[]; selectedFile?: stri
<div style="padding: 4px 16px; color: #6b7280; font-size: 11px; font-family: monospace">{sha}</div>
{shaFiles.map((file) => {
const isSelected = file === selectedFile
// Parse ISO timestamp back from filename: sha_2026-03-10T02-56-59-938Z.jsonl
const isoStr = file.replace(/^[^_]+_/, "").replace(".jsonl", "").replace(/T(\d{2})-(\d{2})-(\d{2})-(\d+)Z/, "T$1:$2:$3.$4Z")
// Parse ISO timestamp back from filename: 2026-03-10T02-56-59-938Z_sha.jsonl
const isoStr = file.replace(/_[^_]+\.jsonl$/, "").replace(/T(\d{2})-(\d{2})-(\d{2})-(\d+)Z/, "T$1:$2:$3.$4Z")
const bg = isSelected ? "#2a2a2a" : "transparent"
return (
<a