ui.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import type { JSX } from 'react';
  2. import type { Nullable } from '@growi/core';
  3. import type { IPageForItem } from '~/interfaces/page';
  4. export const SidebarMode = {
  5. DRAWER: 'drawer',
  6. COLLAPSED: 'collapsed',
  7. DOCK: 'dock',
  8. } as const;
  9. export type SidebarMode = (typeof SidebarMode)[keyof typeof SidebarMode];
  10. export const SidebarContentsType = {
  11. CUSTOM: 'custom',
  12. RECENT: 'recent',
  13. TREE: 'tree',
  14. TAG: 'tag',
  15. BOOKMARKS: 'bookmarks',
  16. NOTIFICATION: 'notification',
  17. AI_ASSISTANT: 'aiAssistant',
  18. } as const;
  19. export const AllSidebarContentsType = Object.values(SidebarContentsType);
  20. export type SidebarContentsType =
  21. (typeof SidebarContentsType)[keyof typeof SidebarContentsType];
  22. export type ICustomTabContent = {
  23. Content?: () => JSX.Element;
  24. i18n?: string;
  25. Icon?: () => JSX.Element;
  26. isLinkEnabled?: boolean | ((content: ICustomTabContent) => boolean);
  27. };
  28. export type ICustomNavTabMappings = { [key: string]: ICustomTabContent };
  29. export type OnDeletedFunction = (
  30. idOrPaths: string | string[],
  31. isRecursively: Nullable<true>,
  32. isCompletely: Nullable<true>,
  33. ) => void;
  34. export type OnRenamedFunction = (path: string) => void;
  35. export type OnDuplicatedFunction = (fromPath: string, toPath: string) => void;
  36. export type OnPutBackedFunction = (path: string) => void;
  37. export type onDeletedBookmarkFolderFunction = (
  38. bookmarkFolderId: string,
  39. ) => void;
  40. export type OnSelectedFunction = (
  41. page: IPageForItem,
  42. isIncludeSubPage: boolean,
  43. ) => void;