diff --git a/partitions/src/lib/components/PdfViewer.svelte b/partitions/src/lib/components/PdfViewer.svelte index 45141f9..8be0b05 100644 --- a/partitions/src/lib/components/PdfViewer.svelte +++ b/partitions/src/lib/components/PdfViewer.svelte @@ -182,7 +182,7 @@ -
+
{#if loading}
@@ -194,7 +194,7 @@

{error}

{:else} - + {/if}
diff --git a/partitions/src/routes/+layout.svelte b/partitions/src/routes/+layout.svelte index ff983c9..e8bf1e4 100644 --- a/partitions/src/routes/+layout.svelte +++ b/partitions/src/routes/+layout.svelte @@ -4,6 +4,7 @@ import { goto } from '$app/navigation'; import { page } from '$app/stores'; import { onMount } from 'svelte'; + import { get } from 'svelte/store'; const publicRoutes = ['/']; @@ -25,7 +26,11 @@ const path = $page.url.pathname; const isPublic = publicRoutes.includes(path); - if (!isPublic && !isAuthenticated) { + // Get current auth state directly + const authState = get(auth); + const authenticated = !!authState.token; + + if (!isPublic && !authenticated) { goto('/'); } }); diff --git a/partitions/src/routes/admin/+page.svelte b/partitions/src/routes/admin/+page.svelte index 34227cf..0519294 100644 --- a/partitions/src/routes/admin/+page.svelte +++ b/partitions/src/routes/admin/+page.svelte @@ -141,7 +141,7 @@ number: i + 1, name: name.trim() || `Partie ${i + 1}` })); - const result = await apiService.createScore(newName, newCompositor, pieces, newRessource); + const result = await apiService.createScore(newName, newCompositor, pieces); if (result.success) { showForm = false; newName = ''; @@ -222,7 +222,7 @@ Admin - OHMJ -
+

Administration

← Retour aux partitions @@ -319,23 +319,23 @@
-
- +
+
- - - - + + + + {#each scores as score} - - - - + + +
IDNomCompositeurActionsIDNomCompositeurActions
{score.id}{score.name}{score.compositor || '-'} + {score.id}{score.name}{score.compositor || '-'} {:else} -
- - - - - {#if showSidebar} -
-

Parties disponibles

- - {#each parts as part} -
- {#if parts.length > 1} -

Version {part.id}

- {/if} -
    - {#each part.files as file} -
  • - - -
  • - {/each} -
-
- {/each} - - {#if parts.length === 0} -

Aucune partie disponible.

- {/if} +
+ {#if !showSidebar} +
+ + {selectedFile ? pdfFileName : ''}
{/if} - - -
- {#if selectedFile} - {#key selectedFile} - - {/key} - {:else} -
-

Sélectionnez une partition pour la visionner

+ +
+ {#if showSidebar} +
+
+

Parties disponibles

+
+ {#each parts as part} +
+ {#if parts.length > 1} +

Version {part.id}

+ {/if} +
    + {#each part.files as file} +
  • + + +
  • + {/each} +
+
+ {/each} + {#if parts.length === 0} +

Aucune partie disponible.

+ {/if} +
{/if} + +
+ {#if selectedFile} + {#key selectedFile} + + {/key} + {:else} +
+

Sélectionnez une partition pour la visionner

+
+ {/if} +
{/if}