feat(guides) : add safer publishing and discovery
CI / Verify (push) Successful in 1m35s
CI / Build immutable images and deploy (push) Successful in 5m27s

This commit is contained in:
2026-09-19 13:32:57 +07:00 Unverified
parent 6698dc1302
commit 9896e8a4ad
27 changed files with 3213 additions and 108 deletions
+31
View File
@@ -0,0 +1,31 @@
import type { PublicGuide } from "@/lib/guides/queries";
function hasPublicSectionContent(guide: PublicGuide, slug: string): boolean {
if (slug === "weapon") return guide.weapons.length > 0;
if (slug === "artifact") {
return guide.artifactGroups.some((condition) =>
condition.tiers.some((group) => group.rows.length > 0),
) || Boolean(
guide.artifactProfile && (
guide.artifactProfile.recommendedConditions.some((condition) =>
condition.sands.length || condition.goblet.length || condition.circlet.length || condition.substats.length,
) ||
guide.artifactProfile.sands.length ||
guide.artifactProfile.goblet.length ||
guide.artifactProfile.circlet.length ||
guide.artifactProfile.substats.length ||
guide.artifactProfile.targetConditions.some((group) => group.rows.length) ||
guide.artifactProfile.talents.length
),
);
}
if (slug === "constellations") {
return guide.constellationGroups.some((group) => group.rows.length > 0);
}
if (slug === "team") return guide.teams.length > 0;
return guide.extras.some((extra) => extra.slug === slug && extra.rows.length > 0);
}
export function publicGuideSections(guide: PublicGuide) {
return guide.sections.filter((section) => hasPublicSectionContent(guide, section.slug));
}