Skip to content

Commit 8e5c122

Browse files
authored
Merge pull request #21 from texttree/develop
Develop
2 parents ef19f30 + 2286ef9 commit 8e5c122

30 files changed

Lines changed: 3203 additions & 1923 deletions

.eslintrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"env": {
3+
"browser": true
4+
},
5+
"parser": "@babel/eslint-parser",
6+
"extends": [
7+
"plugin:react/recommended",
8+
"plugin:jsx-a11y/recommended",
9+
"plugin:prettier/recommended"
10+
],
11+
"settings": {
12+
"react": {
13+
"version": "detect"
14+
},
15+
"linkComponents": [
16+
"Hyperlink",
17+
{
18+
"name": "Link",
19+
"linkAttribute": "to"
20+
}
21+
]
22+
},
23+
"parserOptions": {
24+
"ecmaFeatures": {
25+
"jsx": true
26+
},
27+
"ecmaVersion": 11,
28+
"sourceType": "module"
29+
},
30+
"plugins": [],
31+
"rules": {
32+
"prettier/prettier": [
33+
"error",
34+
{
35+
"endOfLine": "auto"
36+
}
37+
],
38+
"react/prop-types": 0
39+
}
40+
}

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
node_modules/
3+
.*

.prettierrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"useTabs": false,
3+
"printWidth": 90,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"singleQuote": true,
7+
"jsxBracketSameLine": false,
8+
"semi": true
9+
}

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode"
5+
]
6+
}

.vscode/settings.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"[json]": {
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
4+
},
5+
"[jsonc]": {
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
},
8+
"[md]": {
9+
"editor.defaultFormatter": "esbenp.prettier-vscode"
10+
},
11+
"eslint.format.enable": true,
12+
"[javascript]": {
13+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
14+
},
15+
"[javascriptreact]": {
16+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
17+
},
18+
"eslint.alwaysShowStatus": true,
19+
"editor.formatOnSave": true,
20+
"editor.detectIndentation": false,
21+
"editor.formatOnPaste": true,
22+
"files.insertFinalNewline": true,
23+
"files.eol": "\n",
24+
"files.trimTrailingWhitespace": true,
25+
"editor.tabSize": 2,
26+
}

package.json

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
11
{
22
"name": "@texttree/tt-reference-rcl",
3-
"version": "1.0.0",
3+
"author": "TextTree.org",
4+
"version": "1.0.1",
5+
"description": "This library of components was made as part of the development of the Bible Study App and helps to display books and chapters from the books of the Bible.",
6+
"keywords": [
7+
"bible",
8+
"reference"
9+
],
10+
"license": "MIT",
411
"private": false,
512
"main": "dist/index.js",
6-
"license": "MIT",
713
"url": "https://github.com/texttree/tt-reference-rcl",
14+
"homepage": "https://github.com/texttree/tt-reference-rcl#readme",
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/texttree/tt-reference-rcl.git"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/texttree/tt-reference-rcl/issues"
21+
},
22+
"lint-staged": {
23+
"src/**/*.js": [
24+
"eslint --fix"
25+
],
26+
"*.+(json|md)": [
27+
"prettier --write"
28+
]
29+
},
830
"scripts": {
31+
"prepare": "husky install",
932
"start": "styleguidist server",
1033
"build": "styleguidist build",
11-
"prepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline"
34+
"lint": "eslint --fix .",
35+
"prettier": "prettier --write .",
36+
"prepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline",
37+
"precommit": "lint-staged"
1238
},
1339
"peerDependencies": {
1440
"@material-ui/core": "^4.x",
@@ -18,29 +44,25 @@
1844
},
1945
"devDependencies": {
2046
"@babel/cli": "^7.13.14",
21-
"@babel/core": "^7.13.15",
47+
"@babel/core": "^7.14.3",
48+
"@babel/eslint-parser": "^7.14.4",
2249
"@babel/preset-env": "^7.13.15",
2350
"@babel/preset-react": "^7.13.13",
2451
"@material-ui/core": "^4.11.3",
2552
"babel-loader": "^8.2.2",
53+
"eslint": "^7.28.0",
54+
"eslint-config-prettier": "^8.3.0",
55+
"eslint-plugin-jsx-a11y": "^6.4.1",
56+
"eslint-plugin-prettier": "^3.4.0",
57+
"eslint-plugin-react": "^7.24.0",
58+
"eslint-plugin-react-hooks": "^4.2.0",
59+
"husky": "^6.0.0",
60+
"lint-staged": "^11.0.0",
61+
"prettier": "^2.3.1",
2662
"prop-types": "^15.7.2",
2763
"react": "^17.0.2",
2864
"react-dom": "^17.0.2",
29-
"react-styleguidist": "^11.1.6",
30-
"webpack": "^5.32.0"
31-
},
32-
"description": "This library of components was made as part of the development of the Bible Study App and helps to display books and chapters from the books of the Bible.",
33-
"repository": {
34-
"type": "git",
35-
"url": "git+https://github.com/texttree/tt-reference-rcl.git"
36-
},
37-
"author": "texttree",
38-
"bugs": {
39-
"url": "https://github.com/texttree/tt-reference-rcl/issues"
40-
},
41-
"homepage": "https://github.com/texttree/tt-reference-rcl#readme",
42-
"keywords": [
43-
"bible",
44-
"reference"
45-
]
65+
"react-styleguidist": "^11.1.7",
66+
"webpack": "^5.38.1"
67+
}
4668
}

