Skip to content

Commit ecebca6

Browse files
committed
4905: rename key to selectedregion, remove abundant function to simplify grid-generation-and-select
1 parent 6c158d6 commit ecebca6

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

assets/admin/components/screen/util/grid-generation-and-select.jsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ function GridGenerationAndSelect({
2828
}) {
2929
const { t } = useTranslation("common");
3030
const dispatch = useDispatch();
31-
const [key, setKey] = useState(regions.length > 0 ? regions[0]["@id"] : "");
31+
const [selectedRegion, setSelectedRegion] = useState(
32+
regions.length > 0 ? regions[0]["@id"] : "",
33+
);
3234
const [selectedPlaylists, setSelectedPlaylists] = useState([]);
3335

3436
/**
@@ -139,11 +141,6 @@ function GridGenerationAndSelect({
139141
setSelectedPlaylists(playlists);
140142
};
141143

142-
/** @param {string} id - The id of the selected tab */
143-
const handleSelect = (id) => {
144-
setKey(id);
145-
};
146-
147144
/**
148145
* Removes playlist from list of playlists, and closes modal.
149146
*
@@ -169,7 +166,7 @@ function GridGenerationAndSelect({
169166
grid={grid}
170167
vertical={vertical}
171168
regions={regions}
172-
selected={key}
169+
selected={selectedRegion}
173170
/>
174171
</div>
175172
</div>
@@ -180,7 +177,7 @@ function GridGenerationAndSelect({
180177
<Tabs
181178
defaultActiveKey={regions[0]["@id"]}
182179
id="tabs"
183-
onSelect={handleSelect}
180+
onSelect={setSelectedRegion}
184181
className="mb-3"
185182
>
186183
{regions &&

0 commit comments

Comments
 (0)