Skip to content

Commit

Permalink
Rationalize options
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed Nov 28, 2024
1 parent 187e916 commit 586de87
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 25 deletions.
8 changes: 2 additions & 6 deletions lang/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -747,18 +747,14 @@
"defaultMessage": "Graph line thickness",
"description": "Graph line weight setting label"
},
"graph-line-weight-medium": {
"defaultMessage": "Medium",
"graph-line-weight-default": {
"defaultMessage": "Default",
"description": "Graph line weight option"
},
"graph-line-weight-thick": {
"defaultMessage": "Thick",
"description": "Graph line weight option"
},
"graph-line-weight-thin": {
"defaultMessage": "Thin",
"description": "Graph line weight option"
},
"help-label": {
"defaultMessage": "Help",
"description": "Help icon aria label"
Expand Down
3 changes: 1 addition & 2 deletions src/components/LiveGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ const LiveGraph = () => {

// When we update the chart we re-run the effect that syncs it with the connection state.
const [chart, setChart] = useState<SmoothieChart | undefined>(undefined);
const lineWidth =
graphLineWeight === "medium" ? 2 : graphLineWeight === "thin" ? 1 : 3;
const lineWidth = graphLineWeight === "default" ? 2 : 3;

const liveGraphContainerRef = useRef(null);
const { width, height } = useSize(liveGraphContainerRef) ?? {
Expand Down
10 changes: 2 additions & 8 deletions src/messages/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1273,10 +1273,10 @@
"value": "Graph line thickness"
}
],
"graph-line-weight-medium": [
"graph-line-weight-default": [
{
"type": 0,
"value": "Medium"
"value": "Default"
}
],
"graph-line-weight-thick": [
Expand All @@ -1285,12 +1285,6 @@
"value": "Thick"
}
],
"graph-line-weight-thin": [
{
"type": 0,
"value": "Thin"
}
],
"help-label": [
{
"type": 0,
Expand Down
3 changes: 1 addition & 2 deletions src/recording-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export const getConfig = (
const y = processDimensionData(rawY);
const z = processDimensionData(rawZ);
const common = {
borderWidth:
graphLineWeight === "medium" ? 1.5 : graphLineWeight === "thin" ? 1 : 2.5,
borderWidth: graphLineWeight === "default" ? 1 : 2,
pointRadius: 0,
pointHoverRadius: 0,
};
Expand Down
10 changes: 3 additions & 7 deletions src/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const defaultSettings: Settings = {
showGraphs: true,
graphColorScheme: "default",
graphLineScheme: "solid",
graphLineWeight: "medium",
graphLineWeight: "default",
};

export type GraphColorScheme = "default" | "color-blind-1" | "color-blind-2";
Expand All @@ -60,12 +60,8 @@ export const graphLineSchemeOptions: GraphLineScheme[] = [
"accessible",
];

export type GraphLineWeight = "thin" | "medium" | "thick";
export const graphLineWeightOptions: GraphLineWeight[] = [
"thin",
"medium",
"thick",
];
export type GraphLineWeight = "default" | "thick";
export const graphLineWeightOptions: GraphLineWeight[] = ["default", "thick"];

export interface Settings {
languageId: string;
Expand Down

0 comments on commit 586de87

Please sign in to comment.