Commit 2f281140 authored by Michele Alberti's avatar Michele Alberti
Browse files

[ivette] Update Values to marker API changes, and make Eva Values table to...

[ivette] Update Values to marker API changes, and make Eva Values table to filter out not related localizables.
parent 5b8a2ae1
......@@ -49,23 +49,36 @@ const Values = () => {
[],
);
const items = States.useSyncArray(Eva.values).getArray();
const marker = States.useSelection()[0]?.current?.marker;
const t = States.useRequest(Eva.getValues, marker);
const evaValues = States.useSyncArray(Eva.values).getArray();
const selectMarker = States.useSelection()[0]?.current?.marker;
const t = States.useRequest(Eva.getValues, selectMarker);
const markerInfo = States.useSyncArray(Ast.markerInfo).getArray();
const [name, setName] = React.useState('');
React.useEffect(() => {
if (marker && items) {
const m = markerInfo.find((e) => e.key === marker);
if (m) {
setName(m.descr);
}
if (selectMarker && evaValues) {
model.removeAllData();
items.forEach((i) => model.setData(i.key, i));
model.reload();
const selectMarkerInfo = markerInfo.find((e) => e.key === selectMarker);
if (selectMarkerInfo && selectMarkerInfo.var !== 'function') {
switch (selectMarkerInfo.kind) {
case 'expression':
case 'lvalue':
setName(selectMarkerInfo.descr);
evaValues.forEach((i) => model.setData(i.key, i));
break;
case 'declaration':
setName(selectMarkerInfo.name);
evaValues.forEach((i) => model.setData(i.key, i));
break;
default:
setName('');
}
}
} else {
setName('');
}
}, [model, items, t, marker, markerInfo]);
model.reload();
}, [model, evaValues, t, selectMarker, markerInfo]);
// Component
return (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment