|
1 | 1 | <script lang="ts"> |
2 | | - import { goto } from '$app/navigation'; |
3 | 2 | import RedirectToProfileIfLoggedIn from '$lib/auth/RedirectToProfileIfLoggedIn.svelte'; |
4 | | - import DashboardLayout from '$lib/components/dashboard/DashboardLayout.svelte'; |
5 | 3 | import { USER_SERVICE } from '$lib/user/userService'; |
6 | 4 | import { inject } from '@gitbutler/core/context'; |
7 | | - import { isFound } from '@gitbutler/shared/network/loadable'; |
8 | | - import { getRecentlyPushedProjects } from '@gitbutler/shared/organizations/projectsPreview.svelte'; |
9 | | - import { WEB_ROUTES_SERVICE } from '@gitbutler/shared/routing/webRoutes.svelte'; |
10 | 5 |
|
11 | | - const routes = inject(WEB_ROUTES_SERVICE); |
12 | 6 | const userService = inject(USER_SERVICE); |
13 | 7 | const user = userService.user; |
14 | 8 |
|
15 | 9 | const loggedIn = $derived($user !== undefined); |
16 | | - const recentProjects = getRecentlyPushedProjects(); |
17 | | - let hasRecentProjects = $state(false); |
18 | | -
|
19 | | - $effect(() => { |
20 | | - if (recentProjects.current.length >= 1) { |
21 | | - const project = recentProjects.current[0]; |
22 | | - hasRecentProjects = true; |
23 | | - if (isFound(project)) { |
24 | | - goto( |
25 | | - routes.projectReviewUrl({ |
26 | | - ownerSlug: project.value.owner, |
27 | | - projectSlug: project.value.slug |
28 | | - }) |
29 | | - ); |
30 | | - } |
31 | | - } |
32 | | - }); |
33 | 10 | </script> |
34 | 11 |
|
35 | 12 | {#if !loggedIn} |
36 | 13 | <p>Loading...</p> |
37 | | -{:else if hasRecentProjects} |
38 | | - <DashboardLayout> |
39 | | - <p>You have no recent projects!</p> |
40 | | - </DashboardLayout> |
41 | 14 | {:else} |
42 | 15 | <!-- For now, just redirect the user back to the --> |
43 | 16 | <RedirectToProfileIfLoggedIn /> |
|
0 commit comments