1+ import { useRouter } from 'next/router' ;
12import { PropsWithChildren , useEffect , useState } from 'react' ;
23import { css } from 'styled-components' ;
34
45import { Box } from '@/components' ;
56import { useCunninghamTheme } from '@/cunningham' ;
7+ import { useCreateDoc } from '@/features/docs' ;
68import { Header } from '@/features/header' ;
79import { HEADER_HEIGHT } from '@/features/header/conf' ;
810import { LeftPanel } from '@/features/left-panel' ;
911import { MAIN_LAYOUT_ID } from '@/layouts/conf' ;
1012import { useResponsiveStore } from '@/stores' ;
11- import { useCreateDoc } from '@/features/docs' ;
12- import { useRouter } from 'next/router' ;
1313
1414type MainLayoutProps = {
1515 backgroundColor ?: 'white' | 'grey' ;
@@ -28,6 +28,7 @@ export function MainLayout({
2828 const [ isInsideCozy , setIsInsideCozy ] = useState ( false ) ;
2929 useEffect ( ( ) => {
3030 // @ts -expect-error cozyBridge is injected by Cozy platform
31+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
3132 window . _cozyBridge . requestParentOrigin ( ) . then ( ( origin ) => {
3233 setIsInsideCozy ( Boolean ( origin ) ) ;
3334 if ( Boolean ( origin ) ) {
@@ -39,24 +40,29 @@ export function MainLayout({
3940 const hasContent = ! isInsideCozy ;
4041 const shouldShowLeftPanel = ! isInsideCozy ;
4142
43+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4244 const { mutate : createDoc , isPending : isCreatingDoc } = useCreateDoc ( {
4345 onSuccess : ( doc ) => {
46+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
4447 router . push ( `/docs/${ doc . id } ` ) ;
4548 } ,
4649 } ) ;
4750
4851 useEffect ( ( ) => {
4952 window . onmessage = function ( e ) {
50- if ( e . data == undefined || e . data == null || typeof e . data !== 'string' )
53+ if ( e . data == undefined || e . data == null || typeof e . data !== 'string' ) {
5154 return ;
55+ }
5256 if ( e . data . startsWith ( 'newDoc' ) ) {
5357 createDoc ( ) ;
5458 }
5559 if ( e . data . startsWith ( 'openFile:' ) ) {
5660 const fileId = e . data . split ( 'openFile:' ) [ 1 ] . trim ( ) ;
61+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
5762 router . push ( `/docs/${ fileId } ` ) ;
5863 }
5964 } ;
65+ // eslint-disable-next-line react-hooks/exhaustive-deps
6066 } , [ ] ) ;
6167
6268 return (
0 commit comments