Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(apps): edit app source form #9795

Merged
merged 4 commits into from
May 17, 2022
Merged

feat(apps): edit app source form #9795

merged 4 commits into from
May 17, 2022

Conversation

mariusandra
Copy link
Collaborator

Problem

The plugin source drawer, with its multiple code editors, won't scale when we add support for editing apps. It also uses the old antd form, and was in need of a refactor.

Changes

  • Only changes the frontend.
  • Refactors the source editor to load its own data (split from pluginsLogic) and use kea-forms
  • Adds files in tabs in the source editor
  • Add basic handling for error states

2022-05-16 13 20 32

How did you test this code?

Played around in the interface. The API didn't change and the new frontend sends the right data.

Copy link
Contributor

@yakkomajuri yakkomajuri left a comment

Choose a reason for hiding this comment

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

left one comment and will let @Twixes review the frontend code - this certainly looks good to me, in the aesthetic sense

frontend/src/scenes/plugins/edit/pluginSourceLogic.tsx Outdated Show resolved Hide resolved
mariusandra and others added 2 commits May 16, 2022 15:50
Copy link
Collaborator

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

This definitely makes sense overall. My only comments are about the tabs pattern in PluginSourceTabs, though I applied the changes as 1ec693f in a stepping-on-toes way.
Just for context though, why not use Ant Tabs as we don't have an in-house Tabs style formed yet?

Before

before

After

after-x

const { currentFile, fileNames, pluginSourceValidationErrors } = useValues(pluginSourceLogic)

return (
<LemonRow style={{ padding: 0 }}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't need to be a LemonRow, especially since the child buttons are LemonRow-based already. We just need flexbox.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was even in storybook, so 🙈. Thanks!

{fileNames.map((fileName) => (
<LemonButton
key={fileName}
type={currentFile === fileName ? 'secondary' : 'tertiary'}
Copy link
Collaborator

Choose a reason for hiding this comment

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

These types don't perform super well here:

  • tertiary is intended for really "extra" actions, which we don't want to clutter up the screen too much for users (like "Show details" on insight cards) – but tabs are a key element of navigation, so we definitely want those buttons to look clickable
  • the secondary button is outlined, which gives it a ton of individuality, making the pattern feel less like tabs and more like disparate actions
    I suggest using the default type for cohesiveness and instead marking the active file with the active prop.

return (
<LemonRow style={{ padding: 0 }}>
{fileNames.map((fileName) => (
<LemonButton
Copy link
Collaborator

Choose a reason for hiding this comment

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

A gap of 0.5rem between those tab buttons would be perfect

@mariusandra
Copy link
Collaborator Author

Thanks for the review and the stepping and the ✅. Will merge.

Side-question: Other than having read through global.scss for fun and profit, how should I become aware that flex-center and mb-05 are things? Should we make a new "general layout guidelines" section in storybook as well?

@mariusandra mariusandra merged commit 4508e90 into master May 17, 2022
@mariusandra mariusandra deleted the plugin-source-form branch May 17, 2022 11:28
@Twixes
Copy link
Collaborator

Twixes commented May 17, 2022

TBH if you read global.scss and start using them, that's fine, but if you don't use them, that's fine too. It's a pretty half-baked set of utility classes. @benjackwhite suggested fleshing it out a bit and in that case I think some documentation could be part of the effort. Or we can just start using Tailwind. 🤔

alexkim205 pushed a commit that referenced this pull request May 23, 2022
* bind logic also in VerticalForm

* use a kea form and tabs for plugin source editor

* Update frontend/src/scenes/plugins/edit/pluginSourceLogic.tsx

Co-authored-by: Yakko Majuri <38760734+yakkomajuri@users.noreply.github.com>

* Apply `PluginSourceTabs` suggestion from code review

Co-authored-by: Yakko Majuri <38760734+yakkomajuri@users.noreply.github.com>
Co-authored-by: Michael Matloka <dev@twixes.com>
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.

None yet

3 participants