Skip to content

Commit

Permalink
Merge branch 'develop' into feat/daily-plan-unplan
Browse files Browse the repository at this point in the history
  • Loading branch information
GloireMutaliko21 committed May 9, 2024
2 parents 642ebb0 + 10f40de commit 19fdb80
Show file tree
Hide file tree
Showing 35 changed files with 130 additions and 7,774 deletions.
1 change: 0 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@
"Chatwoot",
"CHATWOOT",
"apps/web/messages/*.json",
"apps/web/public/locales/**",
"apps/web/lib/i18n/*.ts",
"apps/web/lib/settings/timezones.js",
"apps/mobile/app/screens/DemoShowroomScreen/demos/**",
Expand Down
6 changes: 2 additions & 4 deletions apps/web/app/hooks/useLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import { currentLanguageState } from '@app/stores';
import { useRouter } from 'next/navigation';
import { useCallback, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useRecoilState } from 'recoil';

export function useLanguage() {
const { i18n } = useTranslation();
const router = useRouter();
const [currentLanguage, setCurrentLanguage] = useRecoilState(currentLanguageState);

Expand All @@ -30,7 +28,7 @@ export function useLanguage() {
}
// router.refresh();
},
[router, i18n]
[router]
);
return { currentLanguage, changeLanguage, i18n };
return { currentLanguage, changeLanguage,};
}
83 changes: 66 additions & 17 deletions apps/web/lib/components/image-overlapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import Link from 'next/link';
import Skeleton from 'react-loading-skeleton';
import { Tooltip } from './tooltip';
import { ScrollArea } from '@components/ui/scroll-bar';
import { CircleIcon } from 'assets/svg';
import { useModal } from '@app/hooks';
import { Modal, Divider } from 'lib/components';
import { useOrganizationTeams } from '@app/hooks';
import { useTranslations } from 'next-intl';

import TeamMember from 'lib/components/team-member';

