From 6a06d890aa130811ead5a6d2fa36e285fff3cd2e Mon Sep 17 00:00:00 2001 From: clean99 Date: Fri, 24 Nov 2023 11:10:51 +0800 Subject: [PATCH] feat: update instructions convert --- frontend/src/lib/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts index ec79801..c6010cb 100644 --- a/frontend/src/lib/utils.ts +++ b/frontend/src/lib/utils.ts @@ -1,6 +1,12 @@ +import { Instruction } from "@/types"; import { type ClassValue, clsx } from "clsx" import { twMerge } from "tailwind-merge" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } + +export const handleInstructions = (instructions: string): string => + (JSON.parse(instructions) || []).map((line: Instruction) => + `- ${line.element} in the ${line.location} has a mistake: ${line.mistake}, please update: ${line.improvement}.`).join("\n\n"); +