fix: bug and auth fixes (#1224)
* fix: sign in and invitation page fixes * fix: project and workspace services track event fix * fix: user onboarding complete track event fix * fix: issue track event fix * fix: partial property , issue comment and mark as done issue track event fix * fix: bulk delete , move to cycle or module and issue label track event fix * fix: state , cycle and module track event fix * fix: pages and block track event fix * fix: integration , estimate , importer , analytics and gpt track event fix * fix: view track event fix * fix: build fix * fix: build fix
This commit is contained in:
parent
c127353281
commit
6f2a38ad66
117 changed files with 1319 additions and 494 deletions
|
|
@ -6,6 +6,8 @@ import useSWR from "swr";
|
|||
|
||||
// react-hook-form
|
||||
import { useForm } from "react-hook-form";
|
||||
// hooks
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// headless ui
|
||||
import { Tab } from "@headlessui/react";
|
||||
// services
|
||||
|
|
@ -35,6 +37,8 @@ const Analytics = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { control, watch, setValue } = useForm<IAnalyticsParams>({ defaultValues });
|
||||
|
||||
const params: IAnalyticsParams = {
|
||||
|
|
@ -59,7 +63,7 @@ const Analytics = () => {
|
|||
? "WORKSPACE_SCOPE_AND_DEMAND_ANALYTICS"
|
||||
: "WORKSPACE_CUSTOM_ANALYTICS";
|
||||
|
||||
trackEventServices.trackAnalyticsEvent(eventPayload, eventType);
|
||||
trackEventServices.trackAnalyticsEvent(eventPayload, eventType, user);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -67,7 +71,8 @@ const Analytics = () => {
|
|||
|
||||
trackEventServices.trackAnalyticsEvent(
|
||||
{ workspaceSlug: workspaceSlug?.toString() },
|
||||
"WORKSPACE_SCOPE_AND_DEMAND_ANALYTICS"
|
||||
"WORKSPACE_SCOPE_AND_DEMAND_ANALYTICS",
|
||||
user
|
||||
);
|
||||
}, [workspaceSlug]);
|
||||
|
||||
|
|
@ -119,6 +124,7 @@ const Analytics = () => {
|
|||
params={params}
|
||||
control={control}
|
||||
setValue={setValue}
|
||||
user={user}
|
||||
fullScreen
|
||||
/>
|
||||
</Tab.Panel>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import cycleServices from "services/cycles.service";
|
|||
import projectService from "services/project.service";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// components
|
||||
import { AnalyticsProjectModal } from "components/analytics";
|
||||
// ui
|
||||
|
|
@ -44,6 +45,8 @@ const SingleCycle: React.FC = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, cycleId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const { data: activeProject } = useSWR(
|
||||
|
|
@ -94,7 +97,7 @@ const SingleCycle: React.FC = () => {
|
|||
if (!workspaceSlug || !projectId) return;
|
||||
|
||||
await issuesService
|
||||
.addIssueToCycle(workspaceSlug as string, projectId as string, cycleId as string, data)
|
||||
.addIssueToCycle(workspaceSlug as string, projectId as string, cycleId as string, data, user)
|
||||
.then(() => {
|
||||
mutate(CYCLE_ISSUES(cycleId as string));
|
||||
})
|
||||
|
|
@ -185,6 +188,7 @@ const SingleCycle: React.FC = () => {
|
|||
cycle={cycleDetails}
|
||||
isOpen={cycleSidebar}
|
||||
isCompleted={cycleStatus === "completed" ?? false}
|
||||
user={user}
|
||||
/>
|
||||
</ProjectAuthorizationWrapper>
|
||||
</IssueViewContextProvider>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import useSWR from "swr";
|
|||
import { Tab } from "@headlessui/react";
|
||||
// hooks
|
||||
import useLocalStorage from "hooks/use-local-storage";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// services
|
||||
import cycleService from "services/cycles.service";
|
||||
import projectService from "services/project.service";
|
||||
|
|
@ -62,6 +63,8 @@ const ProjectCycles: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { data: activeProject } = useSWR(
|
||||
workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
|
|
@ -110,6 +113,7 @@ const ProjectCycles: NextPage = () => {
|
|||
isOpen={createUpdateCycleModal}
|
||||
handleClose={() => setCreateUpdateCycleModal(false)}
|
||||
data={selectedCycle}
|
||||
user={user}
|
||||
/>
|
||||
<div className="space-y-5 p-8 h-full flex flex-col overflow-hidden">
|
||||
<div className="flex gap-4 justify-between">
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import useSWR, { mutate } from "swr";
|
|||
|
||||
// react-hook-form
|
||||
import { useForm } from "react-hook-form";
|
||||
// hooks
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// services
|
||||
import issuesService from "services/issues.service";
|
||||
// layouts
|
||||
|
|
@ -50,6 +52,8 @@ const IssueDetailsPage: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, issueId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { data: issueDetails, mutate: mutateIssueDetails } = useSWR<IIssue | undefined>(
|
||||
workspaceSlug && projectId && issueId ? ISSUE_DETAILS(issueId as string) : null,
|
||||
workspaceSlug && projectId && issueId
|
||||
|
|
@ -92,7 +96,7 @@ const IssueDetailsPage: NextPage = () => {
|
|||
|
||||
const payload = { ...formData };
|
||||
await issuesService
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload)
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
|
||||
.then((res) => {
|
||||
mutateIssueDetails();
|
||||
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
|
||||
|
|
@ -192,7 +196,7 @@ const IssueDetailsPage: NextPage = () => {
|
|||
) : null}
|
||||
<IssueDescriptionForm issue={issueDetails} handleFormSubmit={submitChanges} />
|
||||
<div className="mt-2 space-y-2">
|
||||
<SubIssuesList parentIssue={issueDetails} />
|
||||
<SubIssuesList parentIssue={issueDetails} user={user} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col gap-3 py-3">
|
||||
|
|
@ -204,8 +208,8 @@ const IssueDetailsPage: NextPage = () => {
|
|||
</div>
|
||||
<div className="space-y-5 pt-3">
|
||||
<h3 className="text-lg text-brand-base">Comments/Activity</h3>
|
||||
<IssueActivitySection />
|
||||
<AddComment />
|
||||
<IssueActivitySection user={user} />
|
||||
<AddComment user={user} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="basis-1/3 space-y-5 border-l border-brand-base p-5">
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import modulesService from "services/modules.service";
|
|||
import issuesService from "services/issues.service";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// layouts
|
||||
import { ProjectAuthorizationWrapper } from "layouts/auth-layout";
|
||||
// contexts
|
||||
|
|
@ -49,6 +50,8 @@ const SingleModule: React.FC = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, moduleId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const { data: issues } = useSWR(
|
||||
|
|
@ -95,7 +98,13 @@ const SingleModule: React.FC = () => {
|
|||
if (!workspaceSlug || !projectId) return;
|
||||
|
||||
await modulesService
|
||||
.addIssuesToModule(workspaceSlug as string, projectId as string, moduleId as string, data)
|
||||
.addIssuesToModule(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
moduleId as string,
|
||||
data,
|
||||
user
|
||||
)
|
||||
.then(() => mutate(MODULE_ISSUES(moduleId as string)))
|
||||
.catch(() =>
|
||||
setToastAlert({
|
||||
|
|
@ -186,6 +195,7 @@ const SingleModule: React.FC = () => {
|
|||
module={moduleDetails}
|
||||
isOpen={moduleSidebar}
|
||||
moduleIssues={moduleIssues}
|
||||
user={user}
|
||||
/>
|
||||
</ProjectAuthorizationWrapper>
|
||||
</IssueViewContextProvider>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import useSWR from "swr";
|
|||
|
||||
// layouts
|
||||
import { ProjectAuthorizationWrapper } from "layouts/auth-layout";
|
||||
// hooks
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// services
|
||||
import projectService from "services/project.service";
|
||||
import modulesService from "services/modules.service";
|
||||
|
|
@ -37,6 +39,8 @@ const ProjectModules: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { data: activeProject } = useSWR(
|
||||
workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
|
|
@ -89,6 +93,7 @@ const ProjectModules: NextPage = () => {
|
|||
isOpen={createUpdateModule}
|
||||
setIsOpen={setCreateUpdateModule}
|
||||
data={selectedModule}
|
||||
user={user}
|
||||
/>
|
||||
{modules ? (
|
||||
modules.length > 0 ? (
|
||||
|
|
@ -126,6 +131,7 @@ const ProjectModules: NextPage = () => {
|
|||
key={module.id}
|
||||
module={module}
|
||||
handleEditModule={() => handleEditModule(module)}
|
||||
user={user}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ const SinglePage: NextPage = () => {
|
|||
if (!formData.name || formData.name.length === 0 || formData.name === "") return;
|
||||
|
||||
await pagesService
|
||||
.patchPage(workspaceSlug as string, projectId as string, pageId as string, formData)
|
||||
.patchPage(workspaceSlug as string, projectId as string, pageId as string, formData, user)
|
||||
.then(() => {
|
||||
mutate<IPage>(
|
||||
PAGE_DETAILS(pageId as string),
|
||||
|
|
@ -143,7 +143,7 @@ const SinglePage: NextPage = () => {
|
|||
);
|
||||
|
||||
await pagesService
|
||||
.patchPage(workspaceSlug as string, projectId as string, pageId as string, formData)
|
||||
.patchPage(workspaceSlug as string, projectId as string, pageId as string, formData, user)
|
||||
.then(() => {
|
||||
mutate(PAGE_DETAILS(pageId as string));
|
||||
});
|
||||
|
|
@ -237,7 +237,8 @@ const SinglePage: NextPage = () => {
|
|||
result.draggableId,
|
||||
{
|
||||
sort_order: newSortOrder,
|
||||
}
|
||||
},
|
||||
user
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -529,6 +530,7 @@ const SinglePage: NextPage = () => {
|
|||
block={block}
|
||||
projectDetails={projectDetails}
|
||||
index={index}
|
||||
user={user}
|
||||
/>
|
||||
))}
|
||||
{provided.placeholder}
|
||||
|
|
@ -542,6 +544,7 @@ const SinglePage: NextPage = () => {
|
|||
<CreateUpdateBlockInline
|
||||
handleClose={() => setCreateBlockForm(false)}
|
||||
focus="name"
|
||||
user={user}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -550,6 +553,7 @@ const SinglePage: NextPage = () => {
|
|||
isOpen={labelModal}
|
||||
handleClose={() => setLabelModal(false)}
|
||||
projectId={projectId}
|
||||
user={user}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
|
@ -562,7 +566,7 @@ const SinglePage: NextPage = () => {
|
|||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<CreateBlock />
|
||||
<CreateBlock user={user} />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import { TPageViewProps } from "types";
|
|||
import type { NextPage } from "next";
|
||||
// fetch-keys
|
||||
import { PROJECT_DETAILS } from "constants/fetch-keys";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
|
||||
const AllPagesList = dynamic<TPagesListProps>(
|
||||
() => import("components/pages").then((a) => a.AllPagesList),
|
||||
|
|
@ -66,6 +67,8 @@ const ProjectPages: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { storedValue: pageTab, setValue: setPageTab } = useLocalStorage("pageTab", "Recent");
|
||||
|
||||
const { data: projectDetails } = useSWR(
|
||||
|
|
@ -98,6 +101,7 @@ const ProjectPages: NextPage = () => {
|
|||
<CreateUpdatePageModal
|
||||
isOpen={createUpdatePageModal}
|
||||
handleClose={() => setCreateUpdatePageModal(false)}
|
||||
user={user}
|
||||
/>
|
||||
<ProjectAuthorizationWrapper
|
||||
breadcrumbs={
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import { ProjectAuthorizationWrapper } from "layouts/auth-layout";
|
|||
import projectService from "services/project.service";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// components
|
||||
import { SettingsHeader } from "components/project";
|
||||
// ui
|
||||
|
|
@ -35,6 +36,8 @@ const ControlSettings: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { data: projectDetails } = useSWR<IProject>(
|
||||
workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
|
|
@ -65,7 +68,7 @@ const ControlSettings: NextPage = () => {
|
|||
};
|
||||
|
||||
await projectService
|
||||
.updateProject(workspaceSlug as string, projectId as string, payload)
|
||||
.updateProject(workspaceSlug as string, projectId as string, payload, user)
|
||||
.then((res) => {
|
||||
mutate(PROJECT_DETAILS(projectId as string));
|
||||
mutate(PROJECTS_LIST(workspaceSlug as string));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { CreateUpdateEstimateModal, SingleEstimate } from "components/estimates"
|
|||
import { SettingsHeader } from "components/project";
|
||||
//hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// ui
|
||||
import { EmptyState, Loader, SecondaryButton } from "components/ui";
|
||||
import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
|
||||
|
|
@ -37,6 +38,8 @@ const EstimatesSettings: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const { projectDetails } = useProjectDetails();
|
||||
|
|
@ -63,7 +66,7 @@ const EstimatesSettings: NextPage = () => {
|
|||
);
|
||||
|
||||
estimatesService
|
||||
.deleteEstimate(workspaceSlug as string, projectId as string, estimateId)
|
||||
.deleteEstimate(workspaceSlug as string, projectId as string, estimateId, user)
|
||||
.catch(() => {
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
@ -87,7 +90,7 @@ const EstimatesSettings: NextPage = () => {
|
|||
);
|
||||
|
||||
projectService
|
||||
.updateProject(workspaceSlug as string, projectId as string, { estimate: null })
|
||||
.updateProject(workspaceSlug as string, projectId as string, { estimate: null }, user)
|
||||
.catch(() =>
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
@ -106,6 +109,7 @@ const EstimatesSettings: NextPage = () => {
|
|||
setEstimateFormOpen(false);
|
||||
setEstimateToUpdate(undefined);
|
||||
}}
|
||||
user={user}
|
||||
/>
|
||||
<ProjectAuthorizationWrapper
|
||||
breadcrumbs={
|
||||
|
|
@ -149,6 +153,7 @@ const EstimatesSettings: NextPage = () => {
|
|||
estimate={estimate}
|
||||
editEstimate={(estimate) => editEstimate(estimate)}
|
||||
handleEstimateDelete={(estimateId) => removeEstimate(estimateId)}
|
||||
user={user}
|
||||
/>
|
||||
))}
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import trackEventServices, { MiscellaneousEventType } from "services/track-event
|
|||
import { ProjectAuthorizationWrapper } from "layouts/auth-layout";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// components
|
||||
import { SettingsHeader } from "components/project";
|
||||
// ui
|
||||
|
|
@ -75,6 +76,8 @@ const FeaturesSettings: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const { data: projectDetails } = useSWR(
|
||||
|
|
@ -134,7 +137,7 @@ const FeaturesSettings: NextPage = () => {
|
|||
});
|
||||
|
||||
await projectService
|
||||
.updateProject(workspaceSlug as string, projectId as string, formData)
|
||||
.updateProject(workspaceSlug as string, projectId as string, formData, user)
|
||||
.then(() => {
|
||||
mutate(
|
||||
projectDetails.is_favorite
|
||||
|
|
@ -194,7 +197,8 @@ const FeaturesSettings: NextPage = () => {
|
|||
},
|
||||
!projectDetails?.[feature.property as keyof IProject]
|
||||
? getEventType(feature.title, true)
|
||||
: getEventType(feature.title, false)
|
||||
: getEventType(feature.title, false),
|
||||
user
|
||||
);
|
||||
handleSubmit({
|
||||
[feature.property]: !projectDetails?.[feature.property as keyof IProject],
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { ImagePickerPopover } from "components/core";
|
|||
import EmojiIconPicker from "components/emoji-icon-picker";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// ui
|
||||
import {
|
||||
Input,
|
||||
|
|
@ -45,6 +46,8 @@ const defaultValues: Partial<IProject> = {
|
|||
const GeneralSettings: NextPage = () => {
|
||||
const [selectProject, setSelectedProject] = useState<string | null>(null);
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const router = useRouter();
|
||||
|
|
@ -83,7 +86,7 @@ const GeneralSettings: NextPage = () => {
|
|||
if (!workspaceSlug || !projectDetails) return;
|
||||
|
||||
await projectService
|
||||
.updateProject(workspaceSlug as string, projectDetails.id, payload)
|
||||
.updateProject(workspaceSlug as string, projectDetails.id, payload, user)
|
||||
.then((res) => {
|
||||
mutate<IProject>(
|
||||
PROJECT_DETAILS(projectDetails.id),
|
||||
|
|
@ -154,6 +157,7 @@ const GeneralSettings: NextPage = () => {
|
|||
onSuccess={() => {
|
||||
router.push(`/${workspaceSlug}/projects`);
|
||||
}}
|
||||
user={user}
|
||||
/>
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="p-8">
|
||||
<SettingsHeader />
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import { useRouter } from "next/router";
|
|||
|
||||
import useSWR from "swr";
|
||||
|
||||
// hooks
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// services
|
||||
import projectService from "services/project.service";
|
||||
import issuesService from "services/issues.service";
|
||||
|
|
@ -47,6 +49,8 @@ const LabelsSettings: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const scrollToRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const { data: projectDetails } = useSWR(
|
||||
|
|
@ -85,11 +89,13 @@ const LabelsSettings: NextPage = () => {
|
|||
isOpen={labelsListModal}
|
||||
handleClose={() => setLabelsListModal(false)}
|
||||
parent={parentLabel}
|
||||
user={user}
|
||||
/>
|
||||
<DeleteLabelModal
|
||||
isOpen={!!selectDeleteLabel}
|
||||
data={selectDeleteLabel ?? null}
|
||||
onClose={() => setSelectDeleteLabel(null)}
|
||||
user={user}
|
||||
/>
|
||||
<ProjectAuthorizationWrapper
|
||||
breadcrumbs={
|
||||
|
|
@ -160,6 +166,7 @@ const LabelsSettings: NextPage = () => {
|
|||
});
|
||||
}}
|
||||
handleLabelDelete={() => setSelectDeleteLabel(label)}
|
||||
user={user}
|
||||
/>
|
||||
);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ const MembersSettings: NextPage = () => {
|
|||
isOpen={inviteModal}
|
||||
setIsOpen={setInviteModal}
|
||||
members={members}
|
||||
user={user}
|
||||
/>
|
||||
<ProjectAuthorizationWrapper
|
||||
breadcrumbs={
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import useSWR from "swr";
|
|||
import stateService from "services/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
|
||||
|
|
@ -38,6 +39,8 @@ const StatesSettings: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { projectDetails } = useProjectDetails();
|
||||
|
||||
const { data: states } = useSWR(
|
||||
|
|
@ -55,6 +58,7 @@ const StatesSettings: NextPage = () => {
|
|||
isOpen={!!selectDeleteState}
|
||||
data={statesList?.find((s) => s.id === selectDeleteState) ?? null}
|
||||
onClose={() => setSelectDeleteState(null)}
|
||||
user={user}
|
||||
/>
|
||||
<ProjectAuthorizationWrapper
|
||||
breadcrumbs={
|
||||
|
|
@ -100,6 +104,7 @@ const StatesSettings: NextPage = () => {
|
|||
}}
|
||||
data={null}
|
||||
selectedGroup={key as keyof StateGroup}
|
||||
user={user}
|
||||
/>
|
||||
)}
|
||||
{orderedStateGroups[key].map((state, index) =>
|
||||
|
|
@ -111,6 +116,7 @@ const StatesSettings: NextPage = () => {
|
|||
statesList={statesList}
|
||||
handleEditState={() => setSelectedState(state.id)}
|
||||
handleDeleteState={() => setSelectDeleteState(state.id)}
|
||||
user={user}
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
|
|
@ -126,6 +132,7 @@ const StatesSettings: NextPage = () => {
|
|||
statesList?.find((state) => state.id === selectedState) ?? null
|
||||
}
|
||||
selectedGroup={key as keyof StateGroup}
|
||||
user={user}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import { useRouter } from "next/router";
|
|||
|
||||
import useSWR from "swr";
|
||||
|
||||
// hooks
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// services
|
||||
import viewsService from "services/views.service";
|
||||
import projectService from "services/project.service";
|
||||
|
|
@ -34,6 +36,8 @@ const ProjectViews: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { data: activeProject } = useSWR(
|
||||
workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
|
|
@ -86,11 +90,13 @@ const ProjectViews: NextPage = () => {
|
|||
isOpen={createUpdateViewModal}
|
||||
handleClose={() => setCreateUpdateViewModal(false)}
|
||||
data={selectedViewToUpdate}
|
||||
user={user}
|
||||
/>
|
||||
<DeleteViewModal
|
||||
isOpen={deleteViewModal}
|
||||
data={selectedViewToDelete}
|
||||
setIsOpen={setDeleteViewModal}
|
||||
user={user}
|
||||
/>
|
||||
{views ? (
|
||||
views.length > 0 ? (
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import projectService from "services/project.service";
|
|||
// hooks
|
||||
import useProjects from "hooks/use-projects";
|
||||
import useWorkspaces from "hooks/use-workspaces";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// layouts
|
||||
import { WorkspaceAuthorizationLayout } from "layouts/auth-layout";
|
||||
// components
|
||||
|
|
@ -30,6 +31,8 @@ const ProjectsPage: NextPage = () => {
|
|||
// router
|
||||
const router = useRouter();
|
||||
const { workspaceSlug } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
// context data
|
||||
const { activeWorkspace } = useWorkspaces();
|
||||
const { projects } = useProjects();
|
||||
|
|
@ -81,6 +84,7 @@ const ProjectsPage: NextPage = () => {
|
|||
isOpen={!!deleteProject}
|
||||
onClose={() => setDeleteProject(null)}
|
||||
data={projects?.find((item) => item.id === deleteProject) ?? null}
|
||||
user={user}
|
||||
/>
|
||||
{projects ? (
|
||||
<div className="p-8">
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import workspaceService from "services/workspace.service";
|
|||
import fileService from "services/file.service";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// layouts
|
||||
import { WorkspaceAuthorizationLayout } from "layouts/auth-layout";
|
||||
import SettingsNavbar from "layouts/settings-navbar";
|
||||
|
|
@ -49,6 +50,8 @@ const WorkspaceSettings: NextPage = () => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const { data: activeWorkspace } = useSWR(
|
||||
|
|
@ -82,7 +85,7 @@ const WorkspaceSettings: NextPage = () => {
|
|||
};
|
||||
|
||||
await workspaceService
|
||||
.updateWorkspace(activeWorkspace.slug, payload)
|
||||
.updateWorkspace(activeWorkspace.slug, payload, user)
|
||||
.then((res) => {
|
||||
mutate<IWorkspace[]>(USER_WORKSPACES, (prevData) =>
|
||||
prevData?.map((workspace) => (workspace.id === res.id ? res : workspace))
|
||||
|
|
@ -114,7 +117,7 @@ const WorkspaceSettings: NextPage = () => {
|
|||
|
||||
fileService.deleteFile(asset).then(() => {
|
||||
workspaceService
|
||||
.updateWorkspace(activeWorkspace.slug, { logo: "" })
|
||||
.updateWorkspace(activeWorkspace.slug, { logo: "" }, user)
|
||||
.then((res) => {
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
|
|
@ -169,6 +172,7 @@ const WorkspaceSettings: NextPage = () => {
|
|||
setIsOpen(false);
|
||||
}}
|
||||
data={activeWorkspace ?? null}
|
||||
user={user}
|
||||
/>
|
||||
<div className="p-8">
|
||||
<SettingsHeader />
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ const MembersSettings: NextPage = () => {
|
|||
setIsOpen={setInviteModal}
|
||||
workspace_slug={workspaceSlug as string}
|
||||
members={members}
|
||||
user={user}
|
||||
/>
|
||||
<WorkspaceAuthorizationLayout
|
||||
breadcrumbs={
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue