diff --git a/app/components/place-details.gjs b/app/components/place-details.gjs index f2dc19c..3738fb1 100644 --- a/app/components/place-details.gjs +++ b/app/components/place-details.gjs @@ -1,4 +1,5 @@ import Component from '@glimmer/component'; +import { service } from '@ember/service'; import { on } from '@ember/modifier'; import { htmlSafe } from '@ember/template'; import { humanizeOsmTag } from '../utils/format-text'; @@ -13,9 +14,14 @@ import { tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; export default class PlaceDetails extends Component { + @service storage; @tracked isEditing = false; @tracked showLists = false; + get isSaved() { + return this.storage.isPlaceSaved(this.place.id || this.place.osmId); + } + get place() { return this.args.place || {}; } @@ -38,7 +44,7 @@ export default class PlaceDetails extends Component { @action startEditing() { - if (!this.place.createdAt) return; // Only allow editing saved places + if (!this.isSaved) return; // Only allow editing saved places this.isEditing = true; } @@ -276,7 +282,7 @@ export default class PlaceDetails extends Component { {{#if this.showLists}} {{/if}} - {{#if this.place.createdAt}} + {{#if this.isSaved}}