Skip to content

Commit

Permalink
StatsHouse UI: feature copy max host
Browse files Browse the repository at this point in the history
  • Loading branch information
vauweb committed Jan 17, 2025
1 parent ffd3f62 commit 7075282
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ export const PlotLegendMaxHost = memo(function PlotLegendMaxHost({
});
}, [idx, maxHostLists]);

const copyItem = useCallback((value?: string | string[]) => {
if (typeof value === 'string') {
window.navigator.clipboard.writeText(value).then(() => {
debug.log(`clipboard ${value}`);
});
}
}, []);

const options = useMemo(() => maxHostLists[idx - 1] ?? [], [idx, maxHostLists]);
return (
<div className="d-flex flex-nowrap">
Expand All @@ -43,8 +51,10 @@ export const PlotLegendMaxHost = memo(function PlotLegendMaxHost({
value={value}
placeholder={placeholder}
options={options}
onChange={copyItem}
listOnlyOpen
showCountItems
valueToInput
/>
<Button
onClick={onCopyList}
Expand Down

0 comments on commit 7075282

Please sign in to comment.