Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useRouter } from "next/router";
import useSWR from "swr";

// services
import analyticsService from "services/analytics.service";
import { AnalyticsService } from "services/analytics.service";
// components
import { AnalyticsDemand, AnalyticsLeaderBoard, AnalyticsScope, AnalyticsYearWiseIssues } from "components/analytics";
// ui
Expand All @@ -15,6 +15,9 @@ type Props = {
fullScreen?: boolean;
};

// services
const analyticsService = new AnalyticsService();

export const ScopeAndDemand: React.FC<Props> = (props) => {
const { fullScreen = true } = props;

Expand Down
3 changes: 1 addition & 2 deletions web/components/command-palette/change-interface-theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Command } from "cmdk";
import { THEMES_OBJ } from "constants/themes";
import { useTheme } from "next-themes";
import { SettingIcon } from "components/icons";
import userService from "services/user.service";
import useUser from "hooks/use-user";
// helper
import { unsetCustomCssVariables } from "helpers/theme.helper";
Expand All @@ -25,7 +24,7 @@ export const ChangeInterfaceTheme: React.FC<Props> = observer(({ setIsPaletteOpe

const { setTheme } = useTheme();

const { user, mutateUser } = useUser();
const { user } = useUser();

const updateUserTheme = (newTheme: string) => {
if (!user) return;
Expand Down
15 changes: 10 additions & 5 deletions web/components/command-palette/command-k.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { Command } from "cmdk";
// headless ui
import { Dialog, Transition } from "@headlessui/react";
// services
import workspaceService from "services/workspace.service";
import issuesService from "services/issue/issue.service";
import inboxService from "services/inbox.service";
import { WorkspaceService } from "services/workspace.service";
import { IssueService } from "services/issue";
import { InboxService } from "services/inbox.service";
// hooks
import useProjectDetails from "hooks/use-project-details";
import useDebounce from "hooks/use-debounce";
Expand Down Expand Up @@ -44,6 +44,11 @@ type Props = {
setIsPaletteOpen: React.Dispatch<React.SetStateAction<boolean>>;
};

// services
const workspaceService = new WorkspaceService();
const issueService = new IssueService();
const inboxService = new InboxService();

export const CommandK: React.FC<Props> = ({ deleteIssue, isPaletteOpen, setIsPaletteOpen }) => {
const [placeholder, setPlaceholder] = useState("Type a command or search...");

Expand Down Expand Up @@ -80,7 +85,7 @@ export const CommandK: React.FC<Props> = ({ deleteIssue, isPaletteOpen, setIsPal
const { data: issueDetails } = useSWR(
workspaceSlug && projectId && issueId ? ISSUE_DETAILS(issueId as string) : null,
workspaceSlug && projectId && issueId
? () => issuesService.retrieve(workspaceSlug as string, projectId as string, issueId as string)
? () => issueService.retrieve(workspaceSlug as string, projectId as string, issueId as string)
: null
);

Expand Down Expand Up @@ -108,7 +113,7 @@ export const CommandK: React.FC<Props> = ({ deleteIssue, isPaletteOpen, setIsPal
);

const payload = { ...formData };
await issuesService
await issueService
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
.then(() => {
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
Expand Down
9 changes: 6 additions & 3 deletions web/components/command-palette/command-pallette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ import { CreateUpdatePageModal } from "components/pages";
// helpers
import { copyTextToClipboard } from "helpers/string.helper";
// services
import issuesService from "services/issue/issue.service";
import { IssueService } from "services/issue";
// fetch keys
import { ISSUE_DETAILS } from "constants/fetch-keys";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";

// services
const issueService = new IssueService();

export const CommandPalette: React.FC = observer(() => {
const store: any = useMobxStore();

Expand All @@ -47,7 +50,7 @@ export const CommandPalette: React.FC = observer(() => {
const { data: issueDetails } = useSWR(
workspaceSlug && projectId && issueId ? ISSUE_DETAILS(issueId as string) : null,
workspaceSlug && projectId && issueId
? () => issuesService.retrieve(workspaceSlug as string, projectId as string, issueId as string)
? () => issueService.retrieve(workspaceSlug as string, projectId as string, issueId as string)
: null
);

Expand Down Expand Up @@ -117,7 +120,7 @@ export const CommandPalette: React.FC = observer(() => {
}
}
},
[copyIssueUrlToClipboard]
[copyIssueUrlToClipboard, store.theme]
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useRouter } from "next/router";
import { mutate } from "swr";
import { Command } from "cmdk";
// services
import IssueService from "services/issue/issue.service";
import { IssueService } from "services/issue";
// hooks
import useProjectMembers from "hooks/use-project-members";
// constants
Expand All @@ -21,6 +21,7 @@ type Props = {
user: IUser | undefined;
};

// services
const issueService = new IssueService();

export const ChangeIssueAssignee: FC<Props> = ({ setIsPaletteOpen, issue, user }) => {
Expand Down
11 changes: 7 additions & 4 deletions web/components/command-palette/issue/change-issue-priority.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { mutate } from "swr";
// cmdk
import { Command } from "cmdk";
// services
import issuesService from "services/issue/issue.service";
import { IssueService } from "services/issue";
// types
import { ICurrentUserResponse, IIssue, TIssuePriorities } from "types";
import { IIssue, IUser, TIssuePriorities } from "types";
// constants
import { ISSUE_DETAILS, PROJECT_ISSUES_ACTIVITY } from "constants/fetch-keys";
import { PRIORITIES } from "constants/project";
Expand All @@ -19,9 +19,12 @@ import { CheckIcon, PriorityIcon } from "components/icons";
type Props = {
setIsPaletteOpen: Dispatch<SetStateAction<boolean>>;
issue: IIssue;
user: ICurrentUserResponse;
user: IUser;
};

// services
const issueService = new IssueService();

export const ChangeIssuePriority: React.FC<Props> = ({ setIsPaletteOpen, issue, user }) => {
const router = useRouter();
const { workspaceSlug, projectId, issueId } = router.query;
Expand All @@ -44,7 +47,7 @@ export const ChangeIssuePriority: React.FC<Props> = ({ setIsPaletteOpen, issue,
);

const payload = { ...formData };
await issuesService
await issueService
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
.then(() => {
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
Expand Down
14 changes: 9 additions & 5 deletions web/components/command-palette/issue/change-issue-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,29 @@ import useSWR, { mutate } from "swr";
// cmdk
import { Command } from "cmdk";
// services
import issuesService from "services/issue/issue.service";
import stateService from "services/project.service/project_state.service";
import { IssueService } from "services/issue";
import { ProjectStateService } from "services/project";
// ui
import { Spinner } from "@plane/ui";
// icons
import { CheckIcon, StateGroupIcon } from "components/icons";
// helpers
import { getStatesList } from "helpers/state.helper";
// types
import { ICurrentUserResponse, IIssue } from "types";
import { IUser, IIssue } from "types";
// fetch keys
import { ISSUE_DETAILS, PROJECT_ISSUES_ACTIVITY, STATES_LIST } from "constants/fetch-keys";

type Props = {
setIsPaletteOpen: Dispatch<SetStateAction<boolean>>;
issue: IIssue;
user: ICurrentUserResponse | undefined;
user: IUser | undefined;
};

// services
const issueService = new IssueService();
const stateService = new ProjectStateService();

export const ChangeIssueState: React.FC<Props> = ({ setIsPaletteOpen, issue, user }) => {
const router = useRouter();
const { workspaceSlug, projectId, issueId } = router.query;
Expand Down Expand Up @@ -53,7 +57,7 @@ export const ChangeIssueState: React.FC<Props> = ({ setIsPaletteOpen, issue, use
);

const payload = { ...formData };
await issuesService
await issueService
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
.then(() => {
mutateIssueDetails();
Expand Down
6 changes: 5 additions & 1 deletion web/components/common/product-updates-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useSWR from "swr";
// headless ui
import { Dialog, Transition } from "@headlessui/react";
// services
import workspaceService from "services/workspace.service";
import { WorkspaceService } from "services/workspace.service";
// components
import { MarkdownRenderer } from "components/ui";
import { Loader } from "@plane/ui";
Expand All @@ -19,8 +19,12 @@ type Props = {
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
};

// services
const workspaceService = new WorkspaceService();

export const ProductUpdatesModal: React.FC<Props> = ({ isOpen, setIsOpen }) => {
const { data: updates } = useSWR("PRODUCT_UPDATES", () => workspaceService.getProductUpdates());

return (
<Transition.Root show={isOpen} as={React.Fragment}>
<Dialog as="div" className="relative z-20" onClose={setIsOpen}>
Expand Down
7 changes: 5 additions & 2 deletions web/components/core/activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useSWR from "swr";
// hook
import useEstimateOption from "hooks/use-estimate-option";
// services
import issuesService from "services/issue/issue.service";
import { IssueLabelService } from "services/issue";
// icons
import { Tooltip } from "@plane/ui";
import { Icon } from "components/ui";
Expand Down Expand Up @@ -33,6 +33,9 @@ import { IIssueActivity } from "types";
// fetch-keys
import { WORKSPACE_LABELS } from "constants/fetch-keys";

// services
const issueLabelService = new IssueLabelService();

const IssueLink = ({ activity }: { activity: IIssueActivity }) => {
const router = useRouter();
const { workspaceSlug } = router.query;
Expand Down Expand Up @@ -74,7 +77,7 @@ const LabelPill = ({ labelId }: { labelId: string }) => {

const { data: labels } = useSWR(
workspaceSlug ? WORKSPACE_LABELS(workspaceSlug.toString()) : null,
workspaceSlug ? () => issuesService.getWorkspaceLabels(workspaceSlug.toString()) : null
workspaceSlug ? () => issueLabelService.getWorkspaceIssueLabels(workspaceSlug.toString()) : null
);

return (
Expand Down
10 changes: 4 additions & 6 deletions web/components/core/image-picker-popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useDropzone } from "react-dropzone";
import { Tab, Transition, Popover } from "@headlessui/react";
import { Control, Controller } from "react-hook-form";
// services
import fileService from "services/file.service";
import { FileService } from "services/file.service";
// hooks
import useWorkspaceDetails from "hooks/use-workspace-details";
import useOutsideClickDetector from "hooks/use-outside-click-detector";
Expand Down Expand Up @@ -36,6 +36,9 @@ type Props = {
disabled?: boolean;
};

// services
const fileService = new FileService();

export const ImagePickerPopover: React.FC<Props> = ({ label, value, control, onChange, disabled = false }) => {
const ref = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -65,11 +68,6 @@ export const ImagePickerPopover: React.FC<Props> = ({ label, value, control, onC
revalidateOnReconnect: false,
});

const { data: projectCoverImages } = useSWR(`PROJECT_COVER_IMAGES`, () => fileService.getProjectCoverImages(), {
revalidateOnFocus: false,
revalidateOnReconnect: false,
});

const imagePickerRef = useRef<HTMLDivElement>(null);

const { workspaceDetails } = useWorkspaceDetails();
Expand Down
5 changes: 3 additions & 2 deletions web/components/core/modals/gpt-assistant-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useRouter } from "next/router";
// react-hook-form
import { Controller, useForm } from "react-hook-form";
// services
import AIService from "services/ai.service";
import TrackEventService from "services/track_event.service";
import { AIService } from "services/ai.service";
import { TrackEventService } from "services/track_event.service";
// hooks
import useToast from "hooks/use-toast";
import useUserAuth from "hooks/use-user-auth";
Expand Down Expand Up @@ -32,6 +32,7 @@ type FormData = {
task: string;
};

// services
const aiService = new AIService();
const trackEventService = new TrackEventService();

Expand Down
5 changes: 4 additions & 1 deletion web/components/core/modals/image-upload-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useDropzone } from "react-dropzone";
// headless ui
import { Transition, Dialog } from "@headlessui/react";
// services
import fileService from "services/file.service";
import { FileService } from "services/file.service";
// hooks
import useWorkspaceDetails from "hooks/use-workspace-details";
// ui
Expand All @@ -25,6 +25,9 @@ type Props = {
userImage?: boolean;
};

// services
const fileService = new FileService();

export const ImageUploadModal: React.FC<Props> = ({
value,
onSuccess,
Expand Down
Loading