diff --git a/backend/doc/domain/assembly_strategies/assembly_strategies_book_then_lang_by_chapter.py b/backend/doc/domain/assembly_strategies/assembly_strategies_book_then_lang_by_chapter.py index 61f6a778..308ec20b 100644 --- a/backend/doc/domain/assembly_strategies/assembly_strategies_book_then_lang_by_chapter.py +++ b/backend/doc/domain/assembly_strategies/assembly_strategies_book_then_lang_by_chapter.py @@ -67,7 +67,6 @@ def assemble_content_by_chapter( {usfm_book.book_code for usfm_book in usfm_books} .union(tn_book.book_code for tn_book in tn_books) .union(tq_book.book_code for tq_book in tq_books) - .union(tw_book.book_code for tw_book in tw_books) .union(bc_book.book_code for bc_book in bc_books) .union(rg_book.book_code for rg_book in rg_books) ) @@ -85,9 +84,6 @@ def assemble_content_by_chapter( selected_tq_books = [ tq_book for tq_book in tq_books if tq_book.book_code == book_code ] - selected_tw_books = [ - tw_book for tw_book in tw_books if tw_book.book_code == book_code - ] selected_bc_books = [ bc_book for bc_book in bc_books if bc_book.book_code == book_code ] @@ -103,7 +99,7 @@ def assemble_content_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -127,7 +123,7 @@ def assemble_content_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -152,7 +148,7 @@ def assemble_content_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -166,7 +162,7 @@ def assemble_content_by_chapter( not selected_usfm_books and not selected_tn_books and not selected_tq_books - and (selected_tw_books or selected_bc_books or selected_rg_books) + and (tw_books or selected_bc_books or selected_rg_books) and ( assembly_layout_kind == AssemblyLayoutEnum.ONE_COLUMN or assembly_layout_kind == AssemblyLayoutEnum.ONE_COLUMN_COMPACT @@ -177,7 +173,7 @@ def assemble_content_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -194,7 +190,7 @@ def assemble_content_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -364,13 +360,8 @@ def assemble_usfm_by_chapter( ): content.append(hr) # Add list of tw words used in chapter - selected_tw_books = [ - tw_book - for tw_book in tw_books - if tw_book.book_code == book_code - ] - if selected_tw_books: - tw_book = selected_tw_books[0] + if tw_books: + tw_book = tw_books[0] words = translation_words_for_content( tw_book, usfm_book.chapters[chapter_num].content ) @@ -561,9 +552,7 @@ def assemble_usfm_by_verse_chapter_at_a_time( if tq_book.book_code == book_code and tq_book.lang_code == lang_code ] selected_tw_books = [ - tw_book - for tw_book in tw_books - if tw_book.book_code == book_code and tw_book.lang_code == lang_code + tw_book for tw_book in tw_books if tw_book.lang_code == lang_code ] usfm_book = None usfm_book2 = None @@ -724,12 +713,7 @@ def assemble_tn_by_chapter( book_chapters: Mapping[str, int] = BOOK_CHAPTERS, fmt_str: str = settings.LEFT_ALIGNED_HEADER_FMT_STR, ) -> list[str]: - """ - Construct the HTML for a 'by chapter' strategy wherein at least - tn_books exists. - """ content = [] - # TODO Should we use lang_codes again here to ensure order? if show_tn_book_intro: for tn_book in tn_books: content.append(tn_language_direction_html(tn_book)) diff --git a/backend/doc/domain/assembly_strategies/assembly_strategies_lang_then_book_by_chapter.py b/backend/doc/domain/assembly_strategies/assembly_strategies_lang_then_book_by_chapter.py index 2bf607f8..a1329804 100755 --- a/backend/doc/domain/assembly_strategies/assembly_strategies_lang_then_book_by_chapter.py +++ b/backend/doc/domain/assembly_strategies/assembly_strategies_lang_then_book_by_chapter.py @@ -72,7 +72,6 @@ def assemble_content_by_book( {usfm_book.book_code for usfm_book in usfm_books} .union(tn_book.book_code for tn_book in tn_books) .union(tq_book.book_code for tq_book in tq_books) - .union(tw_book.book_code for tw_book in tw_books) .union(bc_book.book_code for bc_book in bc_books) .union(rg_book.book_code for rg_book in rg_books) ) @@ -115,9 +114,7 @@ def assemble_content_by_book( ] tq_book = selected_tq_books[0] if selected_tq_books else None selected_tw_books = [ - tw_book - for tw_book in tw_books - if tw_book.lang_code == lang_code and tw_book.book_code == book_code + tw_book for tw_book in tw_books if tw_book.lang_code == lang_code ] tw_book = selected_tw_books[0] if selected_tw_books else None selected_bc_books = [ @@ -247,7 +244,6 @@ def assemble_content_by_verse_book_at_a_time( {usfm_book.book_code for usfm_book in usfm_books} .union(tn_book.book_code for tn_book in tn_books) .union(tq_book.book_code for tq_book in tq_books) - .union(tw_book.book_code for tw_book in tw_books) .union(bc_book.book_code for bc_book in bc_books) .union(rg_book.book_code for rg_book in rg_books) ) @@ -292,9 +288,7 @@ def assemble_content_by_verse_book_at_a_time( ] tq_book = selected_tq_books[0] if selected_tq_books else None selected_tw_books = [ - tw_book - for tw_book in tw_books - if tw_book.lang_code == lang_code and tw_book.book_code == book_code + tw_book for tw_book in tw_books if tw_book.lang_code == lang_code ] tw_book = selected_tw_books[0] if selected_tw_books else None selected_bc_books = [ diff --git a/backend/doc/domain/assembly_strategies_docx/assembly_strategies_book_then_lang_by_chapter.py b/backend/doc/domain/assembly_strategies_docx/assembly_strategies_book_then_lang_by_chapter.py index 89aeee6f..abf0f51e 100644 --- a/backend/doc/domain/assembly_strategies_docx/assembly_strategies_book_then_lang_by_chapter.py +++ b/backend/doc/domain/assembly_strategies_docx/assembly_strategies_book_then_lang_by_chapter.py @@ -60,7 +60,6 @@ def assemble_content_by_chapter( [usfm_book.book_code for usfm_book in usfm_books], [tn_book.book_code for tn_book in tn_books], [tq_book.book_code for tq_book in tq_books], - [tw_book.book_code for tw_book in tw_books], [bc_book.book_code for bc_book in bc_books], [rg_book.book_code for rg_book in rg_books], ], @@ -79,9 +78,6 @@ def assemble_content_by_chapter( selected_tq_books = [ tq_book for tq_book in tq_books if tq_book.book_code == book_code ] - selected_tw_books = [ - tw_book for tw_book in tw_books if tw_book.book_code == book_code - ] selected_bc_books = [ bc_book for bc_book in bc_books if bc_book.book_code == book_code ] @@ -94,7 +90,7 @@ def assemble_content_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -111,7 +107,7 @@ def assemble_content_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -128,7 +124,7 @@ def assemble_content_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -142,14 +138,14 @@ def assemble_content_by_chapter( not selected_usfm_books and not selected_tn_books and not selected_tq_books - and (selected_tw_books or selected_bc_books or selected_rg_books) + and (tw_books or selected_bc_books or selected_rg_books) ): document_parts.extend( assemble_tw_by_chapter( selected_usfm_books, selected_tn_books, selected_tq_books, - selected_tw_books, + tw_books, selected_bc_books, selected_rg_books, use_section_visual_separator, @@ -642,9 +638,7 @@ def assemble_usfm_by_verse_chapter_at_a_time( if tq_book.book_code == book_code and tq_book.lang_code == lang_code ] selected_tw_books = [ - tw_book - for tw_book in tw_books - if tw_book.book_code == book_code and tw_book.lang_code == lang_code + tw_book for tw_book in tw_books if tw_book.lang_code == lang_code ] usfm_book = None usfm_book2 = None @@ -1136,7 +1130,7 @@ def assemble_tq_by_chapter( for tq_book in [ tq_book for tq_book in tq_books - if tq_book.book_code == tq_book.book_code + if tq_book.book_code == book_code ]: tq_verses = tq_chapter_verses( tq_book, @@ -1175,7 +1169,7 @@ def assemble_tq_by_chapter( for rg_book in [ rg_book for rg_book in rg_books - if rg_book.book_code == rg_book.book_code + if rg_book.book_code == book_code ]: rg_verses = rg_chapter_verses( rg_book, chapter_num, use_section_visual_separator diff --git a/backend/doc/domain/assembly_strategies_docx/assembly_strategies_lang_then_book_by_chapter.py b/backend/doc/domain/assembly_strategies_docx/assembly_strategies_lang_then_book_by_chapter.py index a0a16619..6844d070 100755 --- a/backend/doc/domain/assembly_strategies_docx/assembly_strategies_lang_then_book_by_chapter.py +++ b/backend/doc/domain/assembly_strategies_docx/assembly_strategies_lang_then_book_by_chapter.py @@ -70,7 +70,6 @@ def assemble_content_by_book( {usfm_book.book_code for usfm_book in usfm_books} .union(tn_book.book_code for tn_book in tn_books) .union(tq_book.book_code for tq_book in tq_books) - .union(tw_book.book_code for tw_book in tw_books) .union(bc_book.book_code for bc_book in bc_books) .union(rg_book.book_code for rg_book in rg_books) ) @@ -115,14 +114,8 @@ def assemble_content_by_book( if tq_book.lang_code == lang_code and tq_book.book_code == book_code ] tq_book = selected_tq_books[0] if selected_tq_books else None - # TODO TWBook doesn't really need to have a book_code attribute - # because TW resources are language centric not book centric. - # We could do something about that later if desired for - # design cleanness sake. selected_tw_books = [ - tw_book - for tw_book in tw_books - if tw_book.lang_code == lang_code and tw_book.book_code == book_code + tw_book for tw_book in tw_books if tw_book.lang_code == lang_code ] tw_book = selected_tw_books[0] if selected_tw_books else None selected_bc_books = [ @@ -251,7 +244,6 @@ def assemble_content_by_verse_book_at_a_time( {usfm_book.book_code for usfm_book in usfm_books} .union(tn_book.book_code for tn_book in tn_books) .union(tq_book.book_code for tq_book in tq_books) - .union(tw_book.book_code for tw_book in tw_books) .union(bc_book.book_code for bc_book in bc_books) .union(rg_book.book_code for rg_book in rg_books) ) @@ -292,14 +284,8 @@ def assemble_content_by_verse_book_at_a_time( if tq_book.lang_code == lang_code and tq_book.book_code == book_code ] tq_book = selected_tq_books[0] if selected_tq_books else None - # TODO TWBook doesn't really need to have a book_code attribute - # because TW resources are language centric not book centric. - # We could do something about that later if desired for - # design cleanness sake. selected_tw_books = [ - tw_book - for tw_book in tw_books - if tw_book.lang_code == lang_code and tw_book.book_code == book_code + tw_book for tw_book in tw_books if tw_book.lang_code == lang_code ] tw_book = selected_tw_books[0] if selected_tw_books else None selected_bc_books = [ diff --git a/backend/doc/domain/model.py b/backend/doc/domain/model.py index fec5c529..5a78613a 100644 --- a/backend/doc/domain/model.py +++ b/backend/doc/domain/model.py @@ -448,7 +448,6 @@ def __init__(self, localized_word: str, path: str, content: str): class TWBook(NamedTuple): lang_code: str lang_name: str - book_code: str resource_type_name: str lang_direction: LangDirEnum name_content_pairs: list[TWNameContentPair] = [] diff --git a/backend/doc/domain/parsing.py b/backend/doc/domain/parsing.py index 10234005..1077817b 100644 --- a/backend/doc/domain/parsing.py +++ b/backend/doc/domain/parsing.py @@ -861,7 +861,6 @@ def tw_book_content( return TWBook( lang_code=resource_lookup_dto.lang_code, lang_name=resource_lookup_dto.lang_name, - book_code=resource_lookup_dto.book_code, resource_type_name=resource_lookup_dto.resource_type_name, name_content_pairs=name_content_pairs, lang_direction=resource_lookup_dto.lang_direction, diff --git a/backend/doc/domain/resource_lookup.py b/backend/doc/domain/resource_lookup.py index a8810443..34243b71 100644 --- a/backend/doc/domain/resource_lookup.py +++ b/backend/doc/domain/resource_lookup.py @@ -1227,12 +1227,6 @@ def nt_survey_rg_passages( BibleReference(book_code='mat', book_name='Matthew', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None) """ path = join(resource_dir, docx_file_path) - # logger.debug("path: %s exists: %s", path, exists(path)) - # TODO Check if resource_dir exists and if it doesn't then submit - # a document request to DOC API to make sure it is cloned. - # Currently we don't have to do this because at startup we copy - # English NT Survey RG doc into place. - # assert exists(path) rg_books = get_rg_books( path, lang_code, @@ -1275,12 +1269,6 @@ def ot_survey_rg1_passages( BibleReference(book_code='gen', book_name='Genesis', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None) """ path = join(resource_dir, docx_file_path) - # logger.debug("path: %s exists: %s", path, exists(path)) - # TODO Check if resource_dir exists and if it doesn't then submit - # a document request to DOC API to make sure it is cloned. - # Currently we don't have to do this because at startup we copy - # English OT Survey RG1 doc into place. - # assert exists(path) rg_books = get_rg_books( path, lang_code, @@ -1323,12 +1311,6 @@ def ot_survey_rg2_passages( BibleReference(book_code='jos', book_name='Joshua', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None) """ path = join(resource_dir, docx_file_path) - # logger.debug("path: %s exists: %s", path, exists(path)) - # TODO Check if resource_dir exists and if it doesn't then submit - # a document request to DOC API to make sure it is cloned. - # Currently we don't have to do this because at startup we copy - # English OT Survey RG2 doc into place. - # assert exists(path) rg_books = get_rg_books( path, lang_code, @@ -1371,12 +1353,6 @@ def ot_survey_rg3_passages( BibleReference(book_code='job', book_name='Job', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None) """ path = join(resource_dir, docx_file_path) - # logger.debug("path: %s exists: %s", path, exists(path)) - # TODO Check if resource_dir exists and if it doesn't then submit - # a document request to DOC API to make sure it is cloned. - # Currently we don't have to do this because at startup we copy - # English OT Survey RG3 doc into place. - # assert exists(path) rg_books = get_rg_books( path, lang_code, @@ -1419,12 +1395,6 @@ def ot_survey_rg4_passages( BibleReference(book_code='isa', book_name='Isaiah', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None) """ path = join(resource_dir, docx_file_path) - # logger.debug("path: %s exists: %s", path, exists(path)) - # TODO Check if resource_dir exists and if it doesn't then submit - # a document request to DOC API to make sure it is cloned. - # Currently we don't have to do this because at startup we copy - # English OT Survey RG4 doc into place. - # assert exists(path) rg_books = get_rg_books( path, lang_code, diff --git a/backend/doc/reviewers_guide/parser.py b/backend/doc/reviewers_guide/parser.py index def7268b..6713f0b8 100644 --- a/backend/doc/reviewers_guide/parser.py +++ b/backend/doc/reviewers_guide/parser.py @@ -27,7 +27,9 @@ def get_book_code(book_name: str, book_names: dict[str, str] = BOOK_NAMES) -> st def parse_bible_reference( - raw_bible_reference: str, book_names: list[str] = list(BOOK_NAMES.values()) + raw_bible_reference: str, + book_names: list[str] = list(BOOK_NAMES.values()), + exceptional_book_name: str = "Song of Songs", ) -> BibleReference: bible_reference_components = raw_bible_reference.split() if ( @@ -97,7 +99,6 @@ def parse_bible_reference( elif bible_reference_components[1][ 0 ].isdigit() and not bible_reference_components[2].endswith("continued"): - # Likely an OT reviewer's guide reference which sometimes looks like ['Genesis', '1:1-2:3', 'God', 'creates', 'everything'] bible_reference_components = bible_reference_components[0:2] logger.debug( "2. Updated bible_reference_components: %s", @@ -106,9 +107,37 @@ def parse_bible_reference( book_name = bible_reference_components[0] book_code = get_book_code(book_name) chapter_verse_components = bible_reference_components[1].split(":") - bible_reference = get_ordinal_bible_reference( - chapter_verse_components, book_code, book_name + if ( + len(chapter_verse_components) == 3 + and "-" in chapter_verse_components[1] + ): + bible_reference = get_bible_reference_spanning_chapter_boundary( + chapter_verse_components, book_code, book_name + ) + else: + bible_reference = get_ordinal_bible_reference( + chapter_verse_components, book_code, book_name + ) + elif ( + not bible_reference_components[2].endswith("continued") + and f"{bible_reference_components[0]} {bible_reference_components[1]} {bible_reference_components[2]} == {exceptional_book_name}" + ): + bible_reference_components = bible_reference_components[0:4] + book_code = get_book_code( + f"{bible_reference_components[0]} {bible_reference_components[1]} Solomon" ) + chapter_verse_components = bible_reference_components[3].split(":") + if ( + len(chapter_verse_components) == 3 + and "-" in chapter_verse_components[1] + ): + bible_reference = get_bible_reference_spanning_chapter_boundary( + chapter_verse_components, book_code, exceptional_book_name + ) + else: + bible_reference = get_ordinal_bible_reference( + chapter_verse_components, book_code, exceptional_book_name + ) return bible_reference @@ -158,7 +187,9 @@ def get_bible_reference_spanning_chapter_boundary( def find_bible_references( - docx_file: str, book_names: list[str] = list(BOOK_NAMES.values()) + docx_file: str, + book_names: list[str] = list(BOOK_NAMES.values()), + solomon: str = "Solomon", ) -> tuple[list[str], list[str]]: """ Identifies Bible passage references and text between references. @@ -185,7 +216,6 @@ def find_bible_references( if "Old Testament" in testament_paragraph.text.strip(): logger.info("Parsing Old Testament rg document") for paragraph in doc.paragraphs: - # Check if the paragraph is a potential Bible reference paragraph_text = paragraph.text.strip() words = paragraph_text.split() if ( @@ -195,10 +225,15 @@ def find_bible_references( and ( words[1][0].isdigit() or (len(words) > 2 and words[2][0].isdigit()) ) + ) or ( + words + and len(words) > 3 + and ( + f"{words[0]} {words[1]} {solomon}" in book_names + ) # Input doc uses Song of Songs, but lookup is Song of Solomon + and words[3][0].isdigit() ): - if paragraph_text.endswith( - "continued" - ): # or "\t" in paragraph_text # \t is in paragraph_text when it is a TOC entry + if paragraph_text.endswith("continued"): continue if inside_bible_reference: if current_text: @@ -212,7 +247,6 @@ def find_bible_references( else: logger.info("Parsing New Testament rg document") for paragraph in doc.paragraphs: - # Check if the paragraph is a potential Bible reference paragraph_text = paragraph.text.strip() words = paragraph_text.split() if ( @@ -221,9 +255,7 @@ def find_bible_references( and len(words) < 5 and (words[0] in book_names or (f"{words[0]} {words[1]}" in book_names)) ): - if ( - paragraph_text.endswith("continued") or "\t" in paragraph_text - ): # \t is in paragraph_text when it is a TOC entry + if paragraph_text.endswith("continued") or "\t" in paragraph_text: continue if inside_bible_reference: if current_text: diff --git a/frontend/src/lib/bible-books.ts b/frontend/src/lib/bible-books.ts index 424f1f78..f0939d15 100644 --- a/frontend/src/lib/bible-books.ts +++ b/frontend/src/lib/bible-books.ts @@ -70,3 +70,11 @@ export const booksMap: { [key: string]: string } = { export type BookKey = keyof typeof booksMap export const bookCodes = Object.keys(booksMap) as BookKey[] + +export function bookRange(start: string, end: string): BookKey[] { + const codes = bookCodes + const s = codes.indexOf(start) + const e = codes.indexOf(end) + if (s === -1 || e === -1 || s > e) return [] + return codes.slice(s, e + 1) +} diff --git a/frontend/src/routes/passages/language/+page.svelte b/frontend/src/routes/passages/language/+page.svelte index 88227c7a..ee47107c 100644 --- a/frontend/src/routes/passages/language/+page.svelte +++ b/frontend/src/routes/passages/language/+page.svelte @@ -10,6 +10,7 @@ import WizardBasket from '$lib/passages/WizardBasket.svelte' import { langCodeAndNameStore, langCountStore } from '$lib/passages/stores/LanguageStore' import { getCode, getName } from '$lib/passages/utils' + import { passagesStore } from '$lib/passages/stores/PassagesStore' let showGatewayLanguages = true @@ -52,6 +53,13 @@ await loadLangCodeNameAndTypes() }) + function handleLangChange(e: Event, lang: string) { + const input = e.currentTarget as HTMLInputElement + if (input.checked) { + $passagesStore = [] + } + } + // Set $langCountStore $: { if ($langCodeAndNameStore) { @@ -120,6 +128,7 @@ {heartCodesAndNames} {filteredHeartCodeAndNames} {filteredGatewayCodeAndNames} + onLangChange={handleLangChange} /> {:else} {/if} {/if} diff --git a/frontend/src/routes/passages/language/DesktopLanguageDisplay.svelte b/frontend/src/routes/passages/language/DesktopLanguageDisplay.svelte index 275e984b..5b893912 100644 --- a/frontend/src/routes/passages/language/DesktopLanguageDisplay.svelte +++ b/frontend/src/routes/passages/language/DesktopLanguageDisplay.svelte @@ -7,6 +7,7 @@ export let heartCodesAndNames: Array export let filteredGatewayCodeAndNames: Array export let filteredHeartCodeAndNames: Array + export let onLangChange: (e: Event, lang: string) => void @@ -23,6 +24,7 @@ type="radio" bind:group={$langCodeAndNameStore} value={langCodeAndName} + on:change={(e) => onLangChange(e, langCodeAndName.split(',')[0])} class="checkbox-target checkbox-style" /> {getName(langCodeAndName)} @@ -44,6 +46,7 @@ type="radio" bind:group={$langCodeAndNameStore} value={langCodeAndName} + on:change={(e) => onLangChange(e, langCodeAndName.split(',')[0])} class="checkbox-target checkbox-style" /> {getName(langCodeAndName)} diff --git a/frontend/src/routes/passages/language/MobileLanguageDisplay.svelte b/frontend/src/routes/passages/language/MobileLanguageDisplay.svelte index c73284a4..6ba8439d 100644 --- a/frontend/src/routes/passages/language/MobileLanguageDisplay.svelte +++ b/frontend/src/routes/passages/language/MobileLanguageDisplay.svelte @@ -7,6 +7,7 @@ export let heartCodesAndNames: Array export let filteredGatewayCodeAndNames: Array export let filteredHeartCodeAndNames: Array + export let onLangChange: (e: Event, lang: string) => void @@ -24,6 +25,7 @@ type="radio" bind:group={$langCodeAndNameStore} value={langCodeAndName} + on:change={(e) => onLangChange(e, langCodeAndName.split(',')[0])} class="checkbox-target checkbox-style" /> {getName(langCodeAndName)} @@ -47,6 +49,7 @@ type="radio" bind:group={$langCodeAndNameStore} value={langCodeAndName} + on:change={(e) => onLangChange(e, langCodeAndName.split(',')[0])} class="checkbox-target checkbox-style" /> {getName(langCodeAndName)} diff --git a/frontend/src/routes/passages/passages/+page.svelte b/frontend/src/routes/passages/passages/+page.svelte index 1c0b30f1..5a39a2b4 100644 --- a/frontend/src/routes/passages/passages/+page.svelte +++ b/frontend/src/routes/passages/passages/+page.svelte @@ -15,8 +15,8 @@ import { passagesStore } from '$lib/passages/stores/PassagesStore' import CheckIcon from '$lib/CheckIcon.svelte' - // For use by Mobile UI - let showWizardBasketModal = false + let showWizardBasketModal = false // For use by Mobile UI + let bookCodesAndNames: Array<[string, string]> = [] async function getBookCodesAndNames( langCode: string, @@ -34,17 +34,15 @@ return bookCodesAndNames } - let bookCodesAndNames: Array<[string, string]> = [] - - onMount(() => { + onMount(async () => { let langCode = $langCodeAndNameStore.split(',')[0] - console.log(langCode) - console.log(`langCode: ${JSON.stringify(langCode)}`) - getBookCodesAndNames(langCode) - .then((bookCodesAndNames_) => { - bookCodesAndNames = [...bookCodesAndNames_] // Ensure reactivity with [...blah] - }) - .catch((err) => console.error(err)) + try { + bookCodesAndNames = await getBookCodesAndNames(langCode) + } catch (error) { + console.error('Failed to retrieve book codes and names:', error) + } finally { + console.log('Book codes and names retrieved successfully') + } }) function removePassage(id: number) { diff --git a/frontend/src/routes/passages/passages/AddNTComponent.svelte b/frontend/src/routes/passages/passages/AddNTComponent.svelte index 7b597d76..4fb7467a 100644 --- a/frontend/src/routes/passages/passages/AddNTComponent.svelte +++ b/frontend/src/routes/passages/passages/AddNTComponent.svelte @@ -1,4 +1,5 @@ - - - Add NT Survey Reviewers' Guide Passages - - {#if isLoadingNTSurvey} - - {:else if ntSurveySuccessMessage} - - {@html checkIcon} - - {/if} +{#if showNT} + + + Add NT Survey Reviewers' Guide Passages + + {#if isLoadingNTSurvey} + + {:else if ntSurveySuccessMessage} + + {@html checkIcon} + + {/if} + - +{/if}