diff --git a/web/package-lock.json b/web/package-lock.json index ad721c9b..498b2d75 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1,12 +1,12 @@ { "name": "wanderer", - "version": "0.17.0-beta", + "version": "0.17.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wanderer", - "version": "0.17.0-beta", + "version": "0.17.0", "dependencies": { "@felte/validator-zod": "^1.0.18", "@fortawesome/fontawesome-free": "^6.5.1", diff --git a/web/package.json b/web/package.json index a31ef2f7..d8bd278f 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "wanderer", - "version": "0.17.0-beta", + "version": "0.17.0", "private": true, "scripts": { "dev": "vite dev", diff --git a/web/src/lib/components/trail/trail_filter_panel.svelte b/web/src/lib/components/trail/trail_filter_panel.svelte index 328f54bc..4dff6d6e 100644 --- a/web/src/lib/components/trail/trail_filter_panel.svelte +++ b/web/src/lib/components/trail/trail_filter_panel.svelte @@ -44,7 +44,7 @@ })), ); - const radioGroupItems: RadioItem[] = [ + const radioGroupCompletenessItems: RadioItem[] = [ { text: $_("completed"), value: "completed" }, { text: $_("not-completed"), value: "not_completed" }, { text: $_("no-preference"), value: "no_preference" }, @@ -82,11 +82,6 @@ update(); } - function setPublicFilter(e: Event) { - filter.public = (e.target as HTMLInputElement).checked; - update(); - } - function setSharedFilter(e: Event) { filter.shared = (e.target as HTMLInputElement).checked; update(); @@ -116,6 +111,16 @@ update(); } + function setPrivateFilter(e: Event) { + filter.private = (e.target as HTMLInputElement).checked; + update(); + } + + function setPublicFilter(e: Event) { + filter.public = (e.target as HTMLInputElement).checked; + update(); + } + async function searchCities(q: string) { if (q.length == 0) { filter.near.lat = undefined; @@ -155,6 +160,20 @@ filter.tags = tags.map((t) => t.text); update(); } + + function getVisibiltyStatus(): number { + const isPublic = filter.public !== undefined && filter.public === true; + const isPrivate = + filter.private !== undefined && filter.private === true; + + if (isPublic === true && isPrivate === true) { + return 2; + } else if (isPublic === true) { + return 1; + } else { + return 0; + } + }
@@ -236,6 +255,7 @@ >{$_("shared")}
+
{/if} {$_("completion-status")}

setCompletedFilter(item)} > diff --git a/web/src/lib/i18n/locales/de.json b/web/src/lib/i18n/locales/de.json index fc6b0eed..3aa88d81 100644 --- a/web/src/lib/i18n/locales/de.json +++ b/web/src/lib/i18n/locales/de.json @@ -347,6 +347,7 @@ "use-roads": "Nutze Straßen", "username": "Nutzername", "view": "Ansehen", + "visibilty-status": "Sichtbarkeit", "walking-speed": "Laufgeschwindigkeit", "waypoints": "{n, plural, =1 {Wegpunkt} other {Wegpunkte}}", "welcome_to": "Willkommen bei", diff --git a/web/src/lib/i18n/locales/en.json b/web/src/lib/i18n/locales/en.json index 829fc5fb..b0909f84 100644 --- a/web/src/lib/i18n/locales/en.json +++ b/web/src/lib/i18n/locales/en.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "Username", "view": "View", + "visibilty-status": "Visibilty", "walking-speed": "", "waypoints": "{n, plural, =1 {Waypoint} other {Waypoints}}", "welcome_to": "Welcome to", diff --git a/web/src/lib/i18n/locales/es.json b/web/src/lib/i18n/locales/es.json index bc2b7ab4..697692bc 100644 --- a/web/src/lib/i18n/locales/es.json +++ b/web/src/lib/i18n/locales/es.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "Nombre de usuario", "view": "Ver", + "visibilty-status": "Visibilidad", "walking-speed": "", "waypoints": "{n, plural, one {}=1 {Punto de Interés} other {Puntos de Interés}}", "welcome_to": "Bienvenid@ a", diff --git a/web/src/lib/i18n/locales/fr.json b/web/src/lib/i18n/locales/fr.json index 67f0c369..c892f69a 100644 --- a/web/src/lib/i18n/locales/fr.json +++ b/web/src/lib/i18n/locales/fr.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "Nom d'utilisateur", "view": "Afficher", + "visibilty-status": "Visibilité", "walking-speed": "", "waypoints": "{n, plural, =1 {Point de passage} other {Points de passage}}", "welcome_to": "Bienvenue sur", diff --git a/web/src/lib/i18n/locales/hu.json b/web/src/lib/i18n/locales/hu.json index de8f30f9..b24b2bb4 100644 --- a/web/src/lib/i18n/locales/hu.json +++ b/web/src/lib/i18n/locales/hu.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "Felhasználónév", "view": "View", + "visibilty-status": "Láthatóság", "walking-speed": "", "waypoints": "{n, plural, =1 {Waypoint} other {Waypoints}}", "welcome_to": "Üdvözöljük a", diff --git a/web/src/lib/i18n/locales/it.json b/web/src/lib/i18n/locales/it.json index ef3dde4e..477b2e1c 100644 --- a/web/src/lib/i18n/locales/it.json +++ b/web/src/lib/i18n/locales/it.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "Nome utente", "view": "Visualizza", + "visibilty-status": "Visibilità", "walking-speed": "", "waypoints": "{n, plural, =1 {Punto di passaggio} other {Punti di passaggio}}", "welcome_to": "Benvenuti a", diff --git a/web/src/lib/i18n/locales/nl.json b/web/src/lib/i18n/locales/nl.json index 695d2cc0..1ee7626b 100644 --- a/web/src/lib/i18n/locales/nl.json +++ b/web/src/lib/i18n/locales/nl.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "Gebruikersnaam", "view": "View", + "visibilty-status": "Zichtbaarheid", "walking-speed": "", "waypoints": "{n, plural, =1 {Waypoint} other {Waypoints}}", "welcome_to": "Welkom bij", diff --git a/web/src/lib/i18n/locales/pl.json b/web/src/lib/i18n/locales/pl.json index bc35ff66..0b4b8b87 100644 --- a/web/src/lib/i18n/locales/pl.json +++ b/web/src/lib/i18n/locales/pl.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "Nazwa Użytkownika", "view": "Widok", + "visibilty-status": "Widoczność", "walking-speed": "", "waypoints": "{n, plural, one {Punkt} few {Punkty} many {Punktów}=1 {Punkt} other {Punktów}}", "welcome_to": "Witaj w", diff --git a/web/src/lib/i18n/locales/pt.json b/web/src/lib/i18n/locales/pt.json index 6431f20e..3a2e653d 100644 --- a/web/src/lib/i18n/locales/pt.json +++ b/web/src/lib/i18n/locales/pt.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "Nome de utilizador", "view": "Ver", + "visibilty-status": "Visibilidade", "walking-speed": "", "waypoints": "{n, plural, =1 {Ponto de passagem} other {Pontos de passagem}}", "welcome_to": "Bem-vindo ao", diff --git a/web/src/lib/i18n/locales/zh.json b/web/src/lib/i18n/locales/zh.json index 0ab93df2..876d3c15 100644 --- a/web/src/lib/i18n/locales/zh.json +++ b/web/src/lib/i18n/locales/zh.json @@ -347,6 +347,7 @@ "use-roads": "Use Roads", "username": "用户名", "view": "查看", + "visibilty-status": "可性见", "walking-speed": "", "waypoints": "{n, plural, =1 {路点} other {路点}}", "welcome_to": "欢迎", diff --git a/web/src/lib/models/trail.ts b/web/src/lib/models/trail.ts index 0225029f..48ebab2a 100644 --- a/web/src/lib/models/trail.ts +++ b/web/src/lib/models/trail.ts @@ -112,6 +112,7 @@ interface TrailFilter { author?: string; public?: boolean; shared?: boolean; + private?: boolean; near: { lat?: number, lon?: number, diff --git a/web/src/lib/stores/trail_store.ts b/web/src/lib/stores/trail_store.ts index 240d8f6c..792e5331 100644 --- a/web/src/lib/stores/trail_store.ts +++ b/web/src/lib/stores/trail_store.ts @@ -524,6 +524,38 @@ function buildFilterText(user: AuthRecord, filter: TrailFilter, includeGeo: bool filterText += ` AND author = ${filter.author}` } + if (filter.public !== undefined || filter.private !== undefined || filter.shared !== undefined) { + filterText += " AND (" + + const showPublic = filter.public === undefined || filter.public === true; + const showPrivate = filter.private === undefined || filter.private === true; + const showShared = filter.shared !== undefined && filter.shared === true; + + if (showPublic === true) { + filterText += "(public = TRUE"; + if (showPrivate === true && (!filter.author?.length || filter.author == user?.id)) { + filterText += ` OR author = ${user?.id}`; + } + filterText += ")"; + } + else if (!filter.author?.length || filter.author == user?.id) { + filterText += "public = FALSE"; + filterText += ` AND author = ${user?.id}`; + } + + if (filter.shared !== undefined) { + if (filter.shared === true) { + filterText += ` OR shares = ${user?.id}` + } else { + filterText += ` AND NOT shares = ${user?.id}` + + } + } + + filterText += ")"; + } + + /* if (filter.public !== undefined || filter.shared !== undefined) { filterText += " AND (" if (filter.public !== undefined) { @@ -545,6 +577,7 @@ function buildFilterText(user: AuthRecord, filter: TrailFilter, includeGeo: bool } filterText += ")" } +*/ if (filter.liked === true) { filterText += ` AND likes = ${user?.actor}` diff --git a/web/src/routes/map/+page.ts b/web/src/routes/map/+page.ts index eb671206..2761f38a 100644 --- a/web/src/routes/map/+page.ts +++ b/web/src/routes/map/+page.ts @@ -16,6 +16,7 @@ export const load: ServerLoad = async ({ params, locals, fetch }) => { public: true, shared: true, liked: false, + private: true, near: { radius: 2000, }, diff --git a/web/src/routes/profile/[handle]/trails/+page.ts b/web/src/routes/profile/[handle]/trails/+page.ts index f6782fa7..fead8afe 100644 --- a/web/src/routes/profile/[handle]/trails/+page.ts +++ b/web/src/routes/profile/[handle]/trails/+page.ts @@ -17,6 +17,7 @@ export const load: Load = async ({ params, fetch, parent }) => { public: true, shared: true, liked: false, + private: true, near: { radius: 2000, }, diff --git a/web/src/routes/trails/+page.ts b/web/src/routes/trails/+page.ts index a8336923..e9f8e12c 100644 --- a/web/src/routes/trails/+page.ts +++ b/web/src/routes/trails/+page.ts @@ -15,6 +15,7 @@ export const load: ServerLoad = async ({ params, locals, url, fetch }) => { public: true, shared: true, liked: false, + private: true, near: { radius: 2000, },