This commit is contained in:
Rizky 2024-03-17 13:07:37 +07:00
parent 8308622901
commit 3958a7a016
1 changed files with 13 additions and 5 deletions

View File

@ -139,19 +139,22 @@ const Name: FC<{ name: string; is_jsx_prop: boolean; meta?: IMeta }> = ({
is_jsx_prop, is_jsx_prop,
meta, meta,
}) => { }) => {
if (is_jsx_prop) {
let comp_label = ""; let comp_label = "";
const comp_id = meta?.item.component?.id; if (meta?.item.component?.id) {
for (const prop of Object.values(meta?.item.component?.props || {})) { for (const prop of Object.values(meta?.item.component?.props || {})) {
if (prop.is_name) { if (prop.is_name) {
try { try {
eval(`comp_label = ${prop.valueBuilt}`); eval(`comp_label = ${prop.valueBuilt}`);
} catch (e) {} } catch (e) {}
if (typeof comp_label !== "string" && typeof comp_label !== "number") { if (typeof comp_label !== "string" && typeof comp_label !== "number") {
comp_label = "asdas"; comp_label = "";
} }
} }
} }
}
if (is_jsx_prop) {
const comp_id = meta?.item.component?.id;
return ( return (
<div className={cx("flex items-center space-x-1 pr-1")}> <div className={cx("flex items-center space-x-1 pr-1")}>
@ -205,7 +208,12 @@ Please put {${name}} somewhere inside component JS.`}</div>
); );
} }
return <div>{name}</div>; return (
<div>
{name}
{comp_label && `: ${comp_label}`}
</div>
);
}; };
const GenerateJSX: FC<{ meta: IMeta }> = ({ meta }) => { const GenerateJSX: FC<{ meta: IMeta }> = ({ meta }) => {