Skip to content

Commit c71f5b9

Browse files
author
Robb Satterwhite
committed
Add captions, wider buttons
1 parent ffb3e64 commit c71f5b9

File tree

6 files changed

+31
-28
lines changed

6 files changed

+31
-28
lines changed

src/components/AddCat.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ const AddCat = ({ props }) => {
6060

6161
</form>
6262
<span className='editButtonArea'>
63-
<IconButton config={ { title:'accept add',
64-
disabled: !isValidLength(categoryName, 1, 60),
63+
<IconButton config={ { title:'accept add', caption:'add category',
64+
disabled: !isValidLength(categoryName, 1, 60), width:'wide',
6565
iconType:'confirm', callProc:onRequestAdd }} />
66-
<IconButton config={ { title:'cancel add',
67-
iconType:'cancel', callProc:cancelAddLocal }} />
66+
<IconButton config={ { title:'cancel add', caption:'cancel add',
67+
width:'wide', iconType:'cancel', callProc:cancelAddLocal }} />
6868
</span>
6969
</div>
7070
</Fragment>

src/components/AddList.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ const AddList = ({ props }) => {
5050
</span>
5151
</form>
5252
<span className='editButtonArea'>
53-
<IconButton config={ { title:'accept add',
54-
disabled: !isValidLength(listName, 1, 60),
53+
<IconButton config={ { title:'accept add', caption:'add new list',
54+
disabled: !isValidLength(listName, 1, 60), width:'wide',
5555
iconType:'confirm', callProc:onRequestAdd }} />
56-
<IconButton config={ { title:'cancel add',
57-
iconType:'cancel', callProc:cancelAddLocal }} />
56+
<IconButton config={ { title:'cancel add', caption:'cancel new list',
57+
width:'wide', iconType:'cancel', callProc:cancelAddLocal }} />
5858
</span>
5959
</div>
6060
</Fragment>

src/components/CopyList.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import '../css/lists.css';
1111
import * as api from '../util/constants';
1212
import { useEscape, validateLength, isValidLength } from '../util/helpers'; // hook to capture escape key
1313
import { useStore } from '../store/StoreContext';
14-
import { handleUpdateList } from '../store/handlers';
14+
import { handleCopyList } from '../store/handlers';
1515
import { IconButton } from './IconButton';
1616
import TextField from '@material-ui/core/TextField';
1717

@@ -25,9 +25,9 @@ const CopyList = ({ cancelCopy, listRec }) => {
2525
};
2626

2727
const onRequestCopy = async () => {
28-
// if (!validateLength(listName, 1, 60, 'list name')) return;
29-
// const status = await handleCopyList(listRec.id, listName, state, dispatch);
30-
// if (status===api.OK) { cancelCopy(); }
28+
if (!validateLength(listName, 1, 60, 'list name')) return;
29+
const status = await handleCopyList(listRec.id, listName, state, dispatch);
30+
if (status===api.OK) { cancelCopy(); } // TODO go to new list if successful
3131
// TODO: maybe add additional message if API operation failed?
3232
};
3333

src/components/EditCat.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ import { IconButton } from './IconButton';
1616
import TextField from '@material-ui/core/TextField';
1717

1818
const EditCat = ({ props }) => {
19-
const { cancelEdit, categoryRec } = props;
19+
const { cancelEdit, categoryRec } = props;
2020
const { state, dispatch } = useStore();
2121
const [categoryName, setCategoryName] = useState(categoryRec.categoryName);
22+
useEscape(() => cancelEdit());
23+
const catNameChangeDisabled = ((categoryName.trim()===categoryRec.categoryName) ||
24+
!isValidLength(categoryName, 1, 60));
2225

2326
const onSubmitEdit = (e) => {
2427
e.preventDefault();
@@ -33,7 +36,7 @@ const EditCat = ({ props }) => {
3336
// TODO: maybe add additional message if API operation failed?
3437
};
3538

36-
useEscape(() => cancelEdit());
39+
3740
return (
3841
<Fragment>
3942
<div className='addArea'>
@@ -51,11 +54,11 @@ const EditCat = ({ props }) => {
5154
</span>
5255
</form>
5356
<span className='editButtonArea'>
54-
<IconButton config={ { title:'accept category edit',
55-
disabled: !isValidLength(categoryName, 1, 60),
57+
<IconButton config={ { title:'accept category edit', caption:'rename category',
58+
disabled:catNameChangeDisabled, width:'wide',
5659
iconType:'confirm', callProc:onRequestEdit }} />
57-
<IconButton config={ { title:'cancel category edit',
58-
iconType:'cancel', callProc:cancelEdit }} />
60+
<IconButton config={ { title:'cancel category edit', caption:'cancel rename',
61+
width:'wide', iconType:'cancel', callProc:cancelEdit }} />
5962
</span>
6063
</div>
6164
</Fragment>

src/components/EditList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ const EditList = ({ cancelEdit, listRec }) => {
5050
</span>
5151
</form>
5252
<span className='editButtonArea'>
53-
<IconButton config={ { title:'accept list edit', caption:'confirm rename',
54-
disabled: listNameChangeDisabled, width:'wide',
53+
<IconButton config={ { title:'accept list edit', caption:'rename list',
54+
disabled:listNameChangeDisabled, width:'wide',
5555
iconType:'confirm', callProc:onRequestEdit }} />
5656
<IconButton config={ { title:'cancel list edit', caption:'cancel rename',
5757
width:'wide', iconType:'cancel', callProc:cancelEdit }} />

src/components/OneList.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ const OneList = () => {
170170
const moreIconsZone = () => {
171171
return (
172172
<div className='oneListMoreIcons'>
173-
<IconButton config={ { title:'rename list', caption:'rename list',
174-
iconType:'edit', callProc:setupEdit } } />
173+
<IconButton config={ { title:'rename list', caption:'rename this list',
174+
width:'wide', iconType:'edit', callProc:setupEdit } } />
175175
{ showOrHideMoveIcon() }
176-
<IconButton config={ { title:'copy list', caption:'copy list',
177-
iconType:'copy', callProc:setupCopy } } />
178-
<IconButton config={ { title:'delete list', caption:'delete list',
179-
iconType:'delete', callProc:removeList } } />
176+
<IconButton config={ { title:'copy list', caption:'copy this list',
177+
width:'wide', iconType:'copy', callProc:setupCopy } } />
178+
<IconButton config={ { title:'delete list', caption:'delete this list',
179+
width:'wide', iconType:'delete', callProc:removeList } } />
180180
<IconButton config={ { title:'hide list ops', caption:'hide changes menu',
181-
iconType:'cancel', callProc:cancelMore } } />
181+
width:'wide', iconType:'cancel', callProc:cancelMore } } />
182182
</div>
183183
);
184184
};
@@ -191,7 +191,7 @@ const OneList = () => {
191191
if (!areThereOtherCats) {return null;}
192192
return (
193193
<IconButton config={ { title:'change category for this list', caption:'change category',
194-
iconType:'move', callProc:setupMove } } />
194+
width:'wide', iconType:'move', callProc:setupMove } } />
195195
);
196196
};
197197

0 commit comments

Comments
 (0)