Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sector location notes): Fixed sector location notes issues #357

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import DeleteIcon from "@mui/icons-material/Delete";
import { useConfirm } from "material-ui-confirm";
import { RtcRichTextEditor } from "components/shared/RichTextEditor";
import { NotesSectionHeader } from "../../NotesSectionHeader";
import { useCallback } from "react";

export function SectorLocationDialog() {
const confirm = useConfirm();
Expand Down Expand Up @@ -90,6 +91,16 @@ export function SectorLocationDialog() {
store.worlds.currentWorld.currentWorldSectors.locations
.updateLocationNotes
);
const updateGMNotesCallback = useCallback(
(locationId: string, notes: Uint8Array, isBeaconRequest?: boolean) =>
updateNotes(locationId, notes, true, isBeaconRequest),
[updateNotes]
);
const updateNotesCallback = useCallback(
(locationId: string, notes: Uint8Array, isBeaconRequest?: boolean) =>
updateNotes(locationId, notes, false, isBeaconRequest),
[updateNotes]
);

const { showGMFields, showGMTips, isSinglePlayer } = useWorldPermissions();

Expand Down Expand Up @@ -145,9 +156,7 @@ export function SectorLocationDialog() {
id={openLocationId}
roomPrefix={`sector-location-private-${worldId}-${sectorId}-`}
documentPassword={openLocationId}
onSave={(locationId, notes, isBeaconRequest) =>
updateNotes(locationId, notes, true, isBeaconRequest)
}
onSave={updateGMNotesCallback}
initialValue={gmNotes}
/>
</Grid>
Expand All @@ -162,9 +171,7 @@ export function SectorLocationDialog() {
id={openLocationId}
roomPrefix={`sector-location-public-${worldId}-${sectorId}-`}
documentPassword={openLocationId}
onSave={(locationId, notes, isBeaconRequest) =>
updateNotes(locationId, notes, false, isBeaconRequest)
}
onSave={updateNotesCallback}
initialValue={notes}
/>
</Grid>
Expand Down
Loading