drawdb-io / drawdb

Free, simple, and intuitive online database design tool and SQL generator.
https://drawdb.vercel.app
MIT License
12.09k stars 855 forks source link

Adding the Ability to Share Database Diagrams via Links #75

Open Javekson opened 2 months ago

Javekson commented 2 months ago

We propose adding a feature that allows users to create links to their database diagrams and share them with other participants. This will enable users to quickly and easily exchange their data models, facilitating collaboration and learning.

micatonge commented 2 months ago

Hi! Id like to work on this :)

1ilit commented 2 months ago

Hi @micatonge, how do you plan on implementing this

micatonge commented 2 months ago

@1ilit In the ControlPanel.jsx file, I added a button component wrapped in a tooltip to enable users to share links to their database diagrams. When clicked, the shareLink function constructs the full URL of the diagram by appending the unique diagramId to the base URL obtained from window.location.origin. Then, it copies this URL to the clipboard using the navigator.clipboard.writeText() method. Upon successful copying, I set the tooltipVisible state to true, displaying a tooltip indicating that the link has been copied. After 3 seconds, the tooltip is hidden again. This functionality allows users to easily share their diagrams with others for collaboration and learning purposes.

In the App.jsx file, I updated the React Router configuration to include a dynamic route parameter :diagramId in the path /editor/:diagramId. This allows the application to handle URLs with specific diagram identifiers. When a user navigates to a URL like /editor/1, React Router matches it to the corresponding route and passes the diagramId as a parameter to the Editor component. This enables the Editor component to load the corresponding diagram based on the provided diagramId, facilitating seamless navigation and collaboration within the application.

In addition to enabling users to share links to their database diagrams, I believe it's essential to incorporate authorization mechanisms to ensure data security and privacy. Similar to the UI/UX design of Canva, where shared documents can only be accessed by users with appropriate permissions, our application should implement similar functionality.

When a user shares a link to a database diagram, the link should be associated with specific access permissions. This could involve generating unique tokens or access codes tied to the shared diagram, which are then validated upon access. Additionally, users should have the ability to set permissions when sharing a diagram, specifying whether recipients can view, edit, or comment on the diagram.

From a UI/UX perspective, this authorization process can be seamlessly integrated into the sharing workflow. When generating a share link, users should be presented with options to configure access permissions. This could be achieved through intuitive dropdown menus or checkboxes allowing users to specify who can access the diagram and what actions they can perform.

Furthermore, the application should provide clear notifications and prompts to users when accessing shared diagrams, indicating the level of access granted and prompting users to sign in or authenticate if necessary. By prioritizing data security and user privacy in the sharing feature's design, we can enhance user trust and confidence in our application.

DesignThinkerer commented 1 month ago

Maybe you could use gist to store the db ? Like https://sqlime.org/