-
Notifications
You must be signed in to change notification settings - Fork 2
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
Create insert panel for inserting instances and relations #48
Draft
aematei
wants to merge
29
commits into
master
Choose a base branch
from
feat/30-insert-component
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 5 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
005401d
wip: moving algorithms panel to bottom left toolbar, make sure to con…
aematei 8333ea6
wip: consolidate toolbar
aematei 58253a0
Merge changes from master
aematei a3cbd9d
Add arrow icon to download button to indicate a pop-out menu
aematei 10b6202
wip: build InsertPanel ui component
aematei 052973d
wip: build insert panel
aematei 0c47837
Rename relationships to relations and components to instances
aematei 0bfacdd
Merge branch 'master' into feat/30-insert-component
aematei 8648303
Style insert panel and sub components
aematei 22e0a1c
Install pragmatic dnd
aematei 6d4f3e1
Install pragmatic-dnd
aematei e43e76a
Remove old click and drag code
aematei 613cb93
Install tiny-invariant for use with pragmatic-dnd
aematei 5cebdcd
Make new instances draggable and style similarly to diagram nodes
aematei 35e108c
Rolled back a commit on local, need to merge to resolve conflict
aematei 13f20d6
Style instance pane and instance item
aematei b496ca0
wip: initial relation pane styling
aematei c6ef490
wip: initial relation pane styling
aematei c0de6a7
Restructure InsertPanel UI components
aematei 78e399d
Add highlighting to draggable elements
aematei aa55cdc
Change on hover for instance
greypilgrim 5b02395
add insert panel component with relations data from OML model
aematei 44a6052
add insert panel component with instance data from OML model
aematei fb764c5
Merge branch 'master' into feat/30-insert-component
aematei 40dda23
Remove mock instance items
aematei c028f56
Reformat instance and relation items
aematei 9b6b843
Fix npm package vulnerabilities
aematei 101448d
Add util for formatting insert entities and its unit test
aematei b61aa43
Style insert items for hover and auto container resizinf
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { ReactElement } from "react"; | ||
|
||
interface InsertItemProps { | ||
label: string; | ||
onItemClicked: () => void; | ||
icon: ReactElement<any>; | ||
} | ||
|
||
const InsertItem: React.FC<InsertItemProps> = ({ label, onItemClicked, icon }) => { | ||
return ( | ||
<div onClick={ onItemClicked } className="flex flex-row"> | ||
<span className="text-[10px]">{ label }</span> | ||
{ icon } | ||
</div> | ||
) | ||
} | ||
|
||
interface InsertPanelProps { | ||
components: InsertItemProps[]; | ||
relationships: InsertItemProps[]; | ||
} | ||
|
||
const InsertPanel: React.FC<InsertPanelProps> = ({ components, relationships }) => { | ||
return ( | ||
<div className="flex flex-col {`z-10 p-2 space-y-2 rounded shadow-md bg-[var(--vscode-banner-background)] overflow-y-auto max-h-[9rem]`}"> | ||
<span className="font-bold">Components</span> | ||
<div className="pl-4 border-solid border-2 "> | ||
{components.map((component, index) => ( | ||
<InsertItem | ||
label={component.label} | ||
onItemClicked={component.onItemClicked} | ||
icon={component.icon} /> | ||
))} | ||
</div> | ||
<span className="">Relationships</span> | ||
{relationships.map((relationship, index) => ( | ||
<InsertItem | ||
label={relationship.label} | ||
onItemClicked={relationship.onItemClicked} | ||
icon={relationship.icon} /> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
||
export default InsertPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { ReactElement } from "react" | ||
|
||
export type InsertItem = { | ||
label: string, | ||
onItemClicked: () => void, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aematei Please refer to my earlier comment regarding the arrow function |
||
icon: ReactElement<any> | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aematei You may want to have a function called
handleItemClicked
. The code will be more reusable than arrow functions. This arrow function is anonymous so it may be hard to call the logic within the function in another part of the app.Look at the official Typescript documentation and this Stack Overflow post for more details:
https://www.typescriptlang.org/docs/handbook/interfaces.html#function-types
https://stackoverflow.com/questions/45721344/arrow-function-in-typescript-interface-with-return-type-as-void
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pogi7 should I still include the function in the interface/type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aematei Yes. It would look like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh got it! That makes sense, thanks.