Skip to content

Commit

Permalink
chore(3973): add events page file
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhanchik committed Dec 30, 2024
1 parent 66577e5 commit 5cf01ee
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
nodejs 22.12.0
python 3.13.1
pnpm 9.15.1
oc 4.13.3
kubectl 1.32.0
terraform 1.5.7
helm 3.16.4
shfmt 3.10.0
act 0.2.70
jq 1.7.1
mongodb-database-tools 0.8.2
17 changes: 17 additions & 0 deletions app/app/events/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use client';

import { useSnapshot } from 'valtio/react';
import { GlobalPermissions } from '@/constants';
import createClientPage from '@/core/client-page';
import { pageState } from './state';

const eventsPage = createClientPage({
permissions: [GlobalPermissions.ViewEvents],
fallbackUrl: '/login?callbackUrl=/home',
});

export default eventsPage(() => {
const snap = useSnapshot({ pageState });

return <div></div>;
});
24 changes: 24 additions & 0 deletions app/app/events/state.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Prisma } from '@prisma/client';

export const eventSorts = [
{
label: 'Create date (new to old)',
sortKey: 'createdAt',
sortOrder: Prisma.SortOrder.desc,
},
{
label: 'Create date (old to new)',
sortKey: 'createdAt',
sortOrder: Prisma.SortOrder.asc,
},
];

const initialValue = {
page: 1,
pageSize: 10,
sortValue: eventSorts[0].label,
sortKey: eventSorts[0].sortKey,
sortOrder: eventSorts[0].sortOrder,
};

export const pageState = initialValue;
2 changes: 2 additions & 0 deletions app/constants/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export enum GlobalPermissions {

DownloadBillingMou = 'downloadBillingMou',

ViewEvents = 'viewEvents',
ViewUsers = 'viewUsers',
EditUsers = 'editUsers',
}
Expand All @@ -58,6 +59,7 @@ export enum GlobalRole {
Approver = 'approver',
BillingReviewer = 'billing-reviewer',
Billingreader = 'billing-reader',
EventReader = 'event-reader',
}

export const RoleToSessionProp = {
Expand Down
1 change: 1 addition & 0 deletions app/core/auth-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export async function generateSession({

downloadBillingMou: session.isBillingReviewer || session.isBillingReader,
viewUsers: session.isAdmin || session.isUserReader,
viewEvents: session.isAdmin || session.isEventReader,
editUsers: session.isAdmin,
};

Expand Down
2 changes: 2 additions & 0 deletions app/types/next-auth.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ declare module 'next-auth' {

downloadBillingMou: boolean;

viewEvents: boolean;
viewUsers: boolean;
editUsers: boolean;
}
Expand Down Expand Up @@ -75,6 +76,7 @@ declare module 'next-auth' {
isPublicEditor: boolean;
isPublicReader: boolean;
isPublicReviewer: boolean;
isEventReader: boolean;
isUserReader: boolean;
isApprover: boolean;
isBillingReviewer: boolean;
Expand Down

0 comments on commit 5cf01ee

Please sign in to comment.