diff --git a/extensions/src/platform-scripture-editor/contributions/localizedStrings.json b/extensions/src/platform-scripture-editor/contributions/localizedStrings.json index 08cae1f1b3..6f671203a3 100644 --- a/extensions/src/platform-scripture-editor/contributions/localizedStrings.json +++ b/extensions/src/platform-scripture-editor/contributions/localizedStrings.json @@ -12,6 +12,7 @@ "%webView_platformScriptureEditor_thickBorders%": "Thick Borders", "%webView_platformScriptureEditor_charactersInventory%": "Inventory: Characters", "%webView_platformScriptureEditor_repeatedWordsInventory%": "Inventory: Repeated Words", + "%webView_platformScriptureEditor_runBasicChecks%": "Run Basic Checks...", "%webView_platformScriptureEditor_publisherInfo%": "Publisher Info", "%webView_platformScriptureEditor_copyrightInfo%": "Copyright Info", "%platformScriptureEditor_dialog_openResourceViewer_title%": "Open Resource Viewer", diff --git a/extensions/src/platform-scripture-editor/contributions/menus.json b/extensions/src/platform-scripture-editor/contributions/menus.json index 5ebc31b3d9..8f7d887614 100644 --- a/extensions/src/platform-scripture-editor/contributions/menus.json +++ b/extensions/src/platform-scripture-editor/contributions/menus.json @@ -53,6 +53,10 @@ "platformScriptureEditor.inventory": { "column": "platformScriptureEditor.tools", "order": 2 + }, + "platformScriptureEditor.checks": { + "column": "platformScriptureEditor.tools", + "order": 3 } }, "items": [ @@ -80,6 +84,12 @@ "order": 2, "command": "platformScripture.openRepeatedWordsInventory" }, + { + "label": "%webView_platformScriptureEditor_runBasicChecks%", + "group": "platformScriptureEditor.checks", + "order": 1, + "command": "platformScripture.runBasicChecks" + }, { "label": "%webView_platformScriptureEditor_thickBorders%", "group": "platformScriptureEditor.layout", diff --git a/extensions/src/platform-scripture/contributions/localizedStrings.json b/extensions/src/platform-scripture/contributions/localizedStrings.json index b2858a1dea..6cedc5ad1e 100644 --- a/extensions/src/platform-scripture/contributions/localizedStrings.json +++ b/extensions/src/platform-scripture/contributions/localizedStrings.json @@ -22,6 +22,7 @@ "%mainMenu_toggleIncludeMyParatext9Projects%": "Toggle Include My Paratext 9 Projects", "%webView_characterInventory_title%": "Character Inventory", "%webView_repeatedWordsInventory_title%": "Repeated Words Inventory", + "%webView_checkResultsList_title%": "Check Results", "%webView_inventory_all%": "All items", "%webView_inventory_approved%": "Approved items", "%webView_inventory_unapproved%": "Unapproved items", diff --git a/extensions/src/platform-scripture/src/checking-results-list.web-view.scss b/extensions/src/platform-scripture/src/checking-results-list.web-view.scss new file mode 100644 index 0000000000..263260539a --- /dev/null +++ b/extensions/src/platform-scripture/src/checking-results-list.web-view.scss @@ -0,0 +1,7 @@ +.checking-results-list { + height: 500px; +} + +.checking-results-list-label { + padding-inline-start: 10px; +} diff --git a/extensions/src/platform-scripture/src/checking-results-list.web-view.tsx b/extensions/src/platform-scripture/src/checking-results-list.web-view.tsx new file mode 100644 index 0000000000..3f098f898b --- /dev/null +++ b/extensions/src/platform-scripture/src/checking-results-list.web-view.tsx @@ -0,0 +1,68 @@ +import { WebViewProps } from '@papi/core'; +import { Button, Label, ResultsSet, ScriptureResultsViewer } from 'platform-bible-react'; +import { useState, useCallback, useEffect, useMemo } from 'react'; +import { badLeftoversCheck, engineProblemsCheck } from './testing/test-scripture-checks'; + +const getLabel = ( + projectName: string | undefined, + datetime: string | undefined, + sources: ResultsSet[], +): string => { + let result = ''; + if (projectName) { + result = projectName; + } + if (datetime) result += `; ${datetime}`; + if (sources.length > 0) { + result += '; '; + result += sources + .map((s) => s.source.displayName) + .filter(Boolean) + .join(', '); + } + return result; +}; + +global.webViewComponent = function CheckingResultsListWebView({ useWebViewState }: WebViewProps) { + const [projectName] = useWebViewState('projectName', 'Dummy project'); + + // This is stub code to get some dummy checking results. + // TODO (#994): Replace this with calls to get actual check results and subscribe to updates. + const onRerun = useCallback(() => { + badLeftoversCheck.reRun(); + engineProblemsCheck.reRun(); + }, []); + + const sources = useMemo(() => [badLeftoversCheck, engineProblemsCheck], []); + + const [lastUpdateTimestamp, setLastUpdateTimestamp] = useState(undefined); + const [currentSources, setCurrentSources] = useState(sources); + + useEffect(() => { + setCurrentSources(sources); + }, [sources]); + + const handleResultsUpdated = useCallback(() => { + const currentTimestamp = new Date().toLocaleString(); + setLastUpdateTimestamp(currentTimestamp); + }, []); + + const reRunChecks = useCallback(() => { + if (onRerun) { + onRerun(); + // Since onRerun modifies the sources directly, we need to trigger a state update + setCurrentSources([...sources]); + handleResultsUpdated(); + } + }, [onRerun, sources, handleResultsUpdated]); + + const label = getLabel(projectName, lastUpdateTimestamp, sources); + + return ( +
+ + {label && } + +
+ ); +}; diff --git a/extensions/src/platform-scripture/src/checking-results.web-view-provider.ts b/extensions/src/platform-scripture/src/checking-results.web-view-provider.ts new file mode 100644 index 0000000000..7086e74db9 --- /dev/null +++ b/extensions/src/platform-scripture/src/checking-results.web-view-provider.ts @@ -0,0 +1,77 @@ +import papi, { logger, projectLookup } from '@papi/backend'; +import { + GetWebViewOptions, + IWebViewProvider, + SavedWebViewDefinition, + WebViewDefinition, +} from '@papi/core'; +import checkingResultsListWebView from './checking-results-list.web-view?inline'; +import checkingResultsListStyles from './checking-results-list.web-view.scss?inline'; + +export const checkResultsListWebViewType = 'platformScripture.checkingResults'; + +export interface CheckResultsWebViewOptions extends GetWebViewOptions { + projectId: string | undefined; +} + +export default class CheckResultsWebViewProvider implements IWebViewProvider { + constructor(public webViewType: string = checkResultsListWebViewType) {} + + async getWebView( + savedWebView: SavedWebViewDefinition, + getWebViewOptions: CheckResultsWebViewOptions, + ): Promise { + if (savedWebView.webViewType !== this.webViewType) + throw new Error( + `${checkResultsListWebViewType} provider received request to provide a ${savedWebView.webViewType} web view`, + ); + + // We know that the projectId (if present in the state) will be a string. + let projectId = + getWebViewOptions.projectId || + // eslint-disable-next-line no-type-assertion/no-type-assertion + (savedWebView.state?.projectId as string) || + undefined; + + let title = await papi.localization.getLocalizedString({ + localizeKey: '%webView_checkResultsList_title%', + }); + + let projectName: string | undefined; + + if (projectId) { + projectName = + (await ( + await papi.projectDataProviders.get('platform.base', projectId) + ).getSetting('platform.name')) ?? projectId; + + title += ` - ${projectName}`; + } + + if (!projectId && globalThis.isNoisyDevModeEnabled) { + logger.debug(`${title} web view did not get a project passed in. Choosing a random one...`); + + const projectMetadata = await projectLookup.getMetadataForAllProjects(); + if (projectMetadata.length === 0) { + logger.debug('Testing out checks: No projects available'); + return undefined; + } + projectId = projectMetadata[0].id; + } + + logger.info(`${title} web view opening with ${projectId}`); + + return { + title, + ...savedWebView, + content: checkingResultsListWebView, + styles: checkingResultsListStyles, + state: { + projectName, + projectId, + ...savedWebView.state, + webViewType: this.webViewType, + }, + }; + } +} diff --git a/extensions/src/platform-scripture/src/inventory.web-view-provider.ts b/extensions/src/platform-scripture/src/inventory.web-view-provider.ts new file mode 100644 index 0000000000..178aa7f189 --- /dev/null +++ b/extensions/src/platform-scripture/src/inventory.web-view-provider.ts @@ -0,0 +1,54 @@ +import papi from '@papi/backend'; +import { + GetWebViewOptions, + IWebViewProvider, + SavedWebViewDefinition, + WebViewDefinition, +} from '@papi/core'; +import { LocalizeKey } from 'platform-bible-utils'; +import inventoryWebView from './inventory.web-view?inline'; +import inventoryWebViewStyles from './inventory.web-view.scss?inline'; + +export interface InventoryWebViewOptions extends GetWebViewOptions { + projectId: string | undefined; +} + +export default class InventoryWebViewProvider implements IWebViewProvider { + constructor( + public titleKey: LocalizeKey, + public webViewType: string, + ) {} + + async getWebView( + savedWebView: SavedWebViewDefinition, + getWebViewOptions: InventoryWebViewOptions, + ): Promise { + if (savedWebView.webViewType !== this.webViewType) + throw new Error( + `${this.webViewType} provider received request to provide a ${savedWebView.webViewType} web view`, + ); + + // We know that the projectId (if present in the state) will be a string. + const projectId = + getWebViewOptions.projectId || + // eslint-disable-next-line no-type-assertion/no-type-assertion + (savedWebView.state?.projectId as string) || + undefined; + + const title: string = await papi.localization.getLocalizedString({ + localizeKey: this.titleKey, + }); + + return { + title, + ...savedWebView, + content: inventoryWebView, + styles: inventoryWebViewStyles, + state: { + ...savedWebView.state, + projectId, + webViewType: this.webViewType, + }, + }; + } +} diff --git a/extensions/src/platform-scripture/src/main.ts b/extensions/src/platform-scripture/src/main.ts index 9d5905538a..e9c9073c4d 100644 --- a/extensions/src/platform-scripture/src/main.ts +++ b/extensions/src/platform-scripture/src/main.ts @@ -1,30 +1,21 @@ import papi, { logger, projectLookup } from '@papi/backend'; import { VerseRef } from '@sillsdev/scripture'; -import { - ExecutionActivationContext, - GetWebViewOptions, - IWebViewProvider, - ProjectSettingValidator, - SavedWebViewDefinition, - WebViewDefinition, -} from '@papi/core'; -import { LocalizeKey } from 'platform-bible-utils'; +import { ExecutionActivationContext, ProjectSettingValidator } from '@papi/core'; import ScriptureExtenderProjectDataProviderEngineFactory, { SCRIPTURE_EXTENDER_PDPF_ID, } from './project-data-provider/platform-scripture-extender-pdpef.model'; import { SCRIPTURE_EXTENDER_PROJECT_INTERFACES } from './project-data-provider/platform-scripture-extender-pdpe.model'; import checkHostingService from './checks/extension-host-check-runner.service'; import checkAggregatorService from './checks/check-aggregator.service'; -import inventoryWebView from './inventory.web-view?inline'; -import inventoryWebViewStyles from './inventory.web-view.scss?inline'; +import InventoryWebViewProvider, { InventoryWebViewOptions } from './inventory.web-view-provider'; +import CheckResultsWebViewProvider, { + checkResultsListWebViewType, + CheckResultsWebViewOptions, +} from './checking-results.web-view-provider'; const characterInventoryWebViewType = 'platformScripture.characterInventory'; const repeatedWordsInventoryWebViewType = 'platformScripture.repeatedWordsInventory'; -interface InventoryOptions extends GetWebViewOptions { - projectId: string | undefined; -} - // #region Project Setting Validators // Should be 123 characters long @@ -76,7 +67,7 @@ async function openInventory( return undefined; } - const options: InventoryOptions = { projectId }; + const options: InventoryWebViewOptions = { projectId }; return papi.webViews.getWebView( webViewType, { type: 'float', floatSize: { width: 700, height: 800 } }, @@ -84,44 +75,23 @@ async function openInventory( ); } -class InventoryWebViewProvider implements IWebViewProvider { - constructor( - public titleKey: LocalizeKey, - public webViewType: string, - ) {} - - async getWebView( - savedWebView: SavedWebViewDefinition, - getWebViewOptions: InventoryOptions, - ): Promise { - if (savedWebView.webViewType !== this.webViewType) - throw new Error( - `${this.webViewType} provider received request to provide a ${savedWebView.webViewType} web view`, - ); +async function runPlatformBasicChecks(webViewId: string | undefined): Promise { + let projectId: string | undefined; - // We know that the projectId (if present in the state) will be a string. - const projectId = - (getWebViewOptions.projectId ?? - // eslint-disable-next-line no-type-assertion/no-type-assertion - (savedWebView.state?.projectId as string)) || - undefined; + logger.debug('Running checks'); - const title: string = await papi.localization.getLocalizedString({ - localizeKey: this.titleKey, - }); + if (webViewId) { + const webViewDefinition = await papi.webViews.getSavedWebViewDefinition(webViewId); + projectId = webViewDefinition?.projectId; + } - return { - title, - ...savedWebView, - content: inventoryWebView, - styles: inventoryWebViewStyles, - state: { - ...savedWebView.state, - projectId, - webViewType: this.webViewType, - }, - }; + if (!projectId) { + logger.debug('No project!'); + return undefined; } + + const options: CheckResultsWebViewOptions = { projectId }; + return papi.webViews.getWebView(checkResultsListWebViewType, { type: 'tab' }, options); } export async function activate(context: ExecutionActivationContext) { @@ -142,6 +112,7 @@ export async function activate(context: ExecutionActivationContext) { '%webView_repeatedWordsInventory_title%', repeatedWordsInventoryWebViewType, ); + const checkResultsWebViewProvider = new CheckResultsWebViewProvider(); const includeProjectsCommandPromise = papi.commands.registerCommand( 'platformScripture.toggleIncludeMyParatext9Projects', @@ -199,6 +170,14 @@ export async function activate(context: ExecutionActivationContext) { repeatedWordsInventoryWebViewType, repeatedWordsInventoryWebViewProvider, ); + const runBasicChecksPromise = papi.commands.registerCommand( + 'platformScripture.runBasicChecks', + runPlatformBasicChecks, + ); + const checkResultsWebViewProviderPromise = papi.webViewProviders.register( + checkResultsListWebViewType, + checkResultsWebViewProvider, + ); await checkHostingService.initialize(); await checkAggregatorService.initialize(); @@ -217,6 +196,8 @@ export async function activate(context: ExecutionActivationContext) { await nonRepeatableWordsPromise, await openRepeatedWordsInventoryPromise, await repeatableWordsInventoryWebViewProviderPromise, + await runBasicChecksPromise, + await checkResultsWebViewProviderPromise, checkHostingService.dispose, checkAggregatorService.dispose, ); diff --git a/extensions/src/platform-scripture/src/testing/test-scripture-checks.ts b/extensions/src/platform-scripture/src/testing/test-scripture-checks.ts new file mode 100644 index 0000000000..dc778fe983 --- /dev/null +++ b/extensions/src/platform-scripture/src/testing/test-scripture-checks.ts @@ -0,0 +1,63 @@ +import { ScriptureItemDetail } from 'platform-bible-react'; + +function generateRandomCheckingData(details: string[]): ScriptureItemDetail[] { + const getRandomNumber = (min: number, max: number) => + Math.floor(Math.random() * (max - min + 1)) + min; + + const numberOfResults = getRandomNumber(1, 10); + const results: ScriptureItemDetail[] = []; + + for (let i = 0; i < numberOfResults; i++) { + const randomOffset = getRandomNumber(0, 300); + const randomBookNum = getRandomNumber(1, 66); + const randomChapterNum = getRandomNumber(1, 150); + const randomVerseNum = getRandomNumber(1, 175); + const randomDetail = details[getRandomNumber(0, details.length - 1)]; + + results.push({ + start: { + jsonPath: '', + offset: randomOffset, + bookNum: randomBookNum, + chapterNum: randomChapterNum, + verseNum: randomVerseNum, + }, + detail: randomDetail, + }); + } + + return results; +} + +export const FIRST_TAB_ID = 'About'; + +function createTestCheck(id: string, displayName: string, possibleErrors: string[]) { + const check = { + id: `test.${id}`, + displayName, + }; + + let data = generateRandomCheckingData(possibleErrors); + + return { + source: check, + data, + reRun() { + data = generateRandomCheckingData(possibleErrors); + this.data = data; // Update the data property + }, + }; +} + +export const badLeftoversCheck = createTestCheck('badLeftovers', 'Bad Leftovers', [ + 'Moldy lasagna', + 'Iffy meatloaf', + 'Dried out chicken', + 'Stinky cheese', +]); + +export const engineProblemsCheck = createTestCheck('engineProblems', 'Engine problems', [ + 'Dirty spark plugs', + 'Low oil', + 'Stuck valves', +]); diff --git a/extensions/src/platform-scripture/src/types/platform-scripture.d.ts b/extensions/src/platform-scripture/src/types/platform-scripture.d.ts index 3b0a68914f..f6e7fb2deb 100644 --- a/extensions/src/platform-scripture/src/types/platform-scripture.d.ts +++ b/extensions/src/platform-scripture/src/types/platform-scripture.d.ts @@ -685,6 +685,10 @@ declare module 'papi-shared-types' { 'platformScripture.openRepeatedWordsInventory': ( projectId?: string | undefined, ) => Promise; + + 'platformScripture.runBasicChecks': ( + projectId?: string | undefined, + ) => Promise; } export interface SettingTypes { diff --git a/src/renderer/components/checking-results-list/checking-results-list.component.css b/src/renderer/components/checking-results-list/checking-results-list.component.css deleted file mode 100644 index f741ebfb73..0000000000 --- a/src/renderer/components/checking-results-list/checking-results-list.component.css +++ /dev/null @@ -1,3 +0,0 @@ -.checking-results-list { - height: 500px; -} diff --git a/src/renderer/components/checking-results-list/checking-results-list.component.tsx b/src/renderer/components/checking-results-list/checking-results-list.component.tsx deleted file mode 100644 index 349c7e764e..0000000000 --- a/src/renderer/components/checking-results-list/checking-results-list.component.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import './checking-results-list.component.css'; -import { badLeftoversCheck, engineProblemsCheck } from '@renderer/testing/test-layout.data'; -import { SavedTabInfo, TabInfo } from '@shared/models/docking-framework.model'; -import { - Button, - Label, - ResultsSet, - ScriptureResultsViewer, - ScriptureResultsViewerProps, -} from 'platform-bible-react'; -import { useState, useCallback, useEffect } from 'react'; - -export type CheckingResultsListProps = ScriptureResultsViewerProps & { - project?: string; - - onRerun?: () => void; -}; - -const getLabel = ( - project: string | undefined, - datetime: string | undefined, - sources: ResultsSet[], -): string => { - let result = ''; - if (project) { - result = project; - if (sources.length > 0) result += '; '; - } - if (datetime) result += `${datetime}; `; - result += sources - .map((s) => s.source.displayName) - .filter(Boolean) - .join(', '); - return result; -}; - -export default function CheckingResultsList(props: CheckingResultsListProps) { - const { sources, project, onRerun } = props; - const [lastUpdateTimestamp, setLastUpdateTimestamp] = useState(undefined); - const [currentSources, setCurrentSources] = useState(sources); - - useEffect(() => { - setCurrentSources(sources); - }, [sources]); - - const handleResultsUpdated = useCallback(() => { - const currentTimestamp = new Date().toLocaleString(); - setLastUpdateTimestamp(currentTimestamp); - }, []); - - const reRunChecks = useCallback(() => { - if (onRerun) { - onRerun(); - // Since onRerun modifies the sources directly, we need to trigger a state update - setCurrentSources([...sources]); - handleResultsUpdated(); - } - }, [onRerun, sources, handleResultsUpdated]); - - const label = getLabel(project, lastUpdateTimestamp, sources); - - return ( -
- {onRerun && } - {label && } - -
- ); -} - -export function loadCheckingResultsListTab(savedTabInfo: SavedTabInfo): TabInfo { - if (!savedTabInfo.id) throw new Error('Tab creation "id" is missing'); - - // This is stub code to get some dummy checking results. - // TODO (#994): Replace this with calls to get actual check results and subscribe to updates. - const data = { - sources: [badLeftoversCheck, engineProblemsCheck], - // TODO (#993): Get real project name. - project: 'Dummy project', - onRerun: () => { - badLeftoversCheck.reRun(); - engineProblemsCheck.reRun(); - }, - }; - - return { - ...savedTabInfo, - tabTitle: savedTabInfo.id || 'Checking Results List', - content: ( - - ), - }; -} diff --git a/src/renderer/components/checking-results-list/checking-results-list.constants.tsx b/src/renderer/components/checking-results-list/checking-results-list.constants.tsx deleted file mode 100644 index 3b0f4c3dbf..0000000000 --- a/src/renderer/components/checking-results-list/checking-results-list.constants.tsx +++ /dev/null @@ -1,4 +0,0 @@ -// TODO: Eventually this can and probably should go back into checking-results-list.component.tsx. -// But for now, since that references the test checks, that would cause a circular dependency. -const TAB_TYPE_CHECKING_RESULTS_LIST = 'checking-results-list'; -export default TAB_TYPE_CHECKING_RESULTS_LIST; diff --git a/src/renderer/components/docking/platform-dock-layout-storage.util.ts b/src/renderer/components/docking/platform-dock-layout-storage.util.ts index 512827aaef..be49036a7c 100644 --- a/src/renderer/components/docking/platform-dock-layout-storage.util.ts +++ b/src/renderer/components/docking/platform-dock-layout-storage.util.ts @@ -21,8 +21,6 @@ import { mergeUpdatablePropertiesIntoWebViewDefinitionIfChangesArePresent, saveTabInfoBase, } from '@renderer/services/web-view.service-host'; -import { loadCheckingResultsListTab } from '@renderer/components/checking-results-list/checking-results-list.component'; -import TAB_TYPE_CHECKING_RESULTS_LIST from '@renderer/components/checking-results-list/checking-results-list.constants'; import DIALOGS from '@renderer/components/dialogs'; import { TAB_TYPE_EXTENSION_MANAGER, @@ -76,7 +74,6 @@ if (globalThis.isNoisyDevModeEnabled) { [TAB_TYPE_USER_SETTINGS_TAB, loadUserSettingsTab], [TAB_TYPE_PROJECT_SETTINGS_TAB, loadProjectSettingsTab], [TAB_TYPE_RUN_BASIC_CHECKS, loadRunBasicChecksTab], - [TAB_TYPE_CHECKING_RESULTS_LIST, loadCheckingResultsListTab], ...Object.entries(DIALOGS).map( ([dialogTabType, dialogDefinition]) => // The default implementation of `loadDialog` uses `this`, so bind it to the definition diff --git a/src/renderer/testing/test-layout.data.ts b/src/renderer/testing/test-layout.data.ts index 1739b0b874..c35430e048 100644 --- a/src/renderer/testing/test-layout.data.ts +++ b/src/renderer/testing/test-layout.data.ts @@ -8,72 +8,10 @@ import { TAB_TYPE_TEST } from '@renderer/testing/test-panel.component'; // import { TAB_TYPE_OPEN_MULTIPLE_PROJECTS_DIALOG } from '@renderer/components/project-dialogs/open-multiple-projects-tab.component'; // import { TAB_TYPE_EXTENSION_MANAGER } from '@renderer/components/extension-manager/extension-manager-tab.component'; import { TAB_TYPE_RUN_BASIC_CHECKS } from '@renderer/components/run-basic-checks-dialog/run-basic-checks-tab.component'; -import { ScriptureItemDetail } from 'platform-bible-react'; -import TAB_TYPE_CHECKING_RESULTS_LIST from '@renderer/components/checking-results-list/checking-results-list.constants'; import LOREM_IPSUM from './lorem-ipsum'; -function generateRandomCheckingData(details: string[]): ScriptureItemDetail[] { - const getRandomNumber = (min: number, max: number) => - Math.floor(Math.random() * (max - min + 1)) + min; - - const numberOfResults = getRandomNumber(1, 10); - const results: ScriptureItemDetail[] = []; - - for (let i = 0; i < numberOfResults; i++) { - const randomOffset = getRandomNumber(0, 300); - const randomBookNum = getRandomNumber(1, 66); - const randomChapterNum = getRandomNumber(1, 150); - const randomVerseNum = getRandomNumber(1, 175); - const randomDetail = details[getRandomNumber(0, details.length - 1)]; - - results.push({ - start: { - jsonPath: '', - offset: randomOffset, - bookNum: randomBookNum, - chapterNum: randomChapterNum, - verseNum: randomVerseNum, - }, - detail: randomDetail, - }); - } - - return results; -} - export const FIRST_TAB_ID = 'About'; -function createTestCheck(id: string, displayName: string, possibleErrors: string[]) { - const check = { - id: `test.${id}`, - displayName, - }; - - let data = generateRandomCheckingData(possibleErrors); - - return { - source: check, - data, - reRun() { - data = generateRandomCheckingData(possibleErrors); - this.data = data; // Update the data property - }, - }; -} - -export const badLeftoversCheck = createTestCheck('badLeftovers', 'Bad Leftovers', [ - 'Moldy lasagna', - 'Iffy meatloaf', - 'Dried out chicken', - 'Stinky cheese', -]); - -export const engineProblemsCheck = createTestCheck('engineProblems', 'Engine problems', [ - 'Dirty spark plugs', - 'Low oil', - 'Stuck valves', -]); - // Using `as` here simplifies type changes. /* eslint-disable no-type-assertion/no-type-assertion */ const testLayout: LayoutBase = globalThis.isNoisyDevModeEnabled @@ -102,19 +40,6 @@ const testLayout: LayoutBase = globalThis.isNoisyDevModeEnabled { tabs: [{ id: 'Test Buttons', tabType: TAB_TYPE_BUTTONS }] as SavedTabInfo[], }, - { - tabs: [ - { - id: 'Checking Results List', - tabType: TAB_TYPE_CHECKING_RESULTS_LIST, - data: { - sources: undefined, - project: 'Dummy project', - onRerun: undefined, - }, - }, - ] as SavedTabInfo[], - }, ], }, floatbox: {