Skip to content

Commit

Permalink
Merge pull request #2016 from ever-co/fix/app-router-migration
Browse files Browse the repository at this point in the history
Fix/app router migration
  • Loading branch information
evereq authored Dec 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents c239b4e + a1f4f5c commit d70361e
Showing 204 changed files with 8,487 additions and 912 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"vsicons.presets.angular": true,
"deepscan.enable": true,
5 changes: 5 additions & 0 deletions apps/web/app/[locale]/[...rest]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { notFound } from 'next/navigation';

export default function CatchAllPage() {
notFound();
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import { getAccessTokenCookie } from '@app/helpers';
'use client';

import { getAccessTokenCookie, getActiveUserIdCookie } from '@app/helpers';
import { TAuthenticationPasscode, useAuthenticationPasscode } from '@app/hooks';
import { IClassName } from '@app/interfaces';
import { clsxm } from '@app/utils';
import { AuthCodeInputField, Avatar, BackButton, Button, Card, InputField, SpinnerLoader, Text } from 'lib/components';
import { CircleIcon, TickCircleIconV2 } from 'lib/components/svgs';
import { AuthLayout } from 'lib/layout';
import { useTranslations } from 'next-intl';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useRouter } from 'next/navigation';
import { FormEvent, useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';

import stc from 'string-to-color';

export default function AuthPasscode() {
const form = useAuthenticationPasscode();
const { t } = useTranslation();
const t = useTranslations();
const router = useRouter();

useEffect(() => {
const userId = getActiveUserIdCookie();
if (userId) {
router.replace('/');
}
}, [router]);

return (
<AuthLayout
@@ -51,7 +62,7 @@ export default function AuthPasscode() {
}

function EmailScreen({ form, className }: { form: TAuthenticationPasscode } & IClassName) {
const { t } = useTranslation();
const t = useTranslations();

const handleSendCode = useCallback(
(e: FormEvent<HTMLFormElement>) => {
@@ -105,7 +116,7 @@ function EmailScreen({ form, className }: { form: TAuthenticationPasscode } & IC
}

function PasscodeScreen({ form, className }: { form: TAuthenticationPasscode } & IClassName) {
const { t } = useTranslation();
const t = useTranslations();

return (
<form className={className} onSubmit={form.handleCodeSubmit} autoComplete="off">
@@ -194,7 +205,7 @@ function PasscodeScreen({ form, className }: { form: TAuthenticationPasscode } &
}

function WorkSpaceScreen({ form, className }: { form: TAuthenticationPasscode } & IClassName) {
const { t } = useTranslation();
const t = useTranslations();

const [selectedWorkspace, setSelectedWorkspace] = useState<number>(0);
const [selectedTeam, setSelectedTeam] = useState('');
@@ -227,7 +238,7 @@ function WorkSpaceScreen({ form, className }: { form: TAuthenticationPasscode }
if (form.authScreen.screen === 'workspace') {
const accessToken = getAccessTokenCookie();
if (accessToken && accessToken.length > 100) {
router.reload();
router.refresh();
}
}
}, [form.authScreen, router]);
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use client';

import { RECAPTCHA_SITE_KEY } from '@app/constants';
import { useAuthenticationTeam, IStepProps } from '@app/hooks';
import { IClassName } from '@app/interfaces';
import { clsxm } from '@app/utils';
import { BackButton, BackdropLoader, Button, Card, InputField, SiteReCAPTCHA, Text } from 'lib/components';
import { AuthLayout } from 'lib/layout';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useTranslations } from 'next-intl';

export default function AuthTeam() {
const {
@@ -20,7 +22,7 @@ export default function AuthTeam() {
loading
} = useAuthenticationTeam();

const { t } = useTranslation();
const t = useTranslations();

return (
<AuthLayout title={t('pages.authTeam.HEADING_TITLE')} description={t('pages.authTeam.HEADING_DESCRIPTION')}>
@@ -70,7 +72,7 @@ function FillTeamNameForm({
handleOnChange,
className
}: IStepProps & { errors: Record<string, string> } & IClassName) {
const { t } = useTranslation();
const t = useTranslations();

return (
<Card className={clsxm('w-full dark:bg-[#25272D]', className)} shadow="custom">
@@ -121,7 +123,7 @@ function FillUserDataForm({
onPreviousStep?: () => void;
loading?: boolean;
} & IClassName) {
const { t } = useTranslation();
const t = useTranslations();

return (
<Card className={clsxm('w-full dark:bg-[#25272D]', className)} shadow="bigger">
@@ -168,7 +170,7 @@ function FillUserDataForm({
}

function ReCAPTCHA({ handleOnChange, errors }: { handleOnChange: any; errors: any }) {
const { t } = useTranslation();
const t = useTranslations();
const [feedback, setFeedback] = useState<string>('');

const content = RECAPTCHA_SITE_KEY.value && (
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { withAuthentication } from 'lib/app/authenticator';
import { BackdropLoader, Meta } from 'lib/components';
import dynamic from 'next/dynamic';
7 changes: 7 additions & 0 deletions apps/web/app/[locale]/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use client';

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

export default Error;
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
'use client';

import { useIntegrationTenant, useIntegrationTypes } from '@app/hooks';
import { useGitHubIntegration } from '@app/hooks/integrations/useGitHubIntegration';
import { withAuthentication } from 'lib/app/authenticator';
import { BackdropLoader } from 'lib/components';
import { useTranslation } from 'react-i18next';
import { useRouter } from 'next/router';
import { useTranslations } from 'next-intl';
import { useRouter, useSearchParams } from 'next/navigation';
import { useCallback, useEffect, useRef } from 'react';

const GitHub = () => {
const router = useRouter();
const { t } = useTranslation();
const searchParams = useSearchParams();
const installation_id = searchParams?.get('installation_id');
const setup_action = searchParams?.get('setup_action');

const t = useTranslations();

const installing = useRef<boolean>(false);

@@ -28,14 +34,14 @@ const GitHub = () => {
const handleInstallGitHub = useCallback(() => {
installing.current = true;

if (router && router.query.installation_id && router.query.setup_action) {
if (installation_id && setup_action) {
setTimeout(() => {
installGitHub(router.query.installation_id as string, router.query.setup_action as string).then(() => {
installGitHub(installation_id as string, setup_action as string).then(() => {
router.replace('/settings/team#integrations');
});
}, 100);
}
}, [installGitHub, router]);
}, [installGitHub, router, installation_id, setup_action]);

useEffect(() => {
if (installing.current) {
170 changes: 170 additions & 0 deletions apps/web/app/[locale]/kanban/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
'use client';

import { KanbanTabs } from '@app/constants';
import { useOrganizationTeams } from '@app/hooks';
import { useKanban } from '@app/hooks/features/useKanban';
import KanbanBoardSkeleton from '@components/shared/skeleton/KanbanBoardSkeleton';
import VerticalLine from '@components/ui/svgs/vertificalline';

Check warning on line 7 in apps/web/app/[locale]/kanban/page.tsx

GitHub Actions / Cspell

Unknown word (vertificalline)
import { withAuthentication } from 'lib/app/authenticator';
import { Breadcrumb } from 'lib/components';
import { stackImages } from 'lib/components/kanban-card';
import { AddIcon } from 'lib/components/svgs';
import { KanbanView } from 'lib/features/team-members-kanban-view';
import { MainLayout } from 'lib/layout';
import Image from 'next/image';
import { useState } from 'react';

const Kanban = () => {
const { data } = useKanban();
const { activeTeam } = useOrganizationTeams();

const [activeTab, setActiveTab] = useState(KanbanTabs.TODAY);

const imageRadius = 20;
const numberOfImagesDisplayed = 4;
const activeTeamMembers = activeTeam?.members ? activeTeam.members : [];
const totalLength = (activeTeamMembers.length + 1) * imageRadius;

return (
<>
<MainLayout>
<div className={'relative bg-white dark:bg-dark--theme pt-20 -mt-8 px-[32px] mx-[0px] w-full'}>
<Breadcrumb paths={['Dashboard', 'Team Page']} className="text-sm" />
<div className="flex flex-row items-center justify-between mt-[24px]">
<div>
<h1 className="text-[35px] font-bold text-[#282048] dark:text-white">Kanban Board</h1>
</div>
<div className="flex flex-row items-center gap-[12px]">
<p>08:00 ( UTC +04:30 )</p>
<VerticalLine />
<div className="relative ">
<div
className="flex h-fit flex-row justify-end items-center relative "
style={{
width: `${totalLength}px`
}}
>
{activeTeamMembers.map((image: any, index: number) => {
if (index < numberOfImagesDisplayed) {
return (
<div className="relative w-[40px] h-[40px]" key={index}>
<Image
src={image.employee.user.imageUrl}
alt={image.title}
fill={true}
className="absolute rounded-full border-2 border-white"
style={stackImages(index, activeTeamMembers.length)}
/>
</div>
);
}
})}
{activeTeamMembers.length > 4 && (
<div
className="flex flex-row text-sm text-[#282048] dark:text-white font-semibold items-center justify-center absolute h-[40px] w-[40px] rounded-full border-2 border-[#0000001a] dark:border-white bg-white dark:bg-[#191A20]"
style={stackImages(4, activeTeamMembers.length)}
>
{activeTeamMembers.length - numberOfImagesDisplayed}+
</div>
)}
</div>
</div>
<VerticalLine />
<button className="p-2 rounded-full border-2 border-[#0000001a] dark:border-white">
<AddIcon width={24} height={24} className={'dark:stroke-white'} />
</button>
</div>
</div>
<div className="relative flex flex-row justify-between items-center mt-[36px]">
<div className="flex flex-row">
<div
onClick={() => {
setActiveTab(KanbanTabs.TODAY);
}}
className={`cursor-pointer pt-2.5 px-5 pb-[30px] text-base font-bold ${
activeTab === KanbanTabs.TODAY
? 'border-b-[#3826A6] text-[#3826A6]'
: 'border-b-white dark:border-b-[#191A20] dark:text-white text-[#282048]'
}`}
style={{
borderBottomWidth: '3px',
borderBottomStyle: 'solid'
}}
>
Today
</div>
<div
onClick={() => {
setActiveTab(KanbanTabs.YESTERDAY);
}}
className={`cursor-pointer pt-2.5 px-5 pb-[30px] text-base font-bold ${
activeTab === KanbanTabs.YESTERDAY
? 'border-b-[#3826A6] text-[#3826A6]'
: 'border-b-white dark:border-b-[#191A20] dark:text-white text-[#282048]'
}`}
style={{
borderBottomWidth: '3px',
borderBottomStyle: 'solid'
}}
>
Yesterday
</div>
<div
onClick={() => {
setActiveTab(KanbanTabs.TOMORROW);
}}
className={`cursor-pointer pt-2.5 px-5 pb-[30px] text-base font-bold ${
activeTab === KanbanTabs.TOMORROW
? 'border-b-[#3826A6] text-[#3826A6]'
: 'border-b-white dark:border-b-[#191A20] dark:text-white text-[#282048]'
}`}
style={{
borderBottomWidth: '3px',
borderBottomStyle: 'solid'
}}
>
Tomorrow
</div>
</div>
<div></div>
</div>
</div>
{/** TODO:fetch teamtask based on days */}

Check warning on line 132 in apps/web/app/[locale]/kanban/page.tsx

GitHub Actions / Cspell

Unknown word (teamtask)
{/** Kanbanboard for today tasks */}

Check warning on line 133 in apps/web/app/[locale]/kanban/page.tsx

GitHub Actions / Cspell

Unknown word (Kanbanboard)
{activeTab === KanbanTabs.TODAY && (
<>
{Object.keys(data).length > 0 ? (
<KanbanView kanbanBoardTasks={data} />
) : (
<KanbanBoardSkeleton />
)}
</>
)}

{/** Kanbanboard for yesterday tasks */}

Check warning on line 144 in apps/web/app/[locale]/kanban/page.tsx

GitHub Actions / Cspell

Unknown word (Kanbanboard)
{activeTab === KanbanTabs.YESTERDAY && (
<>
{Object.keys(data).length > 0 ? (
<KanbanView kanbanBoardTasks={data} />
) : (
<KanbanBoardSkeleton />
)}
</>
)}

{/** Kanbanboard for tomorrow tasks */}

Check warning on line 155 in apps/web/app/[locale]/kanban/page.tsx

GitHub Actions / Cspell

Unknown word (Kanbanboard)
{activeTab === KanbanTabs.TOMORROW && (
<>
{Object.keys(data).length > 0 ? (
<KanbanView kanbanBoardTasks={data} />
) : (
<KanbanBoardSkeleton />
)}
</>
)}
</MainLayout>
</>
);
};

export default withAuthentication(Kanban, { displayName: 'Kanban' });
Loading

0 comments on commit d70361e

Please sign in to comment.