|
4 | 4 | import { isFound } from '@gitbutler/shared/network/loadable';
|
5 | 5 | import { getRecentlyPushedProjects } from '@gitbutler/shared/organizations/projectsPreview.svelte';
|
6 | 6 | import { WebRoutesService } from '@gitbutler/shared/routing/webRoutes.svelte';
|
| 7 | + import Button from '@gitbutler/ui/Button.svelte'; |
7 | 8 | import { goto } from '$app/navigation';
|
8 | 9 |
|
9 | 10 | const routes = getContext(WebRoutesService);
|
10 | 11 | const recentProjects = getRecentlyPushedProjects();
|
| 12 | + let hasRecentProjects = $state(false); |
11 | 13 |
|
12 | 14 | $effect(() => {
|
13 | 15 | if (recentProjects.current.length >= 1) {
|
14 | 16 | const project = recentProjects.current[0];
|
| 17 | + hasRecentProjects = true; |
15 | 18 | if (isFound(project)) {
|
16 | 19 | goto(
|
17 | 20 | routes.projectReviewUrl({
|
|
24 | 27 | });
|
25 | 28 | </script>
|
26 | 29 |
|
27 |
| -<DashboardLayout> |
28 |
| - <p>You have no recent projects!</p> |
29 |
| -</DashboardLayout> |
| 30 | +{#if hasRecentProjects} |
| 31 | + <DashboardLayout> |
| 32 | + <p>You have no recent projects!</p> |
| 33 | + </DashboardLayout> |
| 34 | +{:else} |
| 35 | + <div class="empty-state-container"> |
| 36 | + <div class="empty-state"> |
| 37 | + <div class="empty-state-icon"> |
| 38 | + <svg |
| 39 | + width="64" |
| 40 | + height="64" |
| 41 | + viewBox="0 0 24 24" |
| 42 | + fill="none" |
| 43 | + xmlns="http://www.w3.org/2000/svg" |
| 44 | + > |
| 45 | + <path |
| 46 | + d="M12 4L3 8L12 12L21 8L12 4Z" |
| 47 | + stroke="currentColor" |
| 48 | + stroke-width="2" |
| 49 | + stroke-linecap="round" |
| 50 | + stroke-linejoin="round" |
| 51 | + /> |
| 52 | + <path |
| 53 | + d="M3 16L12 20L21 16" |
| 54 | + stroke="currentColor" |
| 55 | + stroke-width="2" |
| 56 | + stroke-linecap="round" |
| 57 | + stroke-linejoin="round" |
| 58 | + /> |
| 59 | + <path |
| 60 | + d="M3 12L12 16L21 12" |
| 61 | + stroke="currentColor" |
| 62 | + stroke-width="2" |
| 63 | + stroke-linecap="round" |
| 64 | + stroke-linejoin="round" |
| 65 | + /> |
| 66 | + </svg> |
| 67 | + </div> |
| 68 | + <h1>No Recent Projects</h1> |
| 69 | + <p class="description">Get started by creating your first review in GitButler.</p> |
| 70 | + <div class="actions"> |
| 71 | + <a |
| 72 | + href="https://docs.gitbutler.com/review/overview" |
| 73 | + target="_blank" |
| 74 | + rel="noopener noreferrer" |
| 75 | + > |
| 76 | + <Button style="pop" icon="open-link">Learn How to Create Reviews</Button> |
| 77 | + </a> |
| 78 | + <a |
| 79 | + href="https://docs.gitbutler.com/features/virtual-branches" |
| 80 | + target="_blank" |
| 81 | + rel="noopener noreferrer" |
| 82 | + > |
| 83 | + <Button kind="outline" icon="open-link">Explore Virtual Branches</Button> |
| 84 | + </a> |
| 85 | + </div> |
| 86 | + </div> |
| 87 | + </div> |
| 88 | +{/if} |
| 89 | + |
| 90 | +<style lang="postcss"> |
| 91 | + .empty-state-container { |
| 92 | + display: flex; |
| 93 | + justify-content: center; |
| 94 | + align-items: center; |
| 95 | + margin: auto; |
| 96 | + } |
| 97 | +
|
| 98 | + .empty-state { |
| 99 | + max-width: 600px; |
| 100 | + text-align: center; |
| 101 | + padding: 40px; |
| 102 | + background-color: white; |
| 103 | + border-radius: 12px; |
| 104 | + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); |
| 105 | + } |
| 106 | +
|
| 107 | + .empty-state-icon { |
| 108 | + display: flex; |
| 109 | + justify-content: center; |
| 110 | + margin-bottom: 24px; |
| 111 | + color: #2563eb; |
| 112 | + } |
| 113 | +
|
| 114 | + h1 { |
| 115 | + font-size: 24px; |
| 116 | + font-weight: 600; |
| 117 | + margin: 0 0 12px 0; |
| 118 | + color: #1a202c; |
| 119 | + } |
| 120 | +
|
| 121 | + .description { |
| 122 | + font-size: 16px; |
| 123 | + color: #718096; |
| 124 | + margin: 0 0 32px 0; |
| 125 | + } |
| 126 | +
|
| 127 | + .actions { |
| 128 | + display: flex; |
| 129 | + gap: 16px; |
| 130 | + justify-content: center; |
| 131 | + flex-wrap: wrap; |
| 132 | + } |
| 133 | +
|
| 134 | + @media (max-width: 640px) { |
| 135 | + .empty-state { |
| 136 | + padding: 32px 20px; |
| 137 | + margin: 0 20px; |
| 138 | + } |
| 139 | +
|
| 140 | + .actions { |
| 141 | + flex-direction: column; |
| 142 | + gap: 12px; |
| 143 | + } |
| 144 | + } |
| 145 | +</style> |
0 commit comments