Skip to content

Commit 1dcc5d5

Browse files
committed
Project started, task list title buttons created, and input shell too. Using local storage to persist tasklists data
1 parent b3d7440 commit 1dcc5d5

35 files changed

+1298
-49
lines changed

src/App.css

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,39 @@
1-
.App {
2-
text-align: center;
1+
.page-container {
2+
display: flex;
3+
align-items: center;
4+
flex-direction: column;
5+
}
6+
.page-title {
7+
font-size: 3rem;
8+
font-family: Alatsi;
9+
}
10+
11+
.input-shell {
12+
font-family: FiraMono;
13+
font-size: 1.2rem;
14+
padding: 1rem;
15+
background: black;
16+
border: none;
17+
border-radius: 1rem;
18+
color: white;
19+
width: 90vw;
20+
}
21+
22+
.input-shell:focus {
23+
outline-width: 0px;
324
}
425

5-
.App-logo {
6-
height: 40vmin;
26+
.error-message {
27+
color: red;
728
}
829

9-
.App-header {
10-
background-color: #282c34;
11-
min-height: 100vh;
30+
.page-content {
1231
display: flex;
13-
flex-direction: column;
14-
align-items: center;
15-
justify-content: center;
16-
font-size: calc(10px + 2vmin);
17-
color: white;
32+
flex-direction: row;
33+
width: 100vw;
34+
margin-top: 2rem;
1835
}
1936

20-
.App-link {
21-
color: #09d3ac;
37+
.page-content--table {
38+
width: 70%;
2239
}

src/App.js

Lines changed: 97 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,102 @@
1-
import React from 'react';
2-
import logo from './logo.svg';
1+
import React, { Component } from 'react';
2+
3+
import { runProvidedCommand } from './utils/index';
4+
35
import './App.css';
6+
import SelectTaskLists from './components/select-tasklists/select-tasklists';
7+
8+
class App extends Component {
9+
constructor(props) {
10+
super(props);
11+
this.state = {
12+
commandInput: '',
13+
commandError: '',
14+
taskLists: [],
15+
selTaskList: 0
16+
};
17+
}
18+
19+
componentDidMount() {
20+
const taskListsBackup = localStorage.getItem('taskLists');
21+
22+
if (taskListsBackup) {
23+
const { selTaskList, taskLists } = JSON.parse(taskListsBackup);
24+
this.setState({ taskLists, selTaskList });
25+
}
26+
}
27+
28+
backupTaskLists = () => {
29+
const { taskLists, selTaskList } = this.state;
30+
localStorage.setItem(
31+
'taskLists',
32+
JSON.stringify({ taskLists, selTaskList })
33+
);
34+
};
35+
36+
handleCommandInput = event => {
37+
const { value } = event.target;
38+
39+
// We're skipping the first 2 string characters because that's our inputs prefix
40+
this.setState({ commandInput: value.substring(2) });
41+
};
42+
43+
handleCommandSubmit = event => {
44+
if (event.key === 'Enter') {
45+
// Cleaning up the input and updating our taskLists array
46+
this.setState(
47+
prevState => {
48+
const commandResult = runProvidedCommand(
49+
prevState.taskLists,
50+
prevState.commandInput
51+
);
52+
53+
return {
54+
commandInput: '',
55+
commandError: commandResult.status,
56+
taskLists: commandResult.taskLists
57+
};
58+
},
59+
() => {
60+
this.backupTaskLists();
61+
}
62+
);
63+
}
64+
};
65+
66+
handleChangeTasklist = selectedIndex => {
67+
this.setState({ selTaskList: selectedIndex }, () => this.backupTaskLists());
68+
};
69+
70+
render() {
71+
const { commandInput, commandError, taskLists, selTaskList } = this.state;
472

5-
function App() {
6-
return (
7-
<div className="App">
8-
<header className="App-header">
9-
<img src={logo} className="App-logo" alt="logo" />
10-
<p>
11-
Edit <code>src/App.js</code> and save to reload.
12-
</p>
13-
<a
14-
className="App-link"
15-
href="https://reactjs.org"
16-
target="_blank"
17-
rel="noopener noreferrer"
18-
>
19-
Learn React
20-
</a>
21-
</header>
22-
</div>
23-
);
73+
return (
74+
<div className='page-container'>
75+
<h1 className='page-title'>TASK-SHELL</h1>
76+
<input
77+
type='text'
78+
className='input-shell'
79+
value={`$ ${commandInput}`}
80+
onChange={this.handleCommandInput}
81+
onKeyPress={this.handleCommandSubmit}
82+
placeholder='Please enter a command...'
83+
/>
84+
{commandError && <p className='error-message'>{commandError}</p>}
85+
<div className='page-content'>
86+
<SelectTaskLists
87+
taskLists={taskLists}
88+
selectedTaskListId={selTaskList}
89+
changeSelection={this.handleChangeTasklist}
90+
/>
91+
<div className='page-content--table'>
92+
{taskLists.map((taskList, id) => (
93+
<p>{taskList.title}</p>
94+
))}
95+
</div>
96+
</div>
97+
</div>
98+
);
99+
}
24100
}
25101

26102
export default App;
111 KB
Binary file not shown.

src/assets/fonts/Alatsi/OFL.txt

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright 2016 The Alatsi Project Authors (https://github.com/sorkintype/alatsi)
2+
3+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
This license is copied below, and is also available with a FAQ at:
5+
http://scripts.sil.org/OFL
6+
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide
14+
development of collaborative font projects, to support the font creation
15+
efforts of academic and linguistic communities, and to provide a free and
16+
open framework in which fonts may be shared and improved in partnership
17+
with others.
18+
19+
The OFL allows the licensed fonts to be used, studied, modified and
20+
redistributed freely as long as they are not sold by themselves. The
21+
fonts, including any derivative works, can be bundled, embedded,
22+
redistributed and/or sold with any software provided that any reserved
23+
names are not used by derivative works. The fonts and derivatives,
24+
however, cannot be released under any other type of license. The
25+
requirement for fonts to remain under this license does not apply
26+
to any document created using the fonts or their derivatives.
27+
28+
DEFINITIONS
29+
"Font Software" refers to the set of files released by the Copyright
30+
Holder(s) under this license and clearly marked as such. This may
31+
include source files, build scripts and documentation.
32+
33+
"Reserved Font Name" refers to any names specified as such after the
34+
copyright statement(s).
35+
36+
"Original Version" refers to the collection of Font Software components as
37+
distributed by the Copyright Holder(s).
38+
39+
"Modified Version" refers to any derivative made by adding to, deleting,
40+
or substituting -- in part or in whole -- any of the components of the
41+
Original Version, by changing formats or by porting the Font Software to a
42+
new environment.
43+
44+
"Author" refers to any designer, engineer, programmer, technical
45+
writer or other person who contributed to the Font Software.
46+
47+
PERMISSION & CONDITIONS
48+
Permission is hereby granted, free of charge, to any person obtaining
49+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+
redistribute, and sell modified and unmodified copies of the Font
51+
Software, subject to the following conditions:
52+
53+
1) Neither the Font Software nor any of its individual components,
54+
in Original or Modified Versions, may be sold by itself.
55+
56+
2) Original or Modified Versions of the Font Software may be bundled,
57+
redistributed and/or sold with any software, provided that each copy
58+
contains the above copyright notice and this license. These can be
59+
included either as stand-alone text files, human-readable headers or
60+
in the appropriate machine-readable metadata fields within text or
61+
binary files as long as those fields can be easily viewed by the user.
62+
63+
3) No Modified Version of the Font Software may use the Reserved Font
64+
Name(s) unless explicit written permission is granted by the corresponding
65+
Copyright Holder. This restriction only applies to the primary font name as
66+
presented to the users.
67+
68+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+
Software shall not be used to promote, endorse or advertise any
70+
Modified Version, except to acknowledge the contribution(s) of the
71+
Copyright Holder(s) and the Author(s) or with their explicit written
72+
permission.
73+
74+
5) The Font Software, modified or unmodified, in part or in whole,
75+
must be distributed entirely under this license, and must not be
76+
distributed under any other license. The requirement for fonts to
77+
remain under this license does not apply to any document created
78+
using the Font Software.
79+
80+
TERMINATION
81+
This license becomes null and void if any of the above conditions are
82+
not met.
83+
84+
DISCLAIMER
85+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.

src/assets/fonts/Fira_Code/OFL.txt

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright (c) 2014, The Fira Code Project Authors (https://github.com/tonsky/FiraCode)
2+
3+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
This license is copied below, and is also available with a FAQ at:
5+
http://scripts.sil.org/OFL
6+
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide
14+
development of collaborative font projects, to support the font creation
15+
efforts of academic and linguistic communities, and to provide a free and
16+
open framework in which fonts may be shared and improved in partnership
17+
with others.
18+
19+
The OFL allows the licensed fonts to be used, studied, modified and
20+
redistributed freely as long as they are not sold by themselves. The
21+
fonts, including any derivative works, can be bundled, embedded,
22+
redistributed and/or sold with any software provided that any reserved
23+
names are not used by derivative works. The fonts and derivatives,
24+
however, cannot be released under any other type of license. The
25+
requirement for fonts to remain under this license does not apply
26+
to any document created using the fonts or their derivatives.
27+
28+
DEFINITIONS
29+
"Font Software" refers to the set of files released by the Copyright
30+
Holder(s) under this license and clearly marked as such. This may
31+
include source files, build scripts and documentation.
32+
33+
"Reserved Font Name" refers to any names specified as such after the
34+
copyright statement(s).
35+
36+
"Original Version" refers to the collection of Font Software components as
37+
distributed by the Copyright Holder(s).
38+
39+
"Modified Version" refers to any derivative made by adding to, deleting,
40+
or substituting -- in part or in whole -- any of the components of the
41+
Original Version, by changing formats or by porting the Font Software to a
42+
new environment.
43+
44+
"Author" refers to any designer, engineer, programmer, technical
45+
writer or other person who contributed to the Font Software.
46+
47+
PERMISSION & CONDITIONS
48+
Permission is hereby granted, free of charge, to any person obtaining
49+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+
redistribute, and sell modified and unmodified copies of the Font
51+
Software, subject to the following conditions:
52+
53+
1) Neither the Font Software nor any of its individual components,
54+
in Original or Modified Versions, may be sold by itself.
55+
56+
2) Original or Modified Versions of the Font Software may be bundled,
57+
redistributed and/or sold with any software, provided that each copy
58+
contains the above copyright notice and this license. These can be
59+
included either as stand-alone text files, human-readable headers or
60+
in the appropriate machine-readable metadata fields within text or
61+
binary files as long as those fields can be easily viewed by the user.
62+
63+
3) No Modified Version of the Font Software may use the Reserved Font
64+
Name(s) unless explicit written permission is granted by the corresponding
65+
Copyright Holder. This restriction only applies to the primary font name as
66+
presented to the users.
67+
68+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+
Software shall not be used to promote, endorse or advertise any
70+
Modified Version, except to acknowledge the contribution(s) of the
71+
Copyright Holder(s) and the Author(s) or with their explicit written
72+
permission.
73+
74+
5) The Font Software, modified or unmodified, in part or in whole,
75+
must be distributed entirely under this license, and must not be
76+
distributed under any other license. The requirement for fonts to
77+
remain under this license does not apply to any document created
78+
using the Font Software.
79+
80+
TERMINATION
81+
This license becomes null and void if any of the above conditions are
82+
not met.
83+
84+
DISCLAIMER
85+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+
OTHER DEALINGS IN THE FONT SOFTWARE.

0 commit comments

Comments
 (0)