Skip to content

Commit

Permalink
review comments enum
Browse files Browse the repository at this point in the history
  • Loading branch information
mjkkirschner committed May 10, 2024
1 parent 23f3602 commit 63841a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/LibraryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class LibraryItem extends React.Component<LibraryItemProps, LibraryItemSt
}

render() {
if ((this.props.libraryContainer.state?.hostingContext == "home" as HostingContextType)
if ((this.props.libraryContainer.state?.hostingContext == HostingContextType.home)
&& this.props.data.hiddenInWorkspaceContext){
return null;
}
Expand Down
8 changes: 3 additions & 5 deletions src/components/SearchResultItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class SearchResultItem extends React.Component<SearchResultItemProps, Sea
if (this.state.selected) {
let container = ReactDOM.findDOMNode(this.props.libraryContainer);
let currentItem = ReactDOM.findDOMNode(this);
let containerRect = container.getBoundingClientRect();
let currentRect = currentItem.getBoundingClientRect();
let containerRect = container?.getBoundingClientRect();
let currentRect = currentItem?.getBoundingClientRect();
//bail if rects are null.
if(containerRect == null || currentRect == null){
return
Expand Down Expand Up @@ -77,10 +77,8 @@ export class SearchResultItem extends React.Component<SearchResultItemProps, Sea

render() {

if ((this.props.libraryContainer.state.hostingContext == "home" as HostingContextType)
if ((this.props.libraryContainer.state.hostingContext == HostingContextType.home)
&& this.props.data.hiddenInWorkspaceContext){
console.log("we should have hidden this lib item",this.props.data.contextData)

return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/sharedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* Hosting contexts for the library. These represent
* Dynamo home and custom workspaces, none is the default.
*/
export type HostingContextType = "home"|"custom"|"none"
export enum HostingContextType { home ="home", custom = "custom", none = "none"}

0 comments on commit 63841a3

Please sign in to comment.