Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
3ac11aa
style: update (dark) sidebar css variables
lorenzocorallo Jun 4, 2026
aaed723
feat: sidebar boilerplate and breadcrumb header
lorenzocorallo Jun 4, 2026
da6760c
some refactor
lorenzocorallo Jun 4, 2026
1d485af
feat: use collapsible
lorenzocorallo Jun 4, 2026
ef68226
fix: add tg/grants and remove boilerplate
lorenzocorallo Jun 5, 2026
c8ad53a
feat: storage hooks and cookies utility
lorenzocorallo Jun 5, 2026
24828cd
feat: user nav, category open state persistence
lorenzocorallo Jun 5, 2026
1a5d70d
fix: cookie expiration, use <Link> instead of <a>
lorenzocorallo Jun 5, 2026
fba8bd3
chore: remove zustand, remove old i18n, biome fixes
lorenzocorallo Jun 5, 2026
73acf8f
feat: sidebar item icons, type cleanup
lorenzocorallo Jun 5, 2026
6099b46
feat: remove category pages, adjust page padding
lorenzocorallo Jun 5, 2026
ec3c62e
chore: biome
lorenzocorallo Jun 5, 2026
454e9db
style: adjust destructive color variable
lorenzocorallo Jun 5, 2026
fc32ad7
style: container mx-auto by default
lorenzocorallo Jun 5, 2026
51e171e
fix: remove category pages, dont create link for category in breadcrumb
lorenzocorallo Jun 5, 2026
6362566
fix: re-render issue with the use-cookie-storage hook
lorenzocorallo Jun 5, 2026
075f156
fix: same as previous commit, but for use-session-storage
lorenzocorallo Jun 5, 2026
21c64c5
fix: coderabbit suggestion
lorenzocorallo Jun 5, 2026
e9fd9e7
fix: match also subroutes in category items
lorenzocorallo Jun 5, 2026
60d3617
fix: catch JSON parse error
lorenzocorallo Jun 5, 2026
2510a36
fix: rename column in groups
lorenzocorallo Jun 5, 2026
f6e4fa3
style: move breadcrumb to center
lorenzocorallo Jun 5, 2026
fd76b34
fix: cleanup home
lorenzocorallo Jun 5, 2026
d7388b5
style: button icon svg size
lorenzocorallo Jun 5, 2026
ba20b0b
Merge branch 'main' into sidebar
lorenzocorallo Jun 6, 2026
57d3a23
style: fix padding mismatch between pages and loadings
lorenzocorallo Jun 6, 2026
5003e80
feat: loading skeleton for account page
lorenzocorallo Jun 6, 2026
0b1596c
perf: make dashboard homepage static for now
lorenzocorallo Jun 6, 2026
c266bae
feat: add associations management with card component and delete dialog
BIA3IA Jun 9, 2026
c78ecdb
feat: add No association found message for empty state
BIA3IA Jun 9, 2026
dff8b4d
Connect getAllAssociations and move client logic from page
BIA3IA Jun 9, 2026
c3eb226
Refactor AssociationsList integration
BIA3IA Jun 9, 2026
009bc1a
feat: update association card to display initials when logo is not pr…
BIA3IA Jun 9, 2026
a24b0af
refactor: integrate AssociationsList functionality directly into Asso…
BIA3IA Jun 9, 2026
2e6279e
feat: implement create, edit, and delete association functionalities
BIA3IA Jun 9, 2026
cdcf54a
fix: improve getInitials function to remove "-"
BIA3IA Jun 9, 2026
37b7e07
feat: error handling for delete, save, edit
BIA3IA Jun 9, 2026
ff68966
feat: add loading state to save and cancel actions
BIA3IA Jun 9, 2026
aee00a8
feat: update button variants for success and error states in UI compo…
BIA3IA Jun 9, 2026
5b24e28
feat: implement association links management with dialog and save fun…
BIA3IA Jun 10, 2026
585f6f6
fix: review
lorenzocorallo Jun 10, 2026
4797e44
fix: bring back user details page, link from user list
lorenzocorallo Jun 10, 2026
61bfddb
feat: add back user search, make container flex(col) with pb-6
lorenzocorallo Jun 10, 2026
ce7da3c
fix: missing notFound in user-details, loading style
lorenzocorallo Jun 10, 2026
8f351d4
fix: not found page
lorenzocorallo Jun 10, 2026
df0ae86
fix: add a11y to user details button
lorenzocorallo Jun 10, 2026
73f8223
feat: update icon for Web section in navigation
BIA3IA Jun 10, 2026
1df7f77
Merge commit 'df0ae868e2d0e0381ec4e74cff75d0df42367827' into web/asso…
BIA3IA Jun 10, 2026
fc4fbf8
fix: validate user ID and update last messages limit
BIA3IA Jun 11, 2026
ecefa99
Merge commit '1df7f77252231489983eb493e1eb7f6f4c5d5652' into sidebar
BIA3IA Jun 11, 2026
c4b9b7d
Revert "Merge commit '1df7f77252231489983eb493e1eb7f6f4c5d5652' into …
BIA3IA Jun 11, 2026
6e1be95
Merge commit '4336f8a364b30dfca54284f482565e6486e84737' into sidebar
BIA3IA Jun 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/app/dashboard/(active)/account/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Skeleton } from "@/components/ui/skeleton"
import { NewPasskeyButton } from "./passkey-button"

