Skip to content

Commit 3bb5f86

Browse files
committed
commit on dev
1 parent 76b0ac9 commit 3bb5f86

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

app/src/helperFunctions/generateCode.ts

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -300,39 +300,39 @@ const generateUnformattedCode = (
300300
return state;
301301
};
302302

303-
// // Generate import --- FROM PREVIOUS ITERATION BEFORE 12.0, NOT WORKING -> CONSIDER DELETING
304-
let importContext = '';
305-
if (currComponent.useContext) {
306-
for (const providerId of Object.keys(currComponent.useContext)) {
307-
const providerComponent = components[parseInt(providerId) - 1];
308-
importContext += `import ${providerComponent.name}Context from './${providerComponent.name}.tsx'\n \t\t`;
309-
}
310-
}
311-
if (currComponent.useContext) {
312-
for (const providerId of Object.keys(currComponent.useContext)) {
313-
const statesFromProvider =
314-
currComponent.useContext[parseInt(providerId)].statesFromProvider; //{1: {Set, compLink, compText}, 2 : {}...}
315-
const providerComponent = components[parseInt(providerId) - 1];
316-
providers +=
317-
'const ' +
318-
providerComponent.name.toLowerCase() +
319-
'Context = useContext(' +
320-
providerComponent.name +
321-
'Context);\n \t\t';
322-
for (let i = 0; i < providerComponent.stateProps.length; i++) {
323-
if (statesFromProvider.has(providerComponent.stateProps[i].id)) {
324-
context +=
325-
'const ' +
326-
providerComponent.stateProps[i].key +
327-
' = ' +
328-
providerComponent.name.toLowerCase() +
329-
'Context.' +
330-
providerComponent.stateProps[i].key +
331-
'; \n \t\t';
332-
}
333-
}
334-
}
335-
}
303+
// // // Generate import --- FROM PREVIOUS ITERATION BEFORE 12.0, NOT WORKING -> CONSIDER DELETING
304+
// let importContext = '';
305+
// if (currComponent.useContext) {
306+
// for (const providerId of Object.keys(currComponent.useContext)) {
307+
// const providerComponent = components[parseInt(providerId) - 1];
308+
// importContext += `import ${providerComponent.name}Context from './${providerComponent.name}.tsx'\n \t\t`;
309+
// }
310+
// }
311+
// if (currComponent.useContext) {
312+
// for (const providerId of Object.keys(currComponent.useContext)) {
313+
// const statesFromProvider =
314+
// currComponent.useContext[parseInt(providerId)].statesFromProvider; //{1: {Set, compLink, compText}, 2 : {}...}
315+
// const providerComponent = components[parseInt(providerId) - 1];
316+
// providers +=
317+
// 'const ' +
318+
// providerComponent.name.toLowerCase() +
319+
// 'Context = useContext(' +
320+
// providerComponent.name +
321+
// 'Context);\n \t\t';
322+
// for (let i = 0; i < providerComponent.stateProps.length; i++) {
323+
// if (statesFromProvider.has(providerComponent.stateProps[i].id)) {
324+
// context +=
325+
// 'const ' +
326+
// providerComponent.stateProps[i].key +
327+
// ' = ' +
328+
// providerComponent.name.toLowerCase() +
329+
// 'Context.' +
330+
// providerComponent.stateProps[i].key +
331+
// '; \n \t\t';
332+
// }
333+
// }
334+
// }
335+
// }
336336
// create final component code. component code differs between classic react, next.js, gatsby.js
337337
// classic react code
338338
if (projectType === 'Classic React') {

0 commit comments

Comments
 (0)