diff --git a/package-lock.json b/package-lock.json index 25d6933..5a4e0a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "@radix-ui/react-scroll-area": "^1.0.5", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-separator": "^1.0.3", + "@radix-ui/react-slider": "^1.1.2", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", @@ -1180,6 +1181,39 @@ } } }, + "node_modules/@radix-ui/react-slider": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slider/-/react-slider-1.1.2.tgz", + "integrity": "sha512-NKs15MJylfzVsCagVSWKhGGLNR1W9qWs+HtgbmjjVUB3B9+lb3PYoXxVju3kOrpf0VKyVCtZp+iTwVoqpa1Chw==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/number": "1.0.1", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-collection": "1.0.3", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-direction": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-controllable-state": "1.0.1", + "@radix-ui/react-use-layout-effect": "1.0.1", + "@radix-ui/react-use-previous": "1.0.1", + "@radix-ui/react-use-size": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-slot": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz", diff --git a/package.json b/package.json index 1ccc1f6..24a6a6c 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@radix-ui/react-scroll-area": "^1.0.5", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-separator": "^1.0.3", + "@radix-ui/react-slider": "^1.1.2", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", diff --git a/src/app/(dashboard)/dashboard/preferences/page.tsx b/src/app/(dashboard)/dashboard/preferences/page.tsx new file mode 100644 index 0000000..e32cc48 --- /dev/null +++ b/src/app/(dashboard)/dashboard/preferences/page.tsx @@ -0,0 +1,130 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { + Card, + CardContent, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { Separator } from "@/components/ui/separator"; +import { Slider } from "@/components/ui/slider"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { CircleHelp } from "lucide-react"; +import React, { useState } from "react"; + +const dummyPreferences = [ + { + id: 1, + name: "readability", + description: "assesses the clarity and understandability of the code", + }, + { + id: 2, + name: "refinement", + description: "assesses the process and stages of code development", + }, + { + id: 3, + name: "modularity", + description: + "assesses how well the code is compartmentalized into separate parts", + }, + { + id: 4, + name: "optimization", + description: "assesses the code’s efficiency and resource management", + }, + { + id: 5, + name: "portability", + description: + "assesses the ability of the code to run in different environments", + }, + { + id: 6, + name: "robustness", + description: + "assesses how the code handles unexpected situations or inputs", + }, + { + id: 7, + name: "maintainability", + description: "assesses how easy it is to maintain and extend the code", + }, + { + id: 8, + name: "conformity", + description: "assesses adherence to predefined standards or best practices", + }, + { + id: 9, + name: "security", + description: + "assesses how the code protects data and resists malicious attacks", + }, + { + id: 10, + name: "functionality", + description: + "assesses how well the code achieves its intended functionality", + }, +]; + +const Page = () => { + const [value, setValue] = useState([50]); + + return ( +
+ + + + Code Evaluation Criteria + + + + + +
+ {dummyPreferences.map((item) => ( +
+
+

{item.name}

+ + + + + +

{item.description}

+
+
+
+ { + console.log(v); + setValue(v); + }} + min={0} + max={100} + step={1} + /> +
+ ))} +
+
+ + + +
+
+ ); +}; + +export default Page; diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx new file mode 100644 index 0000000..77e9fb7 --- /dev/null +++ b/src/components/ui/card.tsx @@ -0,0 +1,76 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +const Card = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +Card.displayName = "Card" + +const CardHeader = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardHeader.displayName = "CardHeader" + +const CardTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardTitle.displayName = "CardTitle" + +const CardDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardDescription.displayName = "CardDescription" + +const CardContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardContent.displayName = "CardContent" + +const CardFooter = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardFooter.displayName = "CardFooter" + +export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/src/components/ui/slider.tsx b/src/components/ui/slider.tsx new file mode 100644 index 0000000..c5fd6c8 --- /dev/null +++ b/src/components/ui/slider.tsx @@ -0,0 +1,43 @@ +"use client"; + +import * as React from "react"; +import * as SliderPrimitive from "@radix-ui/react-slider"; + +import { cn } from "@/lib/utils"; + +const Slider = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + + +
+ + {/* {formatLabel ? formatLabel(value) : value} */} + {props.value} + +
+ +
+)); +Slider.displayName = SliderPrimitive.Root.displayName; + +export { Slider };