Skip to content

Commit 07e116e

Browse files
github-actions[bot]MarfuenDhanus3133
authored
[comp] Production Deploy (#1412)
* refactor: enhance EmployeeCompletionChart with profile links - Added external profile links for employees in the EmployeeCompletionChart, allowing users to view detailed profiles. - Integrated organization ID retrieval using useParams for dynamic linking. - Improved layout of employee details for better visual presentation. * fix: Enforce role-based access control in app * fix: Prisma seed command in `packages/db` * fix: Move role checks on org level * fix: Allow access to auditor role * chore: Just restrict access to employee role --------- Co-authored-by: Mariano Fuentes <marfuen98@gmail.com> Co-authored-by: Dhanus <dhanus3133@gmail.com>
1 parent 7b8a575 commit 07e116e

6 files changed

Lines changed: 23 additions & 304 deletions

File tree

apps/app/src/app/(app)/[orgId]/layout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export default async function Layout({
6363
return redirect('/auth/unauthorized');
6464
}
6565

66+
if (member.role === 'employee') {
67+
return redirect('/no-access');
68+
}
69+
6670
// If this org is not accessible on current plan, redirect to upgrade
6771
if (!organization.hasAccess) {
6872
return redirect(`/upgrade/${organization.id}`);

apps/app/src/app/(app)/[orgId]/people/dashboard/components/EmployeeCompletionChart.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import { Card, CardContent, CardHeader, CardTitle } from '@comp/ui/card';
44
import { Input } from '@comp/ui/input';
5-
import { Search } from 'lucide-react';
5+
import { ExternalLink, Search } from 'lucide-react';
6+
import Link from 'next/link';
7+
import { useParams } from 'next/navigation';
68
import type { CSSProperties } from 'react';
79
import * as React from 'react';
810

@@ -47,6 +49,8 @@ export function EmployeeCompletionChart({
4749
trainingVideos,
4850
showAll = false,
4951
}: EmployeeCompletionChartProps) {
52+
const params = useParams();
53+
const orgId = params.orgId as string;
5054
const [searchTerm, setSearchTerm] = React.useState('');
5155
const [displayedItems, setDisplayedItems] = React.useState(showAll ? 20 : 5);
5256
const [isLoading, setIsLoading] = React.useState(false);
@@ -209,8 +213,19 @@ export function EmployeeCompletionChart({
209213
{sortedStats.map((stat) => (
210214
<div key={stat.id} className="space-y-2">
211215
<div className="flex items-center justify-between text-sm">
212-
<div>
213-
<p className="font-medium">{stat.name}</p>
216+
<div className="flex-1">
217+
<div className="flex items-center gap-2">
218+
<p className="font-medium">{stat.name}</p>
219+
<Link
220+
href={`/${orgId}/people/${stat.id}`}
221+
target="_blank"
222+
rel="noopener noreferrer"
223+
className="text-primary hover:text-primary/80 flex items-center gap-1 text-xs font-medium underline-offset-4 hover:underline"
224+
>
225+
View Profile
226+
<ExternalLink className="h-3 w-3" />
227+
</Link>
228+
</div>
214229
<p className="text-muted-foreground text-xs">{stat.email}</p>
215230
</div>
216231
<span className="text-muted-foreground">

apps/app/src/app/page.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ export default async function RootPage({
7272
},
7373
});
7474

75-
if (member?.role === 'employee') {
76-
return redirect(await buildUrlWithParams('/no-access'));
77-
}
78-
7975
if (!member) {
8076
return redirect(await buildUrlWithParams('/setup'));
8177
}

packages/db/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"db:generate": "prisma generate",
3535
"db:migrate": "prisma migrate dev",
3636
"db:push": "prisma db push",
37-
"db:seed": "prisma db seed",
37+
"db:seed": "bun prisma/seed/seed.ts",
3838
"db:studio": "prisma studio",
3939
"docker:clean": "docker compose down -v",
4040
"docker:down": "docker compose down",

packages/db/prisma/seed/frameworkEditorSchemas.js

Lines changed: 0 additions & 136 deletions
This file was deleted.

packages/db/prisma/seed/seed.js

Lines changed: 0 additions & 160 deletions
This file was deleted.

0 commit comments

Comments
 (0)