Skip to content

Commit 580bdf1

Browse files
committed
front: Truncate long ruleset names
1 parent c7efd96 commit 580bdf1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

web/src/components/SolverOptions.jsx

+12-3
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,29 @@ export function CalculateWidth({ contents, setWidth }) {
7979
}
8080

8181
export function Preset({ options, setOptions }) {
82-
const bundlesDoc = options.bundles_doc();
82+
const bundlesDoc = options.bundles_doc().map(bundle => {
83+
bundle.doc = bundle.name + " : " + bundle.doc;
84+
return bundle
85+
});
8386
const active_bundle_name = options.get_bundle_name();
8487
const active_bundle = bundlesDoc.filter(bundle => bundle.name == active_bundle_name).pop();
88+
function truncateText(text, length) {
89+
return text.length <= length ? text : text.substr(0, length) + '\u2026'
90+
}
8591
const bundles = bundlesDoc.map(bundle => {
8692
return <option
8793
key={bundle.name}
8894
value={bundle.name}
8995
title={bundle.doc}
9096
>
91-
{bundle.name}
97+
{truncateText(bundle.name, 16)}
9298
</option>
9399
});
94100

95-
return <OverlayTrigger placement="bottom" overlay={<Tooltip>{active_bundle ? active_bundle.doc : "This ruleset does not have a name"}</Tooltip>}>
101+
return <OverlayTrigger
102+
placement="bottom"
103+
overlay={<Tooltip>{active_bundle ? active_bundle.doc : "This ruleset does not have a name"}</Tooltip>}
104+
>
96105
<Form.Select
97106
className="w-auto me-auto"
98107
value={active_bundle_name || "custom"}

0 commit comments

Comments
 (0)