feat: auth & admin

This commit is contained in:
2026-06-03 10:41:53 +03:00
parent 612d0f0125
commit 7dc59fb3c4
120 changed files with 4683 additions and 2159 deletions
@@ -18,7 +18,7 @@ function ProjectList({ projects }: { projects: Project[] }) {
{projects.map(project => {
// slugify() called 100+ times for same project names
const slug = slugify(project.name)
return <ProjectCard key={project.id} slug={slug} />
})}
</div>
@@ -47,7 +47,7 @@ function ProjectList({ projects }: { projects: Project[] }) {
{projects.map(project => {
// Computed only once per unique project name
const slug = cachedSlugify(project.name)
return <ProjectCard key={project.id} slug={slug} />
})}
</div>
@@ -58,20 +58,20 @@ function ProjectList({ projects }: { projects: Project[] }) {
**Simpler pattern for single-value functions:**
```typescript
let isLoggedInCache: boolean | null = null
let isLoggedInCache: boolean | null = null;
function isLoggedIn(): boolean {
if (isLoggedInCache !== null) {
return isLoggedInCache
return isLoggedInCache;
}
isLoggedInCache = document.cookie.includes('auth=')
return isLoggedInCache
isLoggedInCache = document.cookie.includes('auth=');
return isLoggedInCache;
}
// Clear cache when auth changes
function onAuthChange() {
isLoggedInCache = null
isLoggedInCache = null;
}
```