6 Commits

Author SHA1 Message Date
da64ae1572 1.7.0 2026-01-24 21:07:40 +07:00
1a96f95c82 Hide settings pane on outside click, render above places pane 2026-01-24 21:06:50 +07:00
911e6ddf38 Add setting for Overpass API provider 2026-01-24 20:47:55 +07:00
e61dc00725 Restore some lost styles 2026-01-24 20:47:42 +07:00
25d45a62c3 1.6.1 2026-01-24 18:00:47 +07:00
76dd8cdf24 Comment for app settings 2026-01-24 18:00:23 +07:00
11 changed files with 99 additions and 21 deletions

View File

@@ -1,10 +1,16 @@
import Component from '@glimmer/component';
import { on } from '@ember/modifier';
import { service } from '@ember/service';
import { action } from '@ember/object';
import Icon from '#components/icon';
import eq from 'ember-truth-helpers/helpers/eq';
export default class SettingsPane extends Component {
constructor() {
super(...arguments);
@service settings;
@action
updateApi(event) {
this.settings.updateOverpassApi(event.target.value);
}
<template>
@@ -19,6 +25,23 @@ export default class SettingsPane extends Component {
<div class="sidebar-content">
<section class="settings-section">
<h3>Settings</h3>
<div class="form-group">
<label for="overpass-api">Overpass API Provider</label>
<select
id="overpass-api"
class="form-control"
{{on "change" this.updateApi}}
>
{{#each this.settings.overpassApis as |api|}}
<option
value={{api.url}}
selected={{if (eq api.url this.settings.overpassApi) "selected"}}
>
{{api.name}}
</option>
{{/each}}
</select>
</div>
</section>
<section class="settings-section">
<h3>About</h3>

View File

@@ -1,6 +1,8 @@
import Service from '@ember/service';
import Service, { service } from '@ember/service';
export default class OsmService extends Service {
@service settings;
controller = null;
async getNearbyPois(lat, lon, radius = 50) {
@@ -23,10 +25,7 @@ export default class OsmService extends Service {
out center;
`.trim();
const url = `https://overpass.bke.ro/api/interpreter?data=${encodeURIComponent(
// const url = `https://overpass-api.de/api/interpreter?data=${encodeURIComponent(
query
)}`;
const url = `${this.settings.overpassApi}?data=${encodeURIComponent(query)}`;
try {
const res = await this.fetchWithRetry(url, { signal });
@@ -101,10 +100,7 @@ out center;
`.trim();
}
const url = `https://overpass.bke.ro/api/interpreter?data=${encodeURIComponent(
// const url = `https://overpass-api.de/api/interpreter?data=${encodeURIComponent(
query
)}`;
const url = `${this.settings.overpassApi}?data=${encodeURIComponent(query)}`;
const res = await this.fetchWithRetry(url);
if (!res.ok) throw new Error('Overpass request failed');
const data = await res.json();

32
app/services/settings.js Normal file
View File

@@ -0,0 +1,32 @@
import Service from '@ember/service';
import { tracked } from '@glimmer/tracking';
export default class SettingsService extends Service {
@tracked overpassApi = 'https://overpass.bke.ro/api/interpreter';
overpassApis = [
{ name: 'bke.ro', url: 'https://overpass.bke.ro/api/interpreter' },
{ name: 'overpass-api.de', url: 'https://overpass-api.de/api/interpreter' },
{
name: 'private.coffee',
url: 'https://overpass.private.coffee/api/interpreter',
},
];
constructor() {
super(...arguments);
this.loadSettings();
}
loadSettings() {
const savedApi = localStorage.getItem('marco-overpass-api');
if (savedApi) {
this.overpassApi = savedApi;
}
}
updateOverpassApi(url) {
this.overpassApi = url;
localStorage.setItem('marco-overpass-api', url);
}
}

View File

@@ -197,6 +197,10 @@ body {
flex-direction: column;
}
.settings-pane.sidebar {
z-index: 3200; /* Higher than Places Sidebar (3100) */
}
/* Settings Pane Mobile Overrides */
@media (width <= 768px) {
.settings-pane.sidebar {
@@ -280,6 +284,10 @@ body {
letter-spacing: 0.5px;
}
.settings-section .form-group {
margin-top: 1rem;
}
.btn-full {
width: 100%;
}
@@ -298,6 +306,16 @@ body {
background: #0069d9;
}
.meta-info {
font-size: 0.9rem;
}
.meta-info p:first-child {
margin-top: 1.2rem;
padding-top: 1.2rem;
border-top: 1px solid #eee;
}
.meta-info a {
color: #007bff;
text-decoration: none;

View File

@@ -8,7 +8,7 @@ import { service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { eq } from 'ember-truth-helpers';
import { and } from 'ember-truth-helpers';
import { and, or } from 'ember-truth-helpers';
import { on } from '@ember/modifier';
export default class ApplicationComponent extends Component {
@@ -74,6 +74,15 @@ export default class ApplicationComponent extends Component {
}
}
@action
handleOutsideClick() {
if (this.isSettingsOpen) {
this.closeSettings();
} else {
this.closeSidebar();
}
}
@action
closeSidebar() {
this.nearbyPlaces = null;
@@ -105,8 +114,8 @@ export default class ApplicationComponent extends Component {
<Map
@onPlacesFound={{this.showPlaces}}
@isSidebarOpen={{this.isSidebarOpen}}
@onOutsideClick={{this.closeSidebar}}
@isSidebarOpen={{or this.isSidebarOpen this.isSettingsOpen}}
@onOutsideClick={{this.handleOutsideClick}}
/>
{{#if (and (eq this.router.currentRouteName "index") this.nearbyPlaces)}}

View File

@@ -1,6 +1,6 @@
{
"name": "marco",
"version": "1.6.0",
"version": "1.7.0",
"private": true,
"description": "Small description for marco goes here",
"repository": "",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -6,8 +6,8 @@
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module" crossorigin src="/assets/main-Delfl3qe.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-CrGC4Dlj.css">
<script type="module" crossorigin src="/assets/main-Dpm1fpXl.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-B9HZHSjP.css">
</head>
<body>
</body>