chore: move all services inside the apps folder (#7321)

* chore: move all services inside the apps folder

* chore: rename apiserver to server
This commit is contained in:
sriram veeraghanta 2025-07-03 00:44:13 +05:30 committed by GitHub
parent 6000639921
commit 944b873184
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3442 changed files with 1 additions and 4 deletions

View file

@ -0,0 +1,2 @@
export * from "./use-page-store";
export * from "./use-page";

View file

@ -0,0 +1,24 @@
import { useContext } from "react";
// context
import { StoreContext } from "@/lib/store-context";
// mobx store
import { IProjectPageStore } from "@/store/pages/project-page.store";
export enum EPageStoreType {
PROJECT = "PROJECT_PAGE",
}
export type TReturnType = {
[EPageStoreType.PROJECT]: IProjectPageStore;
};
export const usePageStore = <T extends EPageStoreType>(storeType: T): TReturnType[T] => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("usePageStore must be used within StoreProvider");
if (storeType === EPageStoreType.PROJECT) {
return context.projectPages;
}
throw new Error(`Invalid store type: ${storeType}`);
};

View file

@ -0,0 +1,23 @@
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// plane web hooks
import { EPageStoreType, usePageStore } from "@/plane-web/hooks/store";
export type TArgs = {
pageId: string;
storeType: EPageStoreType;
};
export const usePage = (args: TArgs) => {
const { pageId, storeType } = args;
// context
const context = useContext(StoreContext);
// store hooks
const pageStore = usePageStore(storeType);
if (context === undefined) throw new Error("usePage must be used within StoreProvider");
if (!pageId) throw new Error("pageId is required");
return pageStore.getPageById(pageId);
};

View file

@ -0,0 +1,41 @@
import { useCallback } from "react";
// plane editor
import { TMentionSection } from "@plane/editor";
// plane types
import { TSearchEntities, TSearchResponse } from "@plane/types";
export type TAdditionalEditorMentionHandlerArgs = {
response: TSearchResponse;
sections: TMentionSection[];
};
export type TAdditionalParseEditorContentArgs = {
id: string;
entityType: TSearchEntities;
};
export type TAdditionalParseEditorContentReturnType =
| {
redirectionPath: string;
textContent: string;
}
| undefined;
export const useAdditionalEditorMention = () => {
const updateAdditionalSections = useCallback((args: TAdditionalEditorMentionHandlerArgs) => {
const {} = args;
}, []);
const parseAdditionalEditorContent = useCallback(
(args: TAdditionalParseEditorContentArgs): TAdditionalParseEditorContentReturnType => {
const {} = args;
return undefined;
},
[]
);
return {
updateAdditionalSections,
parseAdditionalEditorContent,
};
};

View file

@ -0,0 +1,26 @@
// plane imports
import { IFavorite } from "@plane/types";
// components
import { getFavoriteItemIcon } from "@/components/workspace/sidebar/favorites/favorite-items/common";
export const useAdditionalFavoriteItemDetails = () => {
const getAdditionalFavoriteItemDetails = (_workspaceSlug: string, favorite: IFavorite) => {
const { entity_type: favoriteItemEntityType } = favorite;
const favoriteItemName = favorite?.entity_data?.name || favorite?.name;
let itemIcon;
let itemTitle;
switch (favoriteItemEntityType) {
default:
itemTitle = favoriteItemName;
itemIcon = getFavoriteItemIcon(favoriteItemEntityType);
break;
}
return { itemIcon, itemTitle };
};
return {
getAdditionalFavoriteItemDetails,
};
};

View file

@ -0,0 +1 @@
export const useBulkOperationStatus = () => false;

View file

@ -0,0 +1,12 @@
import { TDeDupeIssue } from "@plane/types";
export const useDebouncedDuplicateIssues = (
workspaceSlug: string | undefined,
workspaceId: string | undefined,
projectId: string | undefined,
formData: { name: string | undefined; description_html?: string | undefined; issueId?: string | undefined }
) => {
const duplicateIssues: TDeDupeIssue[] = [];
return { duplicateIssues };
};

