Skip to content

Commit 4e1b087

Browse files
authored
Convert stores and page loads to TS (#960)
* Remove deprecated scripts * Rename icon exports to TS * Convert view.js to TS * Convert audio store * Convert remaining stores * Other small fixes * Convert page loads * CR feedback
1 parent 42c744a commit 4e1b087

57 files changed

Lines changed: 506 additions & 790 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/lib/components/AudioBar.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ TODO:
2020
audioPlayer,
2121
convertStyle,
2222
modal,
23-
MODAL_PLAYBACK_SPEED,
23+
ModalType,
2424
playMode,
2525
refs,
2626
s,
@@ -153,7 +153,7 @@ TODO:
153153
{#if showSpeed}
154154
<button
155155
class="audio-speed audio-control-buttons"
156-
onclick={() => modal.open(MODAL_PLAYBACK_SPEED)}
156+
onclick={() => modal.open(ModalType.PlaybackSpeed)}
157157
>
158158
<AudioIcon.Speed color={iconColor} />
159159
</button>

src/lib/components/PlayButton.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
let { color = 'black', state, onclick }: Props = $props();
2323
24-
const size = config.mainFeatures['audio-play-button-size'] === 'normal' ? 24 : 48;
24+
const size = String(config.mainFeatures['audio-play-button-size'] === 'normal' ? 24 : 48);
2525
const style = config.mainFeatures['audio-play-button-style'] as keyof typeof icons;
2626
const icon_style = icons[style];
2727
const Icon = $derived(icon_style[state]);

src/lib/components/ScriptureViewSofria.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LOGGING:
3131
language,
3232
logs,
3333
modal,
34-
MODAL_NOTE,
34+
ModalType,
3535
plan,
3636
refs,
3737
t,
@@ -729,7 +729,7 @@ LOGGING:
729729
return '<svg fill="#000000" style="display:inline" xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 96 96"><path d="M 21.07 74.80 L 8.76 87.35 Q 8.00 88.12 8.00 87.03 Q 8.00 52.12 8.00 18.00 Q 8.00 7.73 18.00 7.80 Q 48.00 8.00 78.00 8.00 Q 88.27 8.00 88.18 18.00 Q 88.00 40.13 88.09 62.25 Q 88.13 72.31 78.00 72.22 C 72.03 72.17 25.23 70.89 23.56 72.37 Q 22.78 73.07 21.07 74.80 Z M 72.00 21.60 A 0.60 0.60 0.0 0 0 71.40 21.00 L 24.60 21.00 A 0.60 0.60 0.0 0 0 24.00 21.60 L 24.00 28.40 A 0.60 0.60 0.0 0 0 24.60 29.00 L 71.40 29.00 A 0.60 0.60 0.0 0 0 72.00 28.40 L 72.00 21.60 Z M 72.00 35.60 A 0.60 0.60 0.0 0 0 71.40 35.00 L 24.60 35.00 A 0.60 0.60 0.0 0 0 24.00 35.60 L 24.00 42.40 A 0.60 0.60 0.0 0 0 24.60 43.00 L 71.40 43.00 A 0.60 0.60 0.0 0 0 72.00 42.40 L 72.00 35.60 Z M 60.00 49.60 A 0.60 0.60 0.0 0 0 59.40 49.00 L 24.60 49.00 A 0.60 0.60 0.0 0 0 24.00 49.60 L 24.00 56.40 A 0.60 0.60 0.0 0 0 24.60 57.00 L 59.40 57.00 A 0.60 0.60 0.0 0 0 60.00 56.40 L 60.00 49.60 Z"</path></svg>';
730730
};
731731
function editNote(note) {
732-
modal.open(MODAL_NOTE, note);
732+
modal.open(ModalType.Note, note);
733733
}
734734
function addNotedVerses(notesInChapter) {
735735
notesInChapter.then((notes) => {

src/lib/components/Sidebar.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ The sidebar/drawer.
1616
language,
1717
languageDefault,
1818
modal,
19-
MODAL_COLLECTION,
20-
MODAL_TEXT_APPEARANCE,
19+
ModalType,
2120
refs,
2221
s,
2322
showDesktopSidebar,
@@ -172,7 +171,10 @@ The sidebar/drawer.
172171
{#if showLayouts}
173172
<li>
174173
<!-- svelte-ignore a11y_missing_attribute -->
175-
<button style:color={textColor} onclick={() => modal.open(MODAL_COLLECTION)}>
174+
<button
175+
style:color={textColor}
176+
onclick={() => modal.open(ModalType.Collection)}
177+
>
176178
<BibleIcon color={iconColor} />{$t['Menu_Layout']}
177179
</button>
178180
</li>
@@ -238,7 +240,7 @@ The sidebar/drawer.
238240
<li>
239241
<button
240242
style:color={textColor}
241-
onclick={() => modal.open(MODAL_TEXT_APPEARANCE)}
243+
onclick={() => modal.open(ModalType.TextAppearance)}
242244
>
243245
<TextAppearanceIcon color={iconColor} />{$t['Menu_Text_Appearance']}
244246
</button>

src/lib/components/TextAppearanceSelector.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The navbar component. We have sliders that update reactively to both font size a
4545
language,
4646
languages,
4747
modal,
48-
MODAL_FONT,
48+
ModalType,
4949
monoIconColor,
5050
theme,
5151
themeColors,
@@ -185,7 +185,7 @@ The navbar component. We have sliders that update reactively to both font size a
185185
style:font-family={$currentFont}
186186
style:font-size="large"
187187
style:color={$monoIconColor}
188-
on:click={() => modal.open(MODAL_FONT)}
188+
on:click={() => modal.open(ModalType.Font)}
189189
>{config.fonts.find((x) => x.family === $currentFont)?.name}</button
190190
>
191191
</div>

src/lib/data/analytics.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { scriptureConfig } from '$assets/config';
2-
import { analytics } from '$lib/data/stores';
3-
import type { AudioPlayer } from './audio';
2+
import { analytics, type AudioPlayer } from '$lib/data/stores';
43
import type { HistoryItem } from './history';
54

65
export function getBook(item: { collection?: string; book: string }) {

0 commit comments

Comments
 (0)