src/components/BibleBookList/BibleBookList.js

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,18 @@ function BibleBookList({
2929
};
3030
});
3131

32-
const currentBookListOT = currentBookList.filter(
33-
(el) => el.categories === 'bible-ot'
34-
);
32+
const currentBookListOT = currentBookList.filter((el) => el.categories === 'bible-ot');
3533

36-
const currentBookListNT = currentBookList.filter(
37-
(el) => el.categories === 'bible-nt'
38-
);
34+
const currentBookListNT = currentBookList.filter((el) => el.categories === 'bible-nt');
3935
const handleChange = () => {
4036
setCheckState((prev) => !prev);
4137
};
4238

39+
const allBooksIsSet = (bookList) => {
40+
const allBooks = bookList.filter((el) => el.isset === false);
41+
return allBooks.length > 0;
42+
};
43+
4344
let testamentList = [];
4445

4546
switch (testaments) {
@@ -50,6 +51,9 @@ function BibleBookList({
5051
bookList: currentBookListNT,
5152
},
5253
];
54+
if (showCheckbox) {
55+
showCheckbox = allBooksIsSet(currentBookListNT);
56+
}
5357
break;
5458

5559
case 'ot':
@@ -59,6 +63,9 @@ function BibleBookList({
5963
bookList: currentBookListOT,
6064
},
6165
];
66+
if (showCheckbox) {
67+
showCheckbox = allBooksIsSet(currentBookListOT);
68+
}
6269
break;
6370
case 'all':
6471
testamentList = [
@@ -68,6 +75,10 @@ function BibleBookList({
6875
if (sortFirstNT) {
6976
testamentList.reverse();
7077
}
78+
if (showCheckbox) {
79+
showCheckbox =
80+
allBooksIsSet(currentBookListOT) || allBooksIsSet(currentBookListNT);
81+
}
7182
break;
7283

7384
default:
@@ -79,13 +90,7 @@ function BibleBookList({
7990
classes={{
8091
label: BibleBookListClasses?.label,
8192
}}
82-
control={
83-
<Checkbox
84-
checked={checkState}
85-
onChange={handleChange}
86-
color='primary'
87-
/>
88-
}
93+
control={<Checkbox checked={checkState} color="primary" onChange={handleChange} />}
8994
label={labelForCheckbox}
9095
/>
9196
) : (
@@ -98,18 +103,18 @@ function BibleBookList({
98103
{testamentList.map((el, index) => {
99104
return (
100105
<BookList
101-
title={el.title}
106+
bookClasses={bookClasses}
102107
bookList={el.bookList}
103-
showInactive={!checkState}
104-
onClickBook={onClickBook}
105-
selectedBookId={selectedBookId}
106108
bookListClasses={{
107109
title: BibleBookListClasses?.title,
108110
book: BibleBookListClasses?.book,
109111
bookList: BibleBookListClasses?.bookList,
110112
}}
111-
bookClasses={bookClasses}
112113
key={index}
114+
onClickBook={onClickBook}
115+
selectedBookId={selectedBookId}
116+
showInactive={!checkState}
117+
title={el.title}
113118
/>
114119
);
115120
})}

0 commit comments

Comments
 (0)