Merge pull request #272 from UniversityRadioYork/marks/disable-editing-while-saving

This commit is contained in:
Marks Polakovs 2023-05-02 23:47:50 +01:00 committed by GitHub
commit 32e32cc9d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View file

@ -38,6 +38,10 @@ export const Item = memo(function Item({
const id = itemId(x);
const isGhost = "ghostid" in x;
const planSaving = useSelector(
(state: RootState) => state.showplan.planSaving
);
const loadedItem = useSelector(
(state: RootState) =>
column > -1 ? state.mixer.players[column]?.loadedItem : null,
@ -183,7 +187,7 @@ export const Item = memo(function Item({
return data.join("¬"); // Something obscure to split against.
}
let isDragDisabled = isGhost;
let isDragDisabled = isGhost || planSaving;
if (!process.env.REACT_APP_BAPSICLE_INTERFACE) {
isDragDisabled = isDragDisabled || isLoaded;

View file

@ -100,6 +100,9 @@ const Showplanner: React.FC<{ timeslotId: number | null }> = function({
(state: RootState) => state.showplan.plan !== null,
shallowEqual
);
const planSaving = useSelector(
(state: RootState) => state.showplan.planSaving
);
// Tell Modals that #root is the main page content, for accessability reasons.
Modal.setAppElement("#root");
@ -239,6 +242,7 @@ const Showplanner: React.FC<{ timeslotId: number | null }> = function({
onClick={(args) =>
dispatch(removeItem(timeslotId!, (args.props as any).id))
}
disabled={planSaving}
>
<FaTrash /> Remove
</CtxMenuItem>

View file

@ -682,7 +682,7 @@ export const getShowplan = (timeslotId: number): AppThunk => async (
dispatch(showplan.actions.getShowplanSuccess(plan.flat(2)));
} catch (e) {
console.error(e);
dispatch(showplan.actions.getShowplanError(e.toString()));
dispatch(showplan.actions.getShowplanError(String(e)));
}
};