11import * as React from 'react' ;
22import { isEqual } from 'lodash' ;
3+ import { Icon , Tooltip } from 'antd' ;
34
45import { Item as ItemType } from "types/item" ;
56import { Update } from "types/api/item" ;
@@ -8,11 +9,12 @@ import { AppContext } from "AppContext";
89import { Input , Option , SelectCreatable , Select } from "app/components/FormFields" ;
910import { alertSuccess , alertWarn } from "app/components/Notifications" ;
1011import EditItem from "app/components/EditItem" ;
12+ import { DotIcon } from "app/components/Icons" ;
1113
1214import { categoryOptions , weightUnitOptions } from "lib/utils/form" ;
1315import { categorySelectValue } from "lib/utils/categories" ;
1416
15- import { Grid , PairGrid , inlineStyles } from "styles/grid" ;
17+ import { Grid , PairGrid , NotesIndicator , inlineStyles } from "styles/grid" ;
1618
1719interface ItemProps {
1820 item : ItemType ;
@@ -55,24 +57,32 @@ const Item: React.FC<ItemProps> = ({item, updateItem, fetchItems}) => {
5557 . catch ( ( ) => alertWarn ( { message : 'Error updating item.' } ) ) ;
5658 }
5759
60+
5861 const categoryValue = categorySelectValue ( app . categories , copy . categoryId ) ;
59- const { product_name, name, weight_unit, weight, price} = copy ;
62+ const { product_name, name, weight_unit, weight, price, notes} = copy ;
63+ const hasNotes = notes !== "" ;
6064 return (
6165 < >
6266 < Grid >
67+ < div className = "align-center" >
68+ < NotesIndicator className = { hasNotes ? 'active' : '' } >
69+ < Tooltip title = { hasNotes ? notes : "No notes on this item" }
70+ mouseEnterDelay = { .1 } placement = "right" >
71+ < Icon component = { DotIcon } />
72+ </ Tooltip >
73+ </ NotesIndicator >
74+ </ div >
6375 < div >
6476 < Input value = { name || '' }
6577 onChange = { v => update ( 'name' , v ) }
6678 onBlur = { handleSave }
6779 style = { inlineStyles } />
6880 </ div >
69- < div >
7081 < Input value = { product_name || '' }
7182 placeholder = "product name"
7283 onChange = { v => update ( 'product_name' , v ) }
7384 onBlur = { handleSave }
7485 style = { inlineStyles } />
75- </ div >
7686 < div >
7787 < SelectCreatable
7888 options = { categoryOptions ( app . categories ) }
@@ -130,4 +140,4 @@ const Item: React.FC<ItemProps> = ({item, updateItem, fetchItems}) => {
130140 )
131141} ;
132142
133- export default React . memo ( Item ) ;
143+ export default React . memo ( Item ) ;
0 commit comments