Skip to content

Commit

Permalink
2195 enhancement modify linting (#2198)
Browse files Browse the repository at this point in the history
* fixing the linting issues

* fixing the linting issuesgs

* fixing the linting issues

* fixing the linting issues

* fixing the linting issues

* fixing the linting issues

* fixing the linting issues

* fix the linting issues of project web only

* fix the linting issues of project web only

* fix the linting issues of project web only
  • Loading branch information
Anishali2 authored Feb 10, 2024
1 parent 7a35bb1 commit b59248c
Show file tree
Hide file tree
Showing 32 changed files with 345 additions and 271 deletions.
5 changes: 4 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# npm test
cd "apps/web"

yarn lint

1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"arrowParens": "always",
"trailingComma": "none",
"quoteProps": "as-needed",
"trimTrailingWhitespace": true,
"overrides": [
{
"files": "*.scss",
Expand Down
5 changes: 2 additions & 3 deletions apps/web/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"plugins": ["unused-imports"],
"extends": "next/core-web-vitals",
"rules": {
"react/no-unstable-nested-components": [
"error"
]
"unused-imports/no-unused-imports": "error"
}
}
1 change: 0 additions & 1 deletion apps/web/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"arrowParens": "always",
"trailingComma": "none",
"quoteProps": "as-needed",
"trimTrailingWhitespace": true,
"overrides": [
{
"files": "*.scss",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/app/[locale]/integration/github/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const GitHub = () => {

const installing = useRef<boolean>(false);

const { installGitHub, getRepositories } = useGitHubIntegration();
const { installGitHub, getRepositories } = useGitHubIntegration();
const { getIntegrationTenant, loading: integrationTenantLoading, integrationTenant } = useIntegrationTenant();
const { loading: loadingIntegrationTypes, integrationTypes, getIntegrationTypes } = useIntegrationTypes();

const handleInstallGitHub = useCallback(() => {
installing.current = true;

Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/[locale]/kanban/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const Kanban = () => {
<Breadcrumb paths={breadcrumbPath} className="text-sm" />
</div>
<div className="flex h-10 w-max items-center justify-center gap-1">
<HeaderTabs linkAll={true}/>
<HeaderTabs linkAll={true} />
</div>
</div>
<div className="flex justify-between items-center mt-10">
Expand Down
1 change: 0 additions & 1 deletion apps/web/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { headerTabs } from '@app/stores/header-tabs';

function MainPage() {
const t = useTranslations();

const { isTeamMember, isTrackingEnabled, activeTeam } = useOrganizationTeams();
const fullWidth = useRecoilValue(fullWidthState);
const view = useRecoilValue(headerTabs);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/api/timer/start/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function POST(req: Request) {
taskId,
teamId: organizationTeamId
} = await authenticatedGuard(req, res);
console.log({ user, tenantId, taskId})
console.log({ user, tenantId, taskId });
if (!user) return $res('Unauthorized');

await startTimerRequest(
Expand Down
155 changes: 74 additions & 81 deletions apps/web/app/hooks/auth/useAuthenticationTeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,99 +15,92 @@ const FIRST_STEP = 'STEP1' as const;
const SECOND_STEP = 'STEP2' as const;

export interface IStepProps {
handleOnChange: any;
form: IRegisterDataAPI;
handleOnChange: any;
form: IRegisterDataAPI;
}

const initialValues: IRegisterDataAPI = RECAPTCHA_SITE_KEY
? {
name: '',
email: '',
team: '',
recaptcha: ''
}
: {
name: '',
email: '',
team: ''
};
? {
name: '',
email: '',
team: '',
recaptcha: ''
}
: {
name: '',
email: '',
team: ''
};
export function useAuthenticationTeam() {
const query = useSearchParams();
const queryEmail = useMemo(() => {
const emailQuery =
query?.get('email') ||
localStorage?.getItem('ever-teams-start-email') ||
'';
return emailQuery;
}, [query]);
initialValues.email = queryEmail;
const [step, setStep] = useState<typeof FIRST_STEP | typeof SECOND_STEP>(
FIRST_STEP
);
const [formValues, setFormValues] = useState<IRegisterDataAPI>(initialValues);
const [errors, setErrors] = useState(initialValues);
const { queryCall, loading, infiniteLoading } = useQuery(registerUserTeamAPI);
const query = useSearchParams();
const queryEmail = useMemo(() => {
const emailQuery = query?.get('email') || localStorage?.getItem('ever-teams-start-email') || '';
return emailQuery;
}, [query]);
initialValues.email = queryEmail;
const [step, setStep] = useState<typeof FIRST_STEP | typeof SECOND_STEP>(FIRST_STEP);
const [formValues, setFormValues] = useState<IRegisterDataAPI>(initialValues);
const [errors, setErrors] = useState(initialValues);
const { queryCall, loading, infiniteLoading } = useQuery(registerUserTeamAPI);

const handleSubmit = (e: any) => {
e.preventDefault();
if (step === FIRST_STEP) {
const { errors, valid } = authFormValidate(['team'], formValues);
setErrors(errors as any);
valid && setStep(SECOND_STEP);
return;
}
const handleSubmit = (e: any) => {
e.preventDefault();
if (step === FIRST_STEP) {
const { errors, valid } = authFormValidate(['team'], formValues);
setErrors(errors as any);
valid && setStep(SECOND_STEP);
return;
}

const noRecaptchaArray = ['email', 'name'];
const noRecaptchaArray = ['email', 'name'];

const withRecaptchaArray = [...noRecaptchaArray, 'recaptcha'];
const withRecaptchaArray = [...noRecaptchaArray, 'recaptcha'];

const validationFields = RECAPTCHA_SITE_KEY
? withRecaptchaArray
: noRecaptchaArray;
const validationFields = RECAPTCHA_SITE_KEY ? withRecaptchaArray : noRecaptchaArray;

const { errors, valid } = authFormValidate(validationFields, formValues);
const { errors, valid } = authFormValidate(validationFields, formValues);

if (!valid) {
setErrors(errors as any);
return;
}
if (!valid) {
setErrors(errors as any);
return;
}

formValues['timezone'] = userTimezone();
infiniteLoading.current = true;
formValues['timezone'] = userTimezone();
infiniteLoading.current = true;

queryCall(formValues)
.then(() => window.location.reload())
.catch((err: AxiosError) => {
if (err.response?.status === 400) {
setErrors((err.response?.data as any)?.errors || {});
}
});
};
queryCall(formValues)
.then(() => window.location.reload())
.catch((err: AxiosError) => {
if (err.response?.status === 400) {
setErrors((err.response?.data as any)?.errors || {});
}
});
};

const handleOnChange = useCallback(
(e: any) => {
const { name, value } = e.target;
const key = name as keyof IRegisterDataAPI;
if (errors[key]) {
errors[key] = '';
}
setFormValues((prevState) => ({
...prevState,
[name]: value
}));
},
[errors]
);
const handleOnChange = useCallback(
(e: any) => {
const { name, value } = e.target;
const key = name as keyof IRegisterDataAPI;
if (errors[key]) {
errors[key] = '';
}
setFormValues((prevState) => ({
...prevState,
[name]: value
}));
},
[errors]
);

return {
handleSubmit,
handleOnChange,
loading,
FIRST_STEP,
step,
SECOND_STEP,
setStep,
errors,
formValues
};
return {
handleSubmit,
handleOnChange,
loading,
FIRST_STEP,
step,
SECOND_STEP,
setStep,
errors,
formValues
};
}
2 changes: 1 addition & 1 deletion apps/web/app/interfaces/IScreenshoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export interface IScreenShootItem {
imageUrl: string;
percent: number | string;
showProgress?: boolean;
isTeamPage?: boolean
isTeamPage?: boolean;
onShow: () => any;
}
2 changes: 1 addition & 1 deletion apps/web/app/interfaces/ITaskTimesheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ITeamTask } from './ITask';
import { ITimerSlot } from './timer/ITimerSlot';

export interface ITaskTimesheet {
id: string
id: string;
title: string;
description?: string;
metaData?: string;
Expand Down
4 changes: 1 addition & 3 deletions apps/web/app/services/client/api/public-organization-team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export function getPublicOrganizationTeamsAPI(profile_link: string, team_id: str
params[`relations[${i}]`] = rl;
});


const queries = qs.stringify(params);

const endpoint = GAUZY_API_BASE_SERVER_URL.value
? `/public/team/${profile_link}/${team_id}?${queries}`
: `/public/team/${profile_link}/${team_id}?type=team`;
Expand All @@ -49,7 +48,6 @@ export function getPublicOrganizationTeamsMiscDataAPI(profile_link: string, team
params[`relations[${i}]`] = rl;
});


const queries = qs.stringify(params);

const endpoint = GAUZY_API_BASE_SERVER_URL.value
Expand Down
12 changes: 5 additions & 7 deletions apps/web/app/stores/kanban.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { IKanban } from "@app/interfaces/IKanban";
import { atom } from "recoil";
import { IKanban } from '@app/interfaces/IKanban';
import { atom } from 'recoil';

export const kanbanBoardState = atom<IKanban>({
key: 'kanbanBoardState',
default: {

}
})
key: 'kanbanBoardState',
default: {}
});
2 changes: 1 addition & 1 deletion apps/web/app/utils/scroll-to-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export function scrollToElement(rect: DOMRect, diff = 150) {
top: rect.y > 0 ? rect.y + window.scrollY - diff : window.scrollY - Math.abs(rect.y) - diff,
behavior: 'smooth'
});
}
}
2 changes: 1 addition & 1 deletion apps/web/components/pages/main/header-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const HeaderTabs = ({ linkAll }: { linkAll: boolean }) => {

return (
<>
{options.map(({ label, icon: Icon, view: optionView },index) => (
{options.map(({ label, icon: Icon, view: optionView }, index) => (
<Tooltip key={label} label={label} placement="top-start">
<LinkWrapper isRoute={!!links[index]} href={links[index]}>
<button
Expand Down
70 changes: 36 additions & 34 deletions apps/web/components/shared/skeleton/KanbanBoardSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
import React from "react";
import Skeleton from "react-loading-skeleton";
import React from 'react';
import Skeleton from 'react-loading-skeleton';

const KanbanBoardSkeleton = () => {
const columns = Array.from(Array(5));

const columns = Array.from(Array(5));
const tasks = Array.from(Array(2));

const tasks = Array.from(Array(2));
return (
<>
<div className="flex flex-row gap-[20px] w-full min-h-[600px] p-[32px] bg-transparent dark:bg-[#181920]">
{columns.map((_, index: number) => {
return (
<React.Fragment key={index}>
<div className="flex flex-col gap-[10px]">
<Skeleton height={40} width={325} borderRadius={10} className="dark:bg-[#353741]" />

return (
<>
<div
className="flex flex-row gap-[20px] w-full min-h-[600px] p-[32px] bg-transparent dark:bg-[#181920]"
>
{columns.map((_, index: number)=> {
return (
<React.Fragment key={index}>
<div className="flex flex-col gap-[10px]">
<Skeleton height={40} width={325} borderRadius={10} className="dark:bg-[#353741]" />
<div className="flex flex-col gap-[5px]">
{tasks.map((_, index: number) => {
return (
<React.Fragment key={index}>
<Skeleton
height={155}
width={325}
borderRadius={10}
className="dark:bg-[#353741]"
/>
</React.Fragment>
);
})}

<div className="flex flex-col gap-[5px]">
{tasks.map((_, index: number)=> {
return (
<React.Fragment key={index}>
<Skeleton height={155} width={325} borderRadius={10} className="dark:bg-[#353741]" />
</React.Fragment>
)
})}
<Skeleton height={56} width={325} borderRadius={10} className="dark:bg-[#353741]" />
</div>
</div>
</React.Fragment>
);
})}
</div>
</>
);
};

<Skeleton height={56} width={325} borderRadius={10} className="dark:bg-[#353741]" />
</div>
</div>
</React.Fragment>
)
})}
</div>
</>
)
}

export default KanbanBoardSkeleton;
export default KanbanBoardSkeleton;
Loading

0 comments on commit b59248c

Please sign in to comment.