Skip to content

Commit

Permalink
Merge branch 'develop' into fx-rating-trainee
Browse files Browse the repository at this point in the history
  • Loading branch information
igorihimbazwe authored Sep 27, 2024
2 parents a703b3a + cdb4053 commit 87bf078
Show file tree
Hide file tree
Showing 111 changed files with 2,859 additions and 1,275 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"no-shadow": 0,
"no-unused-expressions": 0,
"react/require-default-props": 0,
"import/prefer-default-export": 0
"import/prefer-default-export": 0,
"react/no-unstable-nested-components": 0
}
}
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions beta_.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,11 @@ server {
listen 80;
server_name localhost;

set $WS_BACKEND_URL ws://localhost:4000;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
location /ws {
proxy_pass $WS_BACKEND_URL;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
Expand Down
12 changes: 8 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
rel="stylesheet"
/> -->

<link href="https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&display=swap" rel="stylesheet">

<link
href="https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&display=swap"
rel="stylesheet"
/>
</head>
<body class="dark:bg-dark-frame-bg">
<div id="tree"></div>
Expand Down Expand Up @@ -90,8 +92,10 @@
href="https://fonts.googleapis.com/css2?family=Inria+Serif:ital@1&family=Lexend+Deca:wght@600&family=Open+Sans:wght@300;400;600;700;800&display=swap"
rel="stylesheet"
/> -->
<link href="https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&display=swap" rel="stylesheet">

<link
href="https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="tree"></div>
Expand Down
4 changes: 2 additions & 2 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,6 @@
"Provide Quantity range between 1-2": "Fournir une gamme de quantité comprise entre 1-2",
"Provide Professional_Skills range between 1-2": "Fournir une gamme de compétences professionnelles comprise entre 1-2",
"Sprint Ratings": "Sprint Notations",
"Please wait to be added to a program or cohort":"Veuillez attendre d'être ajouté à un programme ou à une cohorte",
"Enter all the required information":"Entrez toutes les informations requises"
"Please wait to be added to a program or cohort": "Veuillez attendre d'être ajouté à un programme ou à une cohorte",
"Enter all the required information": "Entrez toutes les informations requises"
}
20 changes: 10 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ function App() {
return (
<div className="min-h-screen">
<TicketsProvider>
<TraineesProvider>
<Router>
<ScrollToTop>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/*" element={<MainRoutes />} />
</Routes>
</ScrollToTop>
</Router>
</TraineesProvider>
<TraineesProvider>
<Router>
<ScrollToTop>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/*" element={<MainRoutes />} />
</Routes>
</ScrollToTop>
</Router>
</TraineesProvider>
</TicketsProvider>
</div>
);
Expand Down
32 changes: 32 additions & 0 deletions src/Mutations/ActionDropdownCell.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import ActionDropdown from '../components/ActionDropdown';

interface ActionDropdownCellProps {
row: {
original: any;
};
onView: (ticket: any) => void;
onEdit?: (id: string) => void;
onDelete?: (id: string) => void;
canEditDelete: boolean;
}

function ActionDropdownCell({
row,
onView,
onEdit,
onDelete,
canEditDelete,
}: ActionDropdownCellProps) {
return (
<ActionDropdown
onView={() => onView(row.original)}
onEdit={canEditDelete ? () => onEdit?.(row.original.id) : undefined}
onDelete={canEditDelete ? () => onDelete?.(row.original.id) : undefined}
canEditDelete={canEditDelete}
id={row.original.id}
/>
);
}

export default ActionDropdownCell;
2 changes: 1 addition & 1 deletion src/Mutations/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ export const DROP_TTL_USER = gql`
dropTTLUser(email: $email, reason: $reason)
}
`;
export default GET_PROFILE;
export default GET_PROFILE;
4 changes: 2 additions & 2 deletions src/Mutations/help.mutation.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { gql } from '@apollo/client';

const CREATE_TICKET = gql`
mutation CreateTicket($subject: String!, $message: String!) {
createTicket(subject: $subject, message: $message) {
mutation CreateTicket($subject: String!, $message: String!, $assignee: ID!) {
createTicket(subject: $subject, message: $message, assignee: $assignee) {
responseMsg
}
}
Expand Down
41 changes: 37 additions & 4 deletions src/Mutations/invitationMutation.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { gql } from '@apollo/client';

export const SEND_INVITATION = gql`
mutation SendInvitation($invitees: [InviteeInput!]!, $orgToken: String!) {
sendInvitation(invitees: $invitees, orgToken: $orgToken) {
mutation SendInvitation($invitees: [InviteeInput!]!,$orgName:String!,$orgToken: String!) {
sendInvitation(invitees: $invitees,orgName:$orgName, orgToken: $orgToken) {
status
invitees {
email
role
}
orgName
orgToken
createdAt
}
}
`;

export const UPLOAD_INVITATION_FILE = gql`
mutation uploadInvitationFile($file: Upload!, $orgToken: String!) {
uploadInvitationFile(file: $file, orgToken: $orgToken) {
mutation uploadInvitationFile($file: Upload!,$orgName:String!, $orgToken: String!) {
uploadInvitationFile(file: $file,orgName:$orgName,orgToken: $orgToken) {
filename
data {
email
Expand All @@ -36,3 +37,35 @@ export const DELETE_INVITATION = gql`
}
}
`;

export const UPDATE_INVITATION = gql`
mutation UpdateInvitation(
$invitationId: ID!
$orgToken: String!
$newEmail: String
$newRole: String
) {
updateInvitation(
invitationId: $invitationId
orgToken: $orgToken
newEmail: $newEmail
newRole: $newRole
) {
id
invitees {
email
role
}
inviterId
orgToken
}
}
`;
export const CANCEL_INVITATION = gql`
mutation CancelInvitation($id: ID!, $orgToken: String!) {
cancelInvitation(id: $id, orgToken: $orgToken) {
status
createdAt
}
}
`;
4 changes: 3 additions & 1 deletion src/Mutations/invitationStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ export const GET_INVITATIONS_STATISTICS_QUERY = gql`
) {
totalInvitations
pendingInvitationsCount
cancelledInvitationsCount
getPendingInvitationsPercentsCount
getAcceptedInvitationsPercentsCount
getCancelledInvitationsPercentsCount
acceptedInvitationsCount
}
}
`;
`;
137 changes: 137 additions & 0 deletions src/components/ActionDropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import React, { useState, useEffect, useRef } from 'react';
import {
FaEllipsisV,
FaEye,
FaEdit,
FaTrashAlt,
FaClipboard,
} from 'react-icons/fa';
import { toast } from 'react-toastify';

interface ActionDropdownProps {
onView: () => void;
onEdit?: () => void;
onDelete?: () => void;
canEditDelete: boolean;
id?: string;
}

function ActionDropdown({
onView,
onEdit,
onDelete,
canEditDelete,
id,
}: ActionDropdownProps) {
const [isOpen, setIsOpen] = useState(false);
const dropdownRef = useRef<HTMLDivElement>(null);

const toggleDropdown = () => setIsOpen(!isOpen);

useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
if (
dropdownRef.current &&
!dropdownRef.current.contains(event.target as Node)
) {
setIsOpen(false);
}
};

if (isOpen) {
document.addEventListener('mousedown', handleClickOutside);
} else {
document.removeEventListener('mousedown', handleClickOutside);
}

return () => {
document.removeEventListener('mousedown', handleClickOutside);
};
}, [isOpen]);

const copyToClipboard = (text: any) => {
navigator.clipboard
.writeText(text)
.then(() => {
toast.success('ID copied to clipboard!');
})
.catch((err) => {
toast.error(`Failed to copy: ${err}`);
});
};

return (
<div className="relative" ref={dropdownRef}>
{/* Hide ellipsis icon if the dropdown is open */}
{!isOpen && (
<button
type="button"
aria-label="Open actions menu"
className="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"
onClick={toggleDropdown}
>
<FaEllipsisV className="text-lg" />
</button>
)}

{isOpen && (
<div className="absolute right-0 z-10 w-48 mt-2 bg-white border border-gray-200 rounded-md shadow-lg">
<button
type="button"
aria-label="View item"
onClick={() => {
onView();
setIsOpen(false);
}}
className="flex items-center w-full px-4 py-2 text-sm text-blue-600 hover:bg-blue-100 dark:text-blue-400 dark:hover:bg-blue-700"
>
<FaEye className="mr-2" />
View
</button>
{canEditDelete && (
<>
<button
type="button"
aria-label="Edit item"
onClick={() => {
onEdit?.();
setIsOpen(false);
}}
className="flex items-center w-full px-4 py-2 text-sm text-yellow-600 hover:bg-yellow-100 dark:text-yellow-400 dark:hover:bg-yellow-700"
>
<FaEdit className="mr-2" />
Edit
</button>
<button
type="button"
aria-label="Delete item"
onClick={() => {
onDelete?.();
setIsOpen(false);
}}
className="flex items-center w-full px-4 py-2 text-sm text-red-600 hover:bg-red-100 dark:text-red-400 dark:hover:bg-red-700"
>
<FaTrashAlt className="mr-2" />
Delete
</button>
</>
)}
<button
type="button"
aria-label="Copy ID"
onClick={() => {
copyToClipboard(id);
setIsOpen(false);
}}
className="flex items-center w-full px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700"
>
<FaClipboard className="mr-2" />
Copy ID
</button>
</div>
)}
</div>
);
}

export default ActionDropdown;
5 changes: 1 addition & 4 deletions src/components/AttendanceStatistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ function BarChart() {

return (
<div className="bg-white dark:bg-dark-bg shadow-lg px-5 py-8 rounded-md w-full font-serif">
<div className="">
hello

</div>
<div className="">hello</div>
</div>
);
}
Expand Down
Loading

0 comments on commit 87bf078

Please sign in to comment.