add multiline edit support
This commit is contained in:
parent
a1c92e4e2c
commit
e118c2861a
5 changed files with 24 additions and 10 deletions
|
|
@ -7,6 +7,7 @@
|
|||
"title": "标题",
|
||||
"notes": "备注",
|
||||
"type": "类型",
|
||||
"cost": "花费",
|
||||
"Daily": "每日任务",
|
||||
"submit": "添加",
|
||||
"No Dailies Present": "目前每日任务为空",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import * as React from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import { Trans } from 'react-i18next'
|
||||
|
||||
function DailyItem(props: any) {
|
||||
const [state, setState] = React.useState('view')
|
||||
|
|
@ -24,8 +25,10 @@ function DailyItem(props: any) {
|
|||
} else {
|
||||
return (
|
||||
<div className="edit-daily-item edit-item">
|
||||
<input type="text" onChange={event => setTitle(event.target.value)} defaultValue={props.daily_text}></input>
|
||||
<input type="text" onChange={event => setNotes(event.target.value)} defaultValue={props.daily_notes}></input>
|
||||
<label><Trans>title</Trans>:</label>
|
||||
<textarea onChange={event => setTitle(event.target.value)} defaultValue={props.daily_text}></textarea>
|
||||
<label><Trans>notes</Trans>:</label>
|
||||
<textarea onChange={event => setNotes(event.target.value)} defaultValue={props.daily_notes}></textarea>
|
||||
<div className="edit-daily-button edit-button">
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={function (e) { props.onChange(e); setState('view') }} title="submit" data-title={title} data-notes={notes}>check</span></button>
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={() => setState('view')} title="cancel">clear</span></button>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import Emoji from "react-emoji-render";
|
||||
import * as React from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import { Trans } from 'react-i18next'
|
||||
|
||||
function HabitItem(props: any) {
|
||||
const [state, setState] = React.useState('view')
|
||||
|
|
@ -30,8 +31,10 @@ function HabitItem(props: any) {
|
|||
} else {
|
||||
return (
|
||||
<div className="edit-habit-item edit-item">
|
||||
<input type="text" onChange={event => setTitle(event.target.value)} defaultValue={props.habit_text}></input>
|
||||
<input type="text" onChange={event => setNotes(event.target.value)} defaultValue={props.habit_notes}></input>
|
||||
<label><Trans>title</Trans>:</label>
|
||||
<textarea onChange={event => setTitle(event.target.value)} defaultValue={props.habit_text}></textarea>
|
||||
<label><Trans>notes</Trans>:</label>
|
||||
<textarea onChange={event => setNotes(event.target.value)} defaultValue={props.habit_notes}></textarea>
|
||||
<div className="edit-habit-button edit-button">
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={function (e) { props.onChange(e); setState('view') }} title="submit" data-title={title} data-notes={notes}>check</span></button>
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={() => setState('view')} title="cancel">clear</span></button>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import Emoji from "react-emoji-render";
|
||||
import * as React from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import { Trans } from 'react-i18next'
|
||||
|
||||
function RewardItem(props: any) {
|
||||
const [state, setState] = React.useState('view')
|
||||
const [title, setTitle] = React.useState('')
|
||||
|
|
@ -25,8 +27,11 @@ function RewardItem(props: any) {
|
|||
} else {
|
||||
return (
|
||||
<div className="edit-reward-item edit-item">
|
||||
<input type="text" onChange={event => setTitle(event.target.value)} defaultValue={props.reward_text}></input>
|
||||
<input type="text" onChange={event => setNotes(event.target.value)} defaultValue={props.reward_notes}></input>
|
||||
<label><Trans>title</Trans>:</label>
|
||||
<textarea onChange={event => setTitle(event.target.value)} defaultValue={props.reward_text}></textarea>
|
||||
<label><Trans>notes</Trans>:</label>
|
||||
<textarea onChange={event => setNotes(event.target.value)} defaultValue={props.reward_notes}></textarea>
|
||||
<label><Trans>cost</Trans>:</label>
|
||||
<input type="text" onChange={event => setCoin(event.target.value)} defaultValue={props.reward_value}></input>
|
||||
<div className="edit-reward-button edit-button">
|
||||
<button className="task-operation" ><span className="material-icons md-24" id={props.id} onClick={function (e) { props.onChange(e); setState('view') }} title="submit" data-title={title} data-notes={notes} data-coin={coin}>check</span></button>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import Emoji from "react-emoji-render";
|
||||
import * as React from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import { Trans } from 'react-i18next'
|
||||
|
||||
function TodoItem(props: any) {
|
||||
const [state, setState] = React.useState('view')
|
||||
|
|
@ -11,7 +11,7 @@ function TodoItem(props: any) {
|
|||
<div className="todo-item" id={props.id}>
|
||||
<input type="checkbox" className="checkbox" id={props.id} onChange={props.onChange} checked={props.completed} />
|
||||
<div className="todo-content">
|
||||
<p><Emoji text={props.todo_text}></Emoji></p>
|
||||
<ReactMarkdown children={props.todo_text} />
|
||||
<ReactMarkdown children={props.todo_notes} />
|
||||
</div>
|
||||
<button className="task-operation" >
|
||||
|
|
@ -25,8 +25,10 @@ function TodoItem(props: any) {
|
|||
} else {
|
||||
return (
|
||||
<div className="edit-todo-item edit-item">
|
||||
<input type="text" onChange={event => setTitle(event.target.value)} defaultValue={props.todo_text}></input>
|
||||
<input type="text" onChange={event => setNotes(event.target.value)} defaultValue={props.todo_notes}></input>
|
||||
<label><Trans>title</Trans>:</label>
|
||||
<textarea onChange={event => setTitle(event.target.value)} defaultValue={props.todo_text}></textarea>
|
||||
<label><Trans>notes</Trans>:</label>
|
||||
<textarea onChange={event => setNotes(event.target.value)} defaultValue={props.todo_notes}></textarea>
|
||||
<div className="edit-todo-button edit-button">
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={function (e) { props.onChange(e); setState('view') }} title="submit" data-title={title} data-notes={notes}>check</span></button>
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={() => setState('view')} title="cancel">clear</span></button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue