// make a page where you can select from garment types, collection types and numbers to create a copyable name "use client" import { Input } from "@/components/ui/input"; import { Combox } from "components/combox"; import { ProductSKUs } from "components/product/sku-generator"; import { collectionsSKUs, garmentHandleKeys } from "constants/sku"; import { capitalizeFirstLetter, copyText, getKeyByValue } from "lib/helpers/actions"; import { useEffect, useState } from "react"; // type SKUSelectorState = { // garment?: keyof typeof garmentHandleKeys, // collection?: keyof typeof collectionsSKUs, // }; export default async function NewProductHelpPage() { // const [open, setOpen] = useState(false) const [collection, setCollection] = useState(null) const [garment, setGarment] = useState(null) const [title, setTitle] = useState(null) const [number, setNumber] = useState(null) useEffect(() => { const title = createTitle() console.log("🍓🍋🍊 title", title); }, [collection, garment]) const garmentValues = Object.keys(garmentHandleKeys) const collectionValues = Object.keys(collectionsSKUs) const optionsMapper = (keys: {}, values: string[]) => { return values.map(value => { return { key: keys[value as keyof typeof keys], label: value, } }) } const garmentOptions = optionsMapper(garmentHandleKeys, garmentValues); const collectionOptions = optionsMapper(collectionsSKUs, collectionValues); const createTitle = () => { let collectionMapper = getKeyByValue(collectionsSKUs, collection) if (collectionMapper) collectionMapper = capitalizeFirstLetter(collectionMapper) let garmentMapper = getKeyByValue(garmentHandleKeys, garment) if (garmentMapper) garmentMapper = capitalizeFirstLetter(garmentMapper) setTitle(`${collectionMapper}scape No.${number} ${garmentMapper}`) } return (

New Product Creator

setCollection(key as keyof typeof collectionsSKUs)} currentKey={collection || null} />
setNumber(e.target.value)} />
setGarment(key as keyof typeof garmentHandleKeys)} currentKey={garment || null} />
{garment && collection && number && title && <>
copyText(title)} > {title}
}
) }