diff --git a/src/UI/History/PreviouslySpiedUsers.svelte b/src/UI/History/PreviouslySpiedUsers.svelte new file mode 100644 index 0000000000..f8c45347ee --- /dev/null +++ b/src/UI/History/PreviouslySpiedUsers.svelte @@ -0,0 +1,102 @@ + + + + + + + sort("name")}> + Contributor + + + + + sort("visitedTime")}> + Visited time + + + + sort("label")}>Label + + Remove + + {#each $inspectedContributors as c} + + + dispatch("selectUser", c.name)}>{c.name} + + + {c.visitedTime} + + + inspectedContributors.ping()}> + No label + {#each $labels as l} + {l} + {/each} + + + + remove(c.name)} /> + + + {/each} + + + + + Labels + {#if $labels.length === 0} + No labels + {:else} + {#each $labels as label} + {label} + {/each} + {/if} + + Create a new label + + addLabel()} class:disabled={!(labelField?.length > 0) } class="disabled shrink-0">Add + label + + + + diff --git a/src/UI/InspectorGUI.svelte b/src/UI/InspectorGUI.svelte index c7d1870137..1afa7ba5bb 100644 --- a/src/UI/InspectorGUI.svelte +++ b/src/UI/InspectorGUI.svelte @@ -23,6 +23,9 @@ import AggregateView from "./History/AggregateView.svelte" import { HistoryUtils } from "./History/HistoryUtils" import AggregateImages from "./History/AggregateImages.svelte" + import Page from "./Base/Page.svelte" + import PreviouslySpiedUsers from "./History/PreviouslySpiedUsers.svelte" + import { OsmConnection } from "../Logic/Osm/OsmConnection" let username = QueryParameters.GetQueryParameter("user", undefined, "Inspect this user") let step = new UIEventSource<"waiting" | "loading" | "done">("waiting") @@ -32,8 +35,8 @@ let lon = UIEventSource.asFloat(QueryParameters.GetQueryParameter("lon", "0")) let theme = new ThemeConfig(inspector_theme, true) let layer = theme.layers.find(l => l.id === "usertouched") + // Is this a dirty hack? Yes it is! theme.getMatchingLayer = () => { - // Is this a dirty hack? Yes it is! return layer } let loadingData = false @@ -61,23 +64,35 @@ } }) - /* new ShowDataLayer(map, - { - layer, - zoomToFeatures: true, - features, - onClick: (f: Feature) => { - selectedElement.set(undefined) - Utils.waitFor(200).then(() => { - selectedElement.set(f) - }) - } - })*/ + let osmConnection = new OsmConnection() + let inspectedContributors: UIEventSource<{ + name: string, + visitedTime: string, + label: string + }[]> = UIEventSource.asObject( + osmConnection.getPreference("spied-upon-users"), []) async function load() { + const user = username.data + { + + const inspectedData = inspectedContributors.data + const previousEntry = inspectedData.find(e => e.name === user) + if (previousEntry) { + previousEntry.visitedTime = new Date().toISOString() + } else { + inspectedData.push({ + label: undefined, + visitedTime: new Date().toISOString(), + name: user + }) + } + inspectedContributors.ping() + } step.setData("loading") - const overpass = new Overpass(undefined, ["nw(user_touched:\"" + username.data + "\");"], Constants.defaultOverpassUrls[0]) + featuresStore.set([]) + const overpass = new Overpass(undefined, ["nw(user_touched:\"" + user + "\");"], Constants.defaultOverpassUrls[0]) if (!maplibremap.bounds.data) { return } @@ -100,6 +115,9 @@ }) let mode: "map" | "table" | "aggregate" | "images" = "map" + + let showPreviouslyVisited = new UIEventSource(true) + @@ -112,6 +130,9 @@ {:else} load()}>Load {/if} + showPreviouslyVisited.setData(true)}> + Show earlier inspected contributors + Back to index @@ -171,13 +192,13 @@ {:else if mode === "table"} - {#each $featuresStore as f} - - {/each} + {#each $featuresStore as f} + + {/each} {:else if mode === "aggregate"} - + {:else if mode === "images"} @@ -185,3 +206,10 @@ {/if} + + + Earlier inspected constributors + { + username.set(e.detail); load();showPreviouslyVisited.set(false) + }} /> +