Skip to content
Merged
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
3 changes: 3 additions & 0 deletions frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ PUBLIC_STET_TARGET_LANG_CODES_NAMES_URL = '/stet/target_languages'
PUBLIC_PASSAGES_URL = '/passages/document_docx'
PUBLIC_CHAPTERS_IN_BOOKS_URL = '/chapters_in_books'
PUBLIC_PRODUCTION_DOMAIN = 'bibleineverylanguage.org'

PUBLIC_TURN_OFF_EPUB = true
PUBLIC_TURN_OFF_PDF = true
2 changes: 1 addition & 1 deletion frontend/src/lib/stores/SettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const chunkSizeDefault: string = <string>PUBLIC_CHUNK_SIZE_CHAPTER
export let layoutForPrintStore: Writable<boolean> = writable<boolean>(false)
export let assemblyStrategyKindStore: Writable<string> = writable<string>(groupingOrderDefault)
export let assemblyStrategyChunkSizeStore: Writable<string> = writable<string>(chunkSizeDefault)
export let docTypeStore: Writable<string> = writable<string>('pdf')
export let docTypeStore: Writable<string> = writable<string>('docx')
export let generatePdfStore: Writable<boolean> = writable<boolean>(true)
export let generateEpubStore: Writable<boolean> = writable<boolean>(false)
export let generateDocxStore: Writable<boolean> = writable<boolean>(false)
Expand Down
71 changes: 38 additions & 33 deletions frontend/src/routes/settings/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import type { SelectElement } from './types'
import { PUBLIC_TURN_OFF_EPUB, PUBLIC_TURN_OFF_PDF } from '$env/static/public'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the initialization correctly, PUBLIC_TURN_OFF_EPUB and ...PDF come into to scope from $env/static/public as strings, which would have the values "true" and "false".

Elsewhere, if I understand svelte correctly, they appear to be treated as booleans, which means a value of "false" will still evaluate to true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thank you

