diff --git a/pages/research/index.jsx b/pages/research/index.jsx index 2afee6f..87159e4 100644 --- a/pages/research/index.jsx +++ b/pages/research/index.jsx @@ -4,9 +4,37 @@ import ResearchCard from '../../components/ResearchCard' import SectionHeader from '../../components/ui/SectionHeader' import { getSortedResearch } from '../../lib/getSortedResearch' +const categoryOrder = ['Publication', 'Case study', 'Experimentation', 'Explainer'] +const categoryLabels = { + 'Case study': 'Case Studies', + 'Publication': 'Publications', + 'Experimentation': 'Explorations', + 'Explainer': 'Explainers' +} +const caseStudyOrder = [ + 'safe-owner-reachability', + 'lido-vault-solvency', + 'nexus-mutual-book-value', + 'stream-recovery-claim' +] + export default function ResearchPage() { const research = getSortedResearch() + const grouped = categoryOrder + .map((tag) => { + const items = research.filter((item) => item.tag === tag) + if (tag === 'Case study') { + items.sort((a, b) => { + const ai = caseStudyOrder.indexOf(a.slug) + const bi = caseStudyOrder.indexOf(b.slug) + return (ai === -1 ? Infinity : ai) - (bi === -1 ? Infinity : bi) + }) + } + return { tag, label: categoryLabels[tag], items } + }) + .filter((group) => group.items.length > 0) + return ( <>
@@ -22,9 +50,16 @@ export default function ResearchPage() { Our Research -