diff --git a/app/components/app-menu/home.gjs b/app/components/app-menu/home.gjs index c0e6528..a878603 100644 --- a/app/components/app-menu/home.gjs +++ b/app/components/app-menu/home.gjs @@ -22,7 +22,7 @@ import iconRounded from '../../icons/icon-rounded.svg?raw';
  • diff --git a/app/controllers/lists/list.js b/app/controllers/lists/list.js index b54ed96..f567548 100644 --- a/app/controllers/lists/list.js +++ b/app/controllers/lists/list.js @@ -14,6 +14,8 @@ function getPlaceTime(place) { return isNaN(parsed) ? 0 : parsed; } +const SAVED_LIST_ID = 'saved'; + export default class ListsListController extends Controller { @service router; @service mapUi; @@ -41,6 +43,12 @@ export default class ListsListController extends Controller { } get listColor() { + if (this.listId === SAVED_LIST_ID) { + return getComputedStyle(document.documentElement) + .getPropertyValue('--default-list-color') + .trim(); + } + const list = this.storage.lists.find((l) => l.id === this.listId); if (list && list.color) { return list.color; @@ -51,11 +59,21 @@ export default class ListsListController extends Controller { } get listTitle() { + if (this.listId === SAVED_LIST_ID) { + return 'Saved Places'; + } + const list = this.storage.lists.find((l) => l.id === this.listId); return list ? list.title : 'Collections'; } get places() { + if (this.listId === SAVED_LIST_ID) { + return [...this.storage.savedPlaces].sort( + (a, b) => getPlaceTime(b) - getPlaceTime(a) + ); + } + const currentList = this.storage.lists.find((l) => l.id === this.listId); const placeRefsIds = new Set( currentList?.placeRefs?.map((ref) => ref.id) || [] diff --git a/app/routes/lists/list.js b/app/routes/lists/list.js index 23138d7..dd84326 100644 --- a/app/routes/lists/list.js +++ b/app/routes/lists/list.js @@ -1,26 +1,22 @@ import Route from '@ember/routing/route'; -import { service } from '@ember/service'; export default class ListsListRoute extends Route { - @service storage; - model(params) { // Resolve instantly so transition happens in 0ms! return { list_id: params.list_id }; } setupController(controller, model) { - console.debug('DEBUG: setupController controller is:', controller); - console.debug( - 'DEBUG: controller.loadPlacesTask is:', - controller?.loadPlacesTask - ); controller.model = model; super.setupController(controller, model); + if (model.list_id === 'saved') { + return; + } + if (controller && controller.loadPlacesTask) { controller.loadPlacesTask.perform(model.list_id); } else { - console.error('DEBUG: ERROR! controller.loadPlacesTask is undefined!'); + console.error('controller.loadPlacesTask is undefined'); } } } diff --git a/app/templates/lists/index.gjs b/app/templates/lists/index.gjs index 58834fe..e24b840 100644 --- a/app/templates/lists/index.gjs +++ b/app/templates/lists/index.gjs @@ -11,6 +11,12 @@ export default class ListsIndexTemplate extends Component { @service router; @service mapUi; + savedList = { + id: 'saved', + title: 'Saved', + color: 'var(--default-list-color)', + }; + styleFor(color) { const finalColor = color || @@ -46,7 +52,7 @@ export default class ListsIndexTemplate extends Component { - Collections + Saved Places +
  • {{#each this.storage.lists as |list|}}