mirror of
https://github.com/makeplane/plane.git
synced 2026-07-14 14:31:37 +02:00
* chore: integrated time traking enabled/disabled feature on project settings and updated the pro icon as a component * chore: Showing the toggle and disabled to make any operations on project features * chore: default exports in constants * chore: seperated isEnabled and isPro * chore: updated time traking key * chore: issue worklog endpoint * chore: added work log issue * chore: csv worklog downloads * chore: acitvity listing * chore: added workspace in export issues * chore: initialised services, contants, and store * chore: integrated worklog hooks * chore: changed types in worklog type * chore: worklog response changes * chore: serializer changes * chore: corrected the import statement * chore: Worklog components and page updates * fix: download csv and excel * chore: implemented pagination for table and updated worklog downloads * chore: updated pagination and updated the api for worklog download filter param * chore: download response change * chore: import errors resolved in issue worklog * chore: handled loaders and empty states in worklog settings * chore: ui, typos and cleanup * chore: resolved merge conflicts * chore: updating the time tracking on issue detail page * chore: updated the ui worklog issue property button * chore: removed create from the worklog header * chore: updated default filters from constants * chore: resolved ce code updates * chore: ce cleanup * chore: worklogs in issue activity * ui: updated UI for peek overview and issue detail for worklog property * fix: exporter type * ui: handled the typos * ui: loader ui height changes * chore: resolved merge conflicts * chore: handled the project worklogs enabled/disabled in the issues * chore: handled empty screen for worklog * chore: typo --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
"use client";
|
|
|
|
import { FC, useState } from "react";
|
|
import { setToast, TOAST_TYPE } from "@plane/ui";
|
|
// plane web components
|
|
import { WorklogFormRoot } from "@/plane-web/components/issues/worklog";
|
|
// plane web hooks
|
|
import { useWorkspaceWorklogs } from "@/plane-web/hooks/store";
|
|
// plane web types
|
|
import { TWorklog } from "@/plane-web/types";
|
|
|
|
type TWorklogCreate = {
|
|
workspaceSlug: string;
|
|
projectId: string;
|
|
issueId: string;
|
|
handleClose?: () => void;
|
|
};
|
|
|
|
export const WorklogCreate: FC<TWorklogCreate> = (props) => {
|
|
const { workspaceSlug, projectId, issueId, handleClose } = props;
|
|
// hooks
|
|
const { createWorklog } = useWorkspaceWorklogs();
|
|
// states
|
|
const [loader, setLoader] = useState(false);
|
|
|
|
const onCancel = () => {
|
|
setLoader(false);
|
|
handleClose && handleClose();
|
|
};
|
|
|
|
const onSubmit = async (payload: Partial<TWorklog>) => {
|
|
if (!workspaceSlug || !projectId || !issueId) return { status: "error" };
|
|
|
|
try {
|
|
setLoader(true);
|
|
await createWorklog(workspaceSlug, projectId, issueId, payload);
|
|
setToast({
|
|
type: TOAST_TYPE.SUCCESS,
|
|
title: "Success!",
|
|
message: "Worklog created successfully.",
|
|
});
|
|
setLoader(false);
|
|
handleClose && handleClose();
|
|
return { status: "success" };
|
|
} catch {
|
|
setLoader(false);
|
|
setToast({
|
|
type: TOAST_TYPE.ERROR,
|
|
title: "Error!",
|
|
message: "Something went wrong. please try again.",
|
|
});
|
|
return { status: "error" };
|
|
}
|
|
};
|
|
|
|
return (
|
|
<WorklogFormRoot
|
|
data={{ hours: "", minutes: "", description: "" }}
|
|
onSubmit={onSubmit}
|
|
onCancel={onCancel}
|
|
buttonDisabled={loader}
|
|
buttonTitle={loader ? `Saving` : `Save`}
|
|
/>
|
|
);
|
|
};
|