Skip to content

Commit 85e8976

Browse files
committed
empty state for when there are no recent projects
1 parent 68f0ad4 commit 85e8976

File tree

1 file changed

+119
-3
lines changed

1 file changed

+119
-3
lines changed

Diff for: apps/web/src/routes/(app)/+page.svelte

+119-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
import { isFound } from '@gitbutler/shared/network/loadable';
55
import { getRecentlyPushedProjects } from '@gitbutler/shared/organizations/projectsPreview.svelte';
66
import { WebRoutesService } from '@gitbutler/shared/routing/webRoutes.svelte';
7+
import Button from '@gitbutler/ui/Button.svelte';
78
import { goto } from '$app/navigation';
89
910
const routes = getContext(WebRoutesService);
1011
const recentProjects = getRecentlyPushedProjects();
12+
let hasRecentProjects = $state(false);
1113
1214
$effect(() => {
1315
if (recentProjects.current.length >= 1) {
1416
const project = recentProjects.current[0];
17+
hasRecentProjects = true;
1518
if (isFound(project)) {
1619
goto(
1720
routes.projectReviewUrl({
@@ -24,6 +27,119 @@
2427
});
2528
</script>
2629

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

Comments
 (0)