From 7929866c334192a83247ed3b27898a388ebcb83f Mon Sep 17 00:00:00 2001 From: object Date: Sat, 6 Aug 2022 16:55:10 +0000 Subject: [PATCH] Add new funcionality for stickies notes ! --- .../furniture/FurnitureStickieView.tsx | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/components/room/widgets/furniture/FurnitureStickieView.tsx b/src/components/room/widgets/furniture/FurnitureStickieView.tsx index cfa23e26..2f0e0fee 100644 --- a/src/components/room/widgets/furniture/FurnitureStickieView.tsx +++ b/src/components/room/widgets/furniture/FurnitureStickieView.tsx @@ -5,6 +5,8 @@ import { useFurnitureStickieWidget } from '../../../../hooks'; const STICKIE_COLORS = [ '9CCEFF','FF9CFF', '9CFF9C','FFFF33' ]; const STICKIE_COLOR_NAMES = [ 'blue', 'pink', 'green', 'yellow' ]; +const STICKIE_TYPES = [ 'post_it','post_it_shakesp', 'post_it_dreams','post_it_xmas', 'post_it_vd', 'post_it_juninas' ]; +const STICKIE_TYPE_NAMES = [ 'post_it', 'shakesp', 'dreams', 'christmas', 'heart', 'juninas' ]; const getStickieColorName = (color: string) => { @@ -15,30 +17,42 @@ const getStickieColorName = (color: string) => return STICKIE_COLOR_NAMES[index]; } +const getStickieTypeName = (type: string) => +{ + let index = STICKIE_TYPES.indexOf(type); + + if(index === -1) index = 0; + + return STICKIE_TYPE_NAMES[index]; +} + export const FurnitureStickieView: FC<{}> = props => { - const { objectId = -1, color = '0', text = '', canModify = false, updateColor = null, updateText = null, trash = null, onClose = null } = useFurnitureStickieWidget(); + const { objectId = -1, color = '0', text = '', type = '', canModify = false, updateColor = null, updateText = null, trash = null, onClose = null } = useFurnitureStickieWidget(); const [ isEditing, setIsEditing ] = useState(false); useEffect(() => { setIsEditing(false); - }, [ objectId, color, text ]); + }, [ objectId, color, text, type ]); if(objectId === -1) return null; return ( -
+
- { canModify && + { canModify && <>
- { STICKIE_COLORS.map(color => - { - return
updateColor(color) } style={ { backgroundColor: ColorUtils.makeColorHex(color) } } /> - }) } + { type == 'post_it' && + <> + { STICKIE_COLORS.map(color => + { + return
updateColor(color) } style={ { backgroundColor: ColorUtils.makeColorHex(color) } } /> + }) } + } }