Skip to content

Commit 5d7f2ea

Browse files
committed
Added helper text to EditableText to avoid blank invisible fields
1 parent 8b3f962 commit 5d7f2ea

2 files changed

Lines changed: 3 additions & 63 deletions

File tree

  • frontend/src/pages/_dashboard/renderDashboard/organiser/edit

frontend/src/pages/_dashboard/renderDashboard/organiser/edit/questions/index.js

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,66 +8,6 @@ import FormControl from 'components/inputs/FormControl'
88
import QuestionSelect from './QuestionSelect'
99

1010
export default () => {
11-
// const buildColumns = useCallback((form, field, fieldValue) => {
12-
// return [
13-
// {
14-
// Header: 'Name',
15-
// accessor: 'label',
16-
// },
17-
// {
18-
// Header: 'Category',
19-
// accessor: 'category',
20-
// },
21-
// {
22-
// Header: 'Enabled?',
23-
// accessor: 'enabled',
24-
// Cell: props => {
25-
// const row = props.row.original
26-
// return (
27-
// <Switch
28-
// color="primary"
29-
// disabled={!row.editable}
30-
// checked={row.enable}
31-
// onChange={(e, enable) => {
32-
// form.setFieldValue(field.name, {
33-
// ...fieldValue,
34-
// [row.key]: {
35-
// ...fieldValue[row.key],
36-
// enable,
37-
// require: !enable ? false : row.require,
38-
// },
39-
// })
40-
// }}
41-
// />
42-
// )
43-
// },
44-
// },
45-
// {
46-
// Header: 'Required?',
47-
// accessor: 'require',
48-
// Cell: props => {
49-
// const row = props.row.original
50-
// return (
51-
// <Switch
52-
// color="primary"
53-
// disabled={!row.editable || !row.enable}
54-
// checked={row.require}
55-
// onChange={(e, require) => {
56-
// form.setFieldValue(field.name, {
57-
// ...fieldValue,
58-
// [row.key]: {
59-
// ...fieldValue[row.key],
60-
// require,
61-
// },
62-
// })
63-
// }}
64-
// />
65-
// )
66-
// },
67-
// },
68-
// ]
69-
// }, [])
70-
7111
return (
7212
<Grid container spacing={3}>
7313
<Grid item xs={12}>

frontend/src/pages/_dashboard/renderDashboard/organiser/edit/submission/components/section/EditableText.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import React, { useEffect } from 'react'
22

33
const typeToClass = {
44
heading: 'tw-text-xl tw-font-bold',
@@ -22,7 +22,7 @@ const EditableText = ({ value, save, className = '', type = 'default' }) => {
2222
}
2323
}
2424

25-
React.useEffect(() => {
25+
useEffect(() => {
2626
setCurrentValue(value)
2727
}, [value])
2828

@@ -42,7 +42,7 @@ const EditableText = ({ value, save, className = '', type = 'default' }) => {
4242
onClick={() => setIsEditable(true)}
4343
className={`tw-w-full tw-items-start tw-justify-start tw-text-gray-800 tw-cursor-pointer ${displayClass}`}
4444
>
45-
{currentValue}
45+
{currentValue || 'Click to edit'}
4646
</span>
4747
)
4848
}

0 commit comments

Comments
 (0)