export default function Loading() {
return (
<main className="container">
<h2 className="text-accent-foreground mb-4 text-3xl font-bold">Account</h2>
<div className="flex gap-4 mb-12">
<Skeleton className="h-32 w-32 rounded-full" />

<div className="flex flex-col gap-2">
<div className="flex items-center gap-2">
<span className="text-accent-foreground/70">Name:</span>
<Skeleton className="w-40 h-5" />
</div>

<div className="flex items-center gap-2">
<span className="text-accent-foreground/70">Email:</span>
<Skeleton className="w-70 h-5" />
</div>
<div className="flex items-center gap-2">
<span className="text-accent-foreground/70">Telegram:</span>
<Skeleton className="w-60 h-5" />
</div>
</div>
</div>
<div className="flex flex-col gap-4 justify-start items-start">
<h3>Passkeys</h3>
<Skeleton className="w-full h-10" />
<NewPasskeyButton />
Comment thread
BIA3IA marked this conversation as resolved.
</div>
</main>
)
}
2 changes: 1 addition & 1 deletion src/app/dashboard/(active)/account/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async function Account() {
const { user } = session

return (
<main className="container mx-auto px-4 py-8">
<main className="container">
<h2 className="text-accent-foreground mb-4 text-3xl font-bold">Account</h2>
<div className="flex gap-4 mb-12">
<ProfilePic user={user} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/dashboard/(active)/azure/members/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SkeletonAssocTable } from "./table"

export default function Loading() {
return (
<div className="container p-8">
<div className="container">
<SkeletonAssocTable />
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion src/app/dashboard/(active)/azure/members/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default async function AssocMembers() {
const members = await getAzureMembers()

return (
<div className="container p-8">
<div className="container">
<ErrorBoundary fallback={<div>Something went wrong</div>}>
<Suspense fallback={<Spinner />}>
<AssocTable members={members} />
Expand Down
4 changes: 2 additions & 2 deletions src/app/dashboard/(active)/azure/members/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function AssocTable({ members }: { members: AzureMember[] }) {
const users = sociFilter ? members.filter((v) => v.isMember) : members

return (
<div className="space-y-3">
<div className="space-y-3 w-full">
<div className="flex gap-2 items-center">
<p>Utenti MS @polinetwork.org</p>
<Badge
Expand All @@ -60,7 +60,7 @@ export function AssocTable({ members }: { members: AzureMember[] }) {

export function SkeletonAssocTable() {
return (
<div className="space-y-3">
<div className="space-y-3 w-full">
<div className="flex gap-2 items-center">
<p>Utenti MS @polinetwork.org</p>
<Badge className="animate-pulse w-15" />
Expand Down
29 changes: 0 additions & 29 deletions src/app/dashboard/(active)/azure/page.tsx

This file was deleted.

74 changes: 74 additions & 0 deletions src/app/dashboard/(active)/breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"use client"
import { usePathname } from "next/navigation"
import { Fragment, useMemo } from "react"
import { NAV_MAP } from "@/components/dashboard-sidebar/data"
import {
BreadcrumbItem as BreadcrumbItemComponent,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
Breadcrumb as BreadcrumbRoot,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"

export type BreadcrumbItem = {
title: string
url?: string
}

export function Breadcrumb({ className, ...props }: React.ComponentProps<"nav">) {
const pathname = usePathname()
const items = useMemo(() => getBreadcrumbs(NAV_MAP, pathname), [pathname])

return (
<BreadcrumbRoot className={className} {...props}>
<BreadcrumbList>
{items.map((item, i) => (
<Fragment key={`breadcrumb-item-${i}`}>
<BreadcrumbItemComponent className="hidden md:block">
{i === items.length - 1 ? (
<BreadcrumbPage>{item.title}</BreadcrumbPage>
) : item.url ? (
<BreadcrumbLink href={item.url}>{item.title}</BreadcrumbLink>
) : (
item.title
)}
</BreadcrumbItemComponent>
{i < items.length - 1 && <BreadcrumbSeparator className="hidden md:block" />}
</Fragment>
))}
</BreadcrumbList>
</BreadcrumbRoot>
)
}

function getBreadcrumbs(navMap: Map<string, string>, pathname: string): BreadcrumbItem[] {
const segments = pathname.split("/").filter(Boolean)
const breadcrumbs: BreadcrumbItem[] = []

let currentPath = ""
let i = 0

for (const segment of segments) {
currentPath += `/${segment}`
let title = navMap.get(currentPath)
if (!title) {
if (isUUIDorId(segment)) {
title = "Details"
} else {
title = segment.charAt(0).toUpperCase() + segment.slice(1)
}
}

// note: at the moment we do not plan to make category pages.
// If such pages are made in the future, this logic can be removed
breadcrumbs.push({ title, url: i !== 1 ? currentPath : undefined })
i++
}

return breadcrumbs
}

function isUUIDorId(segment: string) {
return !Number.isNaN(Number(segment)) || segment.length > 20 // Regex custom a seconda dei tuoi ID
}
10 changes: 7 additions & 3 deletions src/app/dashboard/(active)/complete-profile.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
"use client"

import type { User } from "better-auth"
import { UserRoundPenIcon } from "lucide-react"
import Link from "next/link"
import { Button } from "@/components/ui/button"
import { useSession } from "@/lib/auth"

export function CompleteProfile() {
const { data, isPending } = useSession()

if (!data || isPending) return null

export function CompleteProfile({ user }: { user: User }) {
return (
!user.name && (
!data.user.name && (
<div className="flex items-center p-2 pl-4 mb-4 gap-2 rounded-lg border text-accent-foreground bg-yellow-400/10 border-yellow-400">
<UserRoundPenIcon size={16} />
<p className="grow">Your profile is incomplete, please enter the missing information.</p>
Expand Down
50 changes: 50 additions & 0 deletions src/app/dashboard/(active)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { cookies } from "next/headers"
import { DashboardSidebar } from "@/components/dashboard-sidebar"
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar"
import { COOKIES } from "@/constants"
import { Breadcrumb } from "./breadcrumb"

function parseCookie(cookie: string) {
try {
const parsed = JSON.parse(cookie)
return parsed
} catch (_e) {
return {}
}
}

export default async function AdminLayout({ children }: { children: React.ReactNode }) {
const sidebarCookies = await getSidebarCookies()

return (
<SidebarProvider
defaultOpen={sidebarCookies.open}
style={
{
"--sidebar-width": "19rem",
} as React.CSSProperties
}
>
<DashboardSidebar categoryState={sidebarCookies.state} />
<SidebarInset className="px-4">
<header className="flex h-16 shrink-0 relative items-center justify-between gap-2 border-b mb-8">
<SidebarTrigger className="-ml-1" size="icon" />
<Breadcrumb className="absolute left-1/2 -translate-x-1/2" />
Comment thread
lorenzocorallo marked this conversation as resolved.
<div></div>
</header>
{children}
</SidebarInset>
</SidebarProvider>
)
}

async function getSidebarCookies() {
const cookieStore = await cookies()

const sidebarCategoryStateCookie = cookieStore.get(COOKIES.SIDEBAR_CATEGORY_STATE)?.value
const sidebarOpenCookie = cookieStore.get(COOKIES.SIDEBAR_OPEN)?.value
const state: Record<string, boolean> = sidebarCategoryStateCookie ? parseCookie(sidebarCategoryStateCookie) : {}
const open: boolean = sidebarOpenCookie !== undefined ? parseCookie(sidebarOpenCookie) : true
Comment thread
BIA3IA marked this conversation as resolved.

return { state, open }
}
19 changes: 19 additions & 0 deletions src/app/dashboard/(active)/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Link from "next/link"
import { Button } from "@/components/ui/button"

export default function NotFound() {
return (
<div className="flex flex-1 flex-col items-center justify-center gap-8 px-4">
<div className="flex flex-col items-center gap-2 text-center">
<h1 className="font-heading text-[12rem] leading-none font-bold tracking-tight text-primary">404</h1>
<h2 className="font-heading text-2xl font-semibold text-foreground">Not found</h2>
<p className="max-w-sm text-muted-foreground">
The resource you&apos;re looking for doesn&apos;t exist or has been moved.
</p>
</div>
<Link href=".">
<Button>Go Back</Button>
</Link>
</div>
)
}
51 changes: 11 additions & 40 deletions src/app/dashboard/(active)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,16 @@
import Image from "next/image"
import Link from "next/link"
import azureSvg from "@/assets/svg/azure.svg"
import telegramSvg from "@/assets/svg/telegram.svg"
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { getServerSession } from "@/server/auth"
import { InfoIcon } from "lucide-react"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
import { CompleteProfile } from "./complete-profile"

export default async function AdminHome() {
const { data: session } = await getServerSession()
export default function AdminHome() {
return (
session && (
<div className="container py-8 px-2">
<CompleteProfile user={session.user} />
<h2 className="text-accent-foreground mb-4 text-3xl font-bold">Home</h2>

<div className="gap-4 flex justify-start flex-wrap items-center">
<Link href="/dashboard/azure">
<Card className="w-90 hover:bg-accent transition-colors">
<CardHeader>
<CardTitle className="flex gap-2">
<Image alt="azure logo" src={azureSvg} className="size-5" />
Azure
</CardTitle>
<CardDescription>Manage Azure related things</CardDescription>
</CardHeader>
</Card>
</Link>

<Link href="/dashboard/telegram">
<Card className="w-90 hover:bg-accent transition-colors">
<CardHeader>
<CardTitle className="flex gap-2">
<Image alt="telegram logo" src={telegramSvg} className="size-5" />
Telegram
</CardTitle>
<CardDescription>Manage Telegram related things</CardDescription>
</CardHeader>
</Card>
</Link>
</div>
</div>
)
<div className="container">
<CompleteProfile />
<Alert variant="info">
<InfoIcon />
<AlertTitle>Page under construction</AlertTitle>
<AlertDescription>Use the sidebar to access the sections</AlertDescription>
</Alert>
</div>
)
}
10 changes: 8 additions & 2 deletions src/app/dashboard/(active)/telegram/grants/delete-grant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ import {
import { Button } from "@/components/ui/button"
import { interruptGrant } from "@/server/actions/grants"

export function DeleteGrant({ userId, onDelete }: { userId: number; onDelete(): void }) {
export function DeleteGrant({
userId,
// onDelete
}: {
userId: number
// onDelete(): void
}) {
const router = useRouter()
const [open, setOpen] = useState(false)

Expand All @@ -33,7 +39,7 @@ export function DeleteGrant({ userId, onDelete }: { userId: number; onDelete():
else {
toast.success("Grant interrupted successfully")
router.refresh()
onDelete()
// onDelete()
}
} catch (err) {
toast.error("There was an error")
Expand Down
4 changes: 2 additions & 2 deletions src/app/dashboard/(active)/telegram/grants/grant-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function GrantList({ grants, isScheduled }: { grants: Grants; isScheduled
<GrantRow row={r} key={r.grant.id} />
))}
{grants.length === 0 && (
<div className="w-full text-center py-2 italic">
<div className="w-full text-center py-4 italic">
There are no {isScheduled ? "scheduled" : "ongoing"} grants
</div>
)}
Expand All @@ -36,7 +36,7 @@ function GrantRow({ row: r }: { row: Grants[number] }) {
</p>
<p>{format(r.grant.validSince, "yyyy/MM/dd HH:mm")}</p>
<p>{format(r.grant.validUntil, "yyyy/MM/dd HH:mm")}</p>
<DeleteGrant userId={r.grant.userId} onDelete={() => null} />
<DeleteGrant userId={r.grant.userId} />
</div>
)
}
Loading
Loading