Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for undefineds and material-table #72

Merged
merged 1 commit into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Nor do we need any of the styleguidist stuff from the core
./styleguide.*
./src/code/*.md
./src/**/*.md

# Nor do we need some of the extra stuff
./scripts/
Expand Down
16 changes: 16 additions & 0 deletions .yalcignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# We don't need any of the demo stuff in the NPM package
./src/demos/

# We don't need the testing stuff in the NPM package
./cypress/
./src/__tests__/
./dist/__tests__/

# Nor do we need any of the styleguidist stuff from the core
./styleguide.*
./src/**/*.md

# Nor do we need some of the extra stuff
./scripts/
./makeNoticeList.py
./noticeList.txt
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
"engines": {
"node": ">=4"
},
"yscripts": {
"_comment1": "use this for the scripts when using yalc",
"_comment2": "change name of this object to 'scripts' and the current scripts to say 'xscripts'",
"_comment3": "and revert when done.",
"prepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline && rm -rf ./dist/demos ./dist/__tests__",
"xprepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline"
},
"scripts": {
"prepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline && yarn test:unit",
"predeploy": "yarn styleguide:build",
Expand Down
6 changes: 3 additions & 3 deletions src/core/orig-quote-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ export async function checkOriginalLanguageQuote(languageCode, fieldName, fieldT
// console.log(`getOriginalPassage(${bookID}, ${C}, ${V})…`);
let username;
try {
username = optionalCheckingOptions.originalLanguageRepoUsername;
username = optionalCheckingOptions?.originalLanguageRepoUsername;
} catch (qcoError) { }
if (!username) username = languageCode === 'en' ? 'unfoldingWord' : 'Door43-Catalog'; // ??? !!!
let branch;
try {
branch = optionalCheckingOptions.originalLanguageRepoBranch;
branch = optionalCheckingOptions?.originalLanguageRepoBranch;
} catch (qcunError) { }
if (!branch) branch = 'master';
const getFile_ = (optionalCheckingOptions && optionalCheckingOptions.getFile) ? optionalCheckingOptions.getFile : cachedGetFile;
Expand Down Expand Up @@ -268,7 +268,7 @@ export async function checkOriginalLanguageQuote(languageCode, fieldName, fieldT
verseText = optionalCheckingOptions.originalLanguageVerseText;
} catch (gcVTerror) { }
if (!verseText) {// not supplied, so then we need to get it ourselves
if (optionalCheckingOptions.disableAllLinkFetchingFlag)
if (optionalCheckingOptions?.disableAllLinkFetchingFlag)
return colqResult; // nothing else we can do here
else {
verseText = await getOriginalPassage(bookID, C, V, optionalCheckingOptions);
Expand Down
2 changes: 1 addition & 1 deletion src/core/tn-table-row-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export async function checkTN_TSVDataRow(languageCode, line, bookID, givenC, giv
&& supportReference !== 'guidelines-sonofgodprinciples')
addNoticePartial({ priority: 788, message: "Only 'Just-In-Time Training' TA articles allowed here", fieldName: 'SupportReference', extract: supportReference, rowID, location: ourRowLocation });
SRSuggestion = ourCheckTextField(rowID, 'SupportReference', supportReference, true, ourRowLocation, optionalCheckingOptions);
if (!optionalCheckingOptions.disableAllLinkFetchingFlag)
if (!optionalCheckingOptions?.disableAllLinkFetchingFlag)
await ourCheckSupportReferenceInTA(rowID, 'SupportReference', supportReference, ourRowLocation, optionalCheckingOptions);
if (occurrenceNote.indexOf(supportReference) < 0) // The full link is NOT in the note!
addNoticePartial({ priority: 787, message: "Link to TA should also be in OccurrenceNote", fieldName: 'SupportReference', extract: supportReference, rowID, location: ourRowLocation });
Expand Down
2 changes: 1 addition & 1 deletion src/core/tn-table-text-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export async function checkTN_TSVText(languageCode, bookID, filename, tableText,
}
}

if (optionalCheckingOptions.disableAllLinkFetchingFlag)
if (optionalCheckingOptions?.disableAllLinkFetchingFlag)
addNoticePartial({ priority: 20, message: "Note that 'disableAllLinkFetchingFlag' was set so link targets were not checked", location: ourLocation });

addSuccessMessage(`Checked all ${(lines.length - 1).toLocaleString()} data line${lines.length - 1 === 1 ? '' : 's'}${ourLocation}.`);
Expand Down
41 changes: 38 additions & 3 deletions src/demos/RenderProcessedResults.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
import React from 'react';
// import { forwardRef } from 'react';
import { forwardRef } from 'react';

// NOTE: The following line is currently giving compile warnings -- a problem in a dependency it seems
import MaterialTable from 'material-table';
import AddBox from '@material-ui/icons/AddBox';
import ArrowDownward from '@material-ui/icons/ArrowDownward';
import Check from '@material-ui/icons/Check';
import ChevronLeft from '@material-ui/icons/ChevronLeft';
import ChevronRight from '@material-ui/icons/ChevronRight';
import Clear from '@material-ui/icons/Clear';
import DeleteOutline from '@material-ui/icons/DeleteOutline';
import Edit from '@material-ui/icons/Edit';
import FilterList from '@material-ui/icons/FilterList';
import FirstPage from '@material-ui/icons/FirstPage';
import LastPage from '@material-ui/icons/LastPage';
import Remove from '@material-ui/icons/Remove';
import SaveAlt from '@material-ui/icons/SaveAlt';
import Search from '@material-ui/icons/Search';
import ViewColumn from '@material-ui/icons/ViewColumn';

const tableIcons = {
Add: forwardRef((props, ref) => <AddBox {...props} ref={ref} />),
Check: forwardRef((props, ref) => <Check {...props} ref={ref} />),
Clear: forwardRef((props, ref) => <Clear {...props} ref={ref} />),
Delete: forwardRef((props, ref) => <DeleteOutline {...props} ref={ref} />),
DetailPanel: forwardRef((props, ref) => <ChevronRight {...props} ref={ref} />),
Edit: forwardRef((props, ref) => <Edit {...props} ref={ref} />),
Export: forwardRef((props, ref) => <SaveAlt {...props} ref={ref} />),
Filter: forwardRef((props, ref) => <FilterList {...props} ref={ref} />),
FirstPage: forwardRef((props, ref) => <FirstPage {...props} ref={ref} />),
LastPage: forwardRef((props, ref) => <LastPage {...props} ref={ref} />),
NextPage: forwardRef((props, ref) => <ChevronRight {...props} ref={ref} />),
PreviousPage: forwardRef((props, ref) => <ChevronLeft {...props} ref={ref} />),
ResetSearch: forwardRef((props, ref) => <Clear {...props} ref={ref} />),
Search: forwardRef((props, ref) => <Search {...props} ref={ref} />),
SortArrow: forwardRef((props, ref) => <ArrowDownward {...props} ref={ref} />),
ThirdStateCheck: forwardRef((props, ref) => <Remove {...props} ref={ref} />),
ViewColumn: forwardRef((props, ref) => <ViewColumn {...props} ref={ref} />)
};


// const RENDER_PROCESSED_RESULTS_VERSION = '0.5.6';
Expand Down Expand Up @@ -157,11 +192,11 @@ export function RenderRawResults({ results }) {
<b>Raw Results</b>:
<RenderObject thisObject={results} />
<MaterialTable
// icons={tableIcons}
icons={tableIcons}
title={`All ${results.noticeList.length.toLocaleString()} Raw Notices`}
columns={headerData}
data={results.noticeList}
options={{ sorting: true, exportButton: true, exportAllData: true }}
options={{ sorting: true, exportButton: true, exportAllData: true, columnsButton: true, filtering: true }}
/>
</>;
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './demos';
//export * from './demos';
export * from './core';