diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 3617ae632..2972ef4e8 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -2,6 +2,7 @@ import { parseConfigYaml } from "@continuedev/config-yaml"; import { ArrowsPointingOutIcon, EyeIcon, + InformationCircleIcon, PencilIcon, } from "@heroicons/react/24/outline"; import { RuleWithSource } from "core"; @@ -11,7 +12,7 @@ import { DEFAULT_CHAT_SYSTEM_MESSAGE, DEFAULT_CHAT_SYSTEM_MESSAGE_URL, } from "core/llm/constructMessages"; -import { useContext, useMemo } from "react"; +import { useContext, useMemo, useState } from "react"; import { useAuth } from "../../../../context/Auth"; import { IdeMessengerContext } from "../../../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../../../redux/hooks"; @@ -22,6 +23,8 @@ import { import HeaderButtonWithToolTip from "../../../gui/HeaderButtonWithToolTip"; import { useFontSize } from "../../../ui/font"; import { ExploreBlocksButton } from "./ExploreBlocksButton"; +import { RulePolicyItem } from "./rules/RulePolicyItem"; +import { RulesSectionTooltip } from "./rules/RulesSectionTooltip"; interface RuleCardProps { rule: RuleWithSource; @@ -146,6 +149,7 @@ const RuleCard: React.FC = ({ rule }) => { export function RulesSection() { const { selectedProfile } = useAuth(); + const [showPolicies, setShowPolicies] = useState(false); const config = useAppSelector((store) => store.config.config); const mode = useAppSelector((store) => store.session.mode); @@ -213,12 +217,48 @@ export function RulesSection() { return rules; }, [config, selectedProfile, mode]); + const namedRules = useMemo(() => { + return sortedRules.filter((rule) => rule.name); + }, [sortedRules]); + return (
- {sortedRules.map((rule, index) => ( - - ))} - +
+ + +
+ +
+ +
+
+
+
+ + {showPolicies ? ( +
+ {namedRules.map((rule, index) => ( + + ))} + {namedRules.length === 0 && ( +
+ No rules with names available to configure policies. +
+ )} +
+ ) : ( + <> + {sortedRules.map((rule, index) => ( + + ))} + + + )}
); }