Skip to content

Commit

Permalink
Merge pull request #109 from DDMAL/mei-data
Browse files Browse the repository at this point in the history
Introduce type `MeiData`
  • Loading branch information
yinanazhou authored Jul 10, 2024
2 parents e07d4d9 + 17b2769 commit 204cfbe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Dashboard/Storage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PouchDB from 'pouchdb';
import { AllDocs, Doc, uploadsInfo } from '../Types';
import { AllDocs, Doc, UploadsInfo } from '../Types';
import * as Papa from 'papaparse';
import * as mammoth from 'mammoth/mammoth.browser';

Expand All @@ -13,7 +13,7 @@ function getAllDocuments(): Promise<AllDocs> {
});
}

export async function fetchUploads(): Promise<uploadsInfo> {
export async function fetchUploads(): Promise<UploadsInfo> {
try {
const res = await getAllDocuments();
return res.rows.map((row) => ({
Expand Down
5 changes: 3 additions & 2 deletions src/Editor/MeiTools.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Handsontable from 'handsontable';
import { updateStatus } from './ValidationTools';
import * as Notification from '../utils/Notification';
import { MeiData } from '../Types';

export class MeiTools {
private meiData: any[];
private meiData: MeiData;
public validationInProgress = false;
public pendingValidations = 0;
public hasInvalid = false;
Expand All @@ -18,7 +19,7 @@ export class MeiTools {
const mei = row[inputMeiHeader];
if (mei) {
this.meiData.push({
mei,
mei: mei,
row: rowIndex,
isValid: null,
errorMsg: null,
Expand Down
9 changes: 8 additions & 1 deletion src/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export type Doc = {
};
};

export type uploadsInfo = {
export type UploadsInfo = {
id: string;
name: string;
}[];
Expand All @@ -74,3 +74,10 @@ export type TableEvent =
| 'afterRemoveRow'
| 'afterRowMove'
| 'afterRowSequenceChange';

export type MeiData = {
mei: string;
row: number;
isValid: boolean | null;
errorMsg: string | null;
}[];

0 comments on commit 204cfbe

Please sign in to comment.