Skip to content

Commit

Permalink
Address comments from initial review
Browse files Browse the repository at this point in the history
  • Loading branch information
naschmitz committed Oct 16, 2024
1 parent 9d359bc commit 84f2661
Show file tree
Hide file tree
Showing 8 changed files with 350 additions and 274 deletions.
3 changes: 2 additions & 1 deletion geemap/static/ipywidgets_styles.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion geemap/static/layer_manager.js

Large diffs are not rendered by default.

590 changes: 327 additions & 263 deletions geemap/static/layer_manager_row.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion geemap/static/material_styles.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions geemap/static/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions js/layer_manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AnyModel, RenderContext } from "@anywidget/types";
import type { AnyModel, RenderProps } from "@anywidget/types";
import { html, css, LitElement } from "lit";
import { property } from "lit/decorators.js";
import { legacyStyles } from './ipywidgets_styles';
Expand Down Expand Up @@ -88,11 +88,12 @@ export class LayerManager extends LitElement {
}
}

// Without this check, there's a component registry issue when developing locally.
if (!customElements.get(LayerManager.componentName)) {
customElements.define(LayerManager.componentName, LayerManager);
}

async function render({ model, el }: RenderContext<LayerManagerModel>) {
async function render({ model, el }: RenderProps<LayerManagerModel>) {
loadFonts();
const manager = <LayerManager>document.createElement(LayerManager.componentName);
manager.model = model;
Expand Down
17 changes: 12 additions & 5 deletions js/layer_manager_row.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { AnyModel, RenderContext } from "@anywidget/types";
import type { AnyModel, RenderProps } from "@anywidget/types";
import { html, css, LitElement, TemplateResult, nothing } from "lit";
import { property } from "lit/decorators.js";
import { classMap } from 'lit/directives/class-map.js';

import { legacyStyles } from './ipywidgets_styles';
import { materialStyles } from "./material_styles";
Expand Down Expand Up @@ -122,7 +123,7 @@ export class LayerManagerRow extends LitElement {
visible: boolean = true;

@property()
opacity: number = 0;
opacity: number = 1;

@property()
isLoading: boolean = false;
Expand Down Expand Up @@ -156,7 +157,12 @@ export class LayerManagerRow extends LitElement {
<span class="material-symbols-outlined">&#xe8b8;</span>
</button>
<button
class="legacy-button settings-delete-button ${this.isLoading ? 'loading' : 'done-loading'}"
class=${classMap({
'legacy-button': true,
'settings-delete-button': true,
'loading': this.isLoading,
'done-loading': !this.isLoading
})}
@click="${this.onDeleteClicked}"
>
<div class="spinner"></div>
Expand All @@ -167,7 +173,7 @@ export class LayerManagerRow extends LitElement {
`;
}

private renderConfirmDialog(): TemplateResult | void {
private renderConfirmDialog(): TemplateResult | typeof nothing {
if (!this.isConfirmDialogVisible) {
return nothing;
}
Expand Down Expand Up @@ -225,11 +231,12 @@ export class LayerManagerRow extends LitElement {
}
}

// Without this check, there's a component registry issue when developing locally.
if (!customElements.get(LayerManagerRow.componentName)) {
customElements.define(LayerManagerRow.componentName, LayerManagerRow);
}

function render({ model, el }: RenderContext<LayerManagerRowModel>) {
function render({ model, el }: RenderProps<LayerManagerRowModel>) {
loadFonts();
const row = <LayerManagerRow>document.createElement(LayerManagerRow.componentName);
row.model = model;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"downlevelIteration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
Expand Down

0 comments on commit 84f2661

Please sign in to comment.