-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from Codehagen/88-feature-add-timeline-for-user
Timeline MVP
- Loading branch information
Showing
27 changed files
with
551 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { getTenantDetails } from "@/actions/get-tenant-details" | ||
import { getServerSession } from "next-auth/next" | ||
|
||
import { authOptions } from "@/lib/auth" | ||
import { prisma } from "@/lib/db" | ||
import { DashboardHeader } from "@/components/dashboard/header" | ||
import { DashboardShell } from "@/components/dashboard/shell" | ||
import CustomerTimeline from "@/components/tenant/CustomerTimeline" | ||
|
||
export default async function TimelinePage({ | ||
params, | ||
}: { | ||
params: { id: string } | ||
}) { | ||
const tenantId = params.id | ||
|
||
if (!tenantId) { | ||
return ( | ||
<DashboardShell> | ||
<DashboardHeader heading="Tenant not found" text="Invalid tenant ID." /> | ||
</DashboardShell> | ||
) | ||
} | ||
|
||
const session = await getServerSession(authOptions) | ||
|
||
const user = await prisma.user.findUnique({ | ||
where: { id: session?.user.id }, | ||
select: { workspaceId: true }, | ||
}) | ||
|
||
try { | ||
const tenantDetails = await getTenantDetails(tenantId) | ||
|
||
if (!tenantDetails) { | ||
return ( | ||
<DashboardShell> | ||
<DashboardHeader | ||
heading="Tenant not found" | ||
text="Unable to retrieve tenant details." | ||
/> | ||
</DashboardShell> | ||
) | ||
} | ||
|
||
return ( | ||
<DashboardShell> | ||
<DashboardHeader | ||
heading={`${tenantDetails.name} Tidslinje`} | ||
text="Se kundeinteraksjoner og viktige hendelser." | ||
/> | ||
<CustomerTimeline /> | ||
</DashboardShell> | ||
) | ||
} catch (error) { | ||
console.error("Error in TimelinePage:", error) | ||
return ( | ||
<DashboardShell> | ||
<DashboardHeader heading="Error" text={error.message} /> | ||
</DashboardShell> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.