export interface ImageOverlapperProps {
id: string;
url: string;
Expand All @@ -13,22 +21,63 @@ export interface ImageOverlapperProps {
export default function ImageOverlapper({
images,
radius = 20,
displayImageCount = 4
displayImageCount = 4,
item = null,
diameter = 40
}: {
images: ImageOverlapperProps[];
radius?: number;
displayImageCount?: number;
item?: any;
diameter?: number;
}) {
// Split the array into two arrays based on the display number
const firstArray = images.slice(0, displayImageCount);
const widthCalculate = images.slice(0, 5);
const secondArray = images.slice(displayImageCount);
const isMoreThanDisplay = images.length > displayImageCount;
const imageLength = images.length;
const { isOpen, openModal, closeModal } = useModal();
const { activeTeam } = useOrganizationTeams();
const allMembers = activeTeam?.members || [];

const t = useTranslations();

const hasMembers = item?.members.length > 0;

if (imageLength == undefined) {
return <Skeleton height={40} width={40} borderRadius={100} className="rounded-full dark:bg-[#353741]" />;
}
if (!hasMembers && item) {
return (
<div>
<CircleIcon className="w-6 h-6 cursor-pointer stroke-[#d3d3d3]" onClick={openModal} style={{ width: diameter, height: diameter }} />
<div>
<Modal
isOpen={isOpen}
closeModal={closeModal}
title={t('common.SELECT_TEAM_MEMBER')}
className="bg-light--theme-light dark:bg-dark--theme-light p-5 rounded-xl w-full md:w-[20vw] h-[70vh] justify-start"
titleClass="font-normal"
>
<Divider className="mt-4" />
<ul className="py-6 max-h-56 overflow-auto">
{allMembers?.map((member: any) => {
return (
<li
key={member.employee}
className="w-100 border border-transparent hover:border-blue-500 hover:border-opacity-50 rounded-lg cursor-pointer"
>
<TeamMember member={member} item={item} />
</li>
);
})}
</ul>
</Modal>
</div>
</div>
);
}
return (
<div
style={{
Expand Down Expand Up @@ -74,26 +123,26 @@ export default function ImageOverlapper({
</div>
</PopoverTrigger>
<PopoverContent className="!p-0 bg-white dark:bg-dark--theme input-border">
<ScrollArea className="h-40 ">
<ScrollArea className="h-40 ">
<div className="flex flex-col space-y-2 m-2">
{secondArray.map((image: ImageOverlapperProps, index: number) => {
return (
<Link
href={`/profile/${image.id}?name=${image.alt}`}
className="relative hover:bg-gray-300 hover:dark:bg-[#24262c] p-1 rounded-md"
key={index}
>
<div className="flex items-center">
<Image
src={image.url}
alt={`${image.alt} avatar`}
width={80}
height={80}
className="!h-10 !w-10 rounded-full border-2 border-white"
/>
<p className="ml-2">{image.alt}</p>
</div>
</Link>
href={`/profile/${image.id}?name=${image.alt}`}
className="relative hover:bg-gray-300 hover:dark:bg-[#24262c] p-1 rounded-md"
key={index}
>
<div className="flex items-center">
<Image
src={image.url}
alt={`${image.alt} avatar`}
width={80}
height={80}
className="!h-10 !w-10 rounded-full border-2 border-white"
/>
<p className="ml-2">{image.alt}</p>
</div>
</Link>
);
})}
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/components/kanban-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export default function Item(props: ItemProps) {
</div>
)}
</div>
<ImageComponent radius={30} images={taskAssignee} />
<ImageComponent radius={30} images={taskAssignee} item={item} />
{item.issueType && (
<div className="flex flex-row items-center justify-center rounded-full w-5 h-5 z-[1] bg-[#e5e7eb] dark:bg-[#181920] absolute top-0 right-0">
<div
Expand Down
22 changes: 22 additions & 0 deletions apps/web/lib/components/team-member.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { UserInfo } from 'lib/features/team/user-team-card/user-info';
import { useTeamMemberCard } from '@app/hooks';
import { useModal } from '@app/hooks';

export default function TeamMember({ member, item }: { member: any; item: any }) {
const memberInfo = useTeamMemberCard(member);
const { assignTask } = useTeamMemberCard(member);
const { closeModal } = useModal();

return (
<div
onClick={() => {
assignTask(item);
closeModal();
}}

className="w-100 cursor-pointer"
>
<UserInfo memberInfo={memberInfo} className="2xl:w-[20.625rem] w-100 pointer-events-none" />
</div>
);
}
12 changes: 10 additions & 2 deletions apps/web/lib/features/task/task-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
Text,
VerticalSeparator
} from 'lib/components';
import ImageComponent, { ImageOverlapperProps } from 'lib/components/image-overlapper';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useCallback, useState } from 'react';
Expand Down Expand Up @@ -122,6 +123,13 @@ export function TaskCard(props: Props) {

const memberInfo = useTeamMemberCard(currentMember || undefined);
const taskEdition = useTMCardTaskEdit(task);
const taskAssignee: ImageOverlapperProps[] = task?.members.map((member: any) => {
return {
id: member.user.id,
url: member.user.imageUrl,
alt: member.user.firstName
};
}) || [];

return (
<>
Expand Down Expand Up @@ -158,8 +166,8 @@ export function TaskCard(props: Props) {
)}

{viewType === 'unassign' && (
<div className="w-[20%] flex justify-center">
<UsersTaskAssigned task={task} />
<div className="w-[20%] flex justify-around">
<UsersTaskAssigned task={task} /><ImageComponent radius={30} images={taskAssignee} item={task} />
</div>
)}
<VerticalSeparator />
Expand Down
16 changes: 16 additions & 0 deletions apps/web/lib/features/task/task-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IClassName, ITaskStatus, ITeamTask } from '@app/interfaces';
import { clsxm, isValidUrl } from '@app/utils';
import clsx from 'clsx';
import { Avatar, ConfirmDropdown, SpinnerLoader, Tooltip } from 'lib/components';
import ImageComponent, { ImageOverlapperProps } from 'lib/components/image-overlapper';
import { CrossIcon, RefreshIcon } from 'assets/svg';
import Link from 'next/link';
import { useCallback } from 'react';
Expand Down Expand Up @@ -120,6 +121,20 @@ export function TaskItem({ task, selected, onClick, className }: Props) {
export function TaskAvatars({ task, limit = 2 }: { task: ITeamTask; limit?: number }) {
const members = task.members;

const taskAssignee: ImageOverlapperProps[] = members.map((member: any) => {
return {
id: member.user.id,
url: member.user.imageUrl,
alt: member.user.firstName
};
});



if(!members.length) {
return <div className="avatars flex -space-x-2 min-w-[59px] justify-center"><ImageComponent radius={30} diameter={30} images={taskAssignee} item={task} /></div>
}

return (
<div className="avatars flex -space-x-2 min-w-[59px] justify-center" onClick={(e) => e.stopPropagation()}>
{members.slice(0, limit).map((member, i) => {
Expand All @@ -128,6 +143,7 @@ export function TaskAvatars({ task, limit = 2 }: { task: ITeamTask; limit?: numb
const userImageUrl = user?.image?.thumbUrl || user?.image?.fullUrl || user?.imageUrl || '';
const size = 30;


return (
<Link key={i} title={userName} href={`/profile/${member.userId}?name=${userName}`}>
<div
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "لا يوجد مستخدمين يعملون حاليا",
"NO_USERS_PAUSED_WORK": "لم يتم إيقاف أي مستخدم مؤقتًا عن العمل في الوقت الحالي",
"NO_USERS_IDLE": "لا يوجد مستخدمين خاملين في الوقت الحالي",
"SELECT_TEAM_MEMBER": "اختيار عضو الفريق",
"ALL_MEMBERS": "جميع الأعضاء",
"NOT_WORKING": "غير عامل",
"WORKING": "يعمل",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING":"В момента няма активни потребители",
"NO_USERS_PAUSED_WORK":"В момента няма потребители, които да са спрели работата си",
"NO_USERS_IDLE":"В момента няма неактивни потребители",
"SELECT_TEAM_MEMBER": "изберете член на екипа",
"ALL_MEMBERS": "Всички членове",
"NOT_WORKING": "Не работи",
"WORKING": "Работи",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "Derzeit gibt es keine aktiven Benutzer",
"NO_USERS_PAUSED_WORK": "Derzeit gibt es keine Benutzer, die ihre Arbeit eingestellt haben",
"NO_USERS_IDLE": "Derzeit gibt es keine inaktiven Benutzer.",
"SELECT_TEAM_MEMBER": "Teammitglied auswählen",
"ALL_MEMBERS": "Alle Mitglieder",
"NOT_WORKING": "Nicht arbeiten",
"WORKING": "Arbeiten",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "There are currently no active users",
"NO_USERS_PAUSED_WORK": "There are currently no users who have paused their work",
"NO_USERS_IDLE": "There are currently no inactive users",
"SELECT_TEAM_MEMBER": "Select team member",
"ALL_MEMBERS": "All Members",
"NOT_WORKING": "Not Working",
"WORKING": "Working",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "Actualmente no hay usuarios activos",
"NO_USERS_PAUSED_WORK": "Actualmente no hay usuarios que hayan dejado de trabajar",
"NO_USERS_IDLE": "Actualmente no hay usuarios inactivos",
"SELECT_TEAM_MEMBER": "seleccionar miembro del equipo",
"ALL_MEMBERS": "Todos los miembros",
"NOT_WORKING": "No trabajando",
"WORKING": "Trabajando",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "Il n'y a actuellement aucun utilisateur actif",
"NO_USERS_PAUSED_WORK": "Il n'y a actuellement aucun utilisateur qui a mis en pause son travail",
"NO_USERS_IDLE": "Il n'y a actuellement aucun utilisateur inactif",
"SELECT_TEAM_MEMBER": "Sélectionner un membre",
"ALL_MEMBERS": "Tous les membres",
"NOT_WORKING": "Non actif",
"WORKING": "Actif",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "כרגע אין משתמשים פעילים",
"NO_USERS_PAUSED_WORK": "כרגע אין משתמשים שהפסיקו את עבודתם",
"NO_USERS_IDLE": "כרגע אין משתמשים לא פעילים",
"SELECT_TEAM_MEMBER": "בחר חבר צוות",
"ALL_MEMBERS": "כל החברים",
"NOT_WORKING": "לא עובד",
"WORKING": "עובד",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "Al momento non ci sono utenti attivi",
"NO_USERS_PAUSED_WORK": "Al momento non ci sono utenti che hanno interrotto il proprio lavoro",
"NO_USERS_IDLE": "Al momento non ci sono utenti inattivi",
"SELECT_TEAM_MEMBER": "Seleziona il membro della squadra",
"ALL_MEMBERS": "Tutti i membri",
"NOT_WORKING": "Non Lavora",
"WORKING": "Lavora",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "Er zijn momenteel geen actieve gebruikers",
"NO_USERS_PAUSED_WORK": "Er zijn momenteel geen gebruikers die hun werk hebben stopgezet",
"NO_USERS_IDLE": "Er zijn momenteel geen inactieve gebruikers",
"SELECT_TEAM_MEMBER": "Selecteer teamlid",
"ALL_MEMBERS": "Alle leden",
"NOT_WORKING": "Niet aan het werk",
"WORKING": "Aan het werk",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "Obecnie nie ma aktywnych użytkowników",
"NO_USERS_PAUSED_WORK": "Obecnie nie ma użytkowników, którzy przerwali pracę",
"NO_USERS_IDLE": "Obecnie nie ma nieaktywnych użytkowników",
"SELECT_TEAM_MEMBER": "Wybierz członka zespołu",
"ALL_MEMBERS": "Wszyscy członkowie",
"NOT_WORKING": "Niepracujący",
"WORKING": "Pracujący",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_IDLE": "Atualmente não há usuários inativos",
"NOT_FOUND": "Não encontrado",
"PAGE_NOT_FOUND": "Página não encontrada",
"SELECT_TEAM_MEMBER": "Selecione o membro da equipe",
"ALL_MEMBERS": "Todos os Membros",
"NOT_WORKING": "Não Trabalhando",
"WORKING": "Trabalhando",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "На данный момент нет активных пользователей",
"NO_USERS_PAUSED_WORK": "На данный момент нет пользователей, прекративших свою работу",
"NO_USERS_IDLE": "На данный момент неактивных пользователей нет",
"SELECT_TEAM_MEMBER": "Выберите члена команды",
"ALL_MEMBERS": "Все участники",
"NOT_WORKING": "Не работает",
"WORKING": "Работает",
Expand Down
1 change: 1 addition & 0 deletions apps/web/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"NO_USERS_WORKING": "目前没有活跃用户",
"NO_USERS_PAUSED_WORK": "目前还没有用户停止工作",
"NO_USERS_IDLE": "目前没有不活跃用户",
"SELECT_TEAM_MEMBER": "选择团队成员",
"ALL_MEMBERS": "所有成员",
"NOT_WORKING": "不工作",
"WORKING": "工作",
Expand Down
21 changes: 0 additions & 21 deletions apps/web/ni18n.config.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"react-dom": "^18.2.0",
"react-google-recaptcha": "^2.1.0",
"react-hook-form": "^7.42.1",
"react-i18next": "^13.3.1",
"react-icons": "^5.2.0",
"react-loading-skeleton": "^3.1.1",
"react-paginate": "^8.2.0",
Expand Down
Loading

0 comments on commit 19fdb80

Please sign in to comment.