diff --git a/src/components/Group.tsx b/src/components/Group.tsx index d665fdf..00c689b 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -19,6 +19,17 @@ const Group = ({ className={`p-4 grid grid-cols-10 grid-flow-row-dense gap-3 text-sm w-full`} > {data.blocks.map((block, i) => { + // Sort entries based on "CO-DESIGN LEVEL" + const sortedEntries = block.entries.sort((b, a) => { + const levelA = a.PARSED_MANUAL_TAGS["CO-DESIGN LEVEL"] || ""; + const levelB = b.PARSED_MANUAL_TAGS["CO-DESIGN LEVEL"] || ""; + + // Assuming "CO-DESIGN LEVEL" is alphanumeric, adjust comparison logic accordingly + if (levelA < levelB) return -1; + if (levelA > levelB) return 1; + return 0; + }); + return ( { - const level = getLevel(data); - const bgColor = getBgColorClassName(level); + const bgColor = getNodeBgColorClassName(data); const access = data?.PARSED_MANUAL_TAGS?.ACCESS?.[0]; const starColor = getColorByAccess(access); const summary = data.Notes?.replace(/<[^>]*>?/gm, ""); @@ -30,11 +29,14 @@ export function NodeCard({ window?.open(data?.url, "_blank")?.focus(); }; + return (
-
+
+ {data.title &&

{data.title}

} {data.authors &&

{data.authors}

} {(access === "Institutional Access" || @@ -45,6 +47,7 @@ export function NodeCard({
)}
+ {data.authors && (

Author(s): {data.authors} diff --git a/src/data/basic-tools/index.ts b/src/data/basic-tools/index.ts index d964fe7..315de1a 100644 --- a/src/data/basic-tools/index.ts +++ b/src/data/basic-tools/index.ts @@ -2,12 +2,16 @@ import output from "@/data/zotero"; import { Block, Entry } from "@/types/interfaces"; import { approaches } from "./approaches"; import { toolsData } from "./tools-data"; +import { isBasicTool } from "@/utils/helpers"; const toolData = toolsData["BASIC TOOLS"]; -const entries = output.filter( - (entry) => entry?.PARSED_MANUAL_TAGS && "BASIC TOOLS" in entry.PARSED_MANUAL_TAGS -) as unknown as Entry[]; +const entries = output + .filter((entry) => isBasicTool(entry)) + .map((entry) => ({ + ...entry, + isBasicTool: true, + })) as unknown as Entry[]; const groups: Block[] = [ { diff --git a/src/pages/case-studies-and-core-tools.tsx b/src/pages/case-studies-and-core-tools.tsx index b3a89d1..71568f9 100644 --- a/src/pages/case-studies-and-core-tools.tsx +++ b/src/pages/case-studies-and-core-tools.tsx @@ -9,6 +9,7 @@ const caseStudiesAndCoreTools = () => {

{groups?.map((data, index) => { + console.log("tesss") return ( { const attributeValues = entry?.PARSED_MANUAL_TAGS?.[name]; if (Array.isArray(attributeValues)) return attributeValues.includes(value); @@ -86,3 +88,6 @@ export const getRandomColor = () => { return hexColor; }; + + +export const isBasicTool = (entry: any) => entry?.PARSED_MANUAL_TAGS && "BASIC TOOLS" in entry.PARSED_MANUAL_TAGS \ No newline at end of file diff --git a/src/utils/nodes.ts b/src/utils/nodes.ts index cef258b..c37bd33 100644 --- a/src/utils/nodes.ts +++ b/src/utils/nodes.ts @@ -1,4 +1,6 @@ +import { Entry } from "@/types/interfaces"; import classNames from "classnames"; +import { isBasicTool } from "./helpers"; export function getColorByAccess(accessType: string) { switch (accessType) { @@ -35,3 +37,12 @@ export const getBgColorClassName = (level: any) => { ); } }; + +export const getNodeBgColorClassName = (entry: Entry) => { + console.log(entry) + + if(entry.isBasicTool) return classNames("bg-[#f8cecc] border-[#b85450]"); + + const level = getLevel(entry); + return getBgColorClassName(level); +}; diff --git a/tsconfig.json b/tsconfig.json index fb68dc1..388376c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,10 @@ { "compilerOptions": { - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -13,9 +17,18 @@ "jsx": "preserve", "incremental": true, "paths": { - "@/*": ["./src/*"] - } + "@/*": [ + "./src/*" + ] + }, + "target": "ES2017" }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "node_modules" + ] }