diff --git a/apps/web/.eslintrc.json b/apps/web/.eslintrc.json index fb2505942..4662c7b65 100644 --- a/apps/web/.eslintrc.json +++ b/apps/web/.eslintrc.json @@ -17,7 +17,8 @@ "@typescript-eslint/ban-ts-comment": "off", "no-console": "off", "react/no-array-index-key": "off", - "react-hooks/exhaustive-deps": "off" + "react-hooks/exhaustive-deps": "off", + "@next/next/no-img-element": "off" }, "overrides": [ { diff --git a/apps/web/src/components/ui/report/DynamicReportEditor.tsx b/apps/web/src/components/ui/report/DynamicReportEditor.tsx new file mode 100644 index 000000000..67a59a098 --- /dev/null +++ b/apps/web/src/components/ui/report/DynamicReportEditor.tsx @@ -0,0 +1,15 @@ +import dynamic from 'next/dynamic'; +import { ReportEditorSkeleton } from './ReportEditorSkeleton'; +import { ReportEditor } from './ReportEditor'; + +// export const DynamicReportEditor = dynamic( +// () => import('@/components/ui/report/ReportEditor').then((mod) => mod.ReportEditor), +// { +// ssr: false, +// loading: () => +// } +// ); + +const DynamicReportEditor = ReportEditor; + +export default DynamicReportEditor; diff --git a/apps/web/src/components/ui/report/DynamticEditor.tsx b/apps/web/src/components/ui/report/DynamticEditor.tsx deleted file mode 100644 index 98409ca49..000000000 --- a/apps/web/src/components/ui/report/DynamticEditor.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import dynamic from 'next/dynamic'; -import { ReportEditorSkeleton } from './ReportEditorSkeleton'; - -export const DynamicReportEditor = dynamic( - () => import('@/components/ui/report/ReportEditor').then((mod) => mod.ReportEditor), - { - ssr: false, - loading: () => - } -); - -export default DynamicReportEditor; diff --git a/apps/web/src/components/ui/report/ThemeWrapper/useThemesConfig.ts b/apps/web/src/components/ui/report/ThemeWrapper/useThemesConfig.ts index 7ca36536d..462ad85ca 100644 --- a/apps/web/src/components/ui/report/ThemeWrapper/useThemesConfig.ts +++ b/apps/web/src/components/ui/report/ThemeWrapper/useThemesConfig.ts @@ -1,5 +1,5 @@ import { create } from 'zustand'; -import { THEMES, FONT_BASE_THEME, type Theme } from './themes'; +import { THEMES, type Theme } from './themes'; const useThemesConfigStore = create<{ activeTheme: Theme; @@ -13,5 +13,5 @@ export function useThemesConfig() { const activeTheme = useThemesConfigStore((state) => state.activeTheme); const setActiveTheme = useThemesConfigStore((state) => state.setActiveTheme); - return { activeTheme, setActiveTheme, allThemes: THEMES, FONT_BASE_THEME }; + return { activeTheme, setActiveTheme, allThemes: THEMES }; } diff --git a/apps/web/src/components/ui/report/elements/BlockListStatic.tsx b/apps/web/src/components/ui/report/elements/BlockListStatic.tsx index 2cf75c4bf..dc5b92369 100644 --- a/apps/web/src/components/ui/report/elements/BlockListStatic.tsx +++ b/apps/web/src/components/ui/report/elements/BlockListStatic.tsx @@ -1,6 +1,11 @@ import * as React from 'react'; -import type { RenderStaticNodeWrapper, SlateRenderElementProps, TListElement } from 'platejs'; +import type { + RenderStaticNodeWrapper, + RenderStaticNodeWrapperProps, + SlateRenderElementProps, + TListElement +} from 'platejs'; import { isOrderedList } from '@platejs/list'; import { Check } from '@/components/ui/icons'; @@ -23,7 +28,7 @@ const config: Record< export const BlockListStatic: RenderStaticNodeWrapper = (props) => { if (!props.element.listStyleType) return; - return (props) => ; + return List; }; function List(props: SlateRenderElementProps) { diff --git a/apps/web/src/components/ui/report/elements/CalloutNodeStatic.tsx b/apps/web/src/components/ui/report/elements/CalloutNodeStatic.tsx index 2cae649e8..0fce1e84c 100644 --- a/apps/web/src/components/ui/report/elements/CalloutNodeStatic.tsx +++ b/apps/web/src/components/ui/report/elements/CalloutNodeStatic.tsx @@ -1,17 +1,21 @@ import * as React from 'react'; -import type { SlateElementProps } from 'platejs'; +import type { SlateElementProps, TCalloutElement } from 'platejs'; import { SlateElement } from 'platejs'; import { cn } from '@/lib/utils'; -export function CalloutElementStatic({ children, className, ...props }: SlateElementProps) { +export function CalloutElementStatic({ + children, + className, + ...props +}: SlateElementProps) { return (
@@ -21,7 +25,7 @@ export function CalloutElementStatic({ children, className, ...props }: SlateEle fontFamily: '"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols' }}> - {(props.element.icon as any) || '💡'} + {props.element.icon || '💡'}
{children}
diff --git a/apps/web/src/components/ui/report/elements/MediaImageNodeStatic.tsx b/apps/web/src/components/ui/report/elements/MediaImageNodeStatic.tsx index c42144031..44017642c 100644 --- a/apps/web/src/components/ui/report/elements/MediaImageNodeStatic.tsx +++ b/apps/web/src/components/ui/report/elements/MediaImageNodeStatic.tsx @@ -1,11 +1,6 @@ import * as React from 'react'; -import type { - SlateElementProps, - TCaptionProps, - TImageElement, - TResizableProps, -} from 'platejs'; +import type { SlateElementProps, TCaptionProps, TImageElement, TResizableProps } from 'platejs'; import { NodeApi, SlateElement } from 'platejs'; @@ -19,16 +14,10 @@ export function ImageElementStatic( return (
-
+
{(props.attributes {caption && ( diff --git a/apps/web/src/components/ui/report/plugins/suggestion-kit.tsx b/apps/web/src/components/ui/report/plugins/suggestion-kit.tsx index 355fc8ef9..8f7578525 100644 --- a/apps/web/src/components/ui/report/plugins/suggestion-kit.tsx +++ b/apps/web/src/components/ui/report/plugins/suggestion-kit.tsx @@ -8,7 +8,7 @@ import { isSlateElement, isSlateString } from 'platejs'; -import { toTPlatePlugin } from 'platejs/react'; +import { toTPlatePlugin, type RenderNodeWrapper } from 'platejs/react'; import { BlockSuggestion } from '../elements/BlockSuggestion'; import { SuggestionLeaf, SuggestionLineBreak } from '../elements/SuggestionNode'; @@ -77,7 +77,8 @@ export const suggestionPlugin = toTPlatePlugin( } }, render: { - belowNodes: SuggestionLineBreak as any, + // @ts-expect-error - TODO: fix this + belowNodes: SuggestionLineBreak, node: SuggestionLeaf, belowRootNodes: ({ api, element }) => { if (!api.suggestion!.isBlockSuggestion(element)) { diff --git a/apps/web/src/components/ui/toolbar/Toolbar.tsx b/apps/web/src/components/ui/toolbar/Toolbar.tsx index fe00db258..e925d51a0 100644 --- a/apps/web/src/components/ui/toolbar/Toolbar.tsx +++ b/apps/web/src/components/ui/toolbar/Toolbar.tsx @@ -13,7 +13,7 @@ import { DropdownMenuSeparator } from '@/components/ui/dropdown-menu'; import { Separator } from '@/components/ui/separator'; -import { Tooltip, TooltipTrigger } from '@/components/ui/tooltip'; +import { Tooltip } from '@/components/ui/tooltip'; import { cn } from '@/lib/utils'; export const Toolbar = React.forwardRef< @@ -210,6 +210,8 @@ export const ToolbarSplitButtonSecondary = React.forwardRef< ); }); +ToolbarSplitButtonSecondary.displayName = 'ToolbarSplitButtonSecondary'; + export const ToolbarToggleItem = React.forwardRef< React.ElementRef, React.ComponentProps & @@ -223,6 +225,8 @@ export const ToolbarToggleItem = React.forwardRef< ); }); +ToolbarToggleItem.displayName = 'ToolbarToggleItem'; + export const ToolbarGroup = ({ children, className }: React.ComponentProps<'div'>) => { return (