-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
189 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script> | ||
import Modal from '$ui/flowbite-svelte/modal/Modal.svelte'; | ||
import Spinner from '$svgs/Spinner.svelte'; | ||
import { staticEndpoint, errorLoadingDataMessage } from '$data/websiteSettings'; | ||
import { __lexiconModalVisible, __wordRoot } from '$utils/stores'; | ||
let lexiconData; | ||
$: { | ||
lexiconData = (async () => { | ||
// getting indexes file | ||
const indexesResponse = await fetch(`${staticEndpoint}/v4/lexicon/indexes.json`); | ||
const indexesData = await indexesResponse.json(); | ||
if (indexesData[$__wordRoot] === undefined) return 'No data for this word.'; | ||
const lexiconFile = indexesData[$__wordRoot].file; | ||
const lexiconIndex = indexesData[$__wordRoot].index; | ||
// getting lexicon data for the root | ||
const lexiconResponse = await fetch(`${staticEndpoint}/v4/lexicon/${lexiconFile}.json`); | ||
const lexiconData = await lexiconResponse.json(); | ||
return lexiconData[lexiconIndex]; | ||
})(); | ||
} | ||
</script> | ||
|
||
<Modal title={$__wordRoot} id="lexiconModal" bind:open={$__lexiconModalVisible} class="!rounded-b-none md:!rounded-3xl theme" bodyClass="p-6 space-y-4 flex-1 overflow-y-auto overscroll-contain" headerClass="flex justify-between items-center p-6 rounded-t-3xl text-black theme-grayscale" classFooter="rounded-b-3xl flex flex-row justify-between" size="lg" position="bottom" center outsideclose> | ||
{#await lexiconData} | ||
<Spinner /> | ||
{:then lexiconData} | ||
<div class="text-sm text-black flex flex-col space-y-6"> | ||
<div class="flex flex-col space-y-4"> | ||
{@html lexiconData} | ||
</div> | ||
</div> | ||
{:catch error} | ||
<p>{errorLoadingDataMessage}</p> | ||
{/await} | ||
</Modal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.