Add types

This commit is contained in:
Nicola Benaglia 2025-05-30 09:22:07 +02:00
parent be5c3af318
commit 1f5a604932
2 changed files with 50 additions and 33 deletions

View File

@ -7,7 +7,14 @@ import { useQortalMessageListener } from '../../hooks/useQortalMessageListener';
import { useThemeContext } from '../Theme/ThemeContext';
import { useTranslation } from 'react-i18next';
export const AppViewer = forwardRef(
type AppViewerProps = {
app: any;
hide: boolean;
isDevMode: boolean;
skipAuth?: boolean;
};
export const AppViewer = forwardRef<HTMLIFrameElement, AppViewerProps>(
({ app, hide, isDevMode, skipAuth }, iframeRef) => {
const { window: frameWindow } = useFrame();
const { path, history, changeCurrentIndex, resetHistory } =

View File

@ -2,15 +2,26 @@ import { forwardRef } from 'react';
import { AppViewer } from './AppViewer';
import Frame from 'react-frame-component';
const AppViewerContainer = forwardRef(
({ app, isSelected, hide, isDevMode, customHeight, skipAuth }, ref) => {
return (
<Frame
id={`browser-iframe-${app?.tabId}`}
head={
<>
<style>
{`
type AppViewerContainerProps = {
app: any; // Replace `any` with the correct type of `tab` if available
isSelected: boolean;
hide: boolean;
isDevMode: boolean;
customHeight?: string;
skipAuth?: boolean;
};
const AppViewerContainer = forwardRef<
HTMLIFrameElement,
AppViewerContainerProps
>(({ app, isSelected, hide, isDevMode, customHeight, skipAuth }, ref) => {
return (
<Frame
id={`browser-iframe-${app?.tabId}`}
head={
<>
<style>
{`
body {
margin: 0;
padding: 0;
@ -27,28 +38,27 @@ const AppViewerContainer = forwardRef(
height: 100vh;
}
`}
</style>
</>
}
style={{
border: 'none',
height: customHeight || '100vh',
left: (!isSelected || hide) && '-200vw',
overflow: 'hidden',
position: (!isSelected || hide) && 'fixed',
width: '100%',
}}
>
<AppViewer
app={app}
hide={!isSelected || hide}
isDevMode={isDevMode}
ref={ref}
skipAuth={skipAuth}
/>
</Frame>
);
}
);
</style>
</>
}
style={{
border: 'none',
height: customHeight || '100vh',
left: (!isSelected || hide) && '-200vw',
overflow: 'hidden',
position: (!isSelected || hide) && 'fixed',
width: '100%',
}}
>
<AppViewer
app={app}
hide={!isSelected || hide}
isDevMode={isDevMode}
ref={ref}
skipAuth={skipAuth}
/>
</Frame>
);
});
export default AppViewerContainer;