Skip to content

Commit

Permalink
fix landing build
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed Dec 18, 2024
1 parent ddd0cc5 commit a520461
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions landing/src/routes/docs/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
<script lang="ts">
import { onMount } from 'svelte'
import DocViewer from './DocViewer.svelte'
// List of available documentation files
Expand All @@ -10,15 +11,17 @@
]
// Set default selected document based on hash or default to the first doc
let url = window.location.hash ? getDocUrl(window.location.hash) : docs[0].url
// Watch for hash changes
window.addEventListener('hashchange', () => {
url = getDocUrl(window.location.hash)
let url: string
onMount(() => {
url = window.location.hash ? getDocUrl(window.location.hash) : docs[0].url
// Watch for hash changes
window.addEventListener('hashchange', () => {
url = getDocUrl(window.location.hash)
})
})
// Helper function to get the corresponding URL for a hash
function getDocUrl(hash) {
function getDocUrl(hash: string) {
const docName = hash.replace('#', '') // Remove '#' from the hash
const doc = docs.find((d) => d.name.toLowerCase() === docName.toLowerCase())
return doc ? doc.url : docs[0].url // Default to the first doc if not found
Expand Down

0 comments on commit a520461

Please sign in to comment.