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

adds a collapsible "create new app" section #163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

delasource
Copy link
Contributor

@delasource delasource commented Oct 24, 2024

fixes caprover/caprover#2171

This is just a small ui adjustment and should not break anything. It uses standard html <dialog> functionality.

Screenshots of this change is in the linked issue

@delasource
Copy link
Contributor Author

should run now pretty.

Copy link
Collaborator

@githubsaturn githubsaturn left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Generally, I am aligned with the intention, but implementation needs to be reconsidered.

hasPersistency
)
<details id="create-new-app">
<summary style={{display: 'none'}}></summary>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Look into hide-on-deman usage in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what is the meaning of the "-on-demand" part?

Note: i hide the summary element, as the button to open the details element needs to be somewhere else.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, you can just create a div element and use hide-on-demand class to hide it and show it when it needs to. There are many examples of that in the code.

}}
>
<Button
onClick={() => document.getElementById('create-new-app')?.toggleAttribute('open')}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is an antipattern in react. You must use callbacks and redux if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i tried to implement the minimalistic change here and relied on basic html5 feature. Since there is no state-tracking possibility of the "open" state of the element, the only other approach would be to use useRef.

Since Apps.tsx and AppsTable.tsx are separated i don't have the exact overview of your hierarchy, so i found that this is the simplest approach. Also, it is just frontend only.

But feel free to adjust it if you are not happy with my approach here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Typically, you should just use a call back if it's the parent, or use redux. Modifying DOM elements are not recommended approach when using react.js.

If you want you can leave the pr as is. I'll make the change later.

<Button
onClick={() => document.getElementById('create-new-app')?.toggleAttribute('open')}
type="primary"
>
Copy link
Collaborator

Choose a reason for hiding this comment

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

The button needs to hide when the create app panel is visible.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also create app panel needs to have a close button that result in this button being visible again.

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.

UI: Collapse "Create A New App"
2 participants