diff --git a/web/components/analytics/custom-analytics/sidebar.tsx b/web/components/analytics/custom-analytics/sidebar.tsx index 6189f325b..787fa79bd 100644 --- a/web/components/analytics/custom-analytics/sidebar.tsx +++ b/web/components/analytics/custom-analytics/sidebar.tsx @@ -7,19 +7,14 @@ import analyticsService from "services/analytics.service"; import projectService from "services/project.service"; import cyclesService from "services/cycles.service"; import modulesService from "services/modules.service"; -import trackEventServices from "services/track-event.service"; +import trackEventServices from "services/track_event.service"; // hooks import useProjects from "hooks/use-projects"; import useToast from "hooks/use-toast"; // ui import { PrimaryButton, SecondaryButton } from "components/ui"; // icons -import { - ArrowDownTrayIcon, - ArrowPathIcon, - CalendarDaysIcon, - UserGroupIcon, -} from "@heroicons/react/24/outline"; +import { ArrowDownTrayIcon, ArrowPathIcon, CalendarDaysIcon, UserGroupIcon } from "@heroicons/react/24/outline"; import { ContrastIcon, LayerDiagonalIcon } from "components/icons"; // helpers import { renderShortDate } from "helpers/date-time.helper"; @@ -46,13 +41,7 @@ type Props = { user: ICurrentUserResponse | undefined; }; -export const AnalyticsSidebar: React.FC = ({ - analytics, - params, - fullScreen, - isProjectLevel = false, - user, -}) => { +export const AnalyticsSidebar: React.FC = ({ analytics, params, fullScreen, isProjectLevel = false, user }) => { const router = useRouter(); const { workspaceSlug, projectId, cycleId, moduleId } = router.query; @@ -61,9 +50,7 @@ export const AnalyticsSidebar: React.FC = ({ const { setToastAlert } = useToast(); const { data: projectDetails } = useSWR( - workspaceSlug && projectId && !(cycleId || moduleId) - ? PROJECT_DETAILS(projectId.toString()) - : null, + workspaceSlug && projectId && !(cycleId || moduleId) ? PROJECT_DETAILS(projectId.toString()) : null, workspaceSlug && projectId && !(cycleId || moduleId) ? () => projectService.getProject(workspaceSlug.toString(), projectId.toString()) : null @@ -72,24 +59,14 @@ export const AnalyticsSidebar: React.FC = ({ const { data: cycleDetails } = useSWR( workspaceSlug && projectId && cycleId ? CYCLE_DETAILS(cycleId.toString()) : null, workspaceSlug && projectId && cycleId - ? () => - cyclesService.getCycleDetails( - workspaceSlug.toString(), - projectId.toString(), - cycleId.toString() - ) + ? () => cyclesService.getCycleDetails(workspaceSlug.toString(), projectId.toString(), cycleId.toString()) : null ); const { data: moduleDetails } = useSWR( workspaceSlug && projectId && moduleId ? MODULE_DETAILS(moduleId.toString()) : null, workspaceSlug && projectId && moduleId - ? () => - modulesService.getModuleDetails( - workspaceSlug.toString(), - projectId.toString(), - moduleId.toString() - ) + ? () => modulesService.getModuleDetails(workspaceSlug.toString(), projectId.toString(), moduleId.toString()) : null ); @@ -178,8 +155,7 @@ export const AnalyticsSidebar: React.FC = ({ ); }; - const selectedProjects = - params.project && params.project.length > 0 ? params.project : projects?.map((p) => p.id); + const selectedProjects = params.project && params.project.length > 0 ? params.project : projects?.map((p) => p.id); return (
= ({ )}

{truncateText(project.name, 20)}

- - ({project.identifier}) - + ({project.identifier})
@@ -344,10 +318,7 @@ export const AnalyticsSidebar: React.FC = ({
Network
- - {NETWORK_CHOICES.find((n) => n.key === projectDetails?.network)?.label ?? - ""} - + {NETWORK_CHOICES.find((n) => n.key === projectDetails?.network)?.label ?? ""}
diff --git a/web/components/analytics/project-modal.tsx b/web/components/analytics/project-modal.tsx index d8bb841f7..356af9168 100644 --- a/web/components/analytics/project-modal.tsx +++ b/web/components/analytics/project-modal.tsx @@ -13,15 +13,11 @@ import analyticsService from "services/analytics.service"; import projectService from "services/project.service"; import cyclesService from "services/cycles.service"; import modulesService from "services/modules.service"; -import trackEventServices from "services/track-event.service"; +import trackEventServices from "services/track_event.service"; // components import { CustomAnalytics, ScopeAndDemand } from "components/analytics"; // icons -import { - ArrowsPointingInIcon, - ArrowsPointingOutIcon, - XMarkIcon, -} from "@heroicons/react/24/outline"; +import { ArrowsPointingInIcon, ArrowsPointingOutIcon, XMarkIcon } from "@heroicons/react/24/outline"; // types import { IAnalyticsParams, IWorkspace } from "types"; // fetch-keys @@ -67,9 +63,7 @@ export const AnalyticsProjectModal: React.FC = ({ isOpen, onClose }) => { ); const { data: projectDetails } = useSWR( - workspaceSlug && projectId && !(cycleId || moduleId) - ? PROJECT_DETAILS(projectId.toString()) - : null, + workspaceSlug && projectId && !(cycleId || moduleId) ? PROJECT_DETAILS(projectId.toString()) : null, workspaceSlug && projectId && !(cycleId || moduleId) ? () => projectService.getProject(workspaceSlug.toString(), projectId.toString()) : null @@ -78,24 +72,14 @@ export const AnalyticsProjectModal: React.FC = ({ isOpen, onClose }) => { const { data: cycleDetails } = useSWR( workspaceSlug && projectId && cycleId ? CYCLE_DETAILS(cycleId.toString()) : null, workspaceSlug && projectId && cycleId - ? () => - cyclesService.getCycleDetails( - workspaceSlug.toString(), - projectId.toString(), - cycleId.toString() - ) + ? () => cyclesService.getCycleDetails(workspaceSlug.toString(), projectId.toString(), cycleId.toString()) : null ); const { data: moduleDetails } = useSWR( workspaceSlug && projectId && moduleId ? MODULE_DETAILS(moduleId.toString()) : null, workspaceSlug && projectId && moduleId - ? () => - modulesService.getModuleDetails( - workspaceSlug.toString(), - projectId.toString(), - moduleId.toString() - ) + ? () => modulesService.getModuleDetails(workspaceSlug.toString(), projectId.toString(), moduleId.toString()) : null ); @@ -134,8 +118,7 @@ export const AnalyticsProjectModal: React.FC = ({ isOpen, onClose }) => { eventPayload.moduleName = moduleDetails.name; } - const eventType = - tab === "Scope and Demand" ? "SCOPE_AND_DEMAND_ANALYTICS" : "CUSTOM_ANALYTICS"; + const eventType = tab === "Scope and Demand" ? "SCOPE_AND_DEMAND_ANALYTICS" : "CUSTOM_ANALYTICS"; trackEventServices.trackAnalyticsEvent( eventPayload, @@ -150,9 +133,9 @@ export const AnalyticsProjectModal: React.FC = ({ isOpen, onClose }) => { return (
= ({ isOpen, onClose }) => { >

- Analytics for{" "} - {cycleId ? cycleDetails?.name : moduleId ? moduleDetails?.name : projectDetails?.name} + Analytics for {cycleId ? cycleDetails?.name : moduleId ? moduleDetails?.name : projectDetails?.name}

-
+
{properties.priority && ( = ({ const router = useRouter(); const { workspaceSlug, projectId, cycleId, moduleId, viewId } = router.query; - const { calendarIssues, mutateIssues, params, displayFilters, setDisplayFilters } = - useCalendarIssuesView(); + const { calendarIssues, mutateIssues, params, displayFilters, setDisplayFilters } = useCalendarIssuesView(); const totalDate = eachDayOfInterval({ start: calendarDates.startDate, @@ -80,8 +73,7 @@ export const CalendarView: React.FC = ({ const filterIssue = calendarIssues.length > 0 ? calendarIssues.filter( - (issue) => - issue.target_date && renderDateFormat(issue.target_date) === renderDateFormat(date) + (issue) => issue.target_date && renderDateFormat(issue.target_date) === renderDateFormat(date) ) : []; return { @@ -155,18 +147,16 @@ export const CalendarView: React.FC = ({ }); setDisplayFilters({ - calendar_date_range: `${renderDateFormat(startDate)};after,${renderDateFormat( - endDate - )};before`, + calendar_date_range: `${renderDateFormat(startDate)};after,${renderDateFormat(endDate)};before`, }); }; useEffect(() => { if (!displayFilters || displayFilters.calendar_date_range === "") setDisplayFilters({ - calendar_date_range: `${renderDateFormat( - startOfWeek(currentDate) - )};after,${renderDateFormat(lastDayOfWeek(currentDate))};before`, + calendar_date_range: `${renderDateFormat(startOfWeek(currentDate))};after,${renderDateFormat( + lastDayOfWeek(currentDate) + )};before`, }); }, [currentDate, displayFilters, setDisplayFilters]); @@ -214,11 +204,7 @@ export const CalendarView: React.FC = ({ : "" }`} > - - {isMonthlyView - ? formatDate(date, "eee").substring(0, 3) - : formatDate(date, "eee")} - + {isMonthlyView ? formatDate(date, "eee").substring(0, 3) : formatDate(date, "eee")} {!isMonthlyView && {formatDate(date, "d")}}
))} diff --git a/web/components/core/views/calendar-view/single-issue.tsx b/web/components/core/views/calendar-view/single-issue.tsx index 3db571c99..92e2691c6 100644 --- a/web/components/core/views/calendar-view/single-issue.tsx +++ b/web/components/core/views/calendar-view/single-issue.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // react-beautiful-dnd import { DraggableProvided, DraggableStateSnapshot } from "react-beautiful-dnd"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useCalendarIssuesView from "hooks/use-calendar-issues-view"; import useIssuesProperties from "hooks/use-issue-properties"; @@ -122,13 +122,7 @@ export const SingleCalendarIssue: React.FC = ({ } issuesService - .patchIssue( - workspaceSlug as string, - projectId as string, - issue.id as string, - formData, - user - ) + .patchIssue(workspaceSlug as string, projectId as string, issue.id as string, formData, user) .then(() => { mutate(fetchKey); }) @@ -140,11 +134,8 @@ export const SingleCalendarIssue: React.FC = ({ ); const handleCopyText = () => { - const originURL = - typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; - copyTextToClipboard( - `${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}` - ).then(() => { + const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; + copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}`).then(() => { setToastAlert({ type: "success", title: "Link Copied!", @@ -153,9 +144,7 @@ export const SingleCalendarIssue: React.FC = ({ }); }; - const displayProperties = properties - ? Object.values(properties).some((value) => value === true) - : false; + const displayProperties = properties ? Object.values(properties).some((value) => value === true) : false; const openPeekOverview = () => { const { query } = router; diff --git a/web/components/core/views/issues-view.tsx b/web/components/core/views/issues-view.tsx index 55eefc396..6b6e1c909 100644 --- a/web/components/core/views/issues-view.tsx +++ b/web/components/core/views/issues-view.tsx @@ -7,10 +7,10 @@ import useSWR, { mutate } from "swr"; // react-beautiful-dnd import { DropResult } from "react-beautiful-dnd"; // services -import issuesService from "services/issues.service"; -import stateService from "services/state.service"; +import issuesService from "services/issue.service"; +import stateService from "services/project_state.service"; import modulesService from "services/modules.service"; -import trackEventServices from "services/track-event.service"; +import trackEventServices from "services/track_event.service"; // hooks import useToast from "hooks/use-toast"; import useIssuesView from "hooks/use-issues-view"; @@ -51,10 +51,7 @@ type Props = { disableUserActions?: boolean; }; -export const IssuesView: React.FC = ({ - openIssuesListModal, - disableUserActions = false, -}) => { +export const IssuesView: React.FC = ({ openIssuesListModal, disableUserActions = false }) => { // create issue modal const [createIssueModal, setCreateIssueModal] = useState(false); const [createViewModal, setCreateViewModal] = useState(null); @@ -64,9 +61,7 @@ export const IssuesView: React.FC = ({ // update issue modal const [editIssueModal, setEditIssueModal] = useState(false); - const [issueToEdit, setIssueToEdit] = useState< - (IIssue & { actionType: "edit" | "delete" }) | undefined - >(undefined); + const [issueToEdit, setIssueToEdit] = useState<(IIssue & { actionType: "edit" | "delete" }) | undefined>(undefined); // delete issue modal const [deleteIssueModal, setDeleteIssueModal] = useState(false); @@ -87,15 +82,12 @@ export const IssuesView: React.FC = ({ const { setToastAlert } = useToast(); - const { groupedByIssues, mutateIssues, displayFilters, filters, isEmpty, setFilters, params } = - useIssuesView(); + const { groupedByIssues, mutateIssues, displayFilters, filters, isEmpty, setFilters, params } = useIssuesView(); const [properties] = useIssuesProperties(workspaceSlug as string, projectId as string); const { data: stateGroups } = useSWR( workspaceSlug && projectId ? STATES_LIST(projectId as string) : null, - workspaceSlug - ? () => stateService.getStates(workspaceSlug as string, projectId as string) - : null + workspaceSlug ? () => stateService.getStates(workspaceSlug as string, projectId as string) : null ); const states = getStatesList(stateGroups); @@ -141,12 +133,10 @@ export const IssuesView: React.FC = ({ // check if dropping in the same group if (source.droppableId === destination.droppableId) { // check if dropping at beginning - if (destination.index === 0) - newSortOrder = destinationGroupArray[0].sort_order - 10000; + if (destination.index === 0) newSortOrder = destinationGroupArray[0].sort_order - 10000; // check if dropping at last else if (destination.index === destinationGroupArray.length - 1) - newSortOrder = - destinationGroupArray[destinationGroupArray.length - 1].sort_order + 10000; + newSortOrder = destinationGroupArray[destinationGroupArray.length - 1].sort_order + 10000; else { if (destination.index > source.index) newSortOrder = @@ -161,12 +151,10 @@ export const IssuesView: React.FC = ({ } } else { // check if dropping at beginning - if (destination.index === 0) - newSortOrder = destinationGroupArray[0].sort_order - 10000; + if (destination.index === 0) newSortOrder = destinationGroupArray[0].sort_order - 10000; // check if dropping at last else if (destination.index === destinationGroupArray.length) - newSortOrder = - destinationGroupArray[destinationGroupArray.length - 1].sort_order + 10000; + newSortOrder = destinationGroupArray[destinationGroupArray.length - 1].sort_order + 10000; else newSortOrder = (destinationGroupArray[destination.index - 1].sort_order + @@ -180,18 +168,14 @@ export const IssuesView: React.FC = ({ const destinationGroup = destination.droppableId; // destination group id - if ( - displayFilters.order_by === "sort_order" || - source.droppableId !== destination.droppableId - ) { + if (displayFilters.order_by === "sort_order" || source.droppableId !== destination.droppableId) { // different group/column; // source.droppableId !== destination.droppableId -> even if order by is not sort_order, // if the issue is moved to a different group, then we will change the group of the // dragged item(or issue) - if (displayFilters.group_by === "priority") - draggedItem.priority = destinationGroup as TIssuePriorities; + if (displayFilters.group_by === "priority") draggedItem.priority = destinationGroup as TIssuePriorities; else if (displayFilters.group_by === "state") { draggedItem.state = destinationGroup; draggedItem.state_detail = states?.find((s) => s.id === destinationGroup) as IState; @@ -219,14 +203,8 @@ export const IssuesView: React.FC = ({ return { ...prevData, - [sourceGroup]: orderArrayBy( - sourceGroupArray, - displayFilters.order_by ?? "-created_at" - ), - [destinationGroup]: orderArrayBy( - destinationGroupArray, - displayFilters.order_by ?? "-created_at" - ), + [sourceGroup]: orderArrayBy(sourceGroupArray, displayFilters.order_by ?? "-created_at"), + [destinationGroup]: orderArrayBy(destinationGroupArray, displayFilters.order_by ?? "-created_at"), }; }, false @@ -246,14 +224,9 @@ export const IssuesView: React.FC = ({ user ) .then((response) => { - const sourceStateBeforeDrag = states?.find( - (state) => state.name === source.droppableId - ); + const sourceStateBeforeDrag = states?.find((state) => state.name === source.droppableId); - if ( - sourceStateBeforeDrag?.group !== "completed" && - response?.state_detail?.group === "completed" - ) + if (sourceStateBeforeDrag?.group !== "completed" && response?.state_detail?.group === "completed") trackEventServices.trackIssueMarkedAsDoneEvent( { workspaceSlug, @@ -387,12 +360,7 @@ export const IssuesView: React.FC = ({ ); issuesService - .removeIssueFromCycle( - workspaceSlug as string, - projectId as string, - cycleId as string, - bridgeId - ) + .removeIssueFromCycle(workspaceSlug as string, projectId as string, cycleId as string, bridgeId) .then(() => { setToastAlert({ title: "Success", @@ -430,12 +398,7 @@ export const IssuesView: React.FC = ({ ); modulesService - .removeIssueFromModule( - workspaceSlug as string, - projectId as string, - moduleId as string, - bridgeId - ) + .removeIssueFromModule(workspaceSlug as string, projectId as string, moduleId as string, bridgeId) .then(() => { setToastAlert({ title: "Success", @@ -450,12 +413,9 @@ export const IssuesView: React.FC = ({ [displayFilters.group_by, workspaceSlug, projectId, moduleId, params, setToastAlert] ); - const nullFilters = Object.keys(filters).filter( - (key) => filters[key as keyof IIssueFilterOptions] === null - ); + const nullFilters = Object.keys(filters).filter((key) => filters[key as keyof IIssueFilterOptions] === null); - const areFiltersApplied = - Object.keys(filters).length > 0 && nullFilters.length !== Object.keys(filters).length; + const areFiltersApplied = Object.keys(filters).length > 0 && nullFilters.length !== Object.keys(filters).length; return ( <> @@ -581,10 +541,7 @@ export const IssuesView: React.FC = ({ : undefined, secondaryButton: cycleId || moduleId ? ( - {})} - > + {})}> Add an existing issue diff --git a/web/components/core/views/list-view/single-issue.tsx b/web/components/core/views/list-view/single-issue.tsx index 943916d34..2e88af8d8 100644 --- a/web/components/core/views/list-view/single-issue.tsx +++ b/web/components/core/views/list-view/single-issue.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import { mutate } from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useToast from "hooks/use-toast"; // components @@ -45,12 +45,7 @@ import { UserAuth, } from "types"; // fetch-keys -import { - CYCLE_DETAILS, - MODULE_DETAILS, - SUB_ISSUES, - USER_PROFILE_PROJECT_SEGREGATION, -} from "constants/fetch-keys"; +import { CYCLE_DETAILS, MODULE_DETAILS, SUB_ISSUES, USER_PROFILE_PROJECT_SEGREGATION } from "constants/fetch-keys"; type Props = { type?: string; @@ -140,39 +135,24 @@ export const SingleListIssue: React.FC = ({ ); } - issuesService - .patchIssue(workspaceSlug as string, issue.project, issue.id, formData, user) - .then(() => { - mutateIssues(); + issuesService.patchIssue(workspaceSlug as string, issue.project, issue.id, formData, user).then(() => { + mutateIssues(); - if (userId) - mutate( - USER_PROFILE_PROJECT_SEGREGATION(workspaceSlug.toString(), userId.toString()) - ); + if (userId) + mutate( + USER_PROFILE_PROJECT_SEGREGATION(workspaceSlug.toString(), userId.toString()) + ); - if (cycleId) mutate(CYCLE_DETAILS(cycleId as string)); - if (moduleId) mutate(MODULE_DETAILS(moduleId as string)); - }); + if (cycleId) mutate(CYCLE_DETAILS(cycleId as string)); + if (moduleId) mutate(MODULE_DETAILS(moduleId as string)); + }); }, - [ - displayFilters, - workspaceSlug, - cycleId, - moduleId, - userId, - groupTitle, - index, - mutateIssues, - user, - ] + [displayFilters, workspaceSlug, cycleId, moduleId, userId, groupTitle, index, mutateIssues, user] ); const handleCopyText = () => { - const originURL = - typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; - copyTextToClipboard( - `${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}` - ).then(() => { + const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; + copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}`).then(() => { setToastAlert({ type: "success", title: "Link Copied!", @@ -197,8 +177,7 @@ export const SingleListIssue: React.FC = ({ }); }; - const isNotAllowed = - userAuth.isGuest || userAuth.isViewer || disableUserActions || isArchivedIssues; + const isNotAllowed = userAuth.isGuest || userAuth.isViewer || disableUserActions || isArchivedIssues; console.log("properties", properties); @@ -243,9 +222,7 @@ export const SingleListIssue: React.FC = ({ Copy issue link - - Open issue in new tab - + Open issue in new tab )} @@ -286,11 +263,7 @@ export const SingleListIssue: React.FC = ({
-
+
{properties.priority && ( = ({ const { data: issueLabels } = useSWR( workspaceSlug && projectId ? PROJECT_ISSUE_LABELS(projectId as string) : null, - workspaceSlug && projectId - ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) : null ); const { data: members } = useSWR( @@ -120,12 +118,7 @@ export const SingleList: React.FC = ({ switch (displayFilters?.group_by) { case "state": icon = currentState && ( - + ); break; case "state_detail.group": @@ -152,14 +145,8 @@ export const SingleList: React.FC = ({ : null); break; case "labels": - const labelColor = - issueLabels?.find((label) => label.id === groupTitle)?.color ?? "#000000"; - icon = ( - - ); + const labelColor = issueLabels?.find((label) => label.id === groupTitle)?.color ?? "#000000"; + icon = ; break; case "assignees": case "created_by": @@ -181,9 +168,7 @@ export const SingleList: React.FC = ({
- {displayFilters?.group_by !== null && ( -
{getGroupIcon()}
- )} + {displayFilters?.group_by !== null &&
{getGroupIcon()}
} {displayFilters?.group_by !== null ? (

= ({ > Create new {openIssuesListModal && ( - - Add an existing issue - + Add an existing issue )} )} @@ -256,19 +239,14 @@ export const SingleList: React.FC = ({ makeIssueCopy={() => handleIssueAction(issue, "copy")} handleDeleteIssue={() => handleIssueAction(issue, "delete")} handleDraftIssueSelect={ - handleDraftIssueAction - ? () => handleDraftIssueAction(issue, "edit") - : undefined + handleDraftIssueAction ? () => handleDraftIssueAction(issue, "edit") : undefined } handleDraftIssueDelete={ - handleDraftIssueAction - ? () => handleDraftIssueAction(issue, "delete") - : undefined + handleDraftIssueAction ? () => handleDraftIssueAction(issue, "delete") : undefined } handleMyIssueOpen={handleMyIssueOpen} removeIssue={() => { - if (removeIssue !== null && issue.bridge_id) - removeIssue(issue.bridge_id, issue.id); + if (removeIssue !== null && issue.bridge_id) removeIssue(issue.bridge_id, issue.id); }} disableUserActions={disableUserActions} user={user} @@ -277,9 +255,7 @@ export const SingleList: React.FC = ({ /> )) ) : ( -

- No issues. -

+

No issues.

) ) : (
Loading...
diff --git a/web/components/core/views/spreadsheet-view/single-issue.tsx b/web/components/core/views/spreadsheet-view/single-issue.tsx index 731d7f921..c4519d2dc 100644 --- a/web/components/core/views/spreadsheet-view/single-issue.tsx +++ b/web/components/core/views/spreadsheet-view/single-issue.tsx @@ -17,17 +17,12 @@ import { import { Popover2 } from "@blueprintjs/popover2"; // icons import { Icon } from "components/ui"; -import { - EllipsisHorizontalIcon, - LinkIcon, - PencilIcon, - TrashIcon, -} from "@heroicons/react/24/outline"; +import { EllipsisHorizontalIcon, LinkIcon, PencilIcon, TrashIcon } from "@heroicons/react/24/outline"; // hooks import useSpreadsheetIssuesView from "hooks/use-spreadsheet-issues-view"; import useToast from "hooks/use-toast"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // constant import { CYCLE_DETAILS, @@ -133,13 +128,7 @@ export const SingleSpreadsheetIssue: React.FC = ({ ); issuesService - .patchIssue( - workspaceSlug as string, - projectId as string, - issue.id as string, - formData, - user - ) + .patchIssue(workspaceSlug as string, projectId as string, issue.id as string, formData, user) .then(() => { if (issue.parent) { mutate(SUB_ISSUES(issue.parent as string)); @@ -167,11 +156,8 @@ export const SingleSpreadsheetIssue: React.FC = ({ }; const handleCopyText = () => { - const originURL = - typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; - copyTextToClipboard( - `${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}` - ).then(() => { + const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; + copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}`).then(() => { setToastAlert({ type: "success", title: "Link Copied!", diff --git a/web/components/estimates/create-update-estimate-modal.tsx b/web/components/estimates/create-update-estimate-modal.tsx index c1dfab86f..1242742d4 100644 --- a/web/components/estimates/create-update-estimate-modal.tsx +++ b/web/components/estimates/create-update-estimate-modal.tsx @@ -9,7 +9,7 @@ import { useForm } from "react-hook-form"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // services -import estimatesService from "services/estimates.service"; +import estimatesService from "services/project_estimates.service"; // hooks import useToast from "hooks/use-toast"; // ui @@ -119,13 +119,7 @@ export const CreateUpdateEstimateModal: React.FC = ({ handleClose, data, ); await estimatesService - .patchEstimate( - workspaceSlug as string, - projectId as string, - data?.id as string, - payload, - user - ) + .patchEstimate(workspaceSlug as string, projectId as string, data?.id as string, payload, user) .then(() => { mutate(ESTIMATES_LIST(projectId.toString())); mutate(ESTIMATE_DETAILS(data.id)); @@ -257,9 +251,7 @@ export const CreateUpdateEstimateModal: React.FC = ({ handleClose, data,
-
- {data ? "Update" : "Create"} Estimate -
+
{data ? "Update" : "Create"} Estimate
void; }; -export const Exporter: React.FC = ({ - isOpen, - handleClose, - user, - provider, - mutateServices, -}) => { +const cvsService = new CSVIntegrationService(); + +export const Exporter: React.FC = ({ isOpen, handleClose, user, provider, mutateServices }) => { const [exportLoading, setExportLoading] = useState(false); const router = useRouter(); const { workspaceSlug } = router.query; @@ -60,7 +55,8 @@ export const Exporter: React.FC = ({ project: value, multiple: multiple, }; - await CSVIntegrationService.exportCSVService(workspaceSlug as string, payload, user) + await cvsService + .exportCSVService(workspaceSlug as string, payload, user) .then(() => { mutateServices(); router.push(`/${workspaceSlug}/settings/exports`); @@ -69,13 +65,7 @@ export const Exporter: React.FC = ({ type: "success", title: "Export Successful", message: `You will be able to download the exported ${ - provider === "csv" - ? "CSV" - : provider === "xlsx" - ? "Excel" - : provider === "json" - ? "JSON" - : "" + provider === "csv" ? "CSV" : provider === "xlsx" ? "Excel" : provider === "json" ? "JSON" : "" } from the previous export.`, }); }) @@ -122,13 +112,7 @@ export const Exporter: React.FC = ({

Export to{" "} - {provider === "csv" - ? "CSV" - : provider === "xlsx" - ? "Excel" - : provider === "json" - ? "JSON" - : ""} + {provider === "csv" ? "CSV" : provider === "xlsx" ? "Excel" : provider === "json" ? "JSON" : ""}

@@ -155,22 +139,12 @@ export const Exporter: React.FC = ({ onClick={() => setMultiple(!multiple)} className="flex items-center gap-2 max-w-min cursor-pointer" > - setMultiple(!multiple)} - /> -
- Export the data into separate files -
+ setMultiple(!multiple)} /> +
Export the data into separate files
Cancel - + {exportLoading ? "Exporting..." : "Export"}
diff --git a/web/components/exporter/guide.tsx b/web/components/exporter/guide.tsx index 2643a07cf..553c7c19b 100644 --- a/web/components/exporter/guide.tsx +++ b/web/components/exporter/guide.tsx @@ -9,7 +9,7 @@ import useSWR, { mutate } from "swr"; // hooks import useUserAuth from "hooks/use-user-auth"; // services -import IntegrationService from "services/integration"; +import IntegrationService from "services/integration.service"; // components import { Exporter, SingleExport } from "components/exporter"; // ui @@ -32,9 +32,7 @@ const IntegrationGuide = () => { const { user } = useUserAuth(); const { data: exporterServices } = useSWR( - workspaceSlug && cursor - ? EXPORT_SERVICES_LIST(workspaceSlug as string, cursor, `${per_page}`) - : null, + workspaceSlug && cursor ? EXPORT_SERVICES_LIST(workspaceSlug as string, cursor, `${per_page}`) : null, workspaceSlug && cursor ? () => IntegrationService.getExportsServicesList(workspaceSlug as string, cursor, per_page) : null @@ -57,20 +55,11 @@ const IntegrationGuide = () => {
- {`${service.title} + {`${service.title}
-

- {service.title} -

-

- {service.description} -

+

{service.title}

+

{service.description}

@@ -96,9 +85,9 @@ const IntegrationGuide = () => { className="flex flex-shrink-0 items-center gap-1 rounded bg-custom-background-80 py-1 px-1.5 text-xs outline-none" onClick={() => { setRefreshing(true); - mutate( - EXPORT_SERVICES_LIST(workspaceSlug as string, `${cursor}`, `${per_page}`) - ).then(() => setRefreshing(false)); + mutate(EXPORT_SERVICES_LIST(workspaceSlug as string, `${cursor}`, `${per_page}`)).then(() => + setRefreshing(false) + ); }} > {" "} @@ -108,9 +97,7 @@ const IntegrationGuide = () => {
) : ( -

- No previous export available. -

+

No previous export available.

) ) : ( @@ -169,9 +152,7 @@ const IntegrationGuide = () => { data={null} user={user} provider={provider} - mutateServices={() => - mutate(EXPORT_SERVICES_LIST(workspaceSlug as string, `${cursor}`, `${per_page}`)) - } + mutateServices={() => mutate(EXPORT_SERVICES_LIST(workspaceSlug as string, `${cursor}`, `${per_page}`))} /> )}
diff --git a/web/components/gantt-chart/hooks/block-update.tsx b/web/components/gantt-chart/hooks/block-update.tsx index 68e1f6d12..e1ce642ce 100644 --- a/web/components/gantt-chart/hooks/block-update.tsx +++ b/web/components/gantt-chart/hooks/block-update.tsx @@ -1,7 +1,7 @@ import { KeyedMutator } from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // types import { ICurrentUserResponse, IIssue } from "types"; import { IBlockUpdateData } from "../types"; @@ -34,8 +34,7 @@ export const updateGanttIssue = ( const newPayload: any = { ...payload }; - if (newPayload.sort_order && payload.sort_order) - newPayload.sort_order = payload.sort_order.newSortOrder; + if (newPayload.sort_order && payload.sort_order) newPayload.sort_order = payload.sort_order.newSortOrder; issuesService.patchIssue(workspaceSlug, issue.project, issue.id, newPayload, user); }; diff --git a/web/components/inbox/inbox-issue-activity.tsx b/web/components/inbox/inbox-issue-activity.tsx index dfcbf0262..1e796e16b 100644 --- a/web/components/inbox/inbox-issue-activity.tsx +++ b/web/components/inbox/inbox-issue-activity.tsx @@ -5,7 +5,7 @@ import useSWR, { mutate } from "swr"; // components import { AddComment, IssueActivitySection } from "components/issues"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useUser from "hooks/use-user"; import useToast from "hooks/use-toast"; @@ -25,16 +25,9 @@ export const InboxIssueActivity: React.FC = ({ issueDetails }) => { const { user } = useUser(); const { data: issueActivity, mutate: mutateIssueActivity } = useSWR( + workspaceSlug && projectId && inboxIssueId ? PROJECT_ISSUES_ACTIVITY(inboxIssueId.toString()) : null, workspaceSlug && projectId && inboxIssueId - ? PROJECT_ISSUES_ACTIVITY(inboxIssueId.toString()) - : null, - workspaceSlug && projectId && inboxIssueId - ? () => - issuesService.getIssueActivities( - workspaceSlug.toString(), - projectId.toString(), - inboxIssueId.toString() - ) + ? () => issuesService.getIssueActivities(workspaceSlug.toString(), projectId.toString(), inboxIssueId.toString()) : null ); @@ -42,14 +35,7 @@ export const InboxIssueActivity: React.FC = ({ issueDetails }) => { if (!workspaceSlug || !projectId || !inboxIssueId) return; await issuesService - .patchIssueComment( - workspaceSlug as string, - projectId as string, - inboxIssueId as string, - commentId, - data, - user - ) + .patchIssueComment(workspaceSlug as string, projectId as string, inboxIssueId as string, commentId, data, user) .then(() => mutateIssueActivity()); }; @@ -59,13 +45,7 @@ export const InboxIssueActivity: React.FC = ({ issueDetails }) => { mutateIssueActivity((prevData: any) => prevData?.filter((p: any) => p.id !== commentId), false); await issuesService - .deleteIssueComment( - workspaceSlug as string, - projectId as string, - inboxIssueId as string, - commentId, - user - ) + .deleteIssueComment(workspaceSlug as string, projectId as string, inboxIssueId as string, commentId, user) .then(() => mutateIssueActivity()); }; @@ -73,13 +53,7 @@ export const InboxIssueActivity: React.FC = ({ issueDetails }) => { if (!workspaceSlug || !issueDetails) return; await issuesService - .createIssueComment( - workspaceSlug.toString(), - issueDetails.project, - issueDetails.id, - formData, - user - ) + .createIssueComment(workspaceSlug.toString(), issueDetails.project, issueDetails.id, formData, user) .then(() => { mutate(PROJECT_ISSUES_ACTIVITY(issueDetails.id)); }) diff --git a/web/components/inbox/select-duplicate.tsx b/web/components/inbox/select-duplicate.tsx index 1cc905080..8dbb58faa 100644 --- a/web/components/inbox/select-duplicate.tsx +++ b/web/components/inbox/select-duplicate.tsx @@ -11,7 +11,7 @@ import { Combobox, Dialog, Transition } from "@headlessui/react"; // hooks import useToast from "hooks/use-toast"; // services -import issuesServices from "services/issues.service"; +import issuesServices from "services/issue.service"; // ui import { PrimaryButton, SecondaryButton } from "components/ui"; // icons @@ -39,9 +39,7 @@ export const SelectDuplicateInboxIssueModal: React.FC = (props) => { const { workspaceSlug, projectId, issueId } = router.query; const { data: issues } = useSWR( - workspaceSlug && projectId - ? PROJECT_ISSUES_LIST(workspaceSlug as string, projectId as string) - : null, + workspaceSlug && projectId ? PROJECT_ISSUES_LIST(workspaceSlug as string, projectId as string) : null, workspaceSlug && projectId ? () => issuesServices @@ -71,8 +69,7 @@ export const SelectDuplicateInboxIssueModal: React.FC = (props) => { handleClose(); }; - const filteredIssues = - (query === "" ? issues : issues?.filter((issue) => issue.name.includes(query))) ?? []; + const filteredIssues = (query === "" ? issues : issues?.filter((issue) => issue.name.includes(query))) ?? []; return ( setQuery("")} appear> @@ -128,9 +125,7 @@ export const SelectDuplicateInboxIssueModal: React.FC = (props) => { {filteredIssues.length > 0 ? (
  • {query === "" && ( -

    - Select issue -

    +

    Select issue

    )}
      {filteredIssues.map((issue) => ( @@ -140,9 +135,7 @@ export const SelectDuplicateInboxIssueModal: React.FC = (props) => { value={issue.id} className={({ active, selected }) => `flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-3 py-2 text-custom-text-200 ${ - active || selected - ? "bg-custom-background-80 text-custom-text-100" - : "" + active || selected ? "bg-custom-background-80 text-custom-text-100" : "" } ` } > @@ -154,11 +147,8 @@ export const SelectDuplicateInboxIssueModal: React.FC = (props) => { }} /> - { - issues?.find((i) => i.id === issue.id)?.project_detail - ?.identifier - } - -{issue.sequence_id} + {issues?.find((i) => i.id === issue.id)?.project_detail?.identifier}- + {issue.sequence_id} {issue.name}
  • @@ -171,10 +161,7 @@ export const SelectDuplicateInboxIssueModal: React.FC = (props) => {

    No issues found. Create a new issue with{" "} -
    -                              C
    -                            
    - . +
    C
    .

    )} diff --git a/web/components/integration/delete-import-modal.tsx b/web/components/integration/delete-import-modal.tsx index d869ae2a6..23b956644 100644 --- a/web/components/integration/delete-import-modal.tsx +++ b/web/components/integration/delete-import-modal.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // services -import IntegrationService from "services/integration"; +import IntegrationService from "services/integration.service"; // hooks import useToast from "hooks/use-toast"; // ui @@ -92,10 +92,7 @@ export const DeleteImportModal: React.FC = ({ isOpen, handleClose, data,
    -

    Delete Project

    @@ -104,17 +101,13 @@ export const DeleteImportModal: React.FC = ({ isOpen, handleClose, data,

    Are you sure you want to delete import from{" "} - - {data?.service} - - ? All of the data related to the import will be permanently removed. This - action cannot be undone. + {data?.service} + ? All of the data related to the import will be permanently removed. This action cannot be undone.

    - To confirm, type{" "} - delete import below: + To confirm, type delete import below:

    = ({ isOpen, handleClose, data,
    Cancel - + {deleteLoading ? "Deleting..." : "Delete Project"}
    diff --git a/web/components/integration/github/repo-details.tsx b/web/components/integration/github/repo-details.tsx index 8a9c97193..b53ae2f01 100644 --- a/web/components/integration/github/repo-details.tsx +++ b/web/components/integration/github/repo-details.tsx @@ -7,7 +7,7 @@ import useSWR from "swr"; // react-hook-form import { UseFormSetValue } from "react-hook-form"; // services -import GithubIntegrationService from "services/integration/github.service"; +import GithubIntegrationService from "services/github.service"; // ui import { Loader, PrimaryButton, SecondaryButton } from "components/ui"; // types @@ -22,19 +22,12 @@ type Props = { setValue: UseFormSetValue; }; -export const GithubRepoDetails: FC = ({ - selectedRepo, - handleStepChange, - setUsers, - setValue, -}) => { +export const GithubRepoDetails: FC = ({ selectedRepo, handleStepChange, setUsers, setValue }) => { const router = useRouter(); const { workspaceSlug } = router.query; const { data: repoInfo } = useSWR( - workspaceSlug && selectedRepo - ? GITHUB_REPOSITORY_INFO(workspaceSlug as string, selectedRepo.name) - : null, + workspaceSlug && selectedRepo ? GITHUB_REPOSITORY_INFO(workspaceSlug as string, selectedRepo.name) : null, workspaceSlug && selectedRepo ? () => GithubIntegrationService.getGithubRepoInfo(workspaceSlug as string, { diff --git a/web/components/integration/github/root.tsx b/web/components/integration/github/root.tsx index 2e5d9e0c4..10b5efd76 100644 --- a/web/components/integration/github/root.tsx +++ b/web/components/integration/github/root.tsx @@ -9,8 +9,8 @@ import useSWR, { mutate } from "swr"; // react-hook-form import { useForm } from "react-hook-form"; // services -import IntegrationService from "services/integration"; -import GithubIntegrationService from "services/integration/github.service"; +import IntegrationService from "services/integration.service"; +import GithubIntegrationService from "services/github.service"; // hooks import useToast from "hooks/use-toast"; // components @@ -29,18 +29,9 @@ import GithubLogo from "public/services/github.png"; // types import { ICurrentUserResponse, IGithubRepoCollaborator, IGithubServiceImportFormData } from "types"; // fetch-keys -import { - APP_INTEGRATIONS, - IMPORTER_SERVICES_LIST, - WORKSPACE_INTEGRATIONS, -} from "constants/fetch-keys"; +import { APP_INTEGRATIONS, IMPORTER_SERVICES_LIST, WORKSPACE_INTEGRATIONS } from "constants/fetch-keys"; -export type TIntegrationSteps = - | "import-configure" - | "import-data" - | "repo-details" - | "import-users" - | "import-confirm"; +export type TIntegrationSteps = "import-configure" | "import-data" | "repo-details" | "import-users" | "import-confirm"; export interface IIntegrationData { state: TIntegrationSteps; } @@ -108,21 +99,15 @@ export const GithubImporterRoot: React.FC = ({ user }) => { defaultValues: defaultFormValues, }); - const { data: appIntegrations } = useSWR(APP_INTEGRATIONS, () => - IntegrationService.getAppIntegrationsList() - ); + const { data: appIntegrations } = useSWR(APP_INTEGRATIONS, () => IntegrationService.getAppIntegrationsList()); const { data: workspaceIntegrations } = useSWR( workspaceSlug ? WORKSPACE_INTEGRATIONS(workspaceSlug as string) : null, - workspaceSlug - ? () => IntegrationService.getWorkspaceIntegrationsList(workspaceSlug as string) - : null + workspaceSlug ? () => IntegrationService.getWorkspaceIntegrationsList(workspaceSlug as string) : null ); const activeIntegrationState = () => { - const currentElementIndex = integrationWorkflowData.findIndex( - (i) => i?.key === currentStep?.state - ); + const currentElementIndex = integrationWorkflowData.findIndex((i) => i?.key === currentStep?.state); return currentElementIndex; }; @@ -133,14 +118,11 @@ export const GithubImporterRoot: React.FC = ({ user }) => { // current integration from all the integrations available const integration = - appIntegrations && - appIntegrations.length > 0 && - appIntegrations.find((i) => i.provider === provider); + appIntegrations && appIntegrations.length > 0 && appIntegrations.find((i) => i.provider === provider); // current integration from workspace integrations const workspaceIntegration = - integration && - workspaceIntegrations?.find((i: any) => i.integration_detail.id === integration.id); + integration && workspaceIntegrations?.find((i: any) => i.integration_detail.id === integration.id); const createGithubImporterService = async (formData: TFormValues) => { if (!formData.github || !formData.project) return; @@ -214,9 +196,7 @@ export const GithubImporterRoot: React.FC = ({ user }) => {
    {" "} diff --git a/web/components/integration/guide.tsx b/web/components/integration/guide.tsx index 2ee0e0121..3d8e5d39a 100644 --- a/web/components/integration/guide.tsx +++ b/web/components/integration/guide.tsx @@ -9,14 +9,9 @@ import useSWR, { mutate } from "swr"; // hooks import useUserAuth from "hooks/use-user-auth"; // services -import IntegrationService from "services/integration"; +import IntegrationService from "services/integration.service"; // components -import { - DeleteImportModal, - GithubImporterRoot, - JiraImporterRoot, - SingleImport, -} from "components/integration"; +import { DeleteImportModal, GithubImporterRoot, JiraImporterRoot, SingleImport } from "components/integration"; // ui import { Loader, PrimaryButton } from "components/ui"; // icons @@ -85,18 +80,11 @@ const IntegrationGuide = () => { >
    - {`${service.title} + {`${service.title}

    {service.title}

    -

    - {service.description} -

    +

    {service.description}

    @@ -119,9 +107,7 @@ const IntegrationGuide = () => { className="flex flex-shrink-0 items-center gap-1 rounded bg-custom-background-80 py-1 px-1.5 text-xs outline-none" onClick={() => { setRefreshing(true); - mutate(IMPORTER_SERVICES_LIST(workspaceSlug as string)).then(() => - setRefreshing(false) - ); + mutate(IMPORTER_SERVICES_LIST(workspaceSlug as string)).then(() => setRefreshing(false)); }} > {" "} @@ -145,9 +131,7 @@ const IntegrationGuide = () => {
    ) : ( -

    - No previous imports available. -

    +

    No previous imports available.

    ) ) : ( diff --git a/web/components/integration/jira/jira-project-detail.tsx b/web/components/integration/jira/jira-project-detail.tsx index f651ad89c..edd35231f 100644 --- a/web/components/integration/jira/jira-project-detail.tsx +++ b/web/components/integration/jira/jira-project-detail.tsx @@ -10,7 +10,7 @@ import useSWR from "swr"; import { useFormContext, Controller } from "react-hook-form"; // services -import jiraImporterService from "services/integration/jira.service"; +import jiraImporterService from "services/jira.service"; // fetch keys import { JIRA_IMPORTER_DETAIL } from "constants/fetch-keys"; @@ -157,9 +157,7 @@ export const JiraProjectDetail: React.FC = (props) => { ( - - )} + render={({ field: { value, onChange } }) => } />
    diff --git a/web/components/integration/jira/root.tsx b/web/components/integration/jira/root.tsx index 451c23709..2a4b572ec 100644 --- a/web/components/integration/jira/root.tsx +++ b/web/components/integration/jira/root.tsx @@ -16,7 +16,7 @@ import { ArrowLeftIcon, ListBulletIcon } from "@heroicons/react/24/outline"; import { CogIcon, UsersIcon, CheckIcon } from "components/icons"; // services -import jiraImporterService from "services/integration/jira.service"; +import jiraImporterService from "services/jira.service"; // fetch keys import { IMPORTER_SERVICES_LIST } from "constants/fetch-keys"; @@ -100,9 +100,7 @@ export const JiraImporterRoot: React.FC = ({ user }) => { }; const activeIntegrationState = () => { - const currentElementIndex = integrationWorkflowData.findIndex( - (i) => i?.key === currentStep?.state - ); + const currentElementIndex = integrationWorkflowData.findIndex((i) => i?.key === currentStep?.state); return currentElementIndex; }; @@ -155,9 +153,7 @@ export const JiraImporterRoot: React.FC = ({ user }) => {
    {" "} @@ -174,10 +170,7 @@ export const JiraImporterRoot: React.FC = ({ user }) => {
    {currentStep.state === "import-configure" && } {currentStep.state === "display-import-data" && ( - + )} {currentStep?.state === "import-users" && } {currentStep?.state === "import-confirmation" && } @@ -199,15 +192,9 @@ export const JiraImporterRoot: React.FC = ({ user }) => { )} { - const currentElementIndex = integrationWorkflowData.findIndex( - (i) => i?.key === currentStep?.state - ); + const currentElementIndex = integrationWorkflowData.findIndex((i) => i?.key === currentStep?.state); if (currentElementIndex === integrationWorkflowData.length - 1) { methods.handleSubmit(onSubmit)(); diff --git a/web/components/integration/single-integration-card.tsx b/web/components/integration/single-integration-card.tsx index fab37b0c8..8dbc60bf5 100644 --- a/web/components/integration/single-integration-card.tsx +++ b/web/components/integration/single-integration-card.tsx @@ -6,7 +6,7 @@ import { useRouter } from "next/router"; import useSWR, { mutate } from "swr"; // services -import IntegrationService from "services/integration"; +import IntegrationService from "services/integration.service"; // hooks import useToast from "hooks/use-toast"; import useIntegrationPopup from "hooks/use-integration-popup"; @@ -50,25 +50,17 @@ export const SingleIntegrationCard: React.FC = ({ integration }) => { const { data: workspaceIntegrations } = useSWR( workspaceSlug ? WORKSPACE_INTEGRATIONS(workspaceSlug as string) : null, - () => - workspaceSlug - ? IntegrationService.getWorkspaceIntegrationsList(workspaceSlug as string) - : null + () => (workspaceSlug ? IntegrationService.getWorkspaceIntegrationsList(workspaceSlug as string) : null) ); const handleRemoveIntegration = async () => { if (!workspaceSlug || !integration || !workspaceIntegrations) return; - const workspaceIntegrationId = workspaceIntegrations?.find( - (i) => i.integration === integration.id - )?.id; + const workspaceIntegrationId = workspaceIntegrations?.find((i) => i.integration === integration.id)?.id; setDeletingIntegration(true); - await IntegrationService.deleteWorkspaceIntegration( - workspaceSlug as string, - workspaceIntegrationId ?? "" - ) + await IntegrationService.deleteWorkspaceIntegration(workspaceSlug as string, workspaceIntegrationId ?? "") .then(() => { mutate( WORKSPACE_INTEGRATIONS(workspaceSlug as string), @@ -94,18 +86,13 @@ export const SingleIntegrationCard: React.FC = ({ integration }) => { }); }; - const isInstalled = workspaceIntegrations?.find( - (i: any) => i.integration_detail.id === integration.id - ); + const isInstalled = workspaceIntegrations?.find((i: any) => i.integration_detail.id === integration.id); return (
    - {`${integration.title} + {`${integration.title}

    diff --git a/web/components/integration/slack/select-channel.tsx b/web/components/integration/slack/select-channel.tsx index 712c168df..728b582f1 100644 --- a/web/components/integration/slack/select-channel.tsx +++ b/web/components/integration/slack/select-channel.tsx @@ -4,7 +4,7 @@ import { useRouter } from "next/router"; import useSWR, { mutate } from "swr"; // services -import appinstallationsService from "services/app-installations.service"; +import appinstallationsService from "services/app_installation.service"; // ui import { Loader } from "components/ui"; // hooks @@ -20,8 +20,7 @@ type Props = { }; export const SelectChannel: React.FC = ({ integration }) => { - const [slackChannelAvailabilityToggle, setSlackChannelAvailabilityToggle] = - useState(false); + const [slackChannelAvailabilityToggle, setSlackChannelAvailabilityToggle] = useState(false); const [slackChannel, setSlackChannel] = useState(null); const router = useRouter(); @@ -65,12 +64,7 @@ export const SelectChannel: React.FC = ({ integration }) => { setSlackChannel(null); }); appinstallationsService - .removeSlackChannel( - workspaceSlug as string, - projectId as string, - integration.id as string, - slackChannel?.id - ) + .removeSlackChannel(workspaceSlug as string, projectId as string, integration.id as string, slackChannel?.id) .catch((err) => console.log(err)); }; diff --git a/web/components/issue-layouts/layout-selection.tsx b/web/components/issue-layouts/layout-selection.tsx index 32ae742d8..a6629a2aa 100644 --- a/web/components/issue-layouts/layout-selection.tsx +++ b/web/components/issue-layouts/layout-selection.tsx @@ -7,7 +7,7 @@ import { observer } from "mobx-react-lite"; import { RootStore } from "store/root"; import { useMobxStore } from "lib/mobx/store-provider"; // types and default data -import { TIssueLayouts } from "store/issue-filters"; +import { TIssueLayouts } from "store/issue_filters.legacy"; import { issueFilterVisibilityData } from "store/helpers/issue-data"; export const LayoutSelection = observer(() => { diff --git a/web/components/issues/attachment/attachment-upload.tsx b/web/components/issues/attachment/attachment-upload.tsx index be75f703b..592954afa 100644 --- a/web/components/issues/attachment/attachment-upload.tsx +++ b/web/components/issues/attachment/attachment-upload.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // react-dropzone import { useDropzone } from "react-dropzone"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useToast from "hooks/use-toast"; // types @@ -44,12 +44,7 @@ export const IssueAttachmentUpload: React.FC = ({ disabled = false }) => setIsLoading(true); issuesService - .uploadIssueAttachment( - workspaceSlug as string, - projectId as string, - issueId as string, - formData - ) + .uploadIssueAttachment(workspaceSlug as string, projectId as string, issueId as string, formData) .then((res) => { mutate( ISSUE_ATTACHMENTS(issueId as string), @@ -83,9 +78,7 @@ export const IssueAttachmentUpload: React.FC = ({ disabled = false }) => }); const fileError = - fileRejections.length > 0 - ? `Invalid file type or size (max ${maxFileSize / 1024 / 1024} MB)` - : null; + fileRejections.length > 0 ? `Invalid file type or size (max ${maxFileSize / 1024 / 1024} MB)` : null; return (
    { const { data: attachments } = useSWR( workspaceSlug && projectId && issueId ? ISSUE_ATTACHMENTS(issueId as string) : null, workspaceSlug && projectId && issueId - ? () => - issuesService.getIssueAttachment( - workspaceSlug as string, - projectId as string, - issueId as string - ) + ? () => issuesService.getIssueAttachment(workspaceSlug as string, projectId as string, issueId as string) : null ); @@ -70,14 +65,11 @@ export const IssueAttachments = () => {
    - - {truncateText(`${getFileName(file.attributes.name)}`, 10)} - + {truncateText(`${getFileName(file.attributes.name)}`, 10)} person.member.id === file.updated_by)?.member - .display_name ?? "" + people?.find((person) => person.member.id === file.updated_by)?.member.display_name ?? "" } uploaded on ${renderLongDateFormat(file.updated_at)}`} > diff --git a/web/components/issues/attachment/delete-attachment-modal.tsx b/web/components/issues/attachment/delete-attachment-modal.tsx index 7c0495dd6..62dc3cffe 100644 --- a/web/components/issues/attachment/delete-attachment-modal.tsx +++ b/web/components/issues/attachment/delete-attachment-modal.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useToast from "hooks/use-toast"; // ui @@ -47,12 +47,7 @@ export const DeleteAttachmentModal: React.FC = ({ isOpen, setIsOpen, data ); await issuesService - .deleteIssueAttachment( - workspaceSlug as string, - projectId as string, - issueId as string, - assetId as string - ) + .deleteIssueAttachment(workspaceSlug as string, projectId as string, issueId as string, assetId as string) .then(() => mutate(PROJECT_ISSUES_ACTIVITY(issueId as string))) .catch(() => { setToastAlert({ @@ -94,24 +89,17 @@ export const DeleteAttachmentModal: React.FC = ({ isOpen, setIsOpen, data
    -
    - + Delete Attachment

    Are you sure you want to delete attachment-{" "} - {getFileName(data.attributes.name)}? - This attachment will be permanently removed. This action cannot be - undone. + {getFileName(data.attributes.name)}? This attachment will + be permanently removed. This action cannot be undone.

    diff --git a/web/components/issues/delete-draft-issue-modal.tsx b/web/components/issues/delete-draft-issue-modal.tsx index 6fc4f4218..8928fe51c 100644 --- a/web/components/issues/delete-draft-issue-modal.tsx +++ b/web/components/issues/delete-draft-issue-modal.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // services -import issueServices from "services/issues.service"; +import issueServices from "services/issue.service"; // hooks import useIssuesView from "hooks/use-issues-view"; import useToast from "hooks/use-toast"; @@ -109,10 +109,7 @@ export const DeleteDraftIssueModal: React.FC = (props) => {
    -

    Delete Draft Issue

    @@ -124,8 +121,8 @@ export const DeleteDraftIssueModal: React.FC = (props) => { {data?.project_detail.identifier}-{data?.sequence_id} - {""}? All of the data related to the draft issue will be permanently removed. - This action cannot be undone. + {""}? All of the data related to the draft issue will be permanently removed. This action cannot + be undone.

    diff --git a/web/components/issues/delete-issue-modal.tsx b/web/components/issues/delete-issue-modal.tsx index d76e5ddd2..67e8c88c9 100644 --- a/web/components/issues/delete-issue-modal.tsx +++ b/web/components/issues/delete-issue-modal.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // services -import issueServices from "services/issues.service"; +import issueServices from "services/issue.service"; // hooks import useIssuesView from "hooks/use-issues-view"; import useCalendarIssuesView from "hooks/use-calendar-issues-view"; @@ -37,13 +37,7 @@ type Props = { onSubmit?: () => Promise; }; -export const DeleteIssueModal: React.FC = ({ - isOpen, - handleClose, - data, - user, - onSubmit, -}) => { +export const DeleteIssueModal: React.FC = ({ isOpen, handleClose, data, user, onSubmit }) => { const [isDeleteLoading, setIsDeleteLoading] = useState(false); const router = useRouter(); @@ -82,11 +76,7 @@ export const DeleteIssueModal: React.FC = ({ ? VIEW_ISSUES(viewId.toString(), calendarParams) : PROJECT_ISSUES_LIST_WITH_PARAMS(data.project, calendarParams); - mutate( - calendarFetchKey, - (prevData) => (prevData ?? []).filter((p) => p.id !== data.id), - false - ); + mutate(calendarFetchKey, (prevData) => (prevData ?? []).filter((p) => p.id !== data.id), false); } else if (displayFilters.layout === "spreadsheet") { const spreadsheetFetchKey = cycleId ? CYCLE_ISSUES_WITH_PARAMS(cycleId.toString(), spreadsheetParams) @@ -163,8 +153,7 @@ export const DeleteIssueModal: React.FC = ({ }); }; - const handleIssueDelete = () => - isArchivedIssues ? handleArchivedIssueDeletion() : handleDeletion(); + const handleIssueDelete = () => (isArchivedIssues ? handleArchivedIssueDeletion() : handleDeletion()); return ( @@ -196,10 +185,7 @@ export const DeleteIssueModal: React.FC = ({
    -

    Delete Issue

    @@ -211,8 +197,8 @@ export const DeleteIssueModal: React.FC = ({ {data?.project_detail.identifier}-{data?.sequence_id} - {""}? All of the data related to the issue will be permanently removed. This - action cannot be undone. + {""}? All of the data related to the issue will be permanently removed. This action cannot be + undone.

    diff --git a/web/components/issues/draft-issue-modal.tsx b/web/components/issues/draft-issue-modal.tsx index 3b0664cb8..eafc2a4df 100644 --- a/web/components/issues/draft-issue-modal.tsx +++ b/web/components/issues/draft-issue-modal.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useUser from "hooks/use-user"; import useIssuesView from "hooks/use-issues-view"; @@ -114,8 +114,7 @@ export const CreateUpdateDraftIssueModal: React.FC = ({ return; } - if (prePopulateData && prePopulateData.project) - return setActiveProject(prePopulateData.project); + if (prePopulateData && prePopulateData.project) return setActiveProject(prePopulateData.project); // if data is not present, set active project to the project // in the url. This has the least priority. diff --git a/web/components/issues/main-content.tsx b/web/components/issues/main-content.tsx index b7b154ce2..d4dd636cb 100644 --- a/web/components/issues/main-content.tsx +++ b/web/components/issues/main-content.tsx @@ -4,7 +4,7 @@ import { useRouter } from "next/router"; import useSWR, { mutate } from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useUserAuth from "hooks/use-user-auth"; import useToast from "hooks/use-toast"; @@ -37,11 +37,7 @@ type Props = { uneditable?: boolean; }; -export const IssueMainContent: React.FC = ({ - issueDetails, - submitChanges, - uneditable = false, -}) => { +export const IssueMainContent: React.FC = ({ issueDetails, submitChanges, uneditable = false }) => { const router = useRouter(); const { workspaceSlug, projectId, issueId, archivedIssueId } = router.query; @@ -55,12 +51,7 @@ export const IssueMainContent: React.FC = ({ const { data: siblingIssues } = useSWR( workspaceSlug && projectId && issueDetails?.parent ? SUB_ISSUES(issueDetails.parent) : null, workspaceSlug && projectId && issueDetails?.parent - ? () => - issuesService.subIssues( - workspaceSlug as string, - projectId as string, - issueDetails.parent ?? "" - ) + ? () => issuesService.subIssues(workspaceSlug as string, projectId as string, issueDetails.parent ?? "") : null ); const siblingIssuesList = siblingIssues?.sub_issues.filter((i) => i.id !== issueDetails.id); @@ -68,12 +59,7 @@ export const IssueMainContent: React.FC = ({ const { data: issueActivity, mutate: mutateIssueActivity } = useSWR( workspaceSlug && projectId && issueId ? PROJECT_ISSUES_ACTIVITY(issueId.toString()) : null, workspaceSlug && projectId && issueId - ? () => - issuesService.getIssueActivities( - workspaceSlug.toString(), - projectId.toString(), - issueId.toString() - ) + ? () => issuesService.getIssueActivities(workspaceSlug.toString(), projectId.toString(), issueId.toString()) : null ); @@ -81,14 +67,7 @@ export const IssueMainContent: React.FC = ({ if (!workspaceSlug || !projectId || !issueId) return; await issuesService - .patchIssueComment( - workspaceSlug as string, - projectId as string, - issueId as string, - commentId, - data, - user - ) + .patchIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId, data, user) .then(() => mutateIssueActivity()); }; @@ -98,13 +77,7 @@ export const IssueMainContent: React.FC = ({ mutateIssueActivity((prevData: any) => prevData?.filter((p: any) => p.id !== commentId), false); await issuesService - .deleteIssueComment( - workspaceSlug as string, - projectId as string, - issueId as string, - commentId, - user - ) + .deleteIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId, user) .then(() => mutateIssueActivity()); }; @@ -112,13 +85,7 @@ export const IssueMainContent: React.FC = ({ if (!workspaceSlug || !issueDetails) return; await issuesService - .createIssueComment( - workspaceSlug.toString(), - issueDetails.project, - issueDetails.id, - formData, - user - ) + .createIssueComment(workspaceSlug.toString(), issueDetails.project, issueDetails.id, formData, user) .then(() => { mutate(PROJECT_ISSUES_ACTIVITY(issueDetails.id)); }) @@ -148,8 +115,7 @@ export const IssueMainContent: React.FC = ({ }} /> - {issueDetails.parent_detail?.project_detail.identifier}- - {issueDetails.parent_detail?.sequence_id} + {issueDetails.parent_detail?.project_detail.identifier}-{issueDetails.parent_detail?.sequence_id}
    @@ -169,9 +135,7 @@ export const IssueMainContent: React.FC = ({ diff --git a/web/components/issues/modal.tsx b/web/components/issues/modal.tsx index 65580c94a..88dc38f7a 100644 --- a/web/components/issues/modal.tsx +++ b/web/components/issues/modal.tsx @@ -8,7 +8,7 @@ import { mutate } from "swr"; import { Dialog, Transition } from "@headlessui/react"; // services import modulesService from "services/modules.service"; -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import inboxServices from "services/inbox.service"; // hooks import useUser from "hooks/use-user"; @@ -93,8 +93,10 @@ export const CreateUpdateIssueModal: React.FC = ({ const { groupedIssues, mutateMyIssues } = useMyIssues(workspaceSlug?.toString()); - const { setValue: setValueInLocalStorage, clearValue: clearLocalStorageValue } = - useLocalStorage("draftedIssue", {}); + const { setValue: setValueInLocalStorage, clearValue: clearLocalStorageValue } = useLocalStorage( + "draftedIssue", + {} + ); const { setToastAlert } = useToast(); @@ -201,13 +203,7 @@ export const CreateUpdateIssueModal: React.FC = ({ }; await inboxServices - .createInboxIssue( - workspaceSlug.toString(), - activeProject.toString(), - inboxId.toString(), - payload, - user - ) + .createInboxIssue(workspaceSlug.toString(), activeProject.toString(), inboxId.toString(), payload, user) .then((res) => { setToastAlert({ type: "success", @@ -264,8 +260,7 @@ export const CreateUpdateIssueModal: React.FC = ({ .then(async (res) => { mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(activeProject ?? "", params)); if (payload.cycle && payload.cycle !== "") await addIssueToCycle(res.id, payload.cycle); - if (payload.module && payload.module !== "") - await addIssueToModule(res.id, payload.module); + if (payload.module && payload.module !== "") await addIssueToModule(res.id, payload.module); if (displayFilters.layout === "calendar") mutate(calendarFetchKey); if (displayFilters.layout === "gantt_chart") diff --git a/web/components/issues/my-issues/my-issues-select-filters.tsx b/web/components/issues/my-issues/my-issues-select-filters.tsx index ce8e03797..450381e1a 100644 --- a/web/components/issues/my-issues/my-issues-select-filters.tsx +++ b/web/components/issues/my-issues/my-issues-select-filters.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // components import { DateFilterModal } from "components/core"; // ui @@ -29,12 +29,7 @@ type Props = { height?: "sm" | "md" | "rg" | "lg"; }; -export const MyIssuesSelectFilters: React.FC = ({ - filters, - onSelect, - direction = "right", - height = "md", -}) => { +export const MyIssuesSelectFilters: React.FC = ({ filters, onSelect, direction = "right", height = "md" }) => { const [isDateFilterModalOpen, setIsDateFilterModalOpen] = useState(false); const [dateFilterType, setDateFilterType] = useState<{ title: string; @@ -50,9 +45,7 @@ export const MyIssuesSelectFilters: React.FC = ({ const { data: labels } = useSWR( workspaceSlug && fetchLabels ? WORKSPACE_LABELS(workspaceSlug.toString()) : null, - workspaceSlug && fetchLabels - ? () => issuesService.getWorkspaceLabels(workspaceSlug.toString()) - : null + workspaceSlug && fetchLabels ? () => issuesService.getWorkspaceLabels(workspaceSlug.toString()) : null ); return ( diff --git a/web/components/issues/my-issues/my-issues-view.tsx b/web/components/issues/my-issues/my-issues-view.tsx index ced16b321..26e49fa2c 100644 --- a/web/components/issues/my-issues/my-issues-view.tsx +++ b/web/components/issues/my-issues/my-issues-view.tsx @@ -7,7 +7,7 @@ import useSWR, { mutate } from "swr"; // react-beautiful-dnd import { DropResult } from "react-beautiful-dnd"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useMyIssues from "hooks/my-issues/use-my-issues"; import useMyIssuesFilters from "hooks/my-issues/use-my-issues-filter"; @@ -28,10 +28,7 @@ type Props = { disableUserActions?: false; }; -export const MyIssuesView: React.FC = ({ - openIssuesListModal, - disableUserActions = false, -}) => { +export const MyIssuesView: React.FC = ({ openIssuesListModal, disableUserActions = false }) => { // create issue modal const [createIssueModal, setCreateIssueModal] = useState(false); const [preloadedData, setPreloadedData] = useState< @@ -40,9 +37,7 @@ export const MyIssuesView: React.FC = ({ // update issue modal const [editIssueModal, setEditIssueModal] = useState(false); - const [issueToEdit, setIssueToEdit] = useState< - (IIssue & { actionType: "edit" | "delete" }) | undefined - >(undefined); + const [issueToEdit, setIssueToEdit] = useState<(IIssue & { actionType: "edit" | "delete" }) | undefined>(undefined); // delete issue modal const [deleteIssueModal, setDeleteIssueModal] = useState(false); @@ -57,14 +52,10 @@ export const MyIssuesView: React.FC = ({ const { user } = useUserAuth(); const { groupedIssues, mutateMyIssues, isEmpty, params } = useMyIssues(workspaceSlug?.toString()); - const { filters, setFilters, displayFilters, properties } = useMyIssuesFilters( - workspaceSlug?.toString() - ); + const { filters, setFilters, displayFilters, properties } = useMyIssuesFilters(workspaceSlug?.toString()); const { data: labels } = useSWR( - workspaceSlug && (filters?.labels ?? []).length > 0 - ? WORKSPACE_LABELS(workspaceSlug.toString()) - : null, + workspaceSlug && (filters?.labels ?? []).length > 0 ? WORKSPACE_LABELS(workspaceSlug.toString()) : null, workspaceSlug && (filters?.labels ?? []).length > 0 ? () => issuesService.getWorkspaceLabels(workspaceSlug.toString()) : null @@ -82,13 +73,7 @@ export const MyIssuesView: React.FC = ({ async (result: DropResult) => { setTrashBox(false); - if ( - !result.destination || - !workspaceSlug || - !groupedIssues || - displayFilters?.group_by !== "priority" - ) - return; + if (!result.destination || !workspaceSlug || !groupedIssues || displayFilters?.group_by !== "priority") return; const { source, destination } = result; @@ -120,14 +105,8 @@ export const MyIssuesView: React.FC = ({ return { ...prevData, - [sourceGroup]: orderArrayBy( - sourceGroupArray, - displayFilters.order_by ?? "-created_at" - ), - [destinationGroup]: orderArrayBy( - destinationGroupArray, - displayFilters.order_by ?? "-created_at" - ), + [sourceGroup]: orderArrayBy(sourceGroupArray, displayFilters.order_by ?? "-created_at"), + [destinationGroup]: orderArrayBy(destinationGroupArray, displayFilters.order_by ?? "-created_at"), }; }, false @@ -219,15 +198,11 @@ export const MyIssuesView: React.FC = ({ (key) => filtersToDisplay[key as keyof IIssueFilterOptions] === null ); const areFiltersApplied = - Object.keys(filtersToDisplay).length > 0 && - nullFilters.length !== Object.keys(filtersToDisplay).length; + Object.keys(filtersToDisplay).length > 0 && nullFilters.length !== Object.keys(filtersToDisplay).length; const isSubscribedIssuesRoute = router.pathname.includes("subscribed"); const isMySubscribedIssues = - (filters.subscriber && - filters.subscriber.length > 0 && - router.pathname.includes("my-issues")) ?? - false; + (filters.subscriber && filters.subscriber.length > 0 && router.pathname.includes("my-issues")) ?? false; const disableAddIssueOption = isSubscribedIssuesRoute || isMySubscribedIssues; diff --git a/web/components/issues/peek-overview/issue-activity.tsx b/web/components/issues/peek-overview/issue-activity.tsx index 68e608dba..6639a2473 100644 --- a/web/components/issues/peek-overview/issue-activity.tsx +++ b/web/components/issues/peek-overview/issue-activity.tsx @@ -1,7 +1,7 @@ import useSWR, { mutate } from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useUser from "hooks/use-user"; import useToast from "hooks/use-toast"; @@ -78,10 +78,7 @@ export const PeekOverviewIssueActivity: React.FC = ({ workspaceSlug, issu showAccessSpecifier={projectDetails && projectDetails.is_deployed} />
    - +
    diff --git a/web/components/issues/select/label.tsx b/web/components/issues/select/label.tsx index cf960b3a0..a7772a691 100644 --- a/web/components/issues/select/label.tsx +++ b/web/components/issues/select/label.tsx @@ -7,17 +7,11 @@ import useSWR from "swr"; // headless ui import { Combobox, Transition } from "@headlessui/react"; // services -import issuesServices from "services/issues.service"; +import issuesServices from "services/issue.service"; // ui import { IssueLabelsList } from "components/ui"; // icons -import { - CheckIcon, - MagnifyingGlassIcon, - PlusIcon, - RectangleGroupIcon, - TagIcon, -} from "@heroicons/react/24/outline"; +import { CheckIcon, MagnifyingGlassIcon, PlusIcon, RectangleGroupIcon, TagIcon } from "@heroicons/react/24/outline"; // types import type { IIssueLabels } from "types"; // fetch-keys @@ -39,24 +33,14 @@ export const IssueLabelSelect: React.FC = ({ setIsOpen, value, onChange, const { data: issueLabels } = useSWR( projectId ? PROJECT_ISSUE_LABELS(projectId) : null, - workspaceSlug && projectId - ? () => issuesServices.getIssueLabels(workspaceSlug as string, projectId) - : null + workspaceSlug && projectId ? () => issuesServices.getIssueLabels(workspaceSlug as string, projectId) : null ); const filteredOptions = - query === "" - ? issueLabels - : issueLabels?.filter((l) => l.name.toLowerCase().includes(query.toLowerCase())); + query === "" ? issueLabels : issueLabels?.filter((l) => l.name.toLowerCase().includes(query.toLowerCase())); return ( - onChange(val)} - className="relative flex-shrink-0" - multiple - > + onChange(val)} className="relative flex-shrink-0" multiple> {({ open }: any) => ( <> @@ -129,11 +113,7 @@ export const IssueLabelSelect: React.FC = ({ setIsOpen, value, onChange, {label.name}
    - +
    )} @@ -168,11 +148,7 @@ export const IssueLabelSelect: React.FC = ({ setIsOpen, value, onChange, {child.name}
    - +
    )} diff --git a/web/components/issues/select/state.tsx b/web/components/issues/select/state.tsx index 22a4e6532..ff97fda25 100644 --- a/web/components/issues/select/state.tsx +++ b/web/components/issues/select/state.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // ui import { CustomSearchSelect } from "components/ui"; // icons @@ -30,9 +30,7 @@ export const IssueStateSelect: React.FC = ({ setIsOpen, value, onChange, const { data: stateGroups } = useSWR( workspaceSlug && projectId ? STATES_LIST(projectId) : null, - workspaceSlug && projectId - ? () => stateService.getStates(workspaceSlug as string, projectId) - : null + workspaceSlug && projectId ? () => stateService.getStates(workspaceSlug as string, projectId) : null ); const states = getStatesList(stateGroups); @@ -60,10 +58,7 @@ export const IssueStateSelect: React.FC = ({ setIsOpen, value, onChange, {selectedOption ? ( ) : currentDefaultState ? ( - + ) : ( )} diff --git a/web/components/issues/sidebar-select/blocked.tsx b/web/components/issues/sidebar-select/blocked.tsx index d7e448377..c65d10437 100644 --- a/web/components/issues/sidebar-select/blocked.tsx +++ b/web/components/issues/sidebar-select/blocked.tsx @@ -7,7 +7,7 @@ import { UseFormWatch } from "react-hook-form"; import useToast from "hooks/use-toast"; import useUser from "hooks/use-user"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // components import { ExistingIssuesListModal } from "components/core"; // icons @@ -23,12 +23,7 @@ type Props = { disabled?: boolean; }; -export const SidebarBlockedSelect: React.FC = ({ - issueId, - submitChanges, - watch, - disabled = false, -}) => { +export const SidebarBlockedSelect: React.FC = ({ issueId, submitChanges, watch, disabled = false }) => { const [isBlockedModalOpen, setIsBlockedModalOpen] = useState(false); const { user } = useUser(); @@ -80,10 +75,7 @@ export const SidebarBlockedSelect: React.FC = ({ }) .then((response) => { submitChanges({ - related_issues: [ - ...watch("related_issues")?.filter((i) => i.relation_type !== "blocked_by"), - ...response, - ], + related_issues: [...watch("related_issues")?.filter((i) => i.relation_type !== "blocked_by"), ...response], }); }); @@ -127,9 +119,7 @@ export const SidebarBlockedSelect: React.FC = ({ type="button" className="opacity-0 duration-300 group-hover:opacity-100" onClick={() => { - const updatedRelations = watch("related_issues")?.filter( - (i) => i.id !== relation.id - ); + const updatedRelations = watch("related_issues")?.filter((i) => i.id !== relation.id); submitChanges({ related_issues: updatedRelations, diff --git a/web/components/issues/sidebar-select/blocker.tsx b/web/components/issues/sidebar-select/blocker.tsx index ae8fefa1b..b7adc0e44 100644 --- a/web/components/issues/sidebar-select/blocker.tsx +++ b/web/components/issues/sidebar-select/blocker.tsx @@ -10,7 +10,7 @@ import useUser from "hooks/use-user"; // components import { ExistingIssuesListModal } from "components/core"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // icons import { XMarkIcon } from "@heroicons/react/24/outline"; import { BlockerIcon } from "components/icons"; @@ -24,12 +24,7 @@ type Props = { disabled?: boolean; }; -export const SidebarBlockerSelect: React.FC = ({ - issueId, - submitChanges, - watch, - disabled = false, -}) => { +export const SidebarBlockerSelect: React.FC = ({ issueId, submitChanges, watch, disabled = false }) => { const [isBlockerModalOpen, setIsBlockerModalOpen] = useState(false); const { user } = useUser(); @@ -42,8 +37,7 @@ export const SidebarBlockerSelect: React.FC = ({ setIsBlockerModalOpen(false); }; - const blockerIssue = - watch("issue_relations")?.filter((i) => i.relation_type === "blocked_by") || []; + const blockerIssue = watch("issue_relations")?.filter((i) => i.relation_type === "blocked_by") || []; const onSubmit = async (data: ISearchIssueResponse[]) => { if (data.length === 0) { diff --git a/web/components/issues/sidebar-select/cycle.tsx b/web/components/issues/sidebar-select/cycle.tsx index 8fbfcf707..3080c1af2 100644 --- a/web/components/issues/sidebar-select/cycle.tsx +++ b/web/components/issues/sidebar-select/cycle.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import useSWR, { mutate } from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import cyclesService from "services/cycles.service"; // ui import { Spinner, CustomSelect, Tooltip } from "components/ui"; @@ -22,23 +22,14 @@ type Props = { disabled?: boolean; }; -export const SidebarCycleSelect: React.FC = ({ - issueDetail, - handleCycleChange, - disabled = false, -}) => { +export const SidebarCycleSelect: React.FC = ({ issueDetail, handleCycleChange, disabled = false }) => { const router = useRouter(); const { workspaceSlug, projectId, issueId } = router.query; const { data: incompleteCycles } = useSWR( workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null, workspaceSlug && projectId - ? () => - cyclesService.getCyclesWithParams( - workspaceSlug as string, - projectId as string, - "incomplete" - ) + ? () => cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, "incomplete") : null ); @@ -63,21 +54,14 @@ export const SidebarCycleSelect: React.FC = ({ - + diff --git a/web/components/issues/sidebar-select/duplicate.tsx b/web/components/issues/sidebar-select/duplicate.tsx index db4cae2cd..1b5c11a53 100644 --- a/web/components/issues/sidebar-select/duplicate.tsx +++ b/web/components/issues/sidebar-select/duplicate.tsx @@ -12,7 +12,7 @@ import { X, CopyPlus } from "lucide-react"; import { BlockerIcon } from "components/icons"; import { ExistingIssuesListModal } from "components/core"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // types import { BlockeIssueDetail, IIssue, ISearchIssueResponse } from "types"; diff --git a/web/components/issues/sidebar-select/label.tsx b/web/components/issues/sidebar-select/label.tsx index 3ac2f552e..2052a0d56 100644 --- a/web/components/issues/sidebar-select/label.tsx +++ b/web/components/issues/sidebar-select/label.tsx @@ -11,7 +11,7 @@ import { TwitterPicker } from "react-color"; // headless ui import { Listbox, Popover, Transition } from "@headlessui/react"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useUser from "hooks/use-user"; // ui @@ -66,25 +66,21 @@ export const SidebarLabelSelect: React.FC = ({ const { data: issueLabels, mutate: issueLabelMutate } = useSWR( workspaceSlug && projectId ? PROJECT_ISSUE_LABELS(projectId as string) : null, - workspaceSlug && projectId - ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) : null ); const handleNewLabel = async (formData: Partial) => { if (!workspaceSlug || !projectId || isSubmitting) return; - await issuesService - .createIssueLabel(workspaceSlug as string, projectId as string, formData, user) - .then((res) => { - reset(defaultValues); + await issuesService.createIssueLabel(workspaceSlug as string, projectId as string, formData, user).then((res) => { + reset(defaultValues); - issueLabelMutate((prevData: any) => [...(prevData ?? []), res], false); + issueLabelMutate((prevData: any) => [...(prevData ?? []), res], false); - submitChanges({ labels_list: [...(issueDetails?.labels ?? []), res.id] }); + submitChanges({ labels_list: [...(issueDetails?.labels ?? []), res.id] }); - setCreateLabelForm(false); - }); + setCreateLabelForm(false); + }); }; useEffect(() => { @@ -165,9 +161,7 @@ export const SidebarLabelSelect: React.FC = ({ {issueLabels ? ( issueLabels.length > 0 ? ( issueLabels.map((label: IIssueLabels) => { - const children = issueLabels?.filter( - (l) => l.parent === label.id - ); + const children = issueLabels?.filter((l) => l.parent === label.id); if (children.length === 0) { if (!label.parent) @@ -175,9 +169,7 @@ export const SidebarLabelSelect: React.FC = ({ - `${ - active || selected ? "bg-custom-background-90" : "" - } ${ + `${active || selected ? "bg-custom-background-90" : ""} ${ selected ? "" : "text-custom-text-200" } flex cursor-pointer select-none items-center gap-2 truncate p-2` } @@ -186,10 +178,7 @@ export const SidebarLabelSelect: React.FC = ({ {label.name} @@ -207,11 +196,7 @@ export const SidebarLabelSelect: React.FC = ({ - `${ - active || selected - ? "bg-custom-background-100" - : "" - } ${ + `${active || selected ? "bg-custom-background-100" : ""} ${ selected ? "" : "text-custom-text-200" } flex cursor-pointer select-none items-center gap-2 truncate p-2` } @@ -248,9 +233,7 @@ export const SidebarLabelSelect: React.FC = ({ - diff --git a/web/components/issues/sidebar-select/relates-to.tsx b/web/components/issues/sidebar-select/relates-to.tsx index deadf4d20..2f72d4b98 100644 --- a/web/components/issues/sidebar-select/relates-to.tsx +++ b/web/components/issues/sidebar-select/relates-to.tsx @@ -12,7 +12,7 @@ import { BlockerIcon, RelatedIcon } from "components/icons"; // components import { ExistingIssuesListModal } from "components/core"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // types import { BlockeIssueDetail, IIssue, ISearchIssueResponse } from "types"; diff --git a/web/components/issues/sidebar-select/state.tsx b/web/components/issues/sidebar-select/state.tsx index cf2cfe3b2..7c7970b5a 100644 --- a/web/components/issues/sidebar-select/state.tsx +++ b/web/components/issues/sidebar-select/state.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // ui import { Spinner, CustomSelect } from "components/ui"; // icons @@ -28,9 +28,7 @@ export const SidebarStateSelect: React.FC = ({ value, onChange, disabled const { data: stateGroups } = useSWR( workspaceSlug && projectId ? STATES_LIST(projectId as string) : null, - workspaceSlug && projectId - ? () => stateService.getStates(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => stateService.getStates(workspaceSlug as string, projectId as string) : null ); const states = getStatesList(stateGroups); diff --git a/web/components/issues/sidebar.tsx b/web/components/issues/sidebar.tsx index 5455192fb..c1bc6811f 100644 --- a/web/components/issues/sidebar.tsx +++ b/web/components/issues/sidebar.tsx @@ -12,7 +12,7 @@ import useUserAuth from "hooks/use-user-auth"; import useUserIssueNotificationSubscription from "hooks/use-issue-notification-subscription"; import useEstimateOption from "hooks/use-estimate-option"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import modulesService from "services/modules.service"; // contexts import { useProjectMyMembership } from "contexts/project-member.context"; @@ -103,8 +103,11 @@ export const IssueDetailsSidebar: React.FC = ({ const { isEstimateActive } = useEstimateOption(); - const { loading, handleSubscribe, handleUnsubscribe, subscribed } = - useUserIssueNotificationSubscription(workspaceSlug, projectId, issueId); + const { loading, handleSubscribe, handleUnsubscribe, subscribed } = useUserIssueNotificationSubscription( + workspaceSlug, + projectId, + issueId + ); const { memberRole } = useProjectMyMembership(); @@ -198,13 +201,7 @@ export const IssueDetailsSidebar: React.FC = ({ ); await issuesService - .updateIssueLink( - workspaceSlug as string, - projectId as string, - issueDetail.id, - linkId, - payload - ) + .updateIssueLink(workspaceSlug as string, projectId as string, issueDetail.id, linkId, payload) .then((res) => { mutate(ISSUE_DETAILS(issueDetail.id)); }) @@ -235,12 +232,9 @@ export const IssueDetailsSidebar: React.FC = ({ }; const handleCopyText = () => { - const originURL = - typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; + const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; - copyTextToClipboard( - `${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issueDetail?.id}` - ).then(() => { + copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issueDetail?.id}`).then(() => { setToastAlert({ type: "success", title: "Link Copied!", @@ -264,9 +258,7 @@ export const IssueDetailsSidebar: React.FC = ({ fieldsToShow.includes("dueDate"); const showThirdSection = - fieldsToShow.includes("all") || - fieldsToShow.includes("cycle") || - fieldsToShow.includes("module"); + fieldsToShow.includes("all") || fieldsToShow.includes("cycle") || fieldsToShow.includes("module"); const startDate = watchIssue("start_date"); const targetDate = watchIssue("target_date"); @@ -413,30 +405,27 @@ export const IssueDetailsSidebar: React.FC = ({
    )} - {(fieldsToShow.includes("all") || fieldsToShow.includes("estimate")) && - isEstimateActive && ( -
    -
    - -

    Estimate

    -
    -
    - ( - - submitChanges({ estimate_point: val }) - } - disabled={memberRole.isGuest || memberRole.isViewer || uneditable} - /> - )} - /> -
    + {(fieldsToShow.includes("all") || fieldsToShow.includes("estimate")) && isEstimateActive && ( +
    +
    + +

    Estimate

    - )} +
    + ( + submitChanges({ estimate_point: val })} + disabled={memberRole.isGuest || memberRole.isViewer || uneditable} + /> + )} + /> +
    +
    + )}
    )} {showSecondSection && ( diff --git a/web/components/issues/sub-issues-list.tsx b/web/components/issues/sub-issues-list.tsx index 9ba920ff5..fbb16d5c8 100644 --- a/web/components/issues/sub-issues-list.tsx +++ b/web/components/issues/sub-issues-list.tsx @@ -8,7 +8,7 @@ import useSWR, { mutate } from "swr"; // headless ui import { Disclosure, Transition } from "@headlessui/react"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // contexts import { useProjectMyMembership } from "contexts/project-member.context"; // components @@ -126,10 +126,7 @@ export const SubIssuesList: FC = ({ parentIssue, user, disabled = false }
    - Sub-issues{" "} - - {subIssuesResponse.sub_issues.length} - + Sub-issues {subIssuesResponse.sub_issues.length}
    @@ -186,10 +183,7 @@ export const SubIssuesList: FC = ({ parentIssue, user, disabled = false } > {subIssuesResponse.sub_issues.map((issue) => ( - +
    = ({ parentIssue, user, disabled = false } noChevron > Create new - setSubIssuesListModal(true)}> - Add an existing issue - + setSubIssuesListModal(true)}>Add an existing issue ) )} diff --git a/web/components/issues/view-select/assignee.tsx b/web/components/issues/view-select/assignee.tsx index 1026f240d..d9dfdd080 100644 --- a/web/components/issues/view-select/assignee.tsx +++ b/web/components/issues/view-select/assignee.tsx @@ -6,7 +6,7 @@ import useSWR from "swr"; // services import projectService from "services/project.service"; -import trackEventServices from "services/track-event.service"; +import trackEventServices from "services/track_event.service"; // ui import { AssigneesList, Avatar, CustomSearchSelect, Icon, Tooltip } from "components/ui"; // icons diff --git a/web/components/issues/view-select/due-date.tsx b/web/components/issues/view-select/due-date.tsx index 5cbc26452..66705b332 100644 --- a/web/components/issues/view-select/due-date.tsx +++ b/web/components/issues/view-select/due-date.tsx @@ -5,7 +5,7 @@ import { CustomDatePicker, Tooltip } from "components/ui"; // helpers import { findHowManyDaysLeft, renderShortDateWithYearFormat } from "helpers/date-time.helper"; // services -import trackEventServices from "services/track-event.service"; +import trackEventServices from "services/track_event.service"; // types import { ICurrentUserResponse, IIssue } from "types"; import useIssuesView from "hooks/use-issues-view"; @@ -42,9 +42,7 @@ export const ViewDueDateSelect: React.FC = ({ return (
    = ({ ); }} className={`${issue?.target_date ? "w-[6.5rem]" : "w-[5rem] text-center"} ${ - displayFilters.layout === "kanban" - ? "bg-custom-background-90" - : "bg-custom-background-100" + displayFilters.layout === "kanban" ? "bg-custom-background-90" : "bg-custom-background-100" }`} minDate={minDate ?? undefined} noBorder={noBorder} diff --git a/web/components/issues/view-select/estimate.tsx b/web/components/issues/view-select/estimate.tsx index bef060e77..4e302426b 100644 --- a/web/components/issues/view-select/estimate.tsx +++ b/web/components/issues/view-select/estimate.tsx @@ -3,7 +3,7 @@ import React from "react"; import { useRouter } from "next/router"; // services -import trackEventServices from "services/track-event.service"; +import trackEventServices from "services/track_event.service"; // hooks import useEstimateOption from "hooks/use-estimate-option"; // ui diff --git a/web/components/issues/view-select/label.tsx b/web/components/issues/view-select/label.tsx index 3a75763b2..bd2396736 100644 --- a/web/components/issues/view-select/label.tsx +++ b/web/components/issues/view-select/label.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // component import { CreateLabelModal } from "components/labels"; // ui @@ -45,9 +45,7 @@ export const ViewLabelSelect: React.FC = ({ const { data: issueLabels } = useSWR( projectId ? PROJECT_ISSUE_LABELS(projectId.toString()) : null, - workspaceSlug && projectId - ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) : null ); const options = issueLabels?.map((label) => ({ diff --git a/web/components/issues/view-select/priority.tsx b/web/components/issues/view-select/priority.tsx index 1bdbf3428..31e594a08 100644 --- a/web/components/issues/view-select/priority.tsx +++ b/web/components/issues/view-select/priority.tsx @@ -3,7 +3,7 @@ import React from "react"; import { useRouter } from "next/router"; // services -import trackEventServices from "services/track-event.service"; +import trackEventServices from "services/track_event.service"; // ui import { CustomSelect, Tooltip } from "components/ui"; // icons @@ -61,9 +61,9 @@ export const ViewPrioritySelect: React.FC = ({ customButton={
    diff --git a/web/components/pages/create-block.tsx b/web/components/pages/create-block.tsx index dd3c63c26..6f6159ad0 100644 --- a/web/components/pages/create-block.tsx +++ b/web/components/pages/create-block.tsx @@ -9,7 +9,7 @@ import { PaperAirplaneIcon } from "@heroicons/react/24/outline"; // react-hook-form import { useForm } from "react-hook-form"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; // hooks import useToast from "hooks/use-toast"; @@ -81,8 +81,7 @@ export const CreateBlock: React.FC = ({ user }) => { }; const handleKeyDown = (e: any) => { - const keyCombination = - ((e.ctrlKey || e.metaKey) && e.key === "Enter") || (e.shiftKey && e.key === "Enter"); + const keyCombination = ((e.ctrlKey || e.metaKey) && e.key === "Enter") || (e.shiftKey && e.key === "Enter"); if (e.key === "Enter" && !keyCombination) { if (watch("name") && watch("name") !== "") { diff --git a/web/components/pages/create-update-block-inline.tsx b/web/components/pages/create-update-block-inline.tsx index cee9fe8e3..14e5c283e 100644 --- a/web/components/pages/create-update-block-inline.tsx +++ b/web/components/pages/create-update-block-inline.tsx @@ -4,8 +4,8 @@ import { mutate } from "swr"; import { SparklesIcon } from "@heroicons/react/24/outline"; import { Controller, useForm } from "react-hook-form"; // services -import pagesService from "services/pages.service"; -import issuesService from "services/issues.service"; +import pagesService from "services/page.service"; +import issuesService from "services/issue.service"; import aiService from "services/ai.service"; // hooks import useToast from "hooks/use-toast"; @@ -195,8 +195,7 @@ export const CreateUpdateBlockInline: React.FC = ({ setToastAlert({ type: "error", title: "Error!", - message: - "You have reached the maximum number of requests of 50 requests per month per user.", + message: "You have reached the maximum number of requests of 50 requests per month per user.", }); else setToastAlert({ @@ -294,9 +293,7 @@ export const CreateUpdateBlockInline: React.FC = ({ /> ); else if (!value || !watch("description_html")) - return ( -
    - ); + return
    ; return ( = ({
    Cancel - {data - ? isSubmitting - ? "Updating..." - : "Update block" - : isSubmitting - ? "Adding..." - : "Add block"} + {data ? (isSubmitting ? "Updating..." : "Update block") : isSubmitting ? "Adding..." : "Add block"}
    @@ -371,9 +362,7 @@ export const CreateUpdateBlockInline: React.FC = ({ onResponse={(response) => { if (data && handleAiAssistance) { handleAiAssistance(response); - editorRef.current?.setEditorValue( - `${watch("description_html")}

    ${response}

    ` ?? "" - ); + editorRef.current?.setEditorValue(`${watch("description_html")}

    ${response}

    ` ?? ""); } else { setValue("description", {}); setValue("description_html", `${watch("description_html")}

    ${response}

    `); diff --git a/web/components/pages/create-update-page-modal.tsx b/web/components/pages/create-update-page-modal.tsx index 4835449e1..6a6912747 100644 --- a/web/components/pages/create-update-page-modal.tsx +++ b/web/components/pages/create-update-page-modal.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; // hooks import useToast from "hooks/use-toast"; // components @@ -15,12 +15,7 @@ import { PageForm } from "./page-form"; // types import { ICurrentUserResponse, IPage } from "types"; // fetch-keys -import { - ALL_PAGES_LIST, - FAVORITE_PAGES_LIST, - MY_PAGES_LIST, - RECENT_PAGES_LIST, -} from "constants/fetch-keys"; +import { ALL_PAGES_LIST, FAVORITE_PAGES_LIST, MY_PAGES_LIST, RECENT_PAGES_LIST } from "constants/fetch-keys"; type Props = { isOpen: boolean; diff --git a/web/components/pages/delete-page-modal.tsx b/web/components/pages/delete-page-modal.tsx index 68c2d6732..15a67090b 100644 --- a/web/components/pages/delete-page-modal.tsx +++ b/web/components/pages/delete-page-modal.tsx @@ -7,7 +7,7 @@ import { mutate } from "swr"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; // hooks import useToast from "hooks/use-toast"; // ui @@ -17,12 +17,7 @@ import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; // types import type { ICurrentUserResponse, IPage } from "types"; // fetch-keys -import { - ALL_PAGES_LIST, - FAVORITE_PAGES_LIST, - MY_PAGES_LIST, - RECENT_PAGES_LIST, -} from "constants/fetch-keys"; +import { ALL_PAGES_LIST, FAVORITE_PAGES_LIST, MY_PAGES_LIST, RECENT_PAGES_LIST } from "constants/fetch-keys"; type TConfirmPageDeletionProps = { isOpen: boolean; @@ -31,12 +26,7 @@ type TConfirmPageDeletionProps = { user: ICurrentUserResponse | undefined; }; -export const DeletePageModal: React.FC = ({ - isOpen, - setIsOpen, - data, - user, -}) => { +export const DeletePageModal: React.FC = ({ isOpen, setIsOpen, data, user }) => { const [isDeleteLoading, setIsDeleteLoading] = useState(false); const router = useRouter(); @@ -121,26 +111,17 @@ export const DeletePageModal: React.FC = ({
    -
    - + Delete Page

    Are you sure you want to delete Page-{" "} - - {data?.name} - - ? All of the data related to the page will be permanently removed. This - action cannot be undone. + {data?.name}? All of the + data related to the page will be permanently removed. This action cannot be undone.

    diff --git a/web/components/pages/pages-list/all-pages-list.tsx b/web/components/pages/pages-list/all-pages-list.tsx index f25d00fd5..353fa7b87 100644 --- a/web/components/pages/pages-list/all-pages-list.tsx +++ b/web/components/pages/pages-list/all-pages-list.tsx @@ -3,7 +3,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; // components import { PagesView } from "components/pages"; // types diff --git a/web/components/pages/pages-list/favorite-pages-list.tsx b/web/components/pages/pages-list/favorite-pages-list.tsx index 2faa4bf72..e6ba8ec32 100644 --- a/web/components/pages/pages-list/favorite-pages-list.tsx +++ b/web/components/pages/pages-list/favorite-pages-list.tsx @@ -3,7 +3,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; // components import { PagesView } from "components/pages"; // types @@ -18,8 +18,7 @@ export const FavoritePagesList: React.FC = ({ viewType }) => { const { data: pages } = useSWR( workspaceSlug && projectId ? FAVORITE_PAGES_LIST(projectId as string) : null, workspaceSlug && projectId - ? () => - pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "favorite") + ? () => pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "favorite") : null ); diff --git a/web/components/pages/pages-list/my-pages-list.tsx b/web/components/pages/pages-list/my-pages-list.tsx index c225a0ac5..2bd4a2017 100644 --- a/web/components/pages/pages-list/my-pages-list.tsx +++ b/web/components/pages/pages-list/my-pages-list.tsx @@ -3,7 +3,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; // components import { PagesView } from "components/pages"; // types @@ -18,12 +18,7 @@ export const MyPagesList: React.FC = ({ viewType }) => { const { data: pages } = useSWR( workspaceSlug && projectId ? MY_PAGES_LIST(projectId as string) : null, workspaceSlug && projectId - ? () => - pagesService.getPagesWithParams( - workspaceSlug as string, - projectId as string, - "created_by_me" - ) + ? () => pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "created_by_me") : null ); diff --git a/web/components/pages/pages-list/other-pages-list.tsx b/web/components/pages/pages-list/other-pages-list.tsx index 64764533f..72729f9e2 100644 --- a/web/components/pages/pages-list/other-pages-list.tsx +++ b/web/components/pages/pages-list/other-pages-list.tsx @@ -3,7 +3,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; // components import { PagesView } from "components/pages"; // types @@ -18,12 +18,7 @@ export const OtherPagesList: React.FC = ({ viewType }) => { const { data: pages } = useSWR( workspaceSlug && projectId ? OTHER_PAGES_LIST(projectId as string) : null, workspaceSlug && projectId - ? () => - pagesService.getPagesWithParams( - workspaceSlug as string, - projectId as string, - "created_by_other" - ) + ? () => pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "created_by_other") : null ); diff --git a/web/components/pages/pages-list/recent-pages-list.tsx b/web/components/pages/pages-list/recent-pages-list.tsx index 34199b279..6ea8f9d01 100644 --- a/web/components/pages/pages-list/recent-pages-list.tsx +++ b/web/components/pages/pages-list/recent-pages-list.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; // components import { PagesView } from "components/pages"; // ui @@ -28,9 +28,7 @@ export const RecentPagesList: React.FC = ({ viewType }) => { const { data: pages } = useSWR( workspaceSlug && projectId ? RECENT_PAGES_LIST(projectId as string) : null, - workspaceSlug && projectId - ? () => pagesService.getRecentPages(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => pagesService.getRecentPages(workspaceSlug as string, projectId as string) : null ); const isEmpty = pages && Object.keys(pages).every((key) => pages[key].length === 0); @@ -44,9 +42,7 @@ export const RecentPagesList: React.FC = ({ viewType }) => { return (
    -

    - {replaceUnderscoreIfSnakeCase(key)} -

    +

    {replaceUnderscoreIfSnakeCase(key)}

    ); diff --git a/web/components/pages/pages-view.tsx b/web/components/pages/pages-view.tsx index 8178460e1..b7fc0249c 100644 --- a/web/components/pages/pages-view.tsx +++ b/web/components/pages/pages-view.tsx @@ -4,18 +4,13 @@ import useSWR, { mutate } from "swr"; import { useRouter } from "next/router"; // services -import pagesService from "services/pages.service"; +import pagesService from "services/page.service"; import projectService from "services/project.service"; // hooks import useToast from "hooks/use-toast"; import useUserAuth from "hooks/use-user-auth"; // components -import { - CreateUpdatePageModal, - DeletePageModal, - SinglePageDetailedItem, - SinglePageListItem, -} from "components/pages"; +import { CreateUpdatePageModal, DeletePageModal, SinglePageDetailedItem, SinglePageListItem } from "components/pages"; // ui import { EmptyState, Loader } from "components/ui"; // icons @@ -91,11 +86,7 @@ export const PagesView: React.FC = ({ pages, viewType }) => { }), false ); - mutate( - FAVORITE_PAGES_LIST(projectId.toString()), - (prevData) => [page, ...(prevData ?? [])], - false - ); + mutate(FAVORITE_PAGES_LIST(projectId.toString()), (prevData) => [page, ...(prevData ?? [])], false); pagesService .addPageToFavorites(workspaceSlug.toString(), projectId.toString(), { @@ -185,11 +176,9 @@ export const PagesView: React.FC = ({ pages, viewType }) => { false ); - pagesService - .patchPage(workspaceSlug.toString(), projectId.toString(), page.id, formData, user) - .then(() => { - mutate(RECENT_PAGES_LIST(projectId.toString())); - }); + pagesService.patchPage(workspaceSlug.toString(), projectId.toString(), page.id, formData, user).then(() => { + mutate(RECENT_PAGES_LIST(projectId.toString())); + }); }; return ( diff --git a/web/components/pages/single-page-block.tsx b/web/components/pages/single-page-block.tsx index e4c1d94ac..5d784d98a 100644 --- a/web/components/pages/single-page-block.tsx +++ b/web/components/pages/single-page-block.tsx @@ -10,8 +10,8 @@ import { useForm } from "react-hook-form"; // react-beautiful-dnd import { Draggable } from "react-beautiful-dnd"; // services -import pagesService from "services/pages.service"; -import issuesService from "services/issues.service"; +import pagesService from "services/page.service"; +import issuesService from "services/issue.service"; import aiService from "services/ai.service"; // hooks import useToast from "hooks/use-toast"; @@ -48,13 +48,7 @@ type Props = { user: ICurrentUserResponse | undefined; }; -export const SinglePageBlock: React.FC = ({ - block, - projectDetails, - showBlockDetails, - index, - user, -}) => { +export const SinglePageBlock: React.FC = ({ block, projectDetails, showBlockDetails, index, user }) => { const [isSyncing, setIsSyncing] = useState(false); const [createBlockForm, setCreateBlockForm] = useState(false); const [iAmFeelingLucky, setIAmFeelingLucky] = useState(false); @@ -131,13 +125,7 @@ export const SinglePageBlock: React.FC = ({ if (!workspaceSlug || !projectId || !pageId) return; await pagesService - .convertPageBlockToIssue( - workspaceSlug as string, - projectId as string, - pageId as string, - block.id, - user - ) + .convertPageBlockToIssue(workspaceSlug as string, projectId as string, pageId as string, block.id, user) .then((res: IIssue) => { mutate( PAGE_BLOCKS_LIST(pageId as string), @@ -175,13 +163,7 @@ export const SinglePageBlock: React.FC = ({ ); await pagesService - .deletePageBlock( - workspaceSlug as string, - projectId as string, - pageId as string, - block.id, - user - ) + .deletePageBlock(workspaceSlug as string, projectId as string, pageId as string, block.id, user) .catch(() => { setToastAlert({ type: "error", @@ -221,8 +203,7 @@ export const SinglePageBlock: React.FC = ({ setToastAlert({ type: "error", title: "Error!", - message: - "You have reached the maximum number of requests of 50 requests per month per user.", + message: "You have reached the maximum number of requests of 50 requests per month per user.", }); else setToastAlert({ @@ -283,12 +264,9 @@ export const SinglePageBlock: React.FC = ({ }; const handleCopyText = () => { - const originURL = - typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; + const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; - copyTextToClipboard( - `${originURL}/${workspaceSlug}/projects/${projectId}/issues/${block.issue}` - ).then(() => { + copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${block.issue}`).then(() => { setToastAlert({ type: "success", title: "Link Copied!", @@ -343,11 +321,7 @@ export const SinglePageBlock: React.FC = ({ > {block.issue && block.sync && (
    - {isSyncing ? ( - - ) : ( - - )} + {isSyncing ? : } {isSyncing ? "Syncing..." : "Synced"}
    )} @@ -431,9 +405,7 @@ export const SinglePageBlock: React.FC = ({
    {block.issue && (
    - + {projectDetails?.identifier}-{block.issue_detail?.sequence_id} diff --git a/web/components/profile/profile-issues-view.tsx b/web/components/profile/profile-issues-view.tsx index b0337ecd4..e5a2096ca 100644 --- a/web/components/profile/profile-issues-view.tsx +++ b/web/components/profile/profile-issues-view.tsx @@ -7,7 +7,7 @@ import useSWR from "swr"; // react-beautiful-dnd import { DropResult } from "react-beautiful-dnd"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import userService from "services/user.service"; // hooks import useProfileIssues from "hooks/use-profile-issues"; @@ -31,9 +31,7 @@ export const ProfileIssuesView = () => { // update issue modal const [editIssueModal, setEditIssueModal] = useState(false); - const [issueToEdit, setIssueToEdit] = useState< - (IIssue & { actionType: "edit" | "delete" }) | undefined - >(undefined); + const [issueToEdit, setIssueToEdit] = useState<(IIssue & { actionType: "edit" | "delete" }) | undefined>(undefined); // delete issue modal const [deleteIssueModal, setDeleteIssueModal] = useState(false); @@ -60,19 +58,14 @@ export const ProfileIssuesView = () => { } = useProfileIssues(workspaceSlug?.toString(), userId?.toString()); const { data: profileData } = useSWR( + workspaceSlug && userId ? USER_PROFILE_PROJECT_SEGREGATION(workspaceSlug.toString(), userId.toString()) : null, workspaceSlug && userId - ? USER_PROFILE_PROJECT_SEGREGATION(workspaceSlug.toString(), userId.toString()) - : null, - workspaceSlug && userId - ? () => - userService.getUserProfileProjectsSegregation(workspaceSlug.toString(), userId.toString()) + ? () => userService.getUserProfileProjectsSegregation(workspaceSlug.toString(), userId.toString()) : null ); const { data: labels } = useSWR( - workspaceSlug && (filters?.labels ?? []).length > 0 - ? WORKSPACE_LABELS(workspaceSlug.toString()) - : null, + workspaceSlug && (filters?.labels ?? []).length > 0 ? WORKSPACE_LABELS(workspaceSlug.toString()) : null, workspaceSlug && (filters?.labels ?? []).length > 0 ? () => issuesService.getWorkspaceLabels(workspaceSlug.toString()) : null @@ -90,13 +83,7 @@ export const ProfileIssuesView = () => { async (result: DropResult) => { setTrashBox(false); - if ( - !result.destination || - !workspaceSlug || - !groupedIssues || - displayFilters?.group_by !== "priority" - ) - return; + if (!result.destination || !workspaceSlug || !groupedIssues || displayFilters?.group_by !== "priority") return; const { source, destination } = result; @@ -125,10 +112,7 @@ export const ProfileIssuesView = () => { return { ...prevData, [sourceGroup]: orderArrayBy(sourceGroupArray, displayFilters.order_by ?? "-created_at"), - [destinationGroup]: orderArrayBy( - destinationGroupArray, - displayFilters.order_by ?? "-created_at" - ), + [destinationGroup]: orderArrayBy(destinationGroupArray, displayFilters.order_by ?? "-created_at"), }; }, false); @@ -218,15 +202,11 @@ export const ProfileIssuesView = () => { (key) => filtersToDisplay[key as keyof IIssueFilterOptions] === null ); const areFiltersApplied = - Object.keys(filtersToDisplay).length > 0 && - nullFilters.length !== Object.keys(filtersToDisplay).length; + Object.keys(filtersToDisplay).length > 0 && nullFilters.length !== Object.keys(filtersToDisplay).length; const isSubscribedIssuesRoute = router.pathname.includes("subscribed"); const isMySubscribedIssues = - (filters.subscriber && - filters.subscriber.length > 0 && - router.pathname.includes("my-issues")) ?? - false; + (filters.subscriber && filters.subscriber.length > 0 && router.pathname.includes("my-issues")) ?? false; const disableAddIssueOption = isSubscribedIssuesRoute || isMySubscribedIssues; diff --git a/web/components/project/publish-project/modal.tsx b/web/components/project/publish-project/modal.tsx index 56ed10ee0..b9430285f 100644 --- a/web/components/project/publish-project/modal.tsx +++ b/web/components/project/publish-project/modal.tsx @@ -6,21 +6,14 @@ import { Controller, useForm } from "react-hook-form"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // ui components -import { - ToggleSwitch, - PrimaryButton, - SecondaryButton, - Icon, - DangerButton, - Loader, -} from "components/ui"; +import { ToggleSwitch, PrimaryButton, SecondaryButton, Icon, DangerButton, Loader } from "components/ui"; import { CustomPopover } from "./popover"; // mobx react lite import { observer } from "mobx-react-lite"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; import { RootStore } from "store/root"; -import { IProjectPublishSettings, TProjectPublishViews } from "store/project-publish"; +import { IProjectPublishSettings, TProjectPublishViews } from "store/project_publish"; // hooks import useToast from "hooks/use-toast"; import useProjectDetails from "hooks/use-project-details"; @@ -65,8 +58,8 @@ export const PublishProjectModal: React.FC = observer(() => { let plane_deploy_url = process.env.NEXT_PUBLIC_DEPLOY_URL; - if (typeof window !== 'undefined' && !plane_deploy_url) { - plane_deploy_url= window.location.protocol + "//" + window.location.host + "/spaces"; + if (typeof window !== "undefined" && !plane_deploy_url) { + plane_deploy_url = window.location.protocol + "//" + window.location.host + "/spaces"; } const router = useRouter(); @@ -101,10 +94,7 @@ export const PublishProjectModal: React.FC = observer(() => { // prefill form with the saved settings if the project is already published useEffect(() => { - if ( - projectPublish.projectPublishSettings && - projectPublish.projectPublishSettings !== "not-initialized" - ) { + if (projectPublish.projectPublishSettings && projectPublish.projectPublishSettings !== "not-initialized") { let userBoards: TProjectPublishViews[] = []; if (projectPublish.projectPublishSettings?.views) { @@ -143,11 +133,7 @@ export const PublishProjectModal: React.FC = observer(() => { projectPublish.project_id !== null && projectPublish?.projectPublishSettings === "not-initialized" ) { - projectPublish.getProjectSettingsAsync( - workspaceSlug.toString(), - projectPublish.project_id, - null - ); + projectPublish.getProjectSettingsAsync(workspaceSlug.toString(), projectPublish.project_id, null); } }, [workspaceSlug, projectPublish, projectPublish.projectPublishModal]); @@ -202,12 +188,7 @@ export const PublishProjectModal: React.FC = observer(() => { setIsUnpublishing(true); projectPublish - .unPublishProject( - workspaceSlug.toString(), - projectPublish.project_id as string, - publishId, - null - ) + .unPublishProject(workspaceSlug.toString(), projectPublish.project_id as string, publishId, null) .then((res) => { mutateProjectDetails(); @@ -269,11 +250,7 @@ export const PublishProjectModal: React.FC = observer(() => { // check if an update is required or not const checkIfUpdateIsRequired = () => { - if ( - !projectPublish.projectPublishSettings || - projectPublish.projectPublishSettings === "not-initialized" - ) - return; + if (!projectPublish.projectPublishSettings || projectPublish.projectPublishSettings === "not-initialized") return; const currentSettings = projectPublish.projectPublishSettings as IProjectPublishSettings; const newSettings = getValues(); @@ -289,8 +266,7 @@ export const PublishProjectModal: React.FC = observer(() => { let viewCheckFlag = 0; viewOptions.forEach((option) => { - if (currentSettings.views[option.key] !== newSettings.views.includes(option.key)) - viewCheckFlag++; + if (currentSettings.views[option.key] !== newSettings.views.includes(option.key)) viewCheckFlag++; }); if (viewCheckFlag !== 0) { @@ -416,9 +392,7 @@ export const PublishProjectModal: React.FC = observer(() => { }} >
    {option.label}
    -
    +
    {value.length > 0 && value.includes(option.key) && ( )} diff --git a/web/components/states/create-state-modal.tsx b/web/components/states/create-state-modal.tsx index ad7f38c4e..171f4f17e 100644 --- a/web/components/states/create-state-modal.tsx +++ b/web/components/states/create-state-modal.tsx @@ -11,7 +11,7 @@ import { TwitterPicker } from "react-color"; // headless ui import { Dialog, Popover, Transition } from "@headlessui/react"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // hooks import useToast from "hooks/use-toast"; // ui @@ -131,10 +131,7 @@ export const CreateStateModal: React.FC = ({ isOpen, projectId, handleClo
    - + Create State
    @@ -215,10 +212,7 @@ export const CreateStateModal: React.FC = ({ isOpen, projectId, handleClo name="color" control={control} render={({ field: { value, onChange } }) => ( - onChange(value.hex)} - /> + onChange(value.hex)} /> )} /> diff --git a/web/components/states/create-update-state-inline.tsx b/web/components/states/create-update-state-inline.tsx index 87ad14731..3cd5bfb8d 100644 --- a/web/components/states/create-update-state-inline.tsx +++ b/web/components/states/create-update-state-inline.tsx @@ -11,7 +11,7 @@ import { TwitterPicker } from "react-color"; // headless ui import { Popover, Transition } from "@headlessui/react"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // hooks import useToast from "hooks/use-toast"; // ui @@ -39,13 +39,7 @@ const defaultValues: Partial = { group: "backlog", }; -export const CreateUpdateStateInline: React.FC = ({ - data, - onClose, - selectedGroup, - user, - groupLength, -}) => { +export const CreateUpdateStateInline: React.FC = ({ data, onClose, selectedGroup, user, groupLength }) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -153,8 +147,7 @@ export const CreateUpdateStateInline: React.FC = ({ setToastAlert({ type: "error", title: "Error!", - message: - "Another state exists with the same name. Please try again with another name.", + message: "Another state exists with the same name. Please try again with another name.", }); else setToastAlert({ @@ -230,9 +223,7 @@ export const CreateUpdateStateInline: React.FC = ({ name="group" control={control} render={({ field: { value, onChange } }) => ( - +
    = ({ isOpen, onClose, data, user
    -
    - + Delete State

    Are you sure you want to delete state-{" "} - {data?.name}? - All of the data related to the state will be permanently removed. This - action cannot be undone. + {data?.name}? All of the data + related to the state will be permanently removed. This action cannot be undone.

    diff --git a/web/components/states/single-state.tsx b/web/components/states/single-state.tsx index eb2d9b610..652f9dae0 100644 --- a/web/components/states/single-state.tsx +++ b/web/components/states/single-state.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import { mutate } from "swr"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // ui import { Tooltip } from "components/ui"; // icons @@ -58,11 +58,7 @@ export const SingleState: React.FC = ({ })); newStatesList = orderArrayBy(newStatesList, "sequence", "ascending"); - mutate( - STATES_LIST(projectId as string), - orderStateGroups(groupBy(newStatesList, "group")), - false - ); + mutate(STATES_LIST(projectId as string), orderStateGroups(groupBy(newStatesList, "group")), false); if (currentDefaultState) stateService @@ -131,11 +127,7 @@ export const SingleState: React.FC = ({ })); newStatesList = orderArrayBy(newStatesList, "sequence", "ascending"); - mutate( - STATES_LIST(projectId as string), - orderStateGroups(groupBy(newStatesList, "group")), - false - ); + mutate(STATES_LIST(projectId as string), orderStateGroups(groupBy(newStatesList, "group")), false); stateService .patchState( @@ -216,26 +208,14 @@ export const SingleState: React.FC = ({ > {state.default ? ( - + ) : groupLength === 1 ? ( - + ) : ( - + )}
    diff --git a/web/components/views/form.tsx b/web/components/views/form.tsx index 0c57a9542..0856bafa4 100644 --- a/web/components/views/form.tsx +++ b/web/components/views/form.tsx @@ -7,7 +7,7 @@ import useSWR from "swr"; // react-hook-form import { useForm } from "react-hook-form"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // hooks import useProjectMembers from "hooks/use-project-members"; // components @@ -20,7 +20,7 @@ import { checkIfArraysHaveSameElements } from "helpers/array.helper"; import { getStatesList } from "helpers/state.helper"; // types import { IQuery, IView } from "types"; -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // fetch-keys import { PROJECT_ISSUE_LABELS, STATES_LIST } from "constants/fetch-keys"; @@ -37,13 +37,7 @@ const defaultValues: Partial = { description: "", }; -export const ViewForm: React.FC = ({ - handleFormSubmit, - handleClose, - status, - data, - preLoadedData, -}) => { +export const ViewForm: React.FC = ({ handleFormSubmit, handleClose, status, data, preLoadedData }) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -60,9 +54,7 @@ export const ViewForm: React.FC = ({ const filters = watch("query"); const { data: stateGroups } = useSWR( - workspaceSlug && projectId && (filters?.state ?? []).length > 0 - ? STATES_LIST(projectId as string) - : null, + workspaceSlug && projectId && (filters?.state ?? []).length > 0 ? STATES_LIST(projectId as string) : null, workspaceSlug && (filters?.state ?? []).length > 0 ? () => stateService.getStates(workspaceSlug as string, projectId as string) : null @@ -117,9 +109,7 @@ export const ViewForm: React.FC = ({ return (
    -

    - {status ? "Update" : "Create"} View -

    +

    {status ? "Update" : "Create"} View

    = ({ const key = option.key as keyof typeof filters; if (key === "start_date" || key === "target_date") { - const valueExists = checkIfArraysHaveSameElements( - filters?.[key] ?? [], - option.value - ); + const valueExists = checkIfArraysHaveSameElements(filters?.[key] ?? [], option.value); setValue("query", { ...filters, diff --git a/web/components/views/select-filters.tsx b/web/components/views/select-filters.tsx index 52671f41f..07a8ed337 100644 --- a/web/components/views/select-filters.tsx +++ b/web/components/views/select-filters.tsx @@ -5,9 +5,9 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; import projectService from "services/project.service"; -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // components import { DateFilterModal } from "components/core"; // ui @@ -32,12 +32,7 @@ type Props = { height?: "sm" | "md" | "rg" | "lg"; }; -export const SelectFilters: React.FC = ({ - filters, - onSelect, - direction = "right", - height = "md", -}) => { +export const SelectFilters: React.FC = ({ filters, onSelect, direction = "right", height = "md" }) => { const [isDateFilterModalOpen, setIsDateFilterModalOpen] = useState(false); const [dateFilterType, setDateFilterType] = useState<{ title: string; @@ -52,9 +47,7 @@ export const SelectFilters: React.FC = ({ const { data: states } = useSWR( workspaceSlug && projectId ? STATES_LIST(projectId as string) : null, - workspaceSlug && projectId - ? () => stateService.getStates(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => stateService.getStates(workspaceSlug as string, projectId as string) : null ); const statesList = getStatesList(states); diff --git a/web/components/web-view/create-update-link-form.tsx b/web/components/web-view/create-update-link-form.tsx index fa1a33939..692ffb9c9 100644 --- a/web/components/web-view/create-update-link-form.tsx +++ b/web/components/web-view/create-update-link-form.tsx @@ -11,7 +11,7 @@ import { mutate } from "swr"; import { useForm } from "react-hook-form"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // fetch keys import { ISSUE_DETAILS } from "constants/fetch-keys"; @@ -75,12 +75,7 @@ export const CreateUpdateLinkForm: React.FC = (props) => { if (!data) await issuesService - .createIssueLink( - workspaceSlug.toString(), - projectId.toString(), - issueId.toString(), - payload - ) + .createIssueLink(workspaceSlug.toString(), projectId.toString(), issueId.toString(), payload) .then(() => { onSuccess(); mutate(ISSUE_DETAILS(issueId.toString())); @@ -110,20 +105,10 @@ export const CreateUpdateLinkForm: React.FC = (props) => { : l ); - mutate( - ISSUE_DETAILS(issueId.toString()), - (prevData) => ({ ...prevData, issue_link: updatedLinks }), - false - ); + mutate(ISSUE_DETAILS(issueId.toString()), (prevData) => ({ ...prevData, issue_link: updatedLinks }), false); await issuesService - .updateIssueLink( - workspaceSlug.toString(), - projectId.toString(), - issueId.toString(), - data!.id, - payload - ) + .updateIssueLink(workspaceSlug.toString(), projectId.toString(), issueId.toString(), data!.id, payload) .then(() => { onSuccess(); mutate(ISSUE_DETAILS(issueId.toString())); @@ -172,13 +157,7 @@ export const CreateUpdateLinkForm: React.FC = (props) => { loading={isSubmitting} className="w-full !py-2 text-custom-text-300 !text-base flex items-center justify-center" > - {data - ? isSubmitting - ? "Updating Link..." - : "Update Link" - : isSubmitting - ? "Adding Link..." - : "Add Link"} + {data ? (isSubmitting ? "Updating Link..." : "Update Link") : isSubmitting ? "Adding Link..." : "Add Link"}
    diff --git a/web/components/web-view/issue-activity.tsx b/web/components/web-view/issue-activity.tsx index 4bd13eb5c..75bfb83e0 100644 --- a/web/components/web-view/issue-activity.tsx +++ b/web/components/web-view/issue-activity.tsx @@ -11,7 +11,7 @@ import useSWR, { mutate } from "swr"; import { PROJECT_ISSUES_ACTIVITY } from "constants/fetch-keys"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useUser from "hooks/use-user"; @@ -45,12 +45,7 @@ export const IssueActivity: React.FC = (props) => { const { data: issueActivities, mutate: mutateIssueActivity } = useSWR( workspaceSlug && projectId && issueId ? PROJECT_ISSUES_ACTIVITY(issueId.toString()) : null, workspaceSlug && projectId && issueId - ? () => - issuesService.getIssueActivities( - workspaceSlug.toString(), - projectId.toString(), - issueId.toString() - ) + ? () => issuesService.getIssueActivities(workspaceSlug.toString(), projectId.toString(), issueId.toString()) : null ); @@ -58,14 +53,7 @@ export const IssueActivity: React.FC = (props) => { if (!workspaceSlug || !projectId || !issueId) return; await issuesService - .patchIssueComment( - workspaceSlug as string, - projectId as string, - issueId as string, - comment.id, - comment, - user - ) + .patchIssueComment(workspaceSlug as string, projectId as string, issueId as string, comment.id, comment, user) .then(() => mutateIssueActivity()); }; @@ -75,13 +63,7 @@ export const IssueActivity: React.FC = (props) => { mutateIssueActivity((prevData: any) => prevData?.filter((p: any) => p.id !== commentId), false); await issuesService - .deleteIssueComment( - workspaceSlug as string, - projectId as string, - issueId as string, - commentId, - user - ) + .deleteIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId, user) .then(() => mutateIssueActivity()); }; @@ -89,13 +71,7 @@ export const IssueActivity: React.FC = (props) => { if (!workspaceSlug || !issueDetails) return; await issuesService - .createIssueComment( - workspaceSlug.toString(), - issueDetails.project, - issueDetails.id, - formData, - user - ) + .createIssueComment(workspaceSlug.toString(), issueDetails.project, issueDetails.id, formData, user) .then(() => { mutate(PROJECT_ISSUES_ACTIVITY(issueDetails.id)); }) @@ -118,11 +94,7 @@ export const IssueActivity: React.FC = (props) => {
      {issueActivities?.map((activityItem, index) => { // determines what type of action is performed - const message = activityItem.field ? ( - - ) : ( - "created the issue." - ); + const message = activityItem.field ? : "created the issue."; if ("field" in activityItem && activityItem.field !== "updated_by") { return ( @@ -141,15 +113,11 @@ export const IssueActivity: React.FC = (props) => {
      {activityItem.field ? ( activityItem.new_value === "restore" ? ( - + ) : ( ) - ) : activityItem.actor_detail.avatar && - activityItem.actor_detail.avatar !== "" ? ( + ) : activityItem.actor_detail.avatar && activityItem.actor_detail.avatar !== "" ? ( {activityItem.actor_detail.display_name} = (props) => {
      - {activityItem.field === "archived_at" && - activityItem.new_value !== "restore" ? ( + {activityItem.field === "archived_at" && activityItem.new_value !== "restore" ? ( Plane ) : activityItem.actor_detail.is_bot ? ( - - {activityItem.actor_detail.first_name} Bot - + {activityItem.actor_detail.first_name} Bot ) : ( )}{" "} - {message}{" "} - - {timeAgo(activityItem.created_at)} - + {message} {timeAgo(activityItem.created_at)}
    @@ -217,10 +179,7 @@ export const IssueActivity: React.FC = (props) => {
    diff --git a/web/components/web-view/issue-attachments.tsx b/web/components/web-view/issue-attachments.tsx index ba4540318..c1dde0937 100644 --- a/web/components/web-view/issue-attachments.tsx +++ b/web/components/web-view/issue-attachments.tsx @@ -9,7 +9,7 @@ import { useRouter } from "next/router"; import useSWR, { mutate } from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // react dropzone import { useDropzone } from "react-dropzone"; @@ -61,12 +61,7 @@ export const IssueAttachments: React.FC = (props) => { setIsLoading(true); issuesService - .uploadIssueAttachment( - workspaceSlug as string, - projectId as string, - issueId as string, - formData - ) + .uploadIssueAttachment(workspaceSlug as string, projectId as string, issueId as string, formData) .then((res) => { mutate( ISSUE_ATTACHMENTS(issueId as string), @@ -109,12 +104,7 @@ export const IssueAttachments: React.FC = (props) => { const { data: attachments } = useSWR( workspaceSlug && projectId && issueId ? ISSUE_ATTACHMENTS(issueId as string) : null, workspaceSlug && projectId && issueId - ? () => - issuesService.getIssueAttachment( - workspaceSlug.toString(), - projectId.toString(), - issueId.toString() - ) + ? () => issuesService.getIssueAttachment(workspaceSlug.toString(), projectId.toString(), issueId.toString()) : null ); diff --git a/web/components/web-view/issue-link-list.tsx b/web/components/web-view/issue-link-list.tsx index 5f1da6a62..5df652300 100644 --- a/web/components/web-view/issue-link-list.tsx +++ b/web/components/web-view/issue-link-list.tsx @@ -9,7 +9,7 @@ import { useRouter } from "next/router"; import { mutate } from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // icons // import { LinkIcon, PlusIcon, PencilIcon, TrashIcon } from "@heroicons/react/24/outline"; diff --git a/web/components/web-view/issue-properties-detail.tsx b/web/components/web-view/issue-properties-detail.tsx index 2c745febe..65a2eb173 100644 --- a/web/components/web-view/issue-properties-detail.tsx +++ b/web/components/web-view/issue-properties-detail.tsx @@ -11,7 +11,7 @@ import { mutate } from "swr"; import { Control, Controller, useWatch } from "react-hook-form"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useUser from "hooks/use-user"; @@ -105,10 +105,7 @@ export const IssuePropertiesDetail: React.FC = (props) => { control={control} name="state" render={({ field: { value } }) => ( - submitChanges({ state: val })} - /> + submitChanges({ state: val })} /> )} />
    @@ -117,13 +114,7 @@ export const IssuePropertiesDetail: React.FC = (props) => {
    - + = (props) => { control={control} name="priority" render={({ field: { value } }) => ( - submitChanges({ priority: val })} - /> + submitChanges({ priority: val })} /> )} />
    @@ -157,10 +145,7 @@ export const IssuePropertiesDetail: React.FC = (props) => { control={control} name="assignees_list" render={({ field: { value } }) => ( - submitChanges({ assignees_list: [val] })} - /> + submitChanges({ assignees_list: [val] })} /> )} />
    @@ -180,10 +165,7 @@ export const IssuePropertiesDetail: React.FC = (props) => { control={control} name="estimate_point" render={({ field: { value } }) => ( - submitChanges({ estimate_point: val })} - /> + submitChanges({ estimate_point: val })} /> )} />
    @@ -201,10 +183,7 @@ export const IssuePropertiesDetail: React.FC = (props) => { control={control} name="parent" render={({ field: { value } }) => ( - submitChanges({ parent: val })} - /> + submitChanges({ parent: val })} /> )} />
    @@ -224,22 +203,16 @@ export const IssuePropertiesDetail: React.FC = (props) => { if (!user || !workspaceSlug || !projectId || !issueId) return; issuesService - .createIssueRelation( - workspaceSlug as string, - projectId as string, - issueId as string, - user, - { - related_list: [ - ...val.map((issue: any) => ({ - issue: issue.blocker_issue_detail.id, - relation_type: "blocked_by" as const, - related_issue: issueId as string, - related_issue_detail: issue.blocker_issue_detail, - })), - ], - } - ) + .createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, user, { + related_list: [ + ...val.map((issue: any) => ({ + issue: issue.blocker_issue_detail.id, + relation_type: "blocked_by" as const, + related_issue: issueId as string, + related_issue_detail: issue.blocker_issue_detail, + })), + ], + }) .then((response) => { handleMutation({ issue_relations: [ @@ -315,22 +288,16 @@ export const IssuePropertiesDetail: React.FC = (props) => { if (!user || !workspaceSlug || !projectId || !issueId) return; issuesService - .createIssueRelation( - workspaceSlug as string, - projectId as string, - issueId as string, - user, - { - related_list: [ - ...val.map((issue: any) => ({ - issue: issue.blocked_issue_detail.id, - relation_type: "blocked_by" as const, - related_issue: issueId as string, - related_issue_detail: issue.blocked_issue_detail, - })), - ], - } - ) + .createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, user, { + related_list: [ + ...val.map((issue: any) => ({ + issue: issue.blocked_issue_detail.id, + relation_type: "blocked_by" as const, + related_issue: issueId as string, + related_issue_detail: issue.blocked_issue_detail, + })), + ], + }) .then((response) => { handleMutation({ related_issues: [ @@ -429,13 +396,8 @@ export const IssuePropertiesDetail: React.FC = (props) => { onClick={() => setIsViewAllOpen((prev) => !prev)} className="w-full flex justify-center items-center gap-1 !py-2" > - - {isViewAllOpen ? "View less" : "View all"} - - + {isViewAllOpen ? "View less" : "View all"} +
    diff --git a/web/components/web-view/select-parent.tsx b/web/components/web-view/select-parent.tsx index e5975b7b5..5a2f2cf13 100644 --- a/web/components/web-view/select-parent.tsx +++ b/web/components/web-view/select-parent.tsx @@ -8,7 +8,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // fetch key import { ISSUE_DETAILS } from "constants/fetch-keys"; @@ -37,8 +37,7 @@ export const ParentSelect: React.FC = (props) => { const { data: issueDetails } = useSWR( workspaceSlug && projectId && issueId ? ISSUE_DETAILS(issueId.toString()) : null, workspaceSlug && projectId && issueId - ? () => - issuesService.retrieve(workspaceSlug.toString(), projectId.toString(), issueId.toString()) + ? () => issuesService.retrieve(workspaceSlug.toString(), projectId.toString(), issueId.toString()) : null ); diff --git a/web/components/web-view/select-state.tsx b/web/components/web-view/select-state.tsx index c5bfa1257..2012e13f4 100644 --- a/web/components/web-view/select-state.tsx +++ b/web/components/web-view/select-state.tsx @@ -11,7 +11,7 @@ import useSWR from "swr"; import { ChevronDown } from "lucide-react"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // fetch key import { STATES_LIST } from "constants/fetch-keys"; @@ -39,9 +39,7 @@ export const StateSelect: React.FC = (props) => { const { data: stateGroups } = useSWR( workspaceSlug && projectId ? STATES_LIST(projectId as string) : null, - workspaceSlug && projectId - ? () => stateService.getStates(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => stateService.getStates(workspaceSlug as string, projectId as string) : null ); const states = getStatesList(stateGroups); diff --git a/web/components/web-view/sub-issues.tsx b/web/components/web-view/sub-issues.tsx index 4299d9e3a..a4e180971 100644 --- a/web/components/web-view/sub-issues.tsx +++ b/web/components/web-view/sub-issues.tsx @@ -11,7 +11,7 @@ import useSWR, { mutate } from "swr"; import { X } from "lucide-react"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // fetch key import { SUB_ISSUES } from "constants/fetch-keys"; @@ -41,8 +41,7 @@ export const SubIssueList: React.FC = (props) => { const { data: subIssuesResponse } = useSWR( workspaceSlug && issueDetails ? SUB_ISSUES(issueDetails.id) : null, workspaceSlug && issueDetails - ? () => - issuesService.subIssues(workspaceSlug as string, issueDetails.project, issueDetails.id) + ? () => issuesService.subIssues(workspaceSlug as string, issueDetails.project, issueDetails.id) : null ); diff --git a/web/hooks/gantt-chart/issue-view.tsx b/web/hooks/gantt-chart/issue-view.tsx index 8b24a566c..2f9fd9c18 100644 --- a/web/hooks/gantt-chart/issue-view.tsx +++ b/web/hooks/gantt-chart/issue-view.tsx @@ -1,7 +1,7 @@ import useSWR from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useIssuesView from "hooks/use-issues-view"; // fetch-keys @@ -28,8 +28,7 @@ const useGanttChartIssues = (workspaceSlug: string | undefined, projectId: strin const { data: ganttIssues, mutate: mutateGanttIssues } = useSWR( workspaceSlug && projectId ? PROJECT_ISSUES_LIST_WITH_PARAMS(projectId, params) : null, workspaceSlug && projectId - ? () => - issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) + ? () => issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) : null ); diff --git a/web/hooks/gantt-chart/view-issues-view.tsx b/web/hooks/gantt-chart/view-issues-view.tsx index 8e0bc496b..fae8ec326 100644 --- a/web/hooks/gantt-chart/view-issues-view.tsx +++ b/web/hooks/gantt-chart/view-issues-view.tsx @@ -1,7 +1,7 @@ import useSWR from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // hooks import useIssuesView from "hooks/use-issues-view"; // fetch-keys diff --git a/web/hooks/use-calendar-issues-view.tsx b/web/hooks/use-calendar-issues-view.tsx index 289aed2ac..21f8a4199 100644 --- a/web/hooks/use-calendar-issues-view.tsx +++ b/web/hooks/use-calendar-issues-view.tsx @@ -7,7 +7,7 @@ import useSWR from "swr"; // contexts import { issueViewContext } from "contexts/issue-view.context"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import cyclesService from "services/cycles.service"; import modulesService from "services/modules.service"; // types @@ -45,19 +45,14 @@ const useCalendarIssuesView = () => { }; const { data: projectCalendarIssues, mutate: mutateProjectCalendarIssues } = useSWR( + workspaceSlug && projectId ? PROJECT_ISSUES_LIST_WITH_PARAMS(projectId.toString(), params) : null, workspaceSlug && projectId - ? PROJECT_ISSUES_LIST_WITH_PARAMS(projectId.toString(), params) - : null, - workspaceSlug && projectId - ? () => - issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) + ? () => issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) : null ); const { data: cycleCalendarIssues, mutate: mutateCycleCalendarIssues } = useSWR( - workspaceSlug && projectId && cycleId - ? CYCLE_ISSUES_WITH_PARAMS(cycleId.toString(), params) - : null, + workspaceSlug && projectId && cycleId ? CYCLE_ISSUES_WITH_PARAMS(cycleId.toString(), params) : null, workspaceSlug && projectId && cycleId ? () => cyclesService.getCycleIssuesWithParams( @@ -70,9 +65,7 @@ const useCalendarIssuesView = () => { ); const { data: moduleCalendarIssues, mutate: mutateModuleCalendarIssues } = useSWR( - workspaceSlug && projectId && moduleId - ? MODULE_ISSUES_WITH_PARAMS(moduleId.toString(), params) - : null, + workspaceSlug && projectId && moduleId ? MODULE_ISSUES_WITH_PARAMS(moduleId.toString(), params) : null, workspaceSlug && projectId && moduleId ? () => modulesService.getModuleIssuesWithParams( @@ -87,8 +80,7 @@ const useCalendarIssuesView = () => { const { data: viewCalendarIssues, mutate: mutateViewCalendarIssues } = useSWR( workspaceSlug && projectId && viewId && params ? VIEW_ISSUES(viewId.toString(), params) : null, workspaceSlug && projectId && viewId && params - ? () => - issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) + ? () => issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) : null ); diff --git a/web/hooks/use-comment-reaction.tsx b/web/hooks/use-comment-reaction.tsx index 92b4b9c17..1aa334e43 100644 --- a/web/hooks/use-comment-reaction.tsx +++ b/web/hooks/use-comment-reaction.tsx @@ -4,7 +4,7 @@ import useSWR from "swr"; import { COMMENT_REACTION_LIST } from "constants/fetch-keys"; // services -import reactionService from "services/reaction.service"; +import reactionService from "services/issue_reaction.service"; // helpers import { groupReactions } from "helpers/emoji.helper"; @@ -69,8 +69,7 @@ const useCommentReaction = ( if (!workspaceSlug || !projectId || !commendId) return; mutateCommentReactions( - (prevData: any) => - prevData?.filter((r: any) => r.actor !== user?.user?.id || r.reaction !== reaction) || [], + (prevData: any) => prevData?.filter((r: any) => r.actor !== user?.user?.id || r.reaction !== reaction) || [], false ); diff --git a/web/hooks/use-estimate-option.tsx b/web/hooks/use-estimate-option.tsx index 37b42b9e9..594190583 100644 --- a/web/hooks/use-estimate-option.tsx +++ b/web/hooks/use-estimate-option.tsx @@ -3,7 +3,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import estimatesService from "services/estimates.service"; +import estimatesService from "services/project_estimates.service"; // hooks import useProjectDetails from "hooks/use-project-details"; // helpers diff --git a/web/hooks/use-issue-properties.tsx b/web/hooks/use-issue-properties.tsx index 6f4f093e0..98f1e716f 100644 --- a/web/hooks/use-issue-properties.tsx +++ b/web/hooks/use-issue-properties.tsx @@ -3,7 +3,7 @@ import { useState, useEffect, useCallback } from "react"; import useSWR from "swr"; // services -import issueServices from "services/issues.service"; +import issueServices from "services/issue.service"; // hooks import useUser from "hooks/use-user"; // types @@ -31,12 +31,8 @@ const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => { const { user } = useUser(); const { data: issueProperties, mutate: mutateIssueProperties } = useSWR( - workspaceSlug && projectId - ? `/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-properties/` - : null, - workspaceSlug && projectId - ? () => issueServices.getIssueProperties(workspaceSlug, projectId) - : null + workspaceSlug && projectId ? `/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-properties/` : null, + workspaceSlug && projectId ? () => issueServices.getIssueProperties(workspaceSlug, projectId) : null ); useEffect(() => { @@ -68,7 +64,7 @@ const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => { ({ ...prev, properties: { ...prev?.properties, [key]: !prev?.properties?.[key] }, - }) as IssuePriorities, + } as IssuePriorities), false ); if (Object.keys(issueProperties).length > 0) { diff --git a/web/hooks/use-issue-reaction.tsx b/web/hooks/use-issue-reaction.tsx index fabab98d2..43c85460a 100644 --- a/web/hooks/use-issue-reaction.tsx +++ b/web/hooks/use-issue-reaction.tsx @@ -7,7 +7,7 @@ import { ISSUE_REACTION_LIST } from "constants/fetch-keys"; import { groupReactions } from "helpers/emoji.helper"; // services -import reactionService from "services/reaction.service"; +import reactionService from "services/issue_reaction.service"; // hooks import useUser from "./use-user"; @@ -28,12 +28,7 @@ const useIssueReaction = ( ? ISSUE_REACTION_LIST(workspaceSlug.toString(), projectId.toString(), issueId.toString()) : null, workspaceSlug && projectId && issueId - ? () => - reactionService.listIssueReactions( - workspaceSlug.toString(), - projectId.toString(), - issueId.toString() - ) + ? () => reactionService.listIssueReactions(workspaceSlug.toString(), projectId.toString(), issueId.toString()) : null ); @@ -69,8 +64,7 @@ const useIssueReaction = ( if (!workspaceSlug || !projectId || !issueId) return; mutateReaction( - (prevData: any) => - prevData?.filter((r: any) => r.actor !== user?.user?.id || r.reaction !== reaction) || [], + (prevData: any) => prevData?.filter((r: any) => r.actor !== user?.user?.id || r.reaction !== reaction) || [], false ); diff --git a/web/hooks/use-issues-view.tsx b/web/hooks/use-issues-view.tsx index 80cabda21..87283d2f9 100644 --- a/web/hooks/use-issues-view.tsx +++ b/web/hooks/use-issues-view.tsx @@ -7,10 +7,10 @@ import useSWR from "swr"; // contexts import { issueViewContext } from "contexts/issue-view.context"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import cyclesService from "services/cycles.service"; import modulesService from "services/modules.service"; -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // helpers import { getStatesList } from "helpers/state.helper"; // types @@ -56,12 +56,9 @@ const useIssuesView = () => { }; const { data: projectIssues, mutate: mutateProjectIssues } = useSWR( + workspaceSlug && projectId && params ? PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params) : null, workspaceSlug && projectId && params - ? PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params) - : null, - workspaceSlug && projectId && params - ? () => - issuesService.getIssuesWithParams(workspaceSlug as string, projectId as string, params) + ? () => issuesService.getIssuesWithParams(workspaceSlug as string, projectId as string, params) : null ); @@ -84,9 +81,7 @@ const useIssuesView = () => { ); const { data: cycleIssues, mutate: mutateCycleIssues } = useSWR( - workspaceSlug && projectId && cycleId && params - ? CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params) - : null, + workspaceSlug && projectId && cycleId && params ? CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params) : null, workspaceSlug && projectId && cycleId && params ? () => cyclesService.getCycleIssuesWithParams( @@ -99,9 +94,7 @@ const useIssuesView = () => { ); const { data: moduleIssues, mutate: mutateModuleIssues } = useSWR( - workspaceSlug && projectId && moduleId && params - ? MODULE_ISSUES_WITH_PARAMS(moduleId as string, params) - : null, + workspaceSlug && projectId && moduleId && params ? MODULE_ISSUES_WITH_PARAMS(moduleId as string, params) : null, workspaceSlug && projectId && moduleId && params ? () => modulesService.getModuleIssuesWithParams( @@ -116,21 +109,16 @@ const useIssuesView = () => { const { data: viewIssues, mutate: mutateViewIssues } = useSWR( workspaceSlug && projectId && viewId && params ? VIEW_ISSUES(viewId.toString(), params) : null, workspaceSlug && projectId && viewId && params - ? () => - issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) + ? () => issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) : null ); const { data: states } = useSWR( workspaceSlug && projectId ? STATES_LIST(projectId as string) : null, - workspaceSlug && projectId - ? () => stateService.getStates(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => stateService.getStates(workspaceSlug as string, projectId as string) : null ); const statesList = getStatesList(states); - const activeStatesList = statesList?.filter( - (state) => state.group === "started" || state.group === "unstarted" - ); + const activeStatesList = statesList?.filter((state) => state.group === "started" || state.group === "unstarted"); const backlogStatesList = statesList?.filter((state) => state.group === "backlog"); const stateIds = @@ -141,8 +129,7 @@ const useIssuesView = () => { : statesList?.map((state) => state.id); const filteredStateIds = - (filters && filters?.state ? stateIds?.filter((s) => filters.state?.includes(s)) : stateIds) ?? - []; + (filters && filters?.state ? stateIds?.filter((s) => filters.state?.includes(s)) : stateIds) ?? []; const emptyStatesObject: { [key: string]: [] } = {}; for (let i = 0; i < filteredStateIds.length; i++) { diff --git a/web/hooks/use-spreadsheet-issues-view.tsx b/web/hooks/use-spreadsheet-issues-view.tsx index 5aa86c600..54cc8670a 100644 --- a/web/hooks/use-spreadsheet-issues-view.tsx +++ b/web/hooks/use-spreadsheet-issues-view.tsx @@ -7,7 +7,7 @@ import useSWR from "swr"; // contexts import { issueViewContext } from "contexts/issue-view.context"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import cyclesService from "services/cycles.service"; import modulesService from "services/modules.service"; // types @@ -47,19 +47,14 @@ const useSpreadsheetIssuesView = () => { }; const { data: projectSpreadsheetIssues, mutate: mutateProjectSpreadsheetIssues } = useSWR( + workspaceSlug && projectId ? PROJECT_ISSUES_LIST_WITH_PARAMS(projectId.toString(), params) : null, workspaceSlug && projectId - ? PROJECT_ISSUES_LIST_WITH_PARAMS(projectId.toString(), params) - : null, - workspaceSlug && projectId - ? () => - issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) + ? () => issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) : null ); const { data: cycleSpreadsheetIssues, mutate: mutateCycleSpreadsheetIssues } = useSWR( - workspaceSlug && projectId && cycleId - ? CYCLE_ISSUES_WITH_PARAMS(cycleId.toString(), params) - : null, + workspaceSlug && projectId && cycleId ? CYCLE_ISSUES_WITH_PARAMS(cycleId.toString(), params) : null, workspaceSlug && projectId && cycleId ? () => cyclesService.getCycleIssuesWithParams( @@ -72,9 +67,7 @@ const useSpreadsheetIssuesView = () => { ); const { data: moduleSpreadsheetIssues, mutate: mutateModuleSpreadsheetIssues } = useSWR( - workspaceSlug && projectId && moduleId - ? MODULE_ISSUES_WITH_PARAMS(moduleId.toString(), params) - : null, + workspaceSlug && projectId && moduleId ? MODULE_ISSUES_WITH_PARAMS(moduleId.toString(), params) : null, workspaceSlug && projectId && moduleId ? () => modulesService.getModuleIssuesWithParams( @@ -89,8 +82,7 @@ const useSpreadsheetIssuesView = () => { const { data: viewSpreadsheetIssues, mutate: mutateViewSpreadsheetIssues } = useSWR( workspaceSlug && projectId && viewId && params ? VIEW_ISSUES(viewId.toString(), params) : null, workspaceSlug && projectId && viewId && params - ? () => - issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) + ? () => issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params) : null ); diff --git a/web/hooks/use-sub-issue.tsx b/web/hooks/use-sub-issue.tsx index 8eb30fd0b..64d9f73f6 100644 --- a/web/hooks/use-sub-issue.tsx +++ b/web/hooks/use-sub-issue.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // types import { ISubIssueResponse } from "types"; // fetch-keys @@ -19,10 +19,7 @@ const useSubIssue = (issueId: string, isExpanded: boolean) => { const { data: subIssuesResponse, isLoading } = useSWR( shouldFetch ? SUB_ISSUES(issueId as string) : null, - shouldFetch - ? () => - issuesService.subIssues(workspaceSlug as string, projectId as string, issueId as string) - : null + shouldFetch ? () => issuesService.subIssues(workspaceSlug as string, projectId as string, issueId as string) : null ); return { diff --git a/web/pages/[workspaceSlug]/analytics.tsx b/web/pages/[workspaceSlug]/analytics.tsx index 945b27c4e..2f6d1bc69 100644 --- a/web/pages/[workspaceSlug]/analytics.tsx +++ b/web/pages/[workspaceSlug]/analytics.tsx @@ -13,7 +13,7 @@ import useProjects from "hooks/use-projects"; import { Tab } from "@headlessui/react"; // services import analyticsService from "services/analytics.service"; -import trackEventServices from "services/track-event.service"; +import trackEventServices from "services/track_event.service"; // layouts import { WorkspaceAuthorizationLayout } from "layouts/auth-layout"; // components @@ -66,9 +66,7 @@ const Analytics = () => { }; const eventType = - tab === "Scope and Demand" - ? "WORKSPACE_SCOPE_AND_DEMAND_ANALYTICS" - : "WORKSPACE_CUSTOM_ANALYTICS"; + tab === "Scope and Demand" ? "WORKSPACE_SCOPE_AND_DEMAND_ANALYTICS" : "WORKSPACE_CUSTOM_ANALYTICS"; trackEventServices.trackAnalyticsEvent(eventPayload, eventType, user); }; diff --git a/web/pages/[workspaceSlug]/editor.tsx b/web/pages/[workspaceSlug]/editor.tsx index 711e4a166..e52e26d57 100644 --- a/web/pages/[workspaceSlug]/editor.tsx +++ b/web/pages/[workspaceSlug]/editor.tsx @@ -2,7 +2,7 @@ import { TipTapEditor } from "components/tiptap"; import type { NextPage } from "next"; import { useCallback, useEffect, useState } from "react"; import { Controller, useForm } from "react-hook-form"; -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import { ICurrentUserResponse, IIssue } from "types"; import useReloadConfirmations from "hooks/use-reload-confirmation"; import { Spinner } from "components/ui"; @@ -137,9 +137,7 @@ const Editor: NextPage = () => { { workspaceSlug && projectId && archivedIssueId ? ISSUE_DETAILS(archivedIssueId as string) : null, workspaceSlug && projectId && archivedIssueId ? () => - issuesService.retrieveArchivedIssue( - workspaceSlug as string, - projectId as string, - archivedIssueId as string - ) + issuesService.retrieveArchivedIssue(workspaceSlug as string, projectId as string, archivedIssueId as string) : null ); @@ -87,13 +83,7 @@ const ArchivedIssueDetailsPage: NextPage = () => { }; await issuesService - .patchIssue( - workspaceSlug as string, - projectId as string, - archivedIssueId as string, - payload, - user - ) + .patchIssue(workspaceSlug as string, projectId as string, archivedIssueId as string, payload, user) .then(() => { mutateIssueDetails(); mutate(PROJECT_ISSUES_ACTIVITY(archivedIssueId as string)); @@ -111,8 +101,7 @@ const ArchivedIssueDetailsPage: NextPage = () => { mutate(PROJECT_ISSUES_ACTIVITY(archivedIssueId as string)); reset({ ...issueDetails, - assignees_list: - issueDetails.assignees_list ?? issueDetails.assignee_details?.map((user) => user.id), + assignees_list: issueDetails.assignees_list ?? issueDetails.assignee_details?.map((user) => user.id), labels_list: issueDetails.labels_list ?? issueDetails.labels, labels: issueDetails.labels_list ?? issueDetails.labels, }); @@ -181,11 +170,7 @@ const ArchivedIssueDetailsPage: NextPage = () => {
    )}
    - +
    diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx index de6ad561e..898a9bf80 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx @@ -14,7 +14,7 @@ import { IssueViewContextProvider } from "contexts/issue-view.context"; import { ExistingIssuesListModal, IssuesFilterView, IssuesView } from "components/core"; import { CycleDetailsSidebar, TransferIssues, TransferIssuesModal } from "components/cycles"; // services -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; import cycleServices from "services/cycles.service"; // hooks import useToast from "hooks/use-toast"; @@ -57,12 +57,7 @@ const SingleCycle: React.FC = () => { const { data: cycleDetails, error } = useSWR( workspaceSlug && projectId && cycleId ? CYCLE_DETAILS(cycleId.toString()) : null, workspaceSlug && projectId && cycleId - ? () => - cycleServices.getCycleDetails( - workspaceSlug.toString(), - projectId.toString(), - cycleId.toString() - ) + ? () => cycleServices.getCycleDetails(workspaceSlug.toString(), projectId.toString(), cycleId.toString()) : null ); @@ -83,13 +78,7 @@ const SingleCycle: React.FC = () => { }; await issuesService - .addIssueToCycle( - workspaceSlug as string, - projectId as string, - cycleId as string, - payload, - user - ) + .addIssueToCycle(workspaceSlug as string, projectId as string, cycleId as string, payload, user) .catch(() => { setToastAlert({ type: "error", @@ -173,22 +162,14 @@ const SingleCycle: React.FC = () => { /> ) : ( <> - setTransferIssuesModal(false)} - isOpen={transferIssuesModal} - /> - setAnalyticsModal(false)} - /> + setTransferIssuesModal(false)} isOpen={transferIssuesModal} /> + setAnalyticsModal(false)} />
    - {cycleStatus === "completed" && ( - setTransferIssuesModal(true)} /> - )} + {cycleStatus === "completed" && setTransferIssuesModal(true)} />} { } = useSWR( workspaceSlug && projectId && issueId ? ISSUE_DETAILS(issueId as string) : null, workspaceSlug && projectId && issueId - ? () => - issuesService.retrieve(workspaceSlug as string, projectId as string, issueId as string) + ? () => issuesService.retrieve(workspaceSlug as string, projectId as string, issueId as string) : null ); @@ -108,8 +107,7 @@ const IssueDetailsPage: NextPage = () => { mutate(PROJECT_ISSUES_ACTIVITY(issueId as string)); reset({ ...issueDetails, - assignees_list: - issueDetails.assignees_list ?? issueDetails.assignee_details?.map((user) => user.id), + assignees_list: issueDetails.assignees_list ?? issueDetails.assignee_details?.map((user) => user.id), labels_list: issueDetails.labels_list ?? issueDetails.labels, labels: issueDetails.labels_list ?? issueDetails.labels, }); diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx index d79bfb613..688eeaca8 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx @@ -15,8 +15,8 @@ import { DragDropContext, DropResult } from "react-beautiful-dnd"; import StrictModeDroppable from "components/dnd/StrictModeDroppable"; // services import projectService from "services/project.service"; -import pagesService from "services/pages.service"; -import issuesService from "services/issues.service"; +import pagesService from "services/page.service"; +import issuesService from "services/issue.service"; // hooks import useToast from "hooks/use-toast"; import useUser from "hooks/use-user"; @@ -28,14 +28,7 @@ import { CreateLabelModal } from "components/labels"; import { CreateBlock } from "components/pages/create-block"; // ui import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; -import { - CustomSearchSelect, - EmptyState, - Loader, - TextArea, - ToggleSwitch, - Tooltip, -} from "components/ui"; +import { CustomSearchSelect, EmptyState, Loader, TextArea, ToggleSwitch, Tooltip } from "components/ui"; // images import emptyPage from "public/empty-state/page.svg"; // icons @@ -86,40 +79,26 @@ const SinglePage: NextPage = () => { const { data: projectDetails } = useSWR( workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null, - workspaceSlug && projectId - ? () => projectService.getProject(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => projectService.getProject(workspaceSlug as string, projectId as string) : null ); const { data: pageDetails, error } = useSWR( workspaceSlug && projectId && pageId ? PAGE_DETAILS(pageId as string) : null, workspaceSlug && projectId - ? () => - pagesService.getPageDetails( - workspaceSlug as string, - projectId as string, - pageId as string - ) + ? () => pagesService.getPageDetails(workspaceSlug as string, projectId as string, pageId as string) : null ); const { data: pageBlocks } = useSWR( workspaceSlug && projectId && pageId ? PAGE_BLOCKS_LIST(pageId as string) : null, workspaceSlug && projectId - ? () => - pagesService.listPageBlocks( - workspaceSlug as string, - projectId as string, - pageId as string - ) + ? () => pagesService.listPageBlocks(workspaceSlug as string, projectId as string, pageId as string) : null ); const { data: labels } = useSWR( workspaceSlug && projectId ? PROJECT_ISSUE_LABELS(projectId as string) : null, - workspaceSlug && projectId - ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) : null ); const { data: memberDetails } = useSWR( @@ -209,11 +188,7 @@ const SinglePage: NextPage = () => { }); }); - pagesService.removePageFromFavorites( - workspaceSlug as string, - projectId as string, - pageId as string - ); + pagesService.removePageFromFavorites(workspaceSlug as string, projectId as string, pageId as string); }; const handleOnDragEnd = (result: DropResult) => { @@ -228,15 +203,9 @@ const SinglePage: NextPage = () => { newSortOrder = pageBlocks[pageBlocks.length - 1].sort_order + 10000; else { if (destination.index > source.index) - newSortOrder = - (pageBlocks[destination.index].sort_order + - pageBlocks[destination.index + 1].sort_order) / - 2; + newSortOrder = (pageBlocks[destination.index].sort_order + pageBlocks[destination.index + 1].sort_order) / 2; else if (destination.index < source.index) - newSortOrder = - (pageBlocks[destination.index - 1].sort_order + - pageBlocks[destination.index].sort_order) / - 2; + newSortOrder = (pageBlocks[destination.index - 1].sort_order + pageBlocks[destination.index].sort_order) / 2; } const newBlocksList = pageBlocks.map((p) => ({ @@ -262,18 +231,15 @@ const SinglePage: NextPage = () => { }; const handleCopyText = () => { - const originURL = - typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; + const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; - copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/pages/${pageId}`).then( - () => { - setToastAlert({ - type: "success", - title: "Link Copied!", - message: "Page link copied to clipboard.", - }); - } - ); + copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/pages/${pageId}`).then(() => { + setToastAlert({ + type: "success", + title: "Link Copied!", + message: "Page link copied to clipboard.", + }); + }); }; const handleShowBlockToggle = async () => { @@ -288,9 +254,7 @@ const SinglePage: NextPage = () => { }; mutate( - (workspaceSlug as string) && (projectId as string) - ? USER_PROJECT_VIEW(projectId as string) - : null, + (workspaceSlug as string) && (projectId as string) ? USER_PROJECT_VIEW(projectId as string) : null, (prevData) => { if (!prevData) return prevData; @@ -302,15 +266,13 @@ const SinglePage: NextPage = () => { false ); - await projectService - .setProjectView(workspaceSlug as string, projectId as string, payload) - .catch(() => { - setToastAlert({ - type: "error", - title: "Error!", - message: "Something went wrong. Please try again.", - }); + await projectService.setProjectView(workspaceSlug as string, projectId as string, payload).catch(() => { + setToastAlert({ + type: "error", + title: "Error!", + message: "Something went wrong. Please try again.", }); + }); }; const options = labels?.map((label) => ({ @@ -406,16 +368,13 @@ const SinglePage: NextPage = () => { partialUpdatePage({ labels_list: updatedLabels }); }} style={{ - backgroundColor: `${ - label?.color && label.color !== "" ? label.color : "#000000" - }20`, + backgroundColor: `${label?.color && label.color !== "" ? label.color : "#000000"}20`, }} > {label.name} @@ -492,9 +451,7 @@ const SinglePage: NextPage = () => {
    - - Show full block content - + Show full block content { @@ -594,11 +551,7 @@ const SinglePage: NextPage = () => { ) : ( - )} @@ -649,11 +602,7 @@ const SinglePage: NextPage = () => { {createBlockForm && (
    - setCreateBlockForm(false)} - focus="name" - user={user} - /> + setCreateBlockForm(false)} focus="name" user={user} />
    )} {labelModal && typeof projectId === "string" && ( diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/settings/estimates.tsx b/web/pages/[workspaceSlug]/projects/[projectId]/settings/estimates.tsx index 21e68563a..b9a21f793 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/settings/estimates.tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/settings/estimates.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import useSWR, { mutate } from "swr"; // services -import estimatesService from "services/estimates.service"; +import estimatesService from "services/project_estimates.service"; import projectService from "services/project.service"; // hooks import useProjectDetails from "hooks/use-project-details"; @@ -67,15 +67,13 @@ const EstimatesSettings: NextPage = () => { false ); - estimatesService - .deleteEstimate(workspaceSlug as string, projectId as string, estimateId, user) - .catch(() => { - setToastAlert({ - type: "error", - title: "Error!", - message: "Error: Estimate could not be deleted. Please try again", - }); + estimatesService.deleteEstimate(workspaceSlug as string, projectId as string, estimateId, user).catch(() => { + setToastAlert({ + type: "error", + title: "Error!", + message: "Error: Estimate could not be deleted. Please try again", }); + }); }; const disableEstimates = () => { @@ -91,15 +89,13 @@ const EstimatesSettings: NextPage = () => { false ); - projectService - .updateProject(workspaceSlug as string, projectId as string, { estimate: null }, user) - .catch(() => - setToastAlert({ - type: "error", - title: "Error!", - message: "Estimate could not be disabled. Please try again", - }) - ); + projectService.updateProject(workspaceSlug as string, projectId as string, { estimate: null }, user).catch(() => + setToastAlert({ + type: "error", + title: "Error!", + message: "Estimate could not be disabled. Please try again", + }) + ); }; return ( diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/settings/features.tsx b/web/pages/[workspaceSlug]/projects/[projectId]/settings/features.tsx index 499aaea86..2dd4ab564 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/settings/features.tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/settings/features.tsx @@ -6,7 +6,7 @@ import useSWR, { mutate } from "swr"; // services import projectService from "services/project.service"; -import trackEventServices, { MiscellaneousEventType } from "services/track-event.service"; +import trackEventServices, { MiscellaneousEventType } from "services/track_event.service"; // layouts import { ProjectAuthorizationWrapper } from "layouts/auth-layout"; // hooks @@ -32,39 +32,32 @@ import { truncateText } from "helpers/string.helper"; const featuresList = [ { title: "Cycles", - description: - "Cycles are enabled for all the projects in this workspace. Access them from the sidebar.", - icon: ( - - ), + description: "Cycles are enabled for all the projects in this workspace. Access them from the sidebar.", + icon: , property: "cycle_view", }, { title: "Modules", - description: - "Modules are enabled for all the projects in this workspace. Access it from the sidebar.", + description: "Modules are enabled for all the projects in this workspace. Access it from the sidebar.", icon: , property: "module_view", }, { title: "Views", - description: - "Views are enabled for all the projects in this workspace. Access it from the sidebar.", + description: "Views are enabled for all the projects in this workspace. Access it from the sidebar.", icon: , property: "issue_views_view", }, { title: "Pages", - description: - "Pages are enabled for all the projects in this workspace. Access it from the sidebar.", + description: "Pages are enabled for all the projects in this workspace. Access it from the sidebar.", icon: , property: "page_view", }, { title: "Inbox", - description: - "Inbox are enabled for all the projects in this workspace. Access it from the issues views page.", + description: "Inbox are enabled for all the projects in this workspace. Access it from the issues views page.", icon: , property: "inbox_view", }, @@ -97,9 +90,7 @@ const FeaturesSettings: NextPage = () => { const { data: projectDetails } = useSWR( workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null, - workspaceSlug && projectId - ? () => projectService.getProject(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => projectService.getProject(workspaceSlug as string, projectId as string) : null ); const handleSubmit = async (formData: Partial) => { @@ -129,15 +120,13 @@ const FeaturesSettings: NextPage = () => { message: "Project feature updated successfully.", }); - await projectService - .updateProject(workspaceSlug as string, projectId as string, formData, user) - .catch(() => - setToastAlert({ - type: "error", - title: "Error!", - message: "Project feature could not be updated. Please try again.", - }) - ); + await projectService.updateProject(workspaceSlug as string, projectId as string, formData, user).catch(() => + setToastAlert({ + type: "error", + title: "Error!", + message: "Project feature could not be updated. Please try again.", + }) + ); }; return ( @@ -173,9 +162,7 @@ const FeaturesSettings: NextPage = () => {

    {feature.title}

    -

    - {feature.description} -

    +

    {feature.description}

    { projectIdentifier: projectDetails?.identifier, projectName: projectDetails?.name, }, - getEventType( - feature.title, - !projectDetails?.[feature.property as keyof IProject] - ), + getEventType(feature.title, !projectDetails?.[feature.property as keyof IProject]), user ); handleSubmit({ diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/settings/integrations.tsx b/web/pages/[workspaceSlug]/projects/[projectId]/settings/integrations.tsx index ca64b8e22..9fc2fe7bf 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/settings/integrations.tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/settings/integrations.tsx @@ -7,7 +7,7 @@ import useSWR from "swr"; // layouts import { ProjectAuthorizationWrapper } from "layouts/auth-layout"; // services -import IntegrationService from "services/integration"; +import IntegrationService from "services/integration.service"; import projectService from "services/project.service"; // components import { SettingsSidebar, SingleIntegration } from "components/project"; @@ -32,17 +32,12 @@ const ProjectIntegrations: NextPage = () => { const { data: projectDetails } = useSWR( workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null, - workspaceSlug && projectId - ? () => projectService.getProject(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => projectService.getProject(workspaceSlug as string, projectId as string) : null ); const { data: workspaceIntegrations } = useSWR( workspaceSlug ? WORKSPACE_INTEGRATIONS(workspaceSlug as string) : null, - () => - workspaceSlug - ? IntegrationService.getWorkspaceIntegrationsList(workspaceSlug as string) - : null + () => (workspaceSlug ? IntegrationService.getWorkspaceIntegrationsList(workspaceSlug as string) : null) ); return ( @@ -70,10 +65,7 @@ const ProjectIntegrations: NextPage = () => { workspaceIntegrations.length > 0 ? (
    {workspaceIntegrations.map((integration) => ( - + ))}
    ) : ( diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx b/web/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx index 13b290152..a6198acd2 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx @@ -8,7 +8,7 @@ import useSWR from "swr"; import useUserAuth from "hooks/use-user-auth"; // services import projectService from "services/project.service"; -import issuesService from "services/issues.service"; +import issuesService from "services/issue.service"; // layouts import { ProjectAuthorizationWrapper } from "layouts/auth-layout"; // components @@ -59,16 +59,12 @@ const LabelsSettings: NextPage = () => { const { data: projectDetails } = useSWR( workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null, - workspaceSlug && projectId - ? () => projectService.getProject(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => projectService.getProject(workspaceSlug as string, projectId as string) : null ); const { data: issueLabels } = useSWR( workspaceSlug && projectId ? PROJECT_ISSUE_LABELS(projectId as string) : null, - workspaceSlug && projectId - ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string) : null ); const newLabel = () => { @@ -121,11 +117,7 @@ const LabelsSettings: NextPage = () => {

    Labels

    - + Add label
    diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/settings/states.tsx b/web/pages/[workspaceSlug]/projects/[projectId]/settings/states.tsx index 88be296c4..7037ec8ea 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/settings/states.tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/settings/states.tsx @@ -5,19 +5,14 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import stateService from "services/state.service"; +import stateService from "services/project_state.service"; // hooks import useProjectDetails from "hooks/use-project-details"; import useUserAuth from "hooks/use-user-auth"; // layouts import { ProjectAuthorizationWrapper } from "layouts/auth-layout"; // components -import { - CreateUpdateStateInline, - DeleteStateModal, - SingleState, - StateGroup, -} from "components/states"; +import { CreateUpdateStateInline, DeleteStateModal, SingleState, StateGroup } from "components/states"; import { SettingsSidebar } from "components/project"; // ui import { Loader } from "components/ui"; @@ -46,9 +41,7 @@ const StatesSettings: NextPage = () => { const { data: states } = useSWR( workspaceSlug && projectId ? STATES_LIST(projectId as string) : null, - workspaceSlug && projectId - ? () => stateService.getStates(workspaceSlug as string, projectId as string) - : null + workspaceSlug && projectId ? () => stateService.getStates(workspaceSlug as string, projectId as string) : null ); const orderedStateGroups = orderStateGroups(states); const statesList = getStatesList(orderedStateGroups); @@ -88,9 +81,7 @@ const StatesSettings: NextPage = () => { return (
    -

    - {key} -

    +

    {key}