fix: formatting files

This commit is contained in:
sriram veeraghanta 2024-03-06 20:50:38 +05:30
parent 1fa47a6c04
commit bce69bcbe1
35 changed files with 113 additions and 114 deletions

View File

@ -71,7 +71,11 @@ export const setToast = (props: SetToastProps) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
}} }}
className={cn("w-[350px] h-[67.3px] rounded-lg border shadow-sm p-2", backgroundColorClassName, borderColorClassName)} className={cn(
"w-[350px] h-[67.3px] rounded-lg border shadow-sm p-2",
backgroundColorClassName,
borderColorClassName
)}
> >
<div className="w-full h-full flex items-center justify-center px-4 py-2"> <div className="w-full h-full flex items-center justify-center px-4 py-2">
{icon && <div className="flex items-center justify-center">{icon}</div>} {icon && <div className="flex items-center justify-center">{icon}</div>}

View File

@ -203,8 +203,8 @@ export const SignInUniqueCodeForm: React.FC<Props> = (props) => {
{resendTimerCode > 0 {resendTimerCode > 0
? `Request new code in ${resendTimerCode}s` ? `Request new code in ${resendTimerCode}s`
: isRequestingNewCode : isRequestingNewCode
? "Requesting new code" ? "Requesting new code"
: "Request new code"} : "Request new code"}
</button> </button>
</div> </div>
</div> </div>

View File

@ -202,8 +202,8 @@ export const SignUpUniqueCodeForm: React.FC<Props> = (props) => {
{resendTimerCode > 0 {resendTimerCode > 0
? `Request new code in ${resendTimerCode}s` ? `Request new code in ${resendTimerCode}s`
: isRequestingNewCode : isRequestingNewCode
? "Requesting new code" ? "Requesting new code"
: "Request new code"} : "Request new code"}
</button> </button>
</div> </div>
</div> </div>

View File

@ -160,8 +160,8 @@ export const CustomAnalyticsSidebar: React.FC<Props> = observer((props) => {
(cycleId (cycleId
? cycleDetails?.created_at ? cycleDetails?.created_at
: moduleId : moduleId
? moduleDetails?.created_at ? moduleDetails?.created_at
: projectDetails?.created_at) ?? "" : projectDetails?.created_at) ?? ""
)} )}
</div> </div>
)} )}

View File

@ -170,8 +170,8 @@ export const CreateApiTokenForm: React.FC<Props> = (props) => {
{value === "custom" {value === "custom"
? "Custom date" ? "Custom date"
: selectedOption : selectedOption
? selectedOption.label ? selectedOption.label
: "Set expiration date"} : "Set expiration date"}
</div> </div>
} }
value={value} value={value}
@ -207,8 +207,8 @@ export const CreateApiTokenForm: React.FC<Props> = (props) => {
? `Expires ${renderFormattedDate(customDate)}` ? `Expires ${renderFormattedDate(customDate)}`
: null : null
: watch("expired_at") : watch("expired_at")
? `Expires ${getExpiryDate(watch("expired_at") ?? "")}` ? `Expires ${getExpiryDate(watch("expired_at") ?? "")}`
: null} : null}
</span> </span>
)} )}
</div> </div>

View File

@ -172,8 +172,8 @@ export const GptAssistantPopover: React.FC<Props> = (props) => {
const generateResponseButtonText = isSubmitting const generateResponseButtonText = isSubmitting
? "Generating response..." ? "Generating response..."
: response === "" : response === ""
? "Generate response" ? "Generate response"
: "Generate again"; : "Generate again";
return ( return (
<Popover as="div" className={`relative w-min text-left`}> <Popover as="div" className={`relative w-min text-left`}>

View File

@ -78,8 +78,8 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = observer((props) => {
? cycleTotalIssues === 0 ? cycleTotalIssues === 0
? "0 Issue" ? "0 Issue"
: cycleTotalIssues === cycleDetails.completed_issues : cycleTotalIssues === cycleDetails.completed_issues
? `${cycleTotalIssues} Issue${cycleTotalIssues > 1 ? "s" : ""}` ? `${cycleTotalIssues} Issue${cycleTotalIssues > 1 ? "s" : ""}`
: `${cycleDetails.completed_issues}/${cycleTotalIssues} Issues` : `${cycleDetails.completed_issues}/${cycleTotalIssues} Issues`
: "0 Issue"; : "0 Issue";
const handleCopyText = (e: MouseEvent<HTMLButtonElement>) => { const handleCopyText = (e: MouseEvent<HTMLButtonElement>) => {

View File

@ -216,8 +216,8 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
? "0 Issue" ? "0 Issue"
: `${cycleDetails.progress_snapshot.completed_issues}/${cycleDetails.progress_snapshot.total_issues}` : `${cycleDetails.progress_snapshot.completed_issues}/${cycleDetails.progress_snapshot.total_issues}`
: cycleDetails.total_issues === 0 : cycleDetails.total_issues === 0
? "0 Issue" ? "0 Issue"
: `${cycleDetails.completed_issues}/${cycleDetails.total_issues}`; : `${cycleDetails.completed_issues}/${cycleDetails.total_issues}`;
const daysLeft = findHowManyDaysLeft(cycleDetails.end_date); const daysLeft = findHowManyDaysLeft(cycleDetails.end_date);

View File

@ -79,14 +79,14 @@ export const IssuesByStateGroupWidget: React.FC<WidgetProps> = observer((props)
startedCount > 0 startedCount > 0
? "started" ? "started"
: unStartedCount > 0 : unStartedCount > 0
? "unstarted" ? "unstarted"
: backlogCount > 0 : backlogCount > 0
? "backlog" ? "backlog"
: completedCount > 0 : completedCount > 0
? "completed" ? "completed"
: canceledCount > 0 : canceledCount > 0
? "cancelled" ? "cancelled"
: null; : null;
setActiveStateGroup(stateGroup); setActiveStateGroup(stateGroup);
setDefaultStateGroup(stateGroup); setDefaultStateGroup(stateGroup);

View File

@ -312,8 +312,8 @@ export const CreateUpdateEstimateModal: React.FC<Props> = observer((props) => {
? "Updating Estimate..." ? "Updating Estimate..."
: "Update Estimate" : "Update Estimate"
: isSubmitting : isSubmitting
? "Creating Estimate..." ? "Creating Estimate..."
: "Create Estimate"} : "Create Estimate"}
</Button> </Button>
</div> </div>
</form> </form>

View File

@ -205,9 +205,7 @@ export const CycleIssuesHeader: React.FC = observer(() => {
className="ml-1.5 flex-shrink-0" className="ml-1.5 flex-shrink-0"
placement="bottom-start" placement="bottom-start"
> >
{currentProjectCycleIds?.map((cycleId) => ( {currentProjectCycleIds?.map((cycleId) => <CycleDropdownOption key={cycleId} cycleId={cycleId} />)}
<CycleDropdownOption key={cycleId} cycleId={cycleId} />
))}
</CustomMenu> </CustomMenu>
} }
/> />

View File

@ -206,9 +206,7 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
className="ml-1.5 flex-shrink-0" className="ml-1.5 flex-shrink-0"
placement="bottom-start" placement="bottom-start"
> >
{projectModuleIds?.map((moduleId) => ( {projectModuleIds?.map((moduleId) => <ModuleDropdownOption key={moduleId} moduleId={moduleId} />)}
<ModuleDropdownOption key={moduleId} moduleId={moduleId} />
))}
</CustomMenu> </CustomMenu>
} }
/> />

View File

@ -31,13 +31,7 @@ interface IBaseCalendarRoot {
} }
export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => { export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
const { const { QuickActions, storeType, addIssuesToView, viewId, isCompletedCycle = false } = props;
QuickActions,
storeType,
addIssuesToView,
viewId,
isCompletedCycle = false,
} = props;
// router // router
const router = useRouter(); const router = useRouter();

View File

@ -5,7 +5,15 @@ import { observer } from "mobx-react-lite";
import { Spinner } from "@plane/ui"; import { Spinner } from "@plane/ui";
import { CalendarHeader, CalendarWeekDays, CalendarWeekHeader } from "components/issues"; import { CalendarHeader, CalendarWeekDays, CalendarWeekHeader } from "components/issues";
// types // types
import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOptions, TGroupedIssues, TIssue, TIssueKanbanFilters, TIssueMap } from "@plane/types"; import {
IIssueDisplayFilterOptions,
IIssueDisplayProperties,
IIssueFilterOptions,
TGroupedIssues,
TIssue,
TIssueKanbanFilters,
TIssueMap,
} from "@plane/types";
import { ICalendarWeek } from "./types"; import { ICalendarWeek } from "./types";
// constants // constants
import { EIssueFilterType, EIssuesStoreType } from "constants/issue"; import { EIssueFilterType, EIssuesStoreType } from "constants/issue";

View File

@ -9,7 +9,13 @@ import { Popover, Transition } from "@headlessui/react";
import { Check, ChevronUp } from "lucide-react"; import { Check, ChevronUp } from "lucide-react";
import { ToggleSwitch } from "@plane/ui"; import { ToggleSwitch } from "@plane/ui";
// types // types
import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOptions, TCalendarLayouts, TIssueKanbanFilters } from "@plane/types"; import {
IIssueDisplayFilterOptions,
IIssueDisplayProperties,
IIssueFilterOptions,
TCalendarLayouts,
TIssueKanbanFilters,
} from "@plane/types";
// constants // constants
import { CALENDAR_LAYOUTS } from "constants/calendar"; import { CALENDAR_LAYOUTS } from "constants/calendar";
import { EIssueFilterType } from "constants/issue"; import { EIssueFilterType } from "constants/issue";

View File

@ -12,9 +12,9 @@ import { useIssues } from "hooks/store";
export const ModuleCalendarLayout: React.FC = observer(() => { export const ModuleCalendarLayout: React.FC = observer(() => {
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId, moduleId } = router.query ; const { workspaceSlug, projectId, moduleId } = router.query;
const {issues} = useIssues(EIssuesStoreType.MODULE) const { issues } = useIssues(EIssuesStoreType.MODULE);
if (!moduleId) return null; if (!moduleId) return null;

View File

@ -5,4 +5,4 @@ import { EIssuesStoreType } from "constants/issue";
// components // components
import { BaseGanttRoot } from "./base-gantt-root"; import { BaseGanttRoot } from "./base-gantt-root";
export const GanttLayout: React.FC = observer(() =>( <BaseGanttRoot storeType={EIssuesStoreType.PROJECT} />)); export const GanttLayout: React.FC = observer(() => <BaseGanttRoot storeType={EIssuesStoreType.PROJECT} />);

View File

@ -198,13 +198,9 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = observer((props: IBas
let kanbanFilters = issuesFilter?.issueFilters?.kanbanFilters?.[toggle] || []; let kanbanFilters = issuesFilter?.issueFilters?.kanbanFilters?.[toggle] || [];
if (kanbanFilters.includes(value)) kanbanFilters = kanbanFilters.filter((_value) => _value != value); if (kanbanFilters.includes(value)) kanbanFilters = kanbanFilters.filter((_value) => _value != value);
else kanbanFilters.push(value); else kanbanFilters.push(value);
updateFilters( updateFilters(projectId.toString(), EIssueFilterType.KANBAN_FILTERS, {
projectId.toString(), [toggle]: kanbanFilters,
EIssueFilterType.KANBAN_FILTERS, });
{
[toggle]: kanbanFilters,
}
);
} }
}; };

View File

@ -11,8 +11,8 @@ import { BaseKanBanRoot } from "../base-kanban-root";
export const ProfileIssuesKanBanLayout: React.FC = observer(() => { export const ProfileIssuesKanBanLayout: React.FC = observer(() => {
const { const {
membership: { currentWorkspaceAllProjectsRole }, membership: { currentWorkspaceAllProjectsRole },
} = useUser(); } = useUser();
const canEditPropertiesBasedOnProject = (projectId: string) => { const canEditPropertiesBasedOnProject = (projectId: string) => {
const currentProjectRole = currentWorkspaceAllProjectsRole && currentWorkspaceAllProjectsRole[projectId]; const currentProjectRole = currentWorkspaceAllProjectsRole && currentWorkspaceAllProjectsRole[projectId];

View File

@ -5,7 +5,7 @@ import { EIssuesStoreType } from "constants/issue";
import { EUserProjectRoles } from "constants/project"; import { EUserProjectRoles } from "constants/project";
import { useIssues, useUser } from "hooks/store"; import { useIssues, useUser } from "hooks/store";
import { TIssue } from "@plane/types" import { TIssue } from "@plane/types";
// components // components
import { List } from "./default"; import { List } from "./default";
import { IQuickActionProps } from "./list-view-types"; import { IQuickActionProps } from "./list-view-types";

View File

@ -224,8 +224,8 @@ export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((pro
disabled disabled
? "cursor-not-allowed text-custom-text-200" ? "cursor-not-allowed text-custom-text-200"
: value.length <= maxRender : value.length <= maxRender
? "cursor-pointer" ? "cursor-pointer"
: "cursor-pointer hover:bg-custom-background-80" : "cursor-pointer hover:bg-custom-background-80"
} ${buttonClassName}`} } ${buttonClassName}`}
onClick={handleOnClick} onClick={handleOnClick}
> >

View File

@ -57,13 +57,13 @@ export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
const handleDisplayFiltersUpdate = useCallback( const handleDisplayFiltersUpdate = useCallback(
(updatedDisplayFilter: Partial<IIssueDisplayFilterOptions>) => { (updatedDisplayFilter: Partial<IIssueDisplayFilterOptions>) => {
if ( !projectId) return; if (!projectId) return;
updateFilters(projectId.toString(), EIssueFilterType.DISPLAY_FILTERS, { updateFilters(projectId.toString(), EIssueFilterType.DISPLAY_FILTERS, {
...updatedDisplayFilter, ...updatedDisplayFilter,
}); });
}, },
[ projectId, updateFilters] [projectId, updateFilters]
); );
const renderQuickActions = useCallback( const renderQuickActions = useCallback(

View File

@ -770,4 +770,3 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
</> </>
); );
}); });

View File

@ -159,8 +159,8 @@ export const ModuleCardItem: React.FC<Props> = observer((props) => {
? !moduleTotalIssues || moduleTotalIssues === 0 ? !moduleTotalIssues || moduleTotalIssues === 0
? "0 Issue" ? "0 Issue"
: moduleTotalIssues === moduleDetails.completed_issues : moduleTotalIssues === moduleDetails.completed_issues
? `${moduleTotalIssues} Issue${moduleTotalIssues > 1 ? "s" : ""}` ? `${moduleTotalIssues} Issue${moduleTotalIssues > 1 ? "s" : ""}`
: `${moduleDetails.completed_issues}/${moduleTotalIssues} Issues` : `${moduleDetails.completed_issues}/${moduleTotalIssues} Issues`
: "0 Issue"; : "0 Issue";
return ( return (

View File

@ -176,12 +176,12 @@ export const NotificationCard: React.FC<NotificationCardProps> = (props) => {
{notificationField === "comment" {notificationField === "comment"
? "commented" ? "commented"
: notificationField === "archived_at" : notificationField === "archived_at"
? notification.data.issue_activity.new_value === "restore" ? notification.data.issue_activity.new_value === "restore"
? "restored the issue" ? "restored the issue"
: "archived the issue" : "archived the issue"
: notificationField === "None" : notificationField === "None"
? null ? null
: replaceUnderscoreIfSnakeCase(notificationField)}{" "} : replaceUnderscoreIfSnakeCase(notificationField)}{" "}
{!["comment", "archived_at", "None"].includes(notificationField) ? "to" : ""} {!["comment", "archived_at", "None"].includes(notificationField) ? "to" : ""}
<span className="font-semibold"> <span className="font-semibold">
{" "} {" "}

View File

@ -25,8 +25,8 @@ export const ProfileWorkload: React.FC<Props> = ({ stateDistribution }) => (
{group.state_group === "unstarted" {group.state_group === "unstarted"
? "Not started" ? "Not started"
: group.state_group === "started" : group.state_group === "started"
? "Working on" ? "Working on"
: STATE_GROUPS[group.state_group].label} : STATE_GROUPS[group.state_group].label}
</p> </p>
<p className="text-xl font-semibold">{group.state_count}</p> <p className="text-xl font-semibold">{group.state_count}</p>
</div> </div>

View File

@ -164,8 +164,8 @@ export const ProfileSidebar = observer(() => {
completedIssuePercentage <= 35 completedIssuePercentage <= 35
? "bg-red-500/10 text-red-500" ? "bg-red-500/10 text-red-500"
: completedIssuePercentage <= 70 : completedIssuePercentage <= 70
? "bg-yellow-500/10 text-yellow-500" ? "bg-yellow-500/10 text-yellow-500"
: "bg-green-500/10 text-green-500" : "bg-green-500/10 text-green-500"
}`} }`}
> >
{completedIssuePercentage}% {completedIssuePercentage}%

View File

@ -142,9 +142,8 @@ export const SendProjectInvitationModal: React.FC<Props> = observer((props) => {
if (!memberDetails?.member) return; if (!memberDetails?.member) return;
return { return {
value: `${memberDetails?.member.id}`, value: `${memberDetails?.member.id}`,
query: `${memberDetails?.member.first_name} ${ query: `${memberDetails?.member.first_name} ${memberDetails?.member
memberDetails?.member.last_name .last_name} ${memberDetails?.member.display_name.toLowerCase()}`,
} ${memberDetails?.member.display_name.toLowerCase()}`,
content: ( content: (
<div className="flex w-full items-center gap-2"> <div className="flex w-full items-center gap-2">
<div className="flex-shrink-0 pt-0.5"> <div className="flex-shrink-0 pt-0.5">

View File

@ -108,12 +108,12 @@ export const MultiLevelDropdown: React.FC<MultiLevelDropdownProps> = ({
height === "sm" height === "sm"
? "max-h-28" ? "max-h-28"
: height === "md" : height === "md"
? "max-h-44" ? "max-h-44"
: height === "rg" : height === "rg"
? "max-h-56" ? "max-h-56"
: height === "lg" : height === "lg"
? "max-h-80" ? "max-h-80"
: "" : ""
}`} }`}
> >
{option.children ? ( {option.children ? (

View File

@ -49,10 +49,10 @@ export const getRedirectionFilters = (type: TIssuesListTypes): string => {
type === "pending" type === "pending"
? "?state_group=backlog,unstarted,started" ? "?state_group=backlog,unstarted,started"
: type === "upcoming" : type === "upcoming"
? `?target_date=${today};after` ? `?target_date=${today};after`
: type === "overdue" : type === "overdue"
? `?target_date=${today};before` ? `?target_date=${today};before`
: "?state_group=completed"; : "?state_group=completed";
return filterParams; return filterParams;
}; };

View File

@ -41,13 +41,16 @@ export const groupReactions: (reactions: any[], key: string) => { [key: string]:
reactions: any, reactions: any,
key: string key: string
) => { ) => {
const groupedReactions = reactions.reduce((acc: any, reaction: any) => { const groupedReactions = reactions.reduce(
if (!acc[reaction[key]]) { (acc: any, reaction: any) => {
acc[reaction[key]] = []; if (!acc[reaction[key]]) {
} acc[reaction[key]] = [];
acc[reaction[key]].push(reaction); }
return acc; acc[reaction[key]].push(reaction);
}, {} as { [key: string]: any[] }); return acc;
},
{} as { [key: string]: any[] }
);
return groupedReactions; return groupedReactions;
}; };

View File

@ -172,19 +172,15 @@ export const renderIssueBlocksStructure = (blocks: TIssue[]): IGanttBlock[] =>
target_date: block.target_date ? new Date(block.target_date) : null, target_date: block.target_date ? new Date(block.target_date) : null,
})); }));
export function getChangedIssuefields(formData: Partial<TIssue>, dirtyFields: { [key: string]: boolean | undefined }) {
const changedFields: Partial<TIssue> = {};
export function getChangedIssuefields( const dirtyFieldKeys = Object.keys(dirtyFields) as (keyof TIssue)[];
formData: Partial<TIssue>, for (const dirtyField of dirtyFieldKeys) {
dirtyFields: { [key: string]: boolean | undefined } if (!!dirtyFields[dirtyField]) {
) { changedFields[dirtyField] = formData[dirtyField];
const changedFields: Partial<TIssue> = {};
const dirtyFieldKeys = Object.keys(dirtyFields) as (keyof TIssue)[];
for (const dirtyField of dirtyFieldKeys) {
if (!!dirtyFields[dirtyField]) {
changedFields[dirtyField] = formData[dirtyField];
}
} }
}
return changedFields; return changedFields;
} }

View File

@ -21,9 +21,7 @@ export const ProfileSettingsLayout: FC<IProfileSettingsLayout> = (props) => {
<ProfileLayoutSidebar /> <ProfileLayoutSidebar />
<main className="relative flex h-full w-full flex-col overflow-hidden bg-custom-background-100"> <main className="relative flex h-full w-full flex-col overflow-hidden bg-custom-background-100">
{header} {header}
<div className="h-full w-full overflow-x-hidden overflow-y-scroll"> <div className="h-full w-full overflow-x-hidden overflow-y-scroll">{children}</div>
{children}
</div>
</main> </main>
</div> </div>
</UserAuthWrapper> </UserAuthWrapper>

View File

@ -69,9 +69,10 @@ const ArchivedIssueDetailsPage: NextPageWithLayout = observer(() => {
title: "Success", title: "Success",
message: message:
issue && issue &&
`${getProjectById(issue.project_id)?.identifier}-${ `${getProjectById(issue.project_id)
issue?.sequence_id ?.identifier}-${issue?.sequence_id} is restored successfully under the project ${getProjectById(
} is restored successfully under the project ${getProjectById(issue.project_id)?.name}`, issue.project_id
)?.name}`,
}); });
router.push(`/${workspaceSlug}/projects/${projectId}/issues/${archivedIssueId}`); router.push(`/${workspaceSlug}/projects/${projectId}/issues/${archivedIssueId}`);
}) })

View File

@ -127,9 +127,8 @@ export class WorkspaceMemberStore implements IWorkspaceMemberStore {
const searchedWorkspaceMemberIds = workspaceMemberIds?.filter((userId) => { const searchedWorkspaceMemberIds = workspaceMemberIds?.filter((userId) => {
const memberDetails = this.getWorkspaceMemberDetails(userId); const memberDetails = this.getWorkspaceMemberDetails(userId);
if (!memberDetails) return false; if (!memberDetails) return false;
const memberSearchQuery = `${memberDetails.member.first_name} ${memberDetails.member.last_name} ${ const memberSearchQuery = `${memberDetails.member.first_name} ${memberDetails.member.last_name} ${memberDetails
memberDetails.member?.display_name .member?.display_name} ${memberDetails.member.email ?? ""}`;
} ${memberDetails.member.email ?? ""}`;
return memberSearchQuery.toLowerCase()?.includes(searchQuery.toLowerCase()); return memberSearchQuery.toLowerCase()?.includes(searchQuery.toLowerCase());
}); });
return searchedWorkspaceMemberIds; return searchedWorkspaceMemberIds;