From 3454c7bc7b2bfba5799b13688eace234aff3d09b Mon Sep 17 00:00:00 2001 From: tjcouch-sil Date: Tue, 27 Aug 2024 14:38:37 -0500 Subject: [PATCH] Updated to use scroll groups --- .../assets/displayData.json | 4 ++-- .../src/web-views/paratext-text-collection.web-view.tsx | 9 ++++----- src/paratext-bible-word-list/assets/displayData.json | 4 ++-- src/paratext-bible-word-list/src/word-list.web-view.tsx | 5 +++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/paratext-bible-text-collection/assets/displayData.json b/src/paratext-bible-text-collection/assets/displayData.json index 1bfc77c..219c044 100644 --- a/src/paratext-bible-text-collection/assets/displayData.json +++ b/src/paratext-bible-text-collection/assets/displayData.json @@ -1,7 +1,7 @@ { "icon": "", - "moreInfoUrl": "", - "supportUrl": "", + "moreInfoUrl": "https://github.com/paranext/paratext-bible-extensions/tree/main/src/paratext-bible-text-collection", + "supportUrl": "https://github.com/paranext/paratext-bible-extensions/issues", "localizedDisplayInfo": { "en": { "displayName": "Paratext Text Collection", diff --git a/src/paratext-bible-text-collection/src/web-views/paratext-text-collection.web-view.tsx b/src/paratext-bible-text-collection/src/web-views/paratext-text-collection.web-view.tsx index 57e6909..84e452f 100644 --- a/src/paratext-bible-text-collection/src/web-views/paratext-text-collection.web-view.tsx +++ b/src/paratext-bible-text-collection/src/web-views/paratext-text-collection.web-view.tsx @@ -1,5 +1,5 @@ import papi from '@papi/frontend'; -import { useSetting, useDialogCallback } from '@papi/frontend/react'; +import { useDialogCallback } from '@papi/frontend/react'; import { Fragment, useCallback, useEffect, useMemo } from 'react'; import { IconButton, ScriptureReference, usePromise } from 'platform-bible-react'; import { deepEqual } from 'platform-bible-utils'; @@ -27,13 +27,12 @@ const getResourceVerseRef = (scrRef: ScriptureReference) => { return resourceVerseRef; }; -const defaultScrRef: ScriptureReference = { bookNum: 1, chapterNum: 1, verseNum: 1 }; - globalThis.webViewComponent = function TextCollectionWebView({ // Project ID of the project that is focused or undefined if no project selected projectId: expandedProjectId = '', updateWebViewDefinition, useWebViewState, + useWebViewScrollGroupScrRef, }: WebViewProps) { // Project IDs to show in the text collection const [projectIds, setProjectIds] = useWebViewState('projectIds', []); @@ -60,7 +59,7 @@ globalThis.webViewComponent = function TextCollectionWebView({ }, [projectIds, expandedProjectId, updateWebViewDefinition]); // Current verse reference - const [scrRef] = useSetting('platform.verseRef', defaultScrRef); + const [scrRef] = useWebViewScrollGroupScrRef(); const verseRef = useMemo(() => getResourceVerseRef(scrRef), [scrRef]); // Keep the title up-to-date @@ -101,7 +100,7 @@ globalThis.webViewComponent = function TextCollectionWebView({ const moveProjectUpDownHandler = (directionUp: boolean, projectId: string) => { const projectIdsCopy = [...projectIds]; - const index = projectIdsCopy.findIndex((id) => id === projectId); + const index = projectIdsCopy.findIndex((pid) => pid === projectId); const newIndex = directionUp ? index - 1 : index + 1; if (newIndex < 0 || newIndex > projectIdsCopy.length - 1) return; [projectIdsCopy[index], projectIdsCopy[newIndex]] = [ diff --git a/src/paratext-bible-word-list/assets/displayData.json b/src/paratext-bible-word-list/assets/displayData.json index d4d8a5b..66c8ace 100644 --- a/src/paratext-bible-word-list/assets/displayData.json +++ b/src/paratext-bible-word-list/assets/displayData.json @@ -1,7 +1,7 @@ { "icon": "", - "moreInfoUrl": "", - "supportUrl": "", + "moreInfoUrl": "https://github.com/paranext/paratext-bible-extensions/tree/main/src/paratext-bible-word-list", + "supportUrl": "https://github.com/paranext/paratext-bible-extensions/issues", "localizedDisplayInfo": { "en": { "displayName": "Paratext Word List", diff --git a/src/paratext-bible-word-list/src/word-list.web-view.tsx b/src/paratext-bible-word-list/src/word-list.web-view.tsx index 2908005..67fb926 100644 --- a/src/paratext-bible-word-list/src/word-list.web-view.tsx +++ b/src/paratext-bible-word-list/src/word-list.web-view.tsx @@ -1,4 +1,4 @@ -import { useSetting, useData } from '@papi/frontend/react'; +import { useData } from '@papi/frontend/react'; import { WebViewProps } from '@papi/core'; import { ChangeEvent, useEffect, useMemo, useState } from 'react'; import { ComboBox, ScriptureReference, Switch, TextField } from 'platform-bible-react'; @@ -58,8 +58,9 @@ function newDataNeeded( globalThis.webViewComponent = function WordListWebView({ projectId, useWebViewState, + useWebViewScrollGroupScrRef, }: WebViewProps) { - const [scrRef] = useSetting('platform.verseRef', defaultScrRef); + const [scrRef] = useWebViewScrollGroupScrRef(); const [scope, setScope] = useWebViewState('scope', Scope.Book); const [wordFilter, setWordFilter] = useState(''); const [selectedWord, setSelectedWord] = useState();