Skip to content

Commit

Permalink
MAP_LAYERS rectangleColor
Browse files Browse the repository at this point in the history
  • Loading branch information
K committed Nov 25, 2024
1 parent e2ca975 commit e2218ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 6 additions & 4 deletions nr-app/src/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ const selectEventsForLayers = createSelector(
(layerKey): [MAP_LAYER_KEY, EventWithMetadata[]] => {
const layerConfig = MAP_LAYERS[layerKey];
const filter = filterForMapLayerConfig(layerConfig);
console.log('RETLIF', filter);
console.log("RETLIF", filter);
const events = allEvents.filter((event) =>
matchFilter(filter, event.event),
);
console.log('STNEVE', events);
console.log("STNEVE", events);
return [layerKey, events];
},
);
Expand Down Expand Up @@ -98,11 +98,12 @@ const NoteMarker = ({
);

if (typeof plusCode === "undefined" || !isValidPlusCode(plusCode)) {
console.warn(
console.log(
"#9k8qKM skipping event with missing / invalid plusCode",
event,
);
console.log(plusCode);
console.log("Event tags:", event.event.tags);
return null;
}

Expand All @@ -113,6 +114,7 @@ const NoteMarker = ({
const url = getEventLinkUrl(event.event, layerConfig);

const pinColor = layerConfig?.markerColor || "red";
const rectangleColor = layerConfig?.rectangleColor || "rgba(255,0,0,0.5)";

return (
<View>
Expand All @@ -135,7 +137,7 @@ const NoteMarker = ({
</Marker>
<Polygon
coordinates={rectangleCoordinates}
fillColor="rgba(0, 200, 0, 0.5)" // Semi-transparent green
fillColor={rectangleColor}
strokeColor="rgba(0, 0, 0, 0.5)" // Semi-transparent black
strokeWidth={2}
/>
Expand Down
9 changes: 7 additions & 2 deletions nr-common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type MapLayer = {
kind: 30399 | 30398 | 30397;
pubkey: string;
markerColor: string;
rectangleColor: string;
};

export const MAP_LAYERS = {
Expand All @@ -38,21 +39,24 @@ export const MAP_LAYERS = {
rootUrl: "https://hitchmap.com",
kind: 30399,
pubkey: HITCHMAPS_AUTHOR_PUBLIC_KEY,
markerColor: "gold",
markerColor: "yellow",
rectangleColor: "rgba(255, 255, 0, 0.5)",
} as MapLayer,
hitchwiki: {
title: "Hitchwiki",
rootUrl: "https://hitchwiki.org",
kind: 30399,
pubkey: HITCHWIKI_AUTHOR_PUBLIC_KEY,
markerColor: "yellow",
markerColor: "gold",
rectangleColor: "rgba(255, 215, 0, 0.5)",
} as MapLayer,
timesafari: {
title: "Time Safari",
rootUrl: "https://www.timesafari.app",
kind: 30399,
pubkey: TIMESAFARI_AUTHOR_PUBLIC_KEY,
markerColor: "blue",
rectangleColor: "rgba(0, 0, 255, 0.5)",
} as MapLayer,
triphopping: {
title: "Trip Hopping",
Expand All @@ -66,6 +70,7 @@ export const MAP_LAYERS = {
rootUrl: "https://notes.trustroots.org",
kind: 30397,
markerColor: "red",
rectangleColor: "rgba(255, 0, 0, 0.5)",
} as MapLayer,
} as const;
export type MAP_LAYER_KEY = keyof typeof MAP_LAYERS;
Expand Down

0 comments on commit e2218ef

Please sign in to comment.