Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 1x 1x 1x 16x 16x 6x 5x 5x 5x 1x 4x 1x 3x 1x 2x | export const BURGUNDY = "#800020";
export const POLYLINE_STYLES: Record<
string,
{ color: string; dash?: number[] }
> = {
WALK: { color: BURGUNDY, dash: [2, 5] }, // Dotted Red
SHUTTLE: { color: BURGUNDY }, // Solid Red
BUS: { color: "#0085CA" }, // Solid Blue
BIKE: { color: "#228B22", dash: [10, 5] }, // Dashed Green
CAR: { color: "#808080" }, // Solid Gray
};
export const inferStyleFromInstruction = (
instruction: string,
defaultMode: string,
) => {
const mode = defaultMode.toUpperCase();
// For walk, bike, car — skip instruction parsing, use mode directly
if (mode === "WALK" || mode === "WALKING") return POLYLINE_STYLES.WALK;
if (mode === "BIKE" || mode === "BICYCLING") return POLYLINE_STYLES.BIKE;
Iif (mode === "CAR" || mode === "DRIVING") return POLYLINE_STYLES.CAR;
const text = instruction.toLowerCase();
// If instruction mentions walking, use walk style
if (text.includes("walk")) {
return POLYLINE_STYLES.WALK;
}
// If instruction mentions shuttle
if (text.includes("shuttle")) {
return POLYLINE_STYLES.SHUTTLE;
}
// If instruction mentions transit/bus/train
if (
text.includes("bus") ||
text.includes("train") ||
text.includes("metro")
) {
return POLYLINE_STYLES.BUS;
}
return POLYLINE_STYLES.WALK;
};
|