View file

@ -0,0 +1,35 @@
// editor
import { TExtensions } from "@plane/editor";
export type TEditorFlaggingHookReturnType = {
document: {
disabled: TExtensions[];
flagged: TExtensions[];
};
liteText: {
disabled: TExtensions[];
flagged: TExtensions[];
};
richText: {
disabled: TExtensions[];
flagged: TExtensions[];
};
};
/**
* @description extensions disabled in various editors
*/
export const useEditorFlagging = (workspaceSlug: string): TEditorFlaggingHookReturnType => ({
document: {
disabled: ["ai", "collaboration-cursor"],
flagged: [],
},
liteText: {
disabled: ["ai", "collaboration-cursor"],
flagged: [],
},
richText: {
disabled: ["ai", "collaboration-cursor"],
flagged: [],
},
});

View file

@ -0,0 +1,17 @@
// plane imports
import { MAX_FILE_SIZE } from "@plane/constants";
// hooks
import { useInstance } from "@/hooks/store";
type TReturnProps = {
maxFileSize: number;
};
export const useFileSize = (): TReturnProps => {
// store hooks
const { config } = useInstance();
return {
maxFileSize: config?.file_size_limit ?? MAX_FILE_SIZE,
};
};

View file

@ -0,0 +1,25 @@
// editor
import { TEmbedConfig } from "@plane/editor";
// plane types
import { TSearchEntityRequestPayload, TSearchResponse } from "@plane/types";
// plane web components
import { IssueEmbedUpgradeCard } from "@/plane-web/components/pages";
export type TIssueEmbedHookProps = {
fetchEmbedSuggestions?: (payload: TSearchEntityRequestPayload) => Promise<TSearchResponse>;
projectId?: string;
workspaceSlug?: string;
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const useIssueEmbed = (props: TIssueEmbedHookProps) => {
const widgetCallback = () => <IssueEmbedUpgradeCard />;
const issueEmbedProps: TEmbedConfig["issue"] = {
widgetCallback,
};
return {
issueEmbedProps,
};
};

View file

@ -0,0 +1,10 @@
import { TIssueServiceType } from "@plane/types";
export const useWorkItemProperties = (
projectId: string | null | undefined,
workspaceSlug: string | null | undefined,
workItemId: string | null | undefined,
issueServiceType: TIssueServiceType
) => {
if (!projectId || !workspaceSlug || !workItemId) return;
};

View file

@ -0,0 +1,24 @@
import { EIssueServiceType, IWorkItemPeekOverview } from "@plane/types";
import { IssuePeekOverview } from "@/components/issues";
import { useIssueDetail } from "@/hooks/store";
import { TPeekIssue } from "@/store/issue/issue-details/root.store";
export type TNotificationPreview = {
isWorkItem: boolean;
PeekOverviewComponent: React.ComponentType<IWorkItemPeekOverview>;
setPeekWorkItem: (peekIssue: TPeekIssue | undefined) => void;
};
/**
* This function returns if the current active notification is related to work item or an epic.
* @returns isWorkItem: boolean, peekOverviewComponent: IWorkItemPeekOverview, setPeekWorkItem
*/
export const useNotificationPreview = (): TNotificationPreview => {
const { peekIssue, setPeekIssue } = useIssueDetail(EIssueServiceType.ISSUES);
return {
isWorkItem: Boolean(peekIssue),
PeekOverviewComponent: IssuePeekOverview,
setPeekWorkItem: setPeekIssue,
};
};

View file

@ -0,0 +1,16 @@
export type TPageFlagHookArgs = {
workspaceSlug: string;
};
export type TPageFlagHookReturnType = {
isMovePageEnabled: boolean;
isPageSharingEnabled: boolean;
};
export const usePageFlag = (args: TPageFlagHookArgs): TPageFlagHookReturnType => {
const {} = args;
return {
isMovePageEnabled: false,
isPageSharingEnabled: false,
};
};

View file

@ -0,0 +1,2 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const useWorkspaceIssuePropertiesExtended = (workspaceSlug: string | string[] | undefined) => {};