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

Toggle datatypes for table directly from view dropdown #366

Merged

Conversation

flashpunch0-0
Copy link
Contributor

proposed implementation

1- initially thought of creating a separate context and hook but the settings context did the provide a good base
2- added an attribute(showDataTypes) in settings context
image
3- in the en.js file created a reference
image

4- In the ControlPanel.jsx file under view dropdown created the option show Datatype
image
5- finally in the table.jsx added condition to check settings.showDatatypes and return the element as per condition
image

working
datatype -> onshow
image

datatype-> off
image

Reference issue and pr #346

Copy link

vercel bot commented Mar 15, 2025

@flashpunch0-0 is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Mar 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drawdb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2025 9:45pm

) : (
<i className="bi bi-toggle-off" />
),
function: () => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function: () => {
function: () =>
setSettings((prev) => ({
...prev,
showDataTypes: !prev.showDataTypes,
})),

Please make sure to update the state using the setSettings function. Also the build fails here, please take a lokk https://github.com/drawdb-io/drawdb/actions/runs/13877624768/job/38843669905?pr=366

? "(" + fieldData.size + ")"
: "")}
</span>
{settings.showDataTypes && (
Copy link
Member

Choose a reason for hiding this comment

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

Also try putting the condition before the div so that an emty element doesnt get added to the dom

…ement

in table.jsx code
in the else part im directly returning the element by keeping a check  for settings.showDataTypes?
which helps to not add empty element

for setSetting issue
I used the similar code used just above the snippet and modified it
Copy link
Member

@1ilit 1ilit left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

@1ilit 1ilit merged commit 3e7d1ac into drawdb-io:main Mar 16, 2025
4 checks passed
@1ilit 1ilit linked an issue Mar 16, 2025 that may be closed by this pull request
@flashpunch0-0
Copy link
Contributor Author

flashpunch0-0 commented Mar 16, 2025

@1ilit happy to contribute to this product
let's stay in touch and I'll be contributing more👍

@1ilit
Copy link
Member

1ilit commented Mar 16, 2025

For sure, looking forward to it, thanks for all your work

ewqazxc pushed a commit to ewqazxc/drawdb that referenced this pull request Mar 17, 2025
* showDatatype setting added in view control panel

* removed shortcut

can be discussed later

* fixed linting issue and made sure the condition check is above div element

in table.jsx code
in the else part im directly returning the element by keeping a check  for settings.showDataTypes?
which helps to not add empty element

for setSetting issue
I used the similar code used just above the snippet and modified it
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.

[FEATURE] Hide data types
2 participants