overhaul complete

This commit is contained in:
2026-05-07 11:02:34 +02:00
parent d860d78543
commit 779a1fdb82
29 changed files with 1612 additions and 213 deletions
+30
View File
@@ -0,0 +1,30 @@
import { useCallback } from 'react'
export interface RecentRepo {
ownerName: string
name: string
visitedAt: number
}
const KEY = 'fb_recent_repos'
const MAX = 5
function read(): RecentRepo[] {
try {
return JSON.parse(localStorage.getItem(KEY) ?? '[]')
} catch {
return []
}
}
export function useRecentRepos() {
const repos = read()
const track = useCallback((ownerName: string, name: string) => {
const existing = read().filter(r => !(r.ownerName === ownerName && r.name === name))
const updated: RecentRepo[] = [{ ownerName, name, visitedAt: Date.now() }, ...existing].slice(0, MAX)
localStorage.setItem(KEY, JSON.stringify(updated))
}, [])
return { repos, track }
}