Skip to content

Commit

Permalink
Update wording
Browse files Browse the repository at this point in the history
  • Loading branch information
spaaaacccee committed Sep 20, 2023
1 parent 19ba40d commit e626952
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 29 deletions.
42 changes: 27 additions & 15 deletions client/src/components/layer-editor/layers/queryLayerSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { LayerSource, inferLayerName } from "./LayerSource";
import { Option } from "./Option";
import { MapLayerData } from "./mapLayerSource";
import { TraceLayerData, traceLayerSource } from "./traceLayerSource";
import { Typography as Type } from "@mui/material";

async function findConnection(
connections: Connection[],
Expand Down Expand Up @@ -41,43 +42,54 @@ export const queryLayerSource: LayerSource<"query", QueryLayerData> = {
const [{ algorithms }] = useFeatures();
const [connections] = useConnections();
const filteredLayers = filter(layers, (c) => c.source?.type === "map");
const selectedLayer = find(filteredLayers, { key: mapLayerKey });
return (
<>
<Option
label="Map Layer"
label="Algorithm"
content={
<FeaturePicker
showArrow
label="Map Layer"
value={mapLayerKey}
items={filteredLayers.map((c) => ({
id: c.key,
name: inferLayerName(c),
label="Choose Algorithm"
value={algorithm}
items={algorithms.map((c) => ({
...c,
description: find(connections, { url: c.source })?.name,
}))}
onChange={async (v) =>
produce((p) => set(p, "source.mapLayerKey", v))
produce((p) => set(p, "source.algorithm", v))
}
/>
}
/>
{!algorithms?.length && (
<Type variant="body2" color="warning.main" sx={{ mb: 1 }}>
No connected solver has declared support for running algorithms
</Type>
)}
<Option
label="Algorithm"
label="Map"
content={
<FeaturePicker
showArrow
icon={<CodeIcon />}
label="Algorithm"
value={algorithm}
items={algorithms.map((c) => ({
...c,
description: find(connections, { url: c.source })?.name,
label="Choose Layer"
value={mapLayerKey}
items={filteredLayers.map((c) => ({
id: c.key,
name: inferLayerName(c),
}))}
onChange={async (v) =>
produce((p) => set(p, "source.algorithm", v))
produce((p) => set(p, "source.mapLayerKey", v))
}
/>
}
/>
{selectedLayer && (
<Type variant="body2" color="text.secondary" sx={{ mb: 1 }}>
Hint: Define source and destination nodes by clicking on valid
regions on {inferLayerName(selectedLayer)}
</Type>
)}
</>
);
}),
Expand Down
19 changes: 11 additions & 8 deletions client/src/components/renderer/map-parser/grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ function between(v: number, min: number, max: number) {
return v >= min && v < max;
}

export const parse: MapParser = memo(async (m = "", options: Options) => {
return {
...(await parseGridAsync({
map: m,
options,
})),
};
});
export const parse: MapParser = memo(
async (m = "", options: Options) => {
return {
...(await parseGridAsync({
map: m,
options,
})),
};
},
{ normalizer: JSON.stringify }
);

export const hydrate: ParsedMapHydrator = (result) => {
const { width, height } = result.bounds;
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/renderer/map-parser/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Dictionary } from "lodash";
import memoize from "memoizee";
import { MapParser, ParsedMapHydrator } from "./Parser";
import * as grid from "./grid";
import * as xy from "./network";
import * as mesh from "./mesh";
import * as xy from "./network";
import * as poly from "./poly";
import { MapParser, ParsedMapHydrator } from "./Parser";

export const mapParsers: Dictionary<{
parse: MapParser;
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/renderer/map-parser/mesh/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export const parse: MapParser = memo(
await parseMeshAsync({
map: m,
options,
})
}),
{ normalizer: JSON.stringify }
);

export const hydrate: ParsedMapHydrator = (result) => ({
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/renderer/map-parser/network/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export const parse: MapParser = memo(
await parseNetworkAsync({
map: m,
options,
})
}),
{ normalizer: JSON.stringify }
);

export const hydrate: ParsedMapHydrator = (result) => ({
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/renderer/map-parser/poly/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export const parse: MapParser = memo(
await parsePolyAsync({
map: m,
options,
})
}),
{ normalizer: JSON.stringify }
);

export const hydrate: ParsedMapHydrator = (result: ParsedMap) => ({
Expand Down

0 comments on commit e626952

Please sign in to comment.