Skip to content

Commit

Permalink
disabled check, broke delete somehow
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwayv committed Feb 8, 2021
1 parent f3e24fa commit a908a3e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9,283 deletions.
87 changes: 3 additions & 84 deletions client/todo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ class ToDo extends React.Component {
let user = JSON.parse(window.localStorage.getItem(this.props.state.username));
user.todo = todoArr;
window.localStorage.setItem(user.username, JSON.stringify(user));
}}/><img src={check} className='check' alt='Complete' onClick={e => {
}}/>{/*<img src={check} className='check' alt='Complete' onClick={e => {
//Cross off in todo list and complete in quest list or common goals
//figure out how to remember what todos were checked off previously
}}/></div>;
//Feature may be reinstated after deployment
}}/>*/}</div>;
})}
</div>
<form onSubmit={e => {
Expand All @@ -78,88 +79,6 @@ class ToDo extends React.Component {
<input id='addList' name='addList' type='text' placeholder='e.g. Fire cape...' />
<button id='addSubmit' type='submit'>Add</button>
</form>
{/* <button id='remove' type='submit' onClick={e => {
let l = document.getElementById('list');
let todoArr = this.props.state.todo;
for (let i = 0; i < l.options.length; ++i) {
if (l.options[i].selected) {
todoArr.splice(todoArr.indexOf(l.options[i].value), 1);
}
}
this.props.update({ todo: todoArr });
let user = JSON.parse(window.localStorage.getItem(this.props.state.username));
user.todo = todoArr;
window.localStorage.setItem(user.username, JSON.stringify(user));
}}>Remove</button><br /> */}
{/* Move selected:
<button id='top' type='submit' onClick={e => {
let l = document.getElementById('list');
let todoArr = this.props.state.todo;
let topArr = [];
for (let i = 0; i < l.options.length; ++i) {
if (l.options[i].selected) {
l.options[i].selected = false;
topArr.push(todoArr.splice(todoArr.indexOf(l.options[i].value), 1)[0]);
}
}
todoArr = topArr.concat(todoArr);
this.props.update({ todo: todoArr });
let user = JSON.parse(window.localStorage.getItem(this.props.state.username));
user.todo = todoArr;
window.localStorage.setItem(user.username, JSON.stringify(user));
}}>Top</button>
<button id='up' type='submit' onClick={e => {
let l = document.getElementById('list');
let todoArr = this.props.state.todo;
for (let i = 0; i < l.options.length; ++i) {
if (l.options[i].selected && i > 0) {
l.options[i].selected = false;
let index = todoArr.indexOf(l.options[i].value);
let temp = l.options[i].value;
todoArr[index] = todoArr[index-1];
todoArr[index-1] = temp;
l.options[i-1].selected = true;
}
}
this.props.update({ todo: todoArr });
let user = JSON.parse(window.localStorage.getItem(this.props.state.username));
user.todo = todoArr;
window.localStorage.setItem(user.username, JSON.stringify(user));
}}>Up</button>
<button id='down' type='submit' onClick={e => {
let l = document.getElementById('list');
let todoArr = this.props.state.todo;
for (let i = l.options.length-1; i >= 0; --i) {
if (l.options[i].selected && i < l.options.length-1) {
l.options[i].selected = false;
let index = todoArr.indexOf(l.options[i].value);
let temp = l.options[i].value;
todoArr[index] = todoArr[index+1];
todoArr[index+1] = temp;
l.options[i+1].selected = true;
}
}
this.props.update({ todo: todoArr });
let user = JSON.parse(window.localStorage.getItem(this.props.state.username));
user.todo = todoArr;
window.localStorage.setItem(user.username, JSON.stringify(user));
}}>Down</button>
<button id='bottom' type='submit' onClick={e => {
let l = document.getElementById('list');
let todoArr = this.props.state.todo;
let bottomArr = [];
for (let i = 0; i < l.options.length; ++i) {
if (l.options[i].selected) {
l.options[i].selected = false;
bottomArr.push(todoArr.splice(todoArr.indexOf(l.options[i].value), 1)[0]);
}
}
todoArr = todoArr.concat(bottomArr);
this.props.update({ todo: todoArr });
let user = JSON.parse(window.localStorage.getItem(this.props.state.username));
user.todo = todoArr;
window.localStorage.setItem(user.username, JSON.stringify(user));
}}>Bottom</button> */}
</div>
);
}
Expand Down
Loading

0 comments on commit a908a3e

Please sign in to comment.