Skip to content

Warning log - #144

Merged
bernaferrari merged 6 commits into
bernaferrari:mainfrom
mimshwright:errors
Dec 29, 2024
Merged

bernaferrari merged 6 commits into
bernaferrari:mainfrom
mimshwright:errors

Conversation

@mimshwright

Copy link
Copy Markdown
Contributor

I've added a global object in backend/common that allows you to track errors when doing the conversion from Figma nodes to code.
The file exposes warnings (a Set<string>), addWarning(), and clearWarnings()
The warnings are passed on to the UI to display to the user.
The warnings are also logged to console using console.warn()

Screenshot 2024-12-18 at 23 43 57

Known issue: Any warnings for HTML always appear because they are triggered by the HTML Preview.
Known issue: I added warnings for a few conversion issues I was aware of but I assume there are many more that are not annotated.

@mimshwright

Copy link
Copy Markdown
Contributor Author

I also removed some of the extra UI when there were no layers selected.

image

Comment thread packages/plugin-ui/src/PluginUI.tsx Outdated
Comment on lines +99 to +101
<div className="flex flex-col bg-red-700 text-white p-4 w-full">
<h3 className="text-lg">Warnings:</h3>
<ul className="list-disc list-inside">

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to support both light and dark mode, I would do something like bg-red-300 text-black dark:bg-red-700 dark:text-white, or use opacity like dark:bg-red-700/40

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably also use a lucide warning icon and maybe yellow color since it is not THAT bad, just a warning, not an error

@bernaferrari

Copy link
Copy Markdown
Owner

I like it, thanks

@mimshwright

Copy link
Copy Markdown
Contributor Author

I've added the icon and changed the color to yellow. The dark one is slightly darker but changing it too much didn't look correct to me.
Also cleaned up alignment some.

image

@bernaferrari

Copy link
Copy Markdown
Owner

Oh no, now this has conflicts. Do prefer me to revert the other one, merge this, then merge the other one or do you want to rebase this? Whatever is easier for you. I forgot to merge this, sorry.

@mimshwright

Copy link
Copy Markdown
Contributor Author

This should be rebased and all fixed.

@bernaferrari
bernaferrari merged commit 2886e64 into bernaferrari:main Dec 29, 2024
@bernaferrari

Copy link
Copy Markdown
Owner

Thanks!!

@mimshwright
mimshwright deleted the errors branch December 29, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants