/* eslint-disable @typescript-eslint/no-explicit-any */ import { ShortCodeProps } from "@/Constant/types"; import { ErrorMessage, Field } from "formik"; import React from "react"; const ShortCode: React.FC = ({ toggleSection, openSections, showShortCodeSection, shortCodeDisabled, handleShortCodeDisabled, shortCodeError, shortCodeSuggestions, generateShortCodeSuggestions, setShortCodeSuggestions, setFieldValue, setShortCodeError, }) => { return ( <> {showShortCodeSection && (
toggleSection("shortCode")} style={{ cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "space-between", padding: "1rem", background: "#fff", borderRadius: "10px 10px 0 0", border: "1px solid #eee", borderBottom: openSections.shortCode ? "none" : "1px solid #eee", }} >

Short Code

{shortCodeDisabled ? ( { e.preventDefault(); handleShortCodeDisabled(); }} > Edit ) : ( )}
{openSections.shortCode && (

Create a unique 3-character short code for quick identification.

{shortCodeError && (
{shortCodeError}
)}
Must be 3 characters (A-Z, 0-9)
{/* Short Code Suggestions */} {!shortCodeDisabled && (
{shortCodeSuggestions.length > 0 ? ( <>
Suggested short codes:
{shortCodeSuggestions.map( (suggestion: string, index: number) => ( ) )}
) : ( Generating suggestions... )}
)}
)}
)} ); }; export default ShortCode;