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:
parent
6000639921
commit
944b873184
3442 changed files with 1 additions and 4 deletions
2
apps/web/ce/hooks/store/index.ts
Normal file
2
apps/web/ce/hooks/store/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./use-page-store";
|
||||
export * from "./use-page";
|
||||
24
apps/web/ce/hooks/store/use-page-store.ts
Normal file
24
apps/web/ce/hooks/store/use-page-store.ts
Normal 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}`);
|
||||
};
|
||||
23
apps/web/ce/hooks/store/use-page.ts
Normal file
23
apps/web/ce/hooks/store/use-page.ts
Normal 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);
|
||||
};
|
||||
41
apps/web/ce/hooks/use-additional-editor-mention.tsx
Normal file
41
apps/web/ce/hooks/use-additional-editor-mention.tsx
Normal 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,
|
||||
};
|
||||
};
|
||||
26
apps/web/ce/hooks/use-additional-favorite-item-details.ts
Normal file
26
apps/web/ce/hooks/use-additional-favorite-item-details.ts
Normal 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,
|
||||
};
|
||||
};
|
||||
1
apps/web/ce/hooks/use-bulk-operation-status.ts
Normal file
1
apps/web/ce/hooks/use-bulk-operation-status.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export const useBulkOperationStatus = () => false;
|
||||
12
apps/web/ce/hooks/use-debounced-duplicate-issues.tsx
Normal file
12
apps/web/ce/hooks/use-debounced-duplicate-issues.tsx
Normal 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 };
|
||||
};
|
||||
35
apps/web/ce/hooks/use-editor-flagging.ts
Normal file
35
apps/web/ce/hooks/use-editor-flagging.ts
Normal 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: [],
|
||||
},
|
||||
});
|
||||
17
apps/web/ce/hooks/use-file-size.ts
Normal file
17
apps/web/ce/hooks/use-file-size.ts
Normal 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,
|
||||
};
|
||||
};
|
||||
25
apps/web/ce/hooks/use-issue-embed.tsx
Normal file
25
apps/web/ce/hooks/use-issue-embed.tsx
Normal 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,
|
||||
};
|
||||
};
|
||||
10
apps/web/ce/hooks/use-issue-properties.tsx
Normal file
10
apps/web/ce/hooks/use-issue-properties.tsx
Normal 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;
|
||||
};
|
||||
24
apps/web/ce/hooks/use-notification-preview.tsx
Normal file
24
apps/web/ce/hooks/use-notification-preview.tsx
Normal 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,
|
||||
};
|
||||
};
|
||||
16
apps/web/ce/hooks/use-page-flag.ts
Normal file
16
apps/web/ce/hooks/use-page-flag.ts
Normal 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,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const useWorkspaceIssuePropertiesExtended = (workspaceSlug: string | string[] | undefined) => {};
|
||||
Loading…
Add table
Add a link
Reference in a new issue