Skip to content

Commit

Permalink
Merge pull request #2108 from ever-co/feat/maintenace
Browse files Browse the repository at this point in the history
Feat: Maintenace page
  • Loading branch information
evereq authored Jan 22, 2024
2 parents 2b69ec5 + 3988ab2 commit 3c07ace
Show file tree
Hide file tree
Showing 37 changed files with 265 additions and 32 deletions.
8 changes: 7 additions & 1 deletion apps/web/app/[locale]/error.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
'use client';

import Maintenance from '@components/pages/maintenance';

const Error = () => {
return <>Error Page...</>;
return (
<>
<Maintenance />
</>
);
};

export default Error;
13 changes: 11 additions & 2 deletions apps/web/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import '../../styles/globals.css';
import { ThemeProvider } from 'next-themes';
import { JitsuRoot } from 'lib/settings/JitsuRoot';
import { JitsuOptions } from '@jitsu/jitsu-react/dist/useJitsu';
import { useCheckAPI } from '@app/hooks/useCheckAPI';
import Maintenance from '@components/pages/maintenance';

const locales = ['en', 'de', 'ar', 'bg', 'zh', 'nl', 'de', 'he', 'it', 'pl', 'pt', 'ru', 'es', 'fr'];

Expand Down Expand Up @@ -43,6 +45,7 @@ interface Props {
const LocaleLayout = ({ children, params: { locale }, pageProps }: Props) => {
// Validate that the incoming `locale` parameter is valid
if (!locales.includes(locale as any)) notFound();
const { isApiWork } = useCheckAPI();
// Enable static rendering
// unstable_setRequestLocale(locale);

Expand Down Expand Up @@ -70,8 +73,14 @@ const LocaleLayout = ({ children, params: { locale }, pageProps }: Props) => {
<body className={clsx('flex h-full flex-col dark:bg-[#191A20]')}>
<RecoilRoot>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
<AppState />
<JitsuRoot pageProps={pageProps}>{children}</JitsuRoot>
{isApiWork ? (
<>
<AppState />
<JitsuRoot pageProps={pageProps}>{children}</JitsuRoot>
</>
) : (
<Maintenance />
)}
</ThemeProvider>
</RecoilRoot>
</body>
Expand Down
6 changes: 6 additions & 0 deletions apps/web/app/api/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { getDefaultRequest } from '@app/services/server/requests/default';
import { NextResponse } from 'next/server';

export async function GET() {
return NextResponse.json(await getDefaultRequest());
}
1 change: 1 addition & 0 deletions apps/web/app/hooks/features/useUserProfilePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function useUserProfilePage() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [params]);

console.log({memberId})
const members = activeTeam?.members || [];

const matchUser = members.find((m) => {
Expand Down
28 changes: 28 additions & 0 deletions apps/web/app/hooks/useCheckAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use client';

import React, { useCallback, useEffect } from 'react';
import { useQuery } from './useQuery';
import { getDefaultAPI } from '@app/services/client/api';

export function useCheckAPI() {
const { queryCall } = useQuery(getDefaultAPI);
const [isApiWork, setIsApiWork] = React.useState(true);

const checkAPI = useCallback(() => {
queryCall()
.then(() => {
setIsApiWork(true);
})
.catch(() => {
setIsApiWork(false);
});
}, [queryCall]);

useEffect(() => {
checkAPI();
}, [checkAPI]);

return {
isApiWork
};
}
5 changes: 5 additions & 0 deletions apps/web/app/services/client/api/default.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import api from '../axios';

export function getDefaultAPI() {
return api.get(`/`);
}
1 change: 1 addition & 0 deletions apps/web/app/services/client/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ export * from './organization-projects';

export * from './activity/time-slots';
export * from './activity/activity';
export * from './default';
8 changes: 8 additions & 0 deletions apps/web/app/services/server/requests/default.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { serverFetch } from '../fetch';

export function getDefaultRequest() {
return serverFetch({
path: `/`,
method: 'GET'
});
}
1 change: 1 addition & 0 deletions apps/web/app/services/server/requests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ export * from './integrations/integration-tenant';
export * from './integrations/types';

export * from './organization-projects';
export * from './default';
23 changes: 23 additions & 0 deletions apps/web/components/pages/maintenance/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use client';
import { RocketIcon } from '@radix-ui/react-icons';
import { Text } from 'lib/components';
import { useTranslations } from 'next-intl';
function Maintenance() {
const t = useTranslations();
return (
<div className="h-screen flex flex-col gap-4 justify-center items-center ">
<RocketIcon width={200} height={200} className="text-xl text-chetwodeBlue" />
<div className="m-auto relative my-6 pt-12 flex justify-center items-center gap-4 text-center ">
<Text className="text-[78px] text-center font-semibold text-chetwodeBlue">
{t('pages.maintenance.HEADING_TITLE')}
</Text>
</div>

<Text className="text-[40px] my-4 font-bold text-center text-[#282048] dark:text-light--theme">
{t('pages.maintenance.HEADING_DESCRIPTION')}
</Text>
</div>
);
}

export default Maintenance;
20 changes: 0 additions & 20 deletions apps/web/components/pages/task/task-details-aside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,6 @@ const TaskDetailsAside = () => {
<div className="not-italic font-semibold text-base leading-[140%] tracking-[-0.02em] text-[#282048] dark:text-white">
{t('common.DETAILS')}
</div>

{/* TODO */}
{/* Commented icon temporary, will be enable it in future once dynamic implementation done */}
{/* <div className="flex">
<Image
src="/assets/svg/printer.svg"
alt="printer"
width={16}
height={16}
className="mr-3"
/>
<Image
src="/assets/svg/document-download.svg"
alt="download"
width={16}
height={16}
className="mr-3"
/>
<Image src="/assets/svg/more.svg" alt="more" width={16} height={16} />
</div> */}
</div>
<TaskPublicity />

Expand Down
29 changes: 29 additions & 0 deletions apps/web/components/ui/svgs/rocket.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const RocketIcon = ({
width,
height,
fill = '#8C7AE4',
className
}: {
width: number;
height: number;
fill?: string;
className?: string;
}) => {
return (
<svg
width={width}
height={height}
// viewBox={`0 0 ${width} ${height}`}
fill={fill}
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<path
d="M6.85357 3.85355L7.65355 3.05353C8.2981 2.40901 9.42858 1.96172 10.552 1.80125C11.1056 1.72217 11.6291 1.71725 12.0564 1.78124C12.4987 1.84748 12.7698 1.97696 12.8965 2.10357C13.0231 2.23018 13.1526 2.50125 13.2188 2.94357C13.2828 3.37086 13.2779 3.89439 13.1988 4.44801C13.0383 5.57139 12.591 6.70188 11.9464 7.34645L7.49999 11.7929L6.35354 10.6465C6.15827 10.4512 5.84169 10.4512 5.64643 10.6465C5.45117 10.8417 5.45117 11.1583 5.64643 11.3536L7.14644 12.8536C7.34171 13.0488 7.65829 13.0488 7.85355 12.8536L8.40073 12.3064L9.57124 14.2572C9.65046 14.3893 9.78608 14.4774 9.9389 14.4963C10.0917 14.5151 10.2447 14.4624 10.3535 14.3536L12.3535 12.3536C12.4648 12.2423 12.5172 12.0851 12.495 11.9293L12.0303 8.67679L12.6536 8.05355C13.509 7.19808 14.0117 5.82855 14.1887 4.58943C14.2784 3.9618 14.2891 3.33847 14.2078 2.79546C14.1287 2.26748 13.9519 1.74482 13.6035 1.39645C13.2552 1.04809 12.7325 0.871332 12.2045 0.792264C11.6615 0.710945 11.0382 0.721644 10.4105 0.8113C9.17143 0.988306 7.80189 1.491 6.94644 2.34642L6.32322 2.96968L3.07071 2.50504C2.91492 2.48278 2.75773 2.53517 2.64645 2.64646L0.646451 4.64645C0.537579 4.75533 0.484938 4.90829 0.50375 5.0611C0.522563 5.21391 0.61073 5.34954 0.742757 5.42876L2.69364 6.59928L2.14646 7.14645C2.0527 7.24022 2.00002 7.3674 2.00002 7.50001C2.00002 7.63261 2.0527 7.75979 2.14646 7.85356L3.64647 9.35356C3.84173 9.54883 4.15831 9.54883 4.35357 9.35356C4.54884 9.1583 4.54884 8.84172 4.35357 8.64646L3.20712 7.50001L3.85357 6.85356L6.85357 3.85355ZM10.0993 13.1936L9.12959 11.5775L11.1464 9.56067L11.4697 11.8232L10.0993 13.1936ZM3.42251 5.87041L5.43935 3.85356L3.17678 3.53034L1.80638 4.90074L3.42251 5.87041ZM2.35356 10.3535C2.54882 10.1583 2.54882 9.8417 2.35356 9.64644C2.1583 9.45118 1.84171 9.45118 1.64645 9.64644L0.646451 10.6464C0.451188 10.8417 0.451188 11.1583 0.646451 11.3535C0.841713 11.5488 1.1583 11.5488 1.35356 11.3535L2.35356 10.3535ZM3.85358 11.8536C4.04884 11.6583 4.04885 11.3417 3.85359 11.1465C3.65833 10.9512 3.34175 10.9512 3.14648 11.1465L1.14645 13.1464C0.95119 13.3417 0.951187 13.6583 1.14645 13.8535C1.34171 14.0488 1.65829 14.0488 1.85355 13.8536L3.85358 11.8536ZM5.35356 13.3535C5.54882 13.1583 5.54882 12.8417 5.35356 12.6464C5.1583 12.4512 4.84171 12.4512 4.64645 12.6464L3.64645 13.6464C3.45119 13.8417 3.45119 14.1583 3.64645 14.3535C3.84171 14.5488 4.1583 14.5488 4.35356 14.3535L5.35356 13.3535ZM9.49997 6.74881C10.1897 6.74881 10.7488 6.1897 10.7488 5.5C10.7488 4.8103 10.1897 4.25118 9.49997 4.25118C8.81026 4.25118 8.25115 4.8103 8.25115 5.5C8.25115 6.1897 8.81026 6.74881 9.49997 6.74881Z"
fill="currentColor"
fillRule="evenodd"
clipRule="evenodd"
></path>
</svg>
);
};
7 changes: 6 additions & 1 deletion apps/web/lib/features/team/user-team-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import React from 'react';
import UserTeamActivity from './user-team-card-activity';
import { CollapseUpIcon, ExpandIcon } from '@components/ui/svgs/expand';
import { activityTypeState } from '@app/stores/activity-type';
import { useUserProfilePage } from '@app/hooks';
import { useTaskFilter } from 'lib/features/task/task-filters';

type IUserTeamCard = {
active?: boolean;
Expand Down Expand Up @@ -48,6 +50,9 @@ export function UserTeamCard({
const memberInfo = useTeamMemberCard(member);
const taskEdition = useTMCardTaskEdit(memberInfo.memberTask);

const profile = useUserProfilePage();
const hook = useTaskFilter(profile);

const { collaborativeSelect, user_selected, onUserSelect } = useCollaborative(memberInfo.memberUser);

const seconds = useRecoilValue(timerSecondsState);
Expand Down Expand Up @@ -188,7 +193,7 @@ export function UserTeamCard({
{/* Card menu */}
<div className="absolute right-2">{menu}</div>
</div>
<UserTeamActivity showActivity={showActivity} />
<UserTeamActivity showActivity={showActivity} hook={hook} profile={profile} />
</Card>
<Card
shadow="bigger"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ import { clsxm } from '@app/utils';
import { ScreenshootTeamTab } from 'lib/features/activity/screenshoots';
import { AppsTab } from 'lib/features/activity/apps';
import { VisitedSitesTab } from 'lib/features/activity/visited-sites';
// import { UserWorkedTaskTab } from './user-worked-task';
import { useUserProfilePage } from '@app/hooks';
import { UserProfileTask } from 'lib/features/user-profile-tasks';
import { useTaskFilter } from 'lib/features/task/task-filters';
// import { UserProfileTask } from 'lib/features/user-profile-tasks';

const UserTeamActivity = ({ showActivity }: { showActivity: boolean }) => {
const UserTeamActivity = ({ showActivity }: { showActivity: boolean; profile: any; hook: any }) => {
const { timeSlots } = useTimeSlots(true);
const profile = useUserProfilePage();
const hook = useTaskFilter(profile);

const t = useTranslations();

Expand Down Expand Up @@ -67,7 +62,8 @@ const UserTeamActivity = ({ showActivity }: { showActivity: boolean }) => {
</Tab.List>
<Tab.Panels>
<Tab.Panel className="w-full mx-4 p-2">
<UserProfileTask profile={profile} tabFiltered={hook} />
{/* <UserProfileTask profile={profile} tabFiltered={hook} /> */}

{/* <UserWorkedTaskTab profile={profile} /> */}
</Tab.Panel>
<Tab.Panel className="w-full mx-4 p-2">
Expand Down
47 changes: 47 additions & 0 deletions apps/web/lib/features/user-activity-tasks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { I_UserProfilePage } from '@app/hooks';
import { TaskCard } from './task/task-card';
import { I_TaskFilter } from './task/task-filters';

type Props = {
tabFiltered: I_TaskFilter;
profile: I_UserProfilePage;
};

/**
* It renders a list of tasks, with the first task being the active task, and the rest being the last
* 24 hours of tasks
* @param - `profile` - The user profile page data.
* @returns A component that displays a user's profile page.
*/
export function UserProfileTask({ profile, tabFiltered }: Props) {
const tasks = tabFiltered.tasksFiltered;
const otherTasks = tasks.filter((t) =>
profile.member?.running == true ? t.id !== profile.activeUserTeamTask?.id : t
);

return (
<div className="mt-10">
<ul className="flex flex-col gap-6">
{otherTasks.map((task) => {
return (
<li key={task.id}>
<TaskCard
task={task}
isAuthUser={profile.isAuthUser}
activeAuthTask={false}
viewType={tabFiltered.tab === 'unassigned' ? 'unassign' : 'default'}
profile={profile}
taskBadgeClassName={` ${
task.issueType === 'Bug'
? '!px-[0.3312rem] py-[0.2875rem]'
: '!px-[0.375rem] py-[0.375rem]'
} rounded-sm`}
taskTitleClassName="mt-[0.0625rem]"
/>
</li>
);
})}
</ul>
</div>
);
}
4 changes: 4 additions & 0 deletions apps/web/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@
"offline": {
"HEADING_TITLE": "انقطاع الشبكة!",
"HEADING_DESCRIPTION": "أنت غير متصل حاليًا، يرجى التحقق من اتصالك بالإنترنت..."
},
"maintenance": {
"HEADING_TITLE": "نحن تحت الصيانة",
"HEADING_DESCRIPTION": "نقوم حاليًا بتحديث موقعنا الإلكتروني لخدمتك بشكل أفضل. يرجى التحقق مرة أخرى في وقت لاحق."
}
},

Expand Down
4 changes: 4 additions & 0 deletions apps/web/messages/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@
"offline": {
"HEADING_TITLE": "Мрежата е прекъсната!",
"HEADING_DESCRIPTION": "В момента сте извън линия, моля, проверете интернет връзката си..."
},
"maintenance": {
"HEADING_TITLE": "Ние сме в процес на поддръжка",
"HEADING_DESCRIPTION": "В момента актуализираме нашия уебсайт, за да ви служим по-добре. Моля, проверете отново по-късно."
}
},

Expand Down
4 changes: 4 additions & 0 deletions apps/web/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@
"offline": {
"HEADING_TITLE": "Netzwerk getrennt!",
"HEADING_DESCRIPTION": "Sie sind derzeit offline, bitte überprüfen Sie Ihre Internetverbindung..."
},
"maintenance": {
"HEADING_TITLE": "We zijn in onderhoud ",
"HEADING_DESCRIPTION": "Momenteel zijn wij onze website aan het vernieuwen om u nog beter van dienst te kunnen zijn. Kom later nog eens terug."
}
},
"timer": {
Expand Down
4 changes: 4 additions & 0 deletions apps/web/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@
"offline": {
"HEADING_TITLE": "Network Disconnected!",
"HEADING_DESCRIPTION": "You are currently Offline, please check your internet connection..."
},
"maintenance": {
"HEADING_TITLE": "We are Under Maintenance",
"HEADING_DESCRIPTION": "We are currently updating our website to serve you better. Please check back later."
}
},

Expand Down
4 changes: 4 additions & 0 deletions apps/web/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@
"offline": {
"HEADING_TITLE": "¡Red Desconectada!",
"HEADING_DESCRIPTION": "Actualmente estás desconectado, por favor verifica tu conexión a Internet..."
},
"maintenance": {
"HEADING_TITLE": "Estamos en Mantenimiento",
"HEADING_DESCRIPTION": "Actualmente estamos actualizando nuestro sitio web para brindarle un mejor servicio. Por favor, vuelva más tarde."
}
},
"timer": {
Expand Down
4 changes: 4 additions & 0 deletions apps/web/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@
"offline": {
"HEADING_TITLE": "Réseau déconnecté !",
"HEADING_DESCRIPTION": "Vous êtes actuellement hors ligne, veuillez vérifier votre connexion Internet..."
},
"maintenance": {
"HEADING_TITLE": "Nous sommes en cours de maintenance",
"HEADING_DESCRIPTION": "Nous mettons actuellement à jour notre site Web pour mieux vous servir. Veuillez revenir plus tard."
}
},

Expand Down
4 changes: 4 additions & 0 deletions apps/web/messages/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@
"offline": {
"HEADING_TITLE": "רשת מנותקת!",
"HEADING_DESCRIPTION": "אתה לא מחובר כרגע, בבקשה בדוק את חיבור האינטרנט שלך..."
},
"maintenance": {
"HEADING_TITLE": "אנחנו בשלבי תחזוקה ",
"HEADING_DESCRIPTION": "אנו מעדכנים כעת את האתר שלנו כדי לשרת אותך טוב יותר. אנא בדוק שוב מאוחר יותר."
}
},
"timer": {
Expand Down
4 changes: 4 additions & 0 deletions apps/web/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@
"offline": {
"HEADING_TITLE": "Rete Disconnessa!",
"HEADING_DESCRIPTION": "Attualmente sei offline, controlla la tua connessione Internet..."
},
"maintenance": {
"HEADING_TITLE": "Siamo in manutenzione",
"HEADING_DESCRIPTION": "Stiamo attualmente aggiornando il nostro sito web per servirti meglio. Per favore controllare più tardi."
}
},

Expand Down
Loading

0 comments on commit 3c07ace

Please sign in to comment.