"use client";
import { vipnagorgialla } from "@/components/Vipnagorgialla";
interface RuleSection {
title: string;
rules: (string | { main: string; sub: (string | { main: string; sub: string[] })[] })[];
}
interface CS2RulesProps {
sections: RuleSection[];
}
function RuleItem({ rule, index }: { rule: string | { main: string; sub: (string | { main: string; sub: string[] })[] }; index: number }) {
if (typeof rule === "string") {
return (
{index}.
{rule}
);
}
return (
{index}.
{rule.main}
{rule.sub && rule.sub.length > 0 && (
{rule.sub.map((subRule, subIndex) => {
if (typeof subRule === "string") {
return (
-
{index}.{subIndex + 1}.
{subRule}
);
}
return (
-
{index}.{subIndex + 1}.
{subRule.main}
{subRule.sub && subRule.sub.length > 0 && (
{subRule.sub.map((subSubRule, subSubIndex) => (
-
{index}.{subIndex + 1}.{subSubIndex + 1}.
{subSubRule}
))}
)}
);
})}
)}
);
}
export default function CS2Rules({ sections }: CS2RulesProps) {
let ruleCounter = 0;
return (
{sections.map((section, sectionIndex) => {
const startIndex = ruleCounter;
ruleCounter += section.rules.length;
return (
{sectionIndex + 1}) {section.title}
{section.rules.map((rule, ruleIndex) => (
))}
);
})}
);
}