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

Ft/offline text merge #324

Open
wants to merge 50 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9706f98
added states for handling merge UI
sijumoncy Jan 15, 2024
9af115b
added UI template for text transaltion merge
sijumoncy Jan 15, 2024
d5b928e
import file function added
sijumoncy Jan 15, 2024
d3985a5
added fucntions to read and parse impoted file and check the same fil…
sijumoncy Jan 15, 2024
3d4e8f1
added util function to read usfm from a project
sijumoncy Jan 15, 2024
afab4e8
getting parsed usfm json for imported and exisiting
sijumoncy Jan 15, 2024
f6a51db
parsed usfm
sijumoncy Jan 15, 2024
9da3d4c
added chapters number and book in nav ui
sijumoncy Jan 17, 2024
e0edd59
added usfm conflict ui and import components
sijumoncy Jan 17, 2024
f629c45
sample render of usfm diff for test
sijumoncy Jan 17, 2024
321200b
added a prsing script to check and find the comparison results
sijumoncy Jan 18, 2024
dcb294c
added custom ui to render chapter wise one file
sijumoncy Jan 18, 2024
9c9e255
simple primary render view chapter wise - single json
sijumoncy Jan 18, 2024
65dcd00
test ui
sijumoncy Jan 19, 2024
d49d6f0
added logic to indentify the conflicts and display with basic styling
sijumoncy Feb 6, 2024
0e9ec32
added reset single and select current or incoming section
sijumoncy Feb 6, 2024
82bf7d9
added conflict ui
sijumoncy Feb 9, 2024
6229b25
only listing conflicted fiels
sijumoncy Feb 9, 2024
80d8ac9
detect chapter conflict resolution
sijumoncy Feb 12, 2024
f380e49
added resolve ,reset functionality to retain previous stages based on…
sijumoncy Feb 12, 2024
2c89702
added functionality to save and load conflict files, conflict fixed
sijumoncy Feb 13, 2024
287ab33
UI for Import and resume usfm conflict
sijumoncy Feb 14, 2024
3b531fc
added functionality for finiahs conflict resolution
sijumoncy Feb 15, 2024
8ad16dd
refactor codebase to handle file based merge to project based merge, …
sijumoncy Feb 22, 2024
8a83618
added resolve chapter and book functions added. book resolved ui need…
sijumoncy Feb 23, 2024
596736e
strike out and remove nav from resolved chapter; fixed backend file n…
sijumoncy Apr 17, 2024
b77cf9c
disabled reset option on chapter conflict resolution, auto switch cha…
sijumoncy Apr 17, 2024
714a6e5
functions to trigger complete conflict done
sijumoncy Apr 18, 2024
4be97dc
functionality for merge success;replace source files; delete .merge p…
sijumoncy Apr 18, 2024
f5ca445
added auto select chapter for the current parsed book in the ui
sijumoncy Apr 19, 2024
ced5249
updated meta and md5 on final replace
sijumoncy Apr 19, 2024
50f33e9
added docs and flow diagram
sijumoncy Apr 22, 2024
39c58c3
refactor fucntions; checkpoint for config store on initial load; fix …
sijumoncy Apr 24, 2024
998fbea
fixed issue : showing current and incoming incorrect.
sijumoncy Apr 24, 2024
59c163d
updated abort modal and fixed loading issue in no conflcit
sijumoncy Apr 24, 2024
e9c4385
added new hook for grammar to perf usfm conversion. logic added in si…
sijumoncy Apr 25, 2024
999bb24
logic and hooks to convert grammar usfm to perf usfm. added feature f…
sijumoncy Apr 30, 2024
0639043
no conflict notification and checks
sijumoncy Apr 30, 2024
860a456
added confirm on continue merge for startover;perf logics
sijumoncy Apr 30, 2024
94b2227
chapter level checkpoint and reload from the checkpoint of chapte
sijumoncy May 2, 2024
241c82e
merge button not showing initially
sijumoncy May 2, 2024
2e15f6b
loadback inprogress based on config status
sijumoncy May 2, 2024
50a4a27
added conflict detection based on the current and incoming content va…
sijumoncy May 2, 2024
1ea8299
lint fix
sijumoncy May 2, 2024
8a4c72d
folder and import data exit after close issue fixed
sijumoncy May 3, 2024
d5d6778
removed unused fucntion
sijumoncy May 3, 2024
7cf4d54
cleanup
sijumoncy May 10, 2024
5db0a77
fixes for auto conflict
sijumoncy Jul 9, 2024
527ac23
auto check and mark done
sijumoncy Jul 9, 2024
f48c803
lint: fixed lint issue
sijumoncy Jul 17, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions docs/Development/Offline Merge Text Translation/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Offline Merge Transaltion

- Offline Merge Feature for Text Translation
- Merge Option available on Import Existing Project ( Flavour Text Translation )
- The Merge Can be resumed later from the check point ( Check Point will be the completion of each chapter. The system will only take care of chapter by chapter . You can not stop and continue from middle of a chapter )
- The merge will be corrupted if back end data is modified / removed manually. Can not be restored
- One commit will be created on merge start with all the changes before the merge ( timestamp and commit message can be used to identify the commit)
- One commit will be created after the merge with all the merged changes ( timestamp and commit message can be used to identify)
- This commit can be used to revert back to earlier stage ( **advanced option** )
- Can not re work on chapter or book once you finish the conflicts with book / chapter
- updating `metadata.json` with new USFM's metadata on finish merge conflict for entire project
- Merge UI ( options)
- Accept all new changes
- Keep All existing changes
- Revert All changes
- Accept single changes ( current or new )
- Chapter Completion ( Check point )
- Merge Conflict Completion ( on completion : replace the original USFM with new merge USFM )
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"bible-reference-rcl": "1.1.0",
"clsx": "1.1.1",
"crypto-js": "^4.1.1",
"diff-match-patch": "^1.0.5",
"dotenv": "^16.3.1",
"electron-is-dev": "^2.0.0",
"electron-log": "4.4.7",
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Projects/ProjectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function ProjectList() {
};

const closeEditProject = async () => {
logger.debug('ProjectList.js', 'Closing edit project page and updating the values');
logger.debug('ProjectList.js', 'Closing edit project page and updating the valuesd');
setCallEditProject(false);
await FetchProjects();
};
Expand Down
1 change: 1 addition & 0 deletions renderer/src/components/Projects/ProjectRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ const ProjectRow = ({
</button>
)}
</Menu.Item>

<Menu.Item>
{({ active }) => (
<button
Expand Down
4 changes: 3 additions & 1 deletion renderer/src/components/SnackBar/SnackBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import { Popover, Transition } from '@headlessui/react';
import PropTypes from 'prop-types';

const colors = { success: '#82E0AA', failure: '#F5B7B1', warning: '#F8C471' };
const colors = {
success: '#82E0AA', failure: '#F5B7B1', warning: '#F8C471', info: '#17a2b8',
};
const SnackBar = ({
openSnackBar,
snackText,
Expand Down Expand Up @@ -41,7 +43,7 @@

useEffect(() => {
if (openSnackBar) {
setTimeLeft(3);

Check warning on line 46 in renderer/src/components/SnackBar/SnackBar.js

View workflow job for this annotation

GitHub Actions / Lint Run

React Hook useEffect has a missing dependency: 'error'. Either include it or remove the dependency array. If 'setTimeLeft' needs the current value of 'error', you can also switch to useReducer instead of useState and read 'error' in the reducer

Check warning on line 46 in renderer/src/components/SnackBar/SnackBar.js

View workflow job for this annotation

GitHub Actions / Lint Run

React Hook useEffect has a missing dependency: 'error'. Either include it or remove the dependency array. If 'setTimeLeft' needs the current value of 'error', you can also switch to useReducer instead of useState and read 'error' in the reducer
}
}, [openSnackBar]);

Expand Down
59 changes: 59 additions & 0 deletions renderer/src/components/TextTranslationMerge/ImportUsfmUI.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';

function ImportUsfmUI({
currentProjectMeta, handleImportUsfm, buttonName, savedConflictsBooks, resumeConflictResolution,
}) {
return (
<div className="w-full h-full flex justify-center items-center">
<div className="w-full h-[30vh] flex justify-center items-center gap-2">

<div className="w-full h-full flex-1">

<div className="flex flex-col gap-3 items-center justify-center h-full">
<h4 className="font-medium text-center">Current Project Scope</h4>
<div className="grid grid-cols-7 overflow-y-auto">

{currentProjectMeta && Object.keys(currentProjectMeta?.type?.flavorType?.currentScope).map((scope) => (
<span className="ml-2" key={scope}>{scope}</span>
))}
</div>
<button
type="button"
className="border-2 border-primary rounded-lg px-2 py-1 hover:bg-primary hover:text-white"
onClick={handleImportUsfm}
>
{buttonName}
</button>
</div>

</div>

<div className="w-[.5px] h-full bg-gray-400" />

{/* saved conflicts - resume */}
{savedConflictsBooks?.length > 0 && (

<div className="w-full flex-1 h-full flex flex-col justify-center items-center gap-2">

<h4 className="font-medium text-center">Resume Conflict Resolution</h4>
<div className="grid grid-cols-5 gap-2 overflow-y-auto">

{savedConflictsBooks.map((book) => (
<button
key={book}
type="button"
className="border-2 border-primary rounded-lg px-2 py-1 hover:bg-primary hover:text-white"
onClick={() => resumeConflictResolution(book)}
>
{book.toUpperCase().split('.')[0]}
</button>
))}
</div>
</div>
)}
</div>
</div>
);
}

export default ImportUsfmUI;
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// import { Cog8ToothIcon } from '@heroicons/react/24/outline';
// import { useTranslation } from 'react-i18next';

function TranslationMergNavBar({
conflictedBooks, selectedBook, setSelectedBook, resolvedBooks, disableSelection, conflictedChapters, selectedChapter, setSelectedChapter,
}) {
// const { t } = useTranslation();
return (
<div className="bg-white border-2 rounded-md border-black h-[78vh] overflow-hidden ">
<div className="flex items-center justify-between bg-black py-1.5 px-2.5">

<span className="px-2.5 py-0.5 bg-primary text-white font-medium tracking-wider text-xs uppercase rounded-xl">
Books :
{' '}
{`${conflictedBooks?.length} `}
</span>
{/* <Cog8ToothIcon className="w-5 h-5 text-white" /> */}
</div>

<div className="h-full overflow-auto ">
<ul className="text-black text-xs py-2.5">
{conflictedBooks?.map((book) => {
const bookId = book.split('/');
return (
<li
key={book}
// className="w-full"
className={`w-full py-2 mb-4 ${resolvedBooks.includes(book)
? 'pointer-events-none'
: `${selectedBook === book ? 'bg-primary/70' : 'hover:bg-primary cursor-pointer'}`} `}

// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
>
<button
type="button"
onClick={() => { setSelectedBook(book); setSelectedChapter(); }}
aria-disabled={disableSelection}
className="w-full text-center"

>
<span className={`${resolvedBooks.includes(book) && 'line-through decoration-2'}`}>{bookId[1]}</span>

</button>
{/* chapter selection */}
{selectedBook === book && !resolvedBooks.includes(book) && (

<div className="bg-white w-[95%] mx-auto my-2 grid grid-cols-3 gap-2 border border-gray-400 rounded-md min-h-[50px] p-2">
{conflictedChapters?.map((chNo) => (
<button
key={chNo}
type="button"
className={`p-2 border rounded-md ${selectedChapter === chNo ? 'bg-primary/70' : 'hover:bg-primary cursor-pointer'}`}
onClick={() => setSelectedChapter(chNo)}
>
{chNo}
</button>
))}
</div>
)}

</li>
);
})}
</ul>
</div>
</div>
);
}

export default TranslationMergNavBar;
Loading
Loading