import Switch from '$lib/Switch.svelte'
import WizardBreadcrumb from '$lib/WizardBreadcrumb.svelte'
import WizardBasket from '$lib/WizardBasket.svelte'
Expand Down Expand Up @@ -193,39 +194,43 @@
<span class="text-xl text-[#33445C]">Docx</span>
</label>
</div>
<div class="mb-2">
<label>
<input
name="docType"
value={'epub'}
bind:group={$docTypeStore}
type="radio"
on:change={() => {
$settingsUpdatedStore = true
$errorStore = ''
}}
class="h-4 w-4 border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
/>
<span class="text-xl text-[#33445C]">ePub</span>
</label>
</div>
<div class="mb-2">
<label>
<input
name="docType"
value={'pdf'}
bind:group={$docTypeStore}
type="radio"
on:change={() => {
$settingsUpdatedStore = true
$errorStore = ''
}}
class="h-4 w-4 border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
/>
<span class="text-xl text-[#33445C]">PDF</span>
</label>
</div>
{#if $docTypeStore === 'pdf'}
{#if PUBLIC_TURN_OFF_EPUB === 'false'}
<div class="mb-2">
<label>
<input
name="docType"
value={'epub'}
bind:group={$docTypeStore}
type="radio"
on:change={() => {
$settingsUpdatedStore = true
$errorStore = ''
}}
class="h-4 w-4 border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
/>
<span class="text-xl text-[#33445C]">ePub</span>
</label>
</div>
{/if}
{#if PUBLIC_TURN_OFF_PDF === 'false'}
<div class="mb-2">
<label>
<input
name="docType"
value={'pdf'}
bind:group={$docTypeStore}
type="radio"
on:change={() => {
$settingsUpdatedStore = true
$errorStore = ''
}}
class="h-4 w-4 border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
/>
<span class="text-xl text-[#33445C]">PDF</span>
</label>
</div>
{/if}
{#if PUBLIC_TURN_OFF_PDF === 'false' && $docTypeStore === 'pdf'}
<div class="mb-2 mt-6 flex">
<Switch bind:checked={$usePrinceStore} id="use-prince" />
<span class="ml-2 text-xl text-[#33445C]"
Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/e2e/doc_test_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('ui part 2', async ({ page }) => {
.nth(2)
.click()
await page.getByRole('button', { name: 'Next' }).click()
await page.getByRole('radio', { name: 'PDF' }).click()
// await page.getByRole('radio', { name: 'PDF' }).click()
await page.getByText('Interleave content by chapter').click()
await page.getByRole('button', { name: 'Generate File' }).click()
})
Expand Down
4 changes: 2 additions & 2 deletions frontend/tests/e2e/doc_test_2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test.skip('can select gateway tab after first selecting heart language and hitti
await page.getByText('Regular').click({ timeout: 120_000 })
await page.getByText('Unlocked Literal Bible').click()
await page.getByRole('button', { name: 'Next' }).click()
await page.getByRole('radio', { name: 'PDF' }).click()
// await page.getByRole('radio', { name: 'PDF' }).click()
await page.getByLabel('Interleave content by chapter').check()
await page.getByRole('button', { name: 'Generate File' }).click()
})
Expand All @@ -68,7 +68,7 @@ test('optional settings', async ({ page }) => {
await page.getByRole('button', { name: 'Next' }).click()
await page.getByText('Regular').click()
await page.getByRole('button', { name: 'Next' }).click()
await page.getByRole('radio', { name: 'PDF' }).click()
// await page.getByRole('radio', { name: 'PDF' }).click()
await expect(page.getByRole('main')).toContainText('▶ Show Optional Settings')
await page.getByRole('button', { name: '▶ Show Optional Settings' }).click()
await expect(page.getByRole('main')).toContainText(
Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/e2e/doc_test_3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test('use section visual separator setting', async ({ page }) => {
await page.getByRole('button', { name: 'Generate File' }).click()
})

test('ordering of books in document title(s) and body', async ({ page }) => {
test.skip('ordering of books in document title(s) and body', async ({ page }) => {
await page.goto('http://localhost:8001/')
await page.getByPlaceholder('Search Gateway Languages').click()
await page.getByPlaceholder('Search Gateway Languages').fill('tpi')
Expand Down
8 changes: 4 additions & 4 deletions frontend/tests/e2e/doc_test_4.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test'

test('languages are sorted in clicked order', async ({ page }) => {
test.skip('languages are sorted in clicked order', async ({ page }) => {
await page.goto('http://localhost:8001/')
await page.getByText('Français (French)').click()
await page.getByText('Cebuano').click()
Expand Down Expand Up @@ -30,7 +30,7 @@ test('languages are sorted in clicked order', async ({ page }) => {
)
})

test('use prince with lots of books', async ({ page }) => {
test.skip('use prince with lots of books', async ({ page }) => {
await page.goto('http://localhost:8001/')
await page.getByPlaceholder('Search Gateway Languages').click()
await page.getByPlaceholder('Search Gateway Languages').fill('tpi')
Expand Down Expand Up @@ -68,8 +68,8 @@ test('acq', async ({ page }) => {
await page.getByRole('button', { name: 'Next' }).click()
await page.getByText('Regular').click()
await page.getByRole('button', { name: 'Next' }).click()
await page.getByRole('radio', { name: 'PDF' }).click()
await page.getByText('Use PrinceXml to produce the').click()
// await page.getByRole('radio', { name: 'PDF' }).click()
// await page.getByText('Use PrinceXml to produce the').click()
await page.getByRole('button', { name: '▶ Show Optional Settings' }).click()
await expect(page.getByRole('main')).toContainText(
"Use chapter labels, e.g., 'Chapter 1' instead of '1'"
Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/e2e/doc_test_5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('merge of data API data and DOC only data', async ({ page }) => {
await expect(page.locator('body')).toContainText('Translation Notes')
})

test('space between end of chunk and beginning of another', async ({ page }) => {
test.skip('space between end of chunk and beginning of another', async ({ page }) => {
await page.goto('http://localhost:8001/')
await page.getByRole('button', { name: 'Heart' }).click()
await page.getByPlaceholder('Search Heart Languages').click()
Expand Down
6 changes: 3 additions & 3 deletions frontend/tests/e2e/doc_test_7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test('visibility of optional settings based on resources chosen', async ({ page
await page.getByLabel('French Louis Segond 1910').uncheck()
await page.getByLabel('Translation Words tw').uncheck()
await page.getByRole('button', { name: 'Next' }).click()
await page.getByRole('radio', { name: 'PDF' }).click()
// await page.getByRole('radio', { name: 'PDF' }).click()
await page.getByRole('button', { name: '▶ Show Optional Settings' }).click()
await expect(page.getByRole('main')).toContainText(
"Use chapter labels, e.g., 'Chapter 1' instead of '1'"
Expand Down Expand Up @@ -59,7 +59,7 @@ test('burmese', async ({ page }) => {
await expect(page.locator('body')).toContainText('Unlocked Literal Bible')
await page.getByLabel('Select all').check()
await page.getByRole('button', { name: 'Next' }).click()
await page.getByRole('radio', { name: 'PDF' }).click()
await page.getByText('Use PrinceXml to produce the').click()
// await page.getByRole('radio', { name: 'PDF' }).click()
// await page.getByText('Use PrinceXml to produce the').click()
await page.getByRole('button', { name: 'Generate File' }).click()
})
Loading