-
Notifications
You must be signed in to change notification settings - Fork 42
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
Edit object references #175
Conversation
Testing this out it looks pretty good, but the UI/UX is difficult due to the selection behavior. It should be that a single-click selects a row and a double-click goes into edit for a cell. When I right click on an object reference, I would expect the row to be highlighted: The row is not highlighted so it is hard to see which object I right clicked on. Also, minor, but I think "Update Reference" should be first. Similarly, on the modal to select a reference: I think you should select the row, then click have the blue button change to "Set" vs. "Set to null" to confirm the selection. @kraenhansen thoughts? |
Totally agree. I was trying to avoid changing the current cell implementation which is not highlighting rows nor managing click/double click 'properly'. Working on it 😊. |
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.
Minor changes required - and I did a small commit on the branch as well.
src/ui/realm-browser/Content.tsx
Outdated
style={{ userSelect: 'none', cursor: 'pointer' }} | ||
onClick={e => { | ||
e.stopPropagation(); | ||
e.preventDefault(); |
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.
Is this needed? What is the default behaviour of clicking a div
?
src/ui/realm-browser/Content.tsx
Outdated
onCellChange: (object: any, propertyName: string, value: string) => void; | ||
onListCellClick: ( | ||
onCellChange?: (object: any, propertyName: string, value: string) => void; | ||
onListCellClick?: ( |
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.
What is the reasoning behind making these optional?
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.
If we want to be able to reuse the table (e.g to select a row), there are some props that should be optional, like that one.
@@ -121,6 +121,14 @@ $realm-browser-header-icon-space: 24px; | |||
flex-direction: column; | |||
} | |||
|
|||
&__SelectObject{ |
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.
&__SelectObject {
<- missing a space :)
display: flex; | ||
flex-direction: column; | ||
padding:0; | ||
} |
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.
Missing a space .. here as well. And the properties are not ordered, are you SCSS linting?
src/ui/realm-browser/Content.tsx
Outdated
object: any, | ||
property: Realm.ObjectSchemaProperty, | ||
value: any, | ||
) => void; | ||
onColumnWidthChanged: (index: number, width: number) => void; | ||
schema: Realm.ObjectSchema | null; | ||
rowToHighlight: number | null; | ||
rowToHighlight?: number | null; |
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.
I don't like that this can now both be undefined
(because it's optional) and null
because of its type.
I think it should just be
rowToHighlight?: number
or just left as
rowToHighlight: number | null
Otherwise we have two ways of checking if no row is selected (if we're not using Number.isInteger(...)
)
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.
I believe that null
was there cause the old linter was throwing some errors. Totally true, we have to re-check the types.
min-height: 300px; | ||
padding: 0; | ||
} | ||
|
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.
I added some spaces and sorted the lines - are you running the SASS linter?
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.
I wouldn’t worry too much about this. We were going to propose yesterday to use prettier + stylelinter so we don’t have to fix this stuff manually, but the new features seemed more important.
Also, we could add css-modules
in order to avoid long class names (e.g RealmBrowser__Content__Cell
could be just cell
or Cell
).
I can fix them right now if that's a priority 😛
<ModalFooter> | ||
{optional && ( | ||
<Button color="primary" onClick={() => updateReference(null)}> | ||
Set to null |
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.
I don't think this should be the primary action - if we had a way to select the row in the content table - I would also expect there to be a primary button to "Select" the object of which row was selected, instead for this happening when simply clicking the row.
schema={schema} | ||
data={data} | ||
onRowClick={updateReference} | ||
onListCellClick={updateReference} |
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.
I know this PR didn't add the onListCellClick
but this name confuses me - and why would I need to define this property here, wouldn't the click bubble to the onRowClick callback anyway?
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.
I didn’t add that prop but that’s the one handling the click event for “complex types (Objects/Lists), the simple types don’t have one (they got one internally assigned tho!).
I think that we should have only one onClick event for the cells (from onListCellClick
to onCellClick
and pass it to simples types too) and add another one for onDoubleClick
(onCellDoubleClick
). And get rid of onRowClick
😅.
What do you think about it?
…ouble click, improve 'SelectObject' and 'StringCell'
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.
For the sake of making progress over perfection - let's get this merged.
It’s not clear if Commite is around on the weekend so we should merge if we are happy. |
Closes #168 and closes #37.
Summary
Additional changes which are not related to this PR: