New hook 'type' for stickie notes !

This commit is contained in:
object 2022-08-06 17:02:54 +00:00
parent ff8af8d902
commit c3776e7d7c

View File

@ -10,6 +10,7 @@ const useFurnitureStickieWidgetState = () =>
const [ category, setCategory ] = useState(-1); const [ category, setCategory ] = useState(-1);
const [ color, setColor ] = useState('0'); const [ color, setColor ] = useState('0');
const [ text, setText ] = useState(''); const [ text, setText ] = useState('');
const [ type, setType ] = useState('');
const [ canModify, setCanModify ] = useState(false); const [ canModify, setCanModify ] = useState(false);
const onClose = () => const onClose = () =>
@ -18,6 +19,7 @@ const useFurnitureStickieWidgetState = () =>
setCategory(-1); setCategory(-1);
setColor('0'); setColor('0');
setText(''); setText('');
setType('');
setCanModify(false); setCanModify(false);
} }
@ -66,6 +68,7 @@ const useFurnitureStickieWidgetState = () =>
setCategory(event.category); setCategory(event.category);
setColor(color || '0'); setColor(color || '0');
setText(text || ''); setText(text || '');
setType(roomObject.type || 'post_it');
setCanModify(GetRoomSession().isRoomOwner || GetSessionDataManager().isModerator || IsOwnerOfFurniture(roomObject)); setCanModify(GetRoomSession().isRoomOwner || GetSessionDataManager().isModerator || IsOwnerOfFurniture(roomObject));
}); });
@ -76,7 +79,7 @@ const useFurnitureStickieWidgetState = () =>
onClose(); onClose();
}); });
return { objectId, color, text, canModify, updateColor, updateText, trash, onClose }; return { objectId, color, text, type, canModify, updateColor, updateText, trash, onClose };
} }
export const useFurnitureStickieWidget = useFurnitureStickieWidgetState; export const useFurnitureStickieWidget = useFurnitureStickieWidgetState;