Skip to content

Commit 12a5ccd

Browse files
authored
UI fixes (#478)
* fix: improve timeline input , ui improvement and fixes for participation tab * fix: implement 2fa for email and password login * fix: fix conflict * fix: fix submission form * fix: fix hackathon submission and participant page * fix: fix hackathon submission and participant page * fix: fix auto refresh ib submission page * fix: hackathon submission fixes * fix: fix coderabbit corrections * fix: fix coderabbit corrections * chore: write boundless on x challenge blog * fix: remove blog * fix: my project dashbaord count and extend hackathon deadline * fix: my project dashbaord count and extend hackathon deadline
1 parent 2f7335f commit 12a5ccd

3 files changed

Lines changed: 31 additions & 14 deletions

File tree

app/me/layout.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ interface MeLayoutProfile {
2323
image?: string;
2424
joinedHackathons?: ProfileItemWithId[];
2525
hackathonSubmissionsAsParticipant?: ProfileItemWithId[];
26+
projects?: ProfileItemWithId[];
2627
};
2728
image?: string;
2829
hackathonSubmissionsAsParticipant?: ProfileItemWithId[];
30+
projects?: ProfileItemWithId[];
31+
stats?: {
32+
projectsCreated?: number;
33+
};
2934
}
3035

3136
const getId = (item: ProfileItemWithId): string | undefined =>
@@ -69,6 +74,25 @@ const MeLayout = ({ children }: MeLayoutProps): React.ReactElement => {
6974
}).length;
7075
}, [typedProfile]);
7176

77+
const projectsCount = useMemo(() => {
78+
if (!typedProfile) return 0;
79+
// stats.projectsCreated is often the most direct count
80+
if (typeof typedProfile.stats?.projectsCreated === 'number') {
81+
return typedProfile.stats.projectsCreated;
82+
}
83+
// Fallback to array lengths
84+
const fromUser = typedProfile.user?.projects ?? [];
85+
const fromProfile = typedProfile.projects ?? [];
86+
const merged = [...fromUser, ...fromProfile];
87+
const seen = new Set<string>();
88+
return merged.filter(p => {
89+
const id = getId(p);
90+
if (!id || seen.has(id)) return false;
91+
seen.add(id);
92+
return true;
93+
}).length;
94+
}, [typedProfile]);
95+
7296
// Only show full-screen spinner on first load, not on background refetches
7397
if (isLoading && !hasLoadedOnce.current) {
7498
return (
@@ -92,6 +116,7 @@ const MeLayout = ({ children }: MeLayoutProps): React.ReactElement => {
92116
counts={{
93117
participating: hackathonsCount,
94118
submissions: submissionsCount,
119+
projects: projectsCount,
95120
}}
96121
variant='inset'
97122
/>

components/app-sidebar.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ import {
2929
import Image from 'next/image';
3030
import Link from 'next/link';
3131
import { useNotificationStore } from '@/lib/stores/notification-store';
32+
import { Logo } from './landing-page/navbar';
3233

3334
const getNavigationData = (counts?: {
3435
participating?: number;
3536
unreadNotifications?: number;
3637
submissions?: number;
38+
projects?: number;
3739
}) => ({
3840
main: [
3941
{
@@ -57,7 +59,7 @@ const getNavigationData = (counts?: {
5759
title: 'My Projects',
5860
url: '/me/projects',
5961
icon: IconFolder,
60-
badge: '3',
62+
badge: (counts?.projects ?? 0) > 0 ? String(counts?.projects) : undefined,
6163
},
6264
{
6365
title: 'Create Project',
@@ -132,7 +134,7 @@ export function AppSidebar({
132134
...props
133135
}: {
134136
user: UserData;
135-
counts?: { participating?: number; submissions?: number };
137+
counts?: { participating?: number; submissions?: number; projects?: number };
136138
} & React.ComponentProps<typeof Sidebar>) {
137139
const unreadNotifications = useNotificationStore(state => state.unreadCount);
138140

@@ -164,17 +166,7 @@ export function AppSidebar({
164166
size='lg'
165167
className='group hover:bg-sidebar-accent/0 transition-all duration-200'
166168
>
167-
<Link href='/dashboard' className='flex items-center gap-3'>
168-
<div className='flex items-center justify-center rounded-lg'>
169-
<Image
170-
width={24}
171-
height={24}
172-
className='h-auto w-4/5 object-contain'
173-
src='/logo.svg'
174-
alt='Boundless Logo'
175-
/>
176-
</div>
177-
</Link>
169+
<Logo />
178170
</SidebarMenuButton>
179171
</SidebarMenuItem>
180172
</SidebarMenu>

components/landing-page/navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export function Navbar() {
124124
);
125125
}
126126

127-
function Logo() {
127+
export function Logo() {
128128
return (
129129
<Link
130130
href='/'

0 commit comments

Comments
 (0)