[WEB-3066] refactor: replace Space Services with Services Package (#6353)

* [WEB-3066] refactor: replace Space Services with Services Package

* chore: minor improvements

* fix: type

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
Prateek Shourya 2025-01-11 15:16:11 +05:30 committed by GitHub
parent 39ca600091
commit ade4d290f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 1002 additions and 631 deletions

View file

@ -7,15 +7,15 @@ import { usePathname, useSearchParams } from "next/navigation";
import { usePopper } from "react-popper";
import { LogOut } from "lucide-react";
import { Popover, Transition } from "@headlessui/react";
// plane imports
import { API_BASE_URL } from "@plane/constants";
import { AuthService } from "@plane/services";
import { Avatar, Button } from "@plane/ui";
// helpers
import { getFileURL } from "@/helpers/file.helper";
import { queryParamGenerator } from "@/helpers/query-param-generator";
// hooks
import { useUser } from "@/hooks/store";
// services
import { AuthService } from "@/services/auth.service";
const authService = new AuthService();

View file

@ -3,21 +3,19 @@
import React, { useRef, useState } from "react";
import { observer } from "mobx-react";
import { useForm, Controller } from "react-hook-form";
// editor
// plane imports
import { EditorRefApi } from "@plane/editor";
// ui
import { SitesFileService } from "@plane/services";
import { TIssuePublicComment } from "@plane/types";
import { TOAST_TYPE, setToast } from "@plane/ui";
// editor components
import { LiteTextEditor } from "@/components/editor/lite-text-editor";
// hooks
import { useIssueDetails, usePublish, useUser } from "@/hooks/store";
// services
import { FileService } from "@/services/file.service";
const fileService = new FileService();
// types
import { Comment } from "@/types/issue";
const fileService = new SitesFileService();
const defaultValues: Partial<Comment> = {
const defaultValues: Partial<TIssuePublicComment> = {
comment_html: "",
};
@ -43,9 +41,9 @@ export const AddComment: React.FC<Props> = observer((props) => {
watch,
formState: { isSubmitting },
reset,
} = useForm<Comment>({ defaultValues });
} = useForm<TIssuePublicComment>({ defaultValues });
const onSubmit = async (formData: Comment) => {
const onSubmit = async (formData: TIssuePublicComment) => {
if (!anchor || !issueId || isSubmitting || !formData.comment_html) return;
await addIssueComment(anchor, issueId, formData)

View file

@ -3,8 +3,10 @@ import { observer } from "mobx-react";
import { Controller, useForm } from "react-hook-form";
import { Check, MessageSquare, MoreVertical, X } from "lucide-react";
import { Menu, Transition } from "@headlessui/react";
// components
// plane imports
import { EditorRefApi } from "@plane/editor";
import { TIssuePublicComment } from "@plane/types";
// components
import { LiteTextEditor, LiteTextReadOnlyEditor } from "@/components/editor";
import { CommentReactions } from "@/components/issues/peek-overview";
// helpers
@ -13,12 +15,10 @@ import { getFileURL } from "@/helpers/file.helper";
// hooks
import { useIssueDetails, usePublish, useUser } from "@/hooks/store";
import useIsInIframe from "@/hooks/use-is-in-iframe";
// types
import { Comment } from "@/types/issue";
type Props = {
anchor: string;
comment: Comment;
comment: TIssuePublicComment;
};
export const CommentCard: React.FC<Props> = observer((props) => {
@ -48,7 +48,7 @@ export const CommentCard: React.FC<Props> = observer((props) => {
deleteIssueComment(anchor, peekId, comment.id);
};
const handleCommentUpdate = async (formData: Comment) => {
const handleCommentUpdate = async (formData: TIssuePublicComment) => {
if (!anchor || !peekId) return;
updateIssueComment(anchor, peekId, comment.id, formData);
setIsEditing(false);