Skip to content

Commit

Permalink
fix: remove extra spacing in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
ozhanefemeral committed Jul 28, 2024
1 parent eead7a7 commit e6aafa9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions apps/next/app/features/code-generator/CodeGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ export const CodeGenerator: React.FC = () => {
const { saveCurrentState } = useSavedFunctions();

const isEmpty = state.blocks.length === 0;
const outputWithBreakLine = code.replace(/;/g, ";\n").replace(/{/g, "{\n");

const handleSave = (name: string) => {
saveCurrentState(name, state);
navigator.clipboard.writeText(outputWithBreakLine);
navigator.clipboard.writeText(code);
};

const handleClear = () => {
setState({
blocks: [],
variables: [],
isAsync: false
isAsync: false,
});
};

Expand All @@ -34,7 +33,7 @@ export const CodeGenerator: React.FC = () => {
<SortableBlockList />
</div>
<div className="col-span-1">
<CodeViewer code={outputWithBreakLine} />
<CodeViewer code={code} />
</div>
<div className="col-span-2 mt-auto flex justify-end gap-x-4 items-end">
<SaveDialog onSave={handleSave} isEmpty={isEmpty} />
Expand All @@ -49,4 +48,4 @@ export const CodeGenerator: React.FC = () => {
</div>
</section>
);
};
};

0 comments on commit e6aafa9

Please sign in to comment.