|
1 | | -<script context="module" lang="ts"> |
2 | | - export function load({ session }) { |
3 | | - return { |
4 | | - props: { |
5 | | - user: session.user |
6 | | - } |
7 | | - }; |
8 | | - } |
9 | | -</script> |
10 | | - |
11 | 1 | <script lang="ts"> |
12 | 2 | import { onMount } from 'svelte'; |
13 | 3 | import UserIcon from '$lib/icons/user.svelte'; |
14 | 4 | import Repository from '../../components/repository.svelte'; |
15 | | - import { RegistryBackend, type Catalog, type DetailedRepository } from '../../apis/registry'; |
| 5 | + import { RegistryBackend, type Catalog } from '../../apis/registry'; |
16 | 6 | import type { User } from 'src/apis/auth'; |
17 | 7 | import StarIcon from '$lib/icons/star.svelte'; |
18 | 8 | import UserGroupIcon from '$lib/icons/userGroup.svelte'; |
| 9 | + import { goto } from '$app/navigation'; |
| 10 | + import { session } from '$app/stores'; |
19 | 11 | export let user: User; |
20 | 12 |
|
21 | 13 | let isRepo = true; |
22 | 14 | let isStarred = false; |
23 | 15 | let isContrib = false; |
24 | 16 |
|
| 17 | + onMount(async () => { |
| 18 | + // @ts-ignore |
| 19 | + if (!$session.authenticated) { |
| 20 | + await goto('/auth/unauthorized'); |
| 21 | + } |
| 22 | +
|
| 23 | + // @ts-ignore |
| 24 | + user = $session.user; |
| 25 | + await fetchPageData(); |
| 26 | + }); |
| 27 | +
|
25 | 28 | const toggleRepo = () => { |
26 | 29 | isContrib = false; |
27 | 30 | isStarred = false; |
|
58 | 61 |
|
59 | 62 | catalog = data; |
60 | 63 | }; |
61 | | - let showTooltip = false; |
62 | | - onMount(async () => { |
63 | | - fetchPageData(); |
64 | | - }); |
65 | 64 | </script> |
66 | 65 |
|
67 | 66 | <svelte:head> |
|
135 | 134 |
|
136 | 135 | {#if isRepo} |
137 | 136 | <div> |
138 | | - <div class="w-full px-16 p-8"> |
| 137 | + <div class="w-full px-16 py-8"> |
139 | 138 | {#if catalog?.repositories} |
140 | 139 | {#each catalog.repositories as repo} |
141 | 140 | <Repository compact={false} data={repo} /> |
|
150 | 149 | {/if} |
151 | 150 |
|
152 | 151 | {#if isStarred} |
153 | | - <div class="w-full px-8"> |
| 152 | + <div class="w-full px-16 py-8"> |
154 | 153 | <div |
155 | 154 | class="bg-gray-50 w-full rounded-md px-28 py-20 flex flex-col justify-center items-center" |
156 | 155 | > |
|
164 | 163 | {/if} |
165 | 164 |
|
166 | 165 | {#if isContrib} |
167 | | - <div class="w-full px-8"> |
| 166 | + <div class="w-full px-16 py-8"> |
168 | 167 | <div |
169 | 168 | class="bg-gray-50 w-full rounded-md px-28 py-20 flex flex-col justify-center items-center" |
170 | 169 | > |
|
0 commit comments