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.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">
{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
? `Request new code in ${resendTimerCode}s`
: isRequestingNewCode
? "Requesting new code"
: "Request new code"}
? "Requesting new code"
: "Request new code"}
</button>
</div>
</div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,15 @@ import { observer } from "mobx-react-lite";
import { Spinner } from "@plane/ui";
import { CalendarHeader, CalendarWeekDays, CalendarWeekHeader } from "components/issues";
// 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";
// constants
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 { ToggleSwitch } from "@plane/ui";
// types
import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOptions, TCalendarLayouts, TIssueKanbanFilters } from "@plane/types";
import {
IIssueDisplayFilterOptions,
IIssueDisplayProperties,
IIssueFilterOptions,
TCalendarLayouts,
TIssueKanbanFilters,
} from "@plane/types";
// constants
import { CALENDAR_LAYOUTS } from "constants/calendar";
import { EIssueFilterType } from "constants/issue";

View File

@ -12,9 +12,9 @@ import { useIssues } from "hooks/store";
export const ModuleCalendarLayout: React.FC = observer(() => {
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;

View File

@ -5,4 +5,4 @@ import { EIssuesStoreType } from "constants/issue";
// components
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] || [];
if (kanbanFilters.includes(value)) kanbanFilters = kanbanFilters.filter((_value) => _value != value);
else kanbanFilters.push(value);
updateFilters(
projectId.toString(),
EIssueFilterType.KANBAN_FILTERS,
{
[toggle]: kanbanFilters,
}
);
updateFilters(projectId.toString(), EIssueFilterType.KANBAN_FILTERS, {
[toggle]: kanbanFilters,
});
}
};

View File

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

View File

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

View File

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

View File

@ -57,13 +57,13 @@ export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
const handleDisplayFiltersUpdate = useCallback(
(updatedDisplayFilter: Partial<IIssueDisplayFilterOptions>) => {
if ( !projectId) return;
if (!projectId) return;
updateFilters(projectId.toString(), EIssueFilterType.DISPLAY_FILTERS, {
...updatedDisplayFilter,
});
},
[ projectId, updateFilters]
[projectId, updateFilters]
);
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
? "0 Issue"
: moduleTotalIssues === moduleDetails.completed_issues
? `${moduleTotalIssues} Issue${moduleTotalIssues > 1 ? "s" : ""}`
: `${moduleDetails.completed_issues}/${moduleTotalIssues} Issues`
? `${moduleTotalIssues} Issue${moduleTotalIssues > 1 ? "s" : ""}`
: `${moduleDetails.completed_issues}/${moduleTotalIssues} Issues`
: "0 Issue";
return (

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,13 +41,16 @@ export const groupReactions: (reactions: any[], key: string) => { [key: string]:
reactions: any,
key: string
) => {
const groupedReactions = reactions.reduce((acc: any, reaction: any) => {
if (!acc[reaction[key]]) {
acc[reaction[key]] = [];
}
acc[reaction[key]].push(reaction);
return acc;
}, {} as { [key: string]: any[] });
const groupedReactions = reactions.reduce(
(acc: any, reaction: any) => {
if (!acc[reaction[key]]) {
acc[reaction[key]] = [];
}
acc[reaction[key]].push(reaction);
return acc;
},
{} as { [key: string]: any[] }
);
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,
}));
export function getChangedIssuefields(formData: Partial<TIssue>, dirtyFields: { [key: string]: boolean | undefined }) {
const changedFields: Partial<TIssue> = {};
export function getChangedIssuefields(
formData: Partial<TIssue>,
dirtyFields: { [key: string]: boolean | undefined }
) {
const changedFields: Partial<TIssue> = {};
const dirtyFieldKeys = Object.keys(dirtyFields) as (keyof TIssue)[];
for (const dirtyField of dirtyFieldKeys) {
if (!!dirtyFields[dirtyField]) {
changedFields[dirtyField] = formData[dirtyField];
}
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 />
<main className="relative flex h-full w-full flex-col overflow-hidden bg-custom-background-100">
{header}
<div className="h-full w-full overflow-x-hidden overflow-y-scroll">
{children}
</div>
<div className="h-full w-full overflow-x-hidden overflow-y-scroll">{children}</div>
</main>
</div>
</UserAuthWrapper>

View File

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

View File

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