Skip to content
Draft
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"resource-workspace-rcl": "2.1.4",
"scripture-resources-rcl": "6.6.2",
"scripture-tsv": "1.2.0",
"single-scripture-rcl": "3.5.3",
"single-scripture-rcl": "/Users/blm0/Development/RCL/single-scripture-rcl/single-scripture-rcl-v3.5.4-beta.9.tgz",
"tailwindcss": "^2.0.4",
"tc-ui-toolkit": "5.3.3",
"translation-helps-rcl": "3.6.8",
Expand Down
7 changes: 4 additions & 3 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ export default function Header({
if (state.cardWithConflicts && !cardWithConflicts?.show) {
setCardWithConflicts(showIfNewer(cardWithConflicts))
}
if (state.cardWithError && !cardWithError?.show) {
setCardWithError(showIfNewer(cardWithError))
}
// disable all the error
// if (state.cardWithError && !cardWithError?.show) {
// // setCardWithError(showIfNewer(cardWithError))
// }
if (state.cardToMerge && !cardToMerge?.show) {
setCardToMerge(showIfNewer(cardToMerge))
}
Expand Down
43 changes: 41 additions & 2 deletions src/components/ResourceCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const { tsvsObjectToFileString } = tsvDataActions
import { useEdit } from 'gitea-react-toolkit'
import { getResourceErrorMessage } from 'single-scripture-rcl'
import isEqual from 'deep-equal'
import { getResourceMessage } from '@utils/resources'
import { getResourceMessage, parseRepoName } from '@utils/resources'
import {
HTTP_CONFIG,
RESOURCE_HTTP_CONFIG,
Expand Down Expand Up @@ -205,6 +205,43 @@ export default function ResourceCard({
viewMode,
})

const excludeResourceIds = ['ta', 'tn', 'tq', 'twl', 'tw']
const excludeLanguageIds = ['hbo', 'el-x-koine']

useEffect(() => {
if (resource?.manifest) {
if (resourceId === 'tn') { // tN manifest is the index to the resources used for this org
const relations = resource?.manifest?.dublin_core?.relation;
if (relations) {
if (relations.length >= 2) {
// get valid bible list
const validBibles = [];
for (const relation of relations) {
const {languageId, resourceId} = parseRepoName(relation)
if (languageId && resourceId) {
if (!excludeResourceIds.includes(resourceId) && !excludeLanguageIds.includes(languageId)) {
validBibles.push({languageId, resourceId})
}
}
}
if (validBibles.length >= 2) {
console.log('ResourceCard() resource manifest relations', validBibles)
if (!isEqual(validBibles, bibleRelations)) { // only update if different
setBibleRelations(validBibles)
return
}
}
}

console.log('ResourceCard() resource manifest should have at least 2 relations', relations)
} else {
console.log('ResourceCard() resource NO manifest relations')
}
}
}

}, [resource?.manifest])

useEffect(() => {
if (!savedContent && fetchResponse) {
try {
Expand Down Expand Up @@ -372,12 +409,14 @@ export default function ResourceCard({
bibleReference: {
bookId,
},
bibleRelations,
},
actions: {
updateMergeState,
setBibleRelations,
setCardsSaving,
setCardsLoadingUpdate,
setCardsLoadingMerge,
updateMergeState,
}
} = useContext(StoreContext)

Expand Down
3 changes: 3 additions & 0 deletions src/components/WorkspaceContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ function WorkspaceContainer() {
bibleReference: {
bookId, chapter, verse,
},
bibleRelations,
currentLayout,
enableObsSupport,
greekRepoUrl,
Expand Down Expand Up @@ -620,6 +621,7 @@ function WorkspaceContainer() {
resourceId: TARGET_LITERAL,
originalLanguageOwner: scriptureOwner,
},
bibleRelations,
...commonScriptureCardConfigs,
}

Expand Down Expand Up @@ -649,6 +651,7 @@ function WorkspaceContainer() {
resourceId: TARGET_SIMPLIFIED,
originalLanguageOwner: scriptureOwner,
},
bibleRelations,
...commonScriptureCardConfigs,
},
{
Expand Down
3 changes: 3 additions & 0 deletions src/context/StoreContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default function StoreContextProvider(props) {
const mergeCheckRef = useRef(0)
const [mergeCheck, setMergeCheck] = useState(0)
const [authError, setAuthError] = useState(0)
const [bibleRelations, setBibleRelations] = useState([])
const transtateRef = useRef(null)

function translate(key, options) {
Expand Down Expand Up @@ -173,6 +174,7 @@ export default function StoreContextProvider(props) {
authError,
authentication,
bibleReference,
bibleRelations,
cardsLoadingUpdate,
cardsLoadingMerge,
cardsSaving,
Expand Down Expand Up @@ -205,6 +207,7 @@ export default function StoreContextProvider(props) {
onReferenceChange,
setAppRef,
setAuthError,
setBibleRelations,
setCardsLoadingMerge,
setCardsLoadingUpdate,
setCardsSaving,
Expand Down
15 changes: 15 additions & 0 deletions src/utils/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,21 @@ export async function getLatestBibleRepo(server, org, lang, bible, processError)
return repo
}

/**
* Parses a repository name in the format "languageId/resourceId" into its components.
* @param {string} repoName - The repository name to parse (e.g., "en/ult")
* @return {{languageId: string, resourceId: string}} An object containing the languageId and resourceId
*/
export function parseRepoName(repoName) {
const [languageId, resourceId] = repoName.trim().split('/')
return {languageId, resourceId}
}

/**
* Creates a promise that resolves after a specified delay
* @param {number} ms - The delay in milliseconds
* @return {Promise<void>} A promise that resolves after the specified delay
*/
export function delay(ms) {
return new Promise((resolve) =>
setTimeout(resolve, ms),
Expand Down
15 changes: 7 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5561,10 +5561,10 @@ enhanced-resolve@^5.0.0:
graceful-fs "^4.2.4"
tapable "^2.3.0"

enhanced-word-aligner-rcl@1.4.4:
version "1.4.4"
resolved "https://registry.yarnpkg.com/enhanced-word-aligner-rcl/-/enhanced-word-aligner-rcl-1.4.4.tgz#1b5d1535f1585acd88ebf84bbd6d3316f9422729"
integrity sha512-2dY3TQR3Loc4upCYVYAW5WPqt/v5LbCioFUUR/8CX+iErsrfF3vB0XWYSDb3k8Xx/vQZYZ8Y6R/oM6pLRKY+QA==
enhanced-word-aligner-rcl@1.4.5:
version "1.4.5"
resolved "https://registry.yarnpkg.com/enhanced-word-aligner-rcl/-/enhanced-word-aligner-rcl-1.4.5.tgz#8e65d49a3aba7a1b35a0a182d262a0f593388ff9"
integrity sha512-lakJhli+MeEZixVEuXdSSc4DsoxriBeCMrv8CUKIBW9mOYowrTJIg8OnrD2acG2g2adZQDnfL1kL+SWxoWlczA==
dependencies:
"@mui/icons-material" "6.5.0"
"@mui/material" "6.5.0"
Expand Down Expand Up @@ -11974,10 +11974,9 @@ simple-swizzle@^0.2.2:
dependencies:
is-arrayish "^0.3.1"

single-scripture-rcl@3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/single-scripture-rcl/-/single-scripture-rcl-3.5.3.tgz#04689898321c23e87661436220ec9fd3b1118cce"
integrity sha512-KaQht/kMZ1E+1LvOnTci/GO74beSu3mwAY8ZkvvmIu0sbp3a212c19q6t03uw+cKgVUaSJl4F+BkT5tPn3cgqw==
"single-scripture-rcl@file:../single-scripture-rcl/single-scripture-rcl-v3.5.4-beta.9.tgz":
version "3.5.4-beta.9"
resolved "file:../single-scripture-rcl/single-scripture-rcl-v3.5.4-beta.9.tgz#24bfbe6d8e3c866669c645aa9317dfd447233751"
dependencies:
"@react-hookz/deep-equal" "^1.0.4"
"@types/react" "^17.0.0"
Expand Down
Loading