feat(cases): cases de clientes, serviços ligados à prova e SEO por página
Cases da SEV Moda Íntima e da Lavação 047; case no formato cliente, problema, entrega, mídia e contato, com detalhes técnicos recolhidos; sem GitHub, ressalvas e fontes de commit. /cases separa clientes e Laboratório. Serviços mostram o case de cliente certo e o bloco de investimento e prazo só aparece preenchido. Metadata social própria por página, not-found com noindex, sitemap com /ia.
This commit is contained in:
1 parent
3756905a1b
commit
6e1022b58c
44 files changed
+2691
-1424
No files matched your search
+1
-63
@@ -1,19 +1,12 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import portfolioData from "@/public/portfolio-data.json";
|
||||
import {
|
||||
createProjectHealthSnapshot,
|
||||
type DemoAvailability,
|
||||
getDemoAvailability,
|
||||
PROJECT_HEALTH_MAX_AGE_MS,
|
||||
type ProjectHealthSnapshot,
|
||||
} from "./project-health";
|
||||
|
||||
export type PortfolioData = typeof portfolioData;
|
||||
type PortfolioData = typeof portfolioData;
|
||||
export type PortfolioProject = PortfolioData["projects"][number];
|
||||
export type PortfolioExperience = PortfolioData["experiences"][number];
|
||||
export type PortfolioSkillCategory =
|
||||
PortfolioData["skills"]["technical"][number];
|
||||
|
||||
export type PortfolioProjectView = PortfolioProject & {
|
||||
demoAvailability: DemoAvailability;
|
||||
@@ -36,58 +29,3 @@ export function getFeaturedProjects(
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function isSnapshotFresh(
|
||||
snapshot: ProjectHealthSnapshot | null,
|
||||
now = new Date(),
|
||||
) {
|
||||
if (!snapshot) return false;
|
||||
const checkedAt = Date.parse(snapshot.checkedAt);
|
||||
return (
|
||||
Number.isFinite(checkedAt) &&
|
||||
now.getTime() - checkedAt <= PROJECT_HEALTH_MAX_AGE_MS
|
||||
);
|
||||
}
|
||||
|
||||
export async function loadProjectHealthSnapshot(): Promise<ProjectHealthSnapshot | null> {
|
||||
try {
|
||||
const path = resolve(process.cwd(), "data/project-health.json");
|
||||
return JSON.parse(await readFile(path, "utf8")) as ProjectHealthSnapshot;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadFeaturedProjects(): Promise<PortfolioProjectView[]> {
|
||||
const snapshot = await loadProjectHealthSnapshot();
|
||||
if (process.env.NODE_ENV !== "development" || isSnapshotFresh(snapshot)) {
|
||||
return getFeaturedProjects(snapshot);
|
||||
}
|
||||
|
||||
const projectDemos = portfolio.projects.reduce<
|
||||
Array<{ id: string; demoUrl: string }>
|
||||
>((demos, project) => {
|
||||
if (project.demoUrl)
|
||||
demos.push({ id: project.id, demoUrl: project.demoUrl });
|
||||
return demos;
|
||||
}, []);
|
||||
|
||||
try {
|
||||
const refreshed = await createProjectHealthSnapshot(projectDemos);
|
||||
const projects = { ...refreshed.projects };
|
||||
|
||||
for (const [id, check] of Object.entries(projects)) {
|
||||
if (!check.error && check.status !== null) continue;
|
||||
const previous = snapshot?.projects[id];
|
||||
if (previous && !previous.error && previous.status !== null) {
|
||||
projects[id] = previous;
|
||||
} else {
|
||||
delete projects[id];
|
||||
}
|
||||
}
|
||||
|
||||
return getFeaturedProjects({ ...refreshed, projects });
|
||||
} catch {
|
||||
return getFeaturedProjects(snapshot);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user