🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
'use client';
import { Center, createStaticStyles, Flexbox, Spin } from '@lobehub/ui';
import { memo } from 'react';
import AsyncError from '@/components/AsyncError';
import { InlineHtmlPreview } from '@/components/HtmlPreview';
import { useTextFileLoader } from '../../hooks/useTextFileLoader';
import NotSupport from '../../NotSupport';
const styles = createStaticStyles(({ css }) => ({
page: css`
width: 100%;
height: 100%;
padding: 0;
`,
}));
interface HTMLViewerProps {
fileId: string;
url: string | null;
}
const HTMLViewer = memo<HTMLViewerProps>(({ url }) => {
const { error, fileData, loading, tooLarge } = useTextFileLoader(url);
if (!loading && fileData === null)
return (
<Flexbox>
{error && <AsyncError error={error} variant={'block'} />}
<NotSupport tooLarge={tooLarge} url={url} />
</Flexbox>
);
return (
<Flexbox className={styles.page}>
{!loading && fileData !== null ? (
<InlineHtmlPreview content={fileData} />
) : (
<Center height={'100%'}>
<Spin size="large" />
</Center>
)}
</Flexbox>
);
});
HTMLViewer.displayName = 'HTMLViewer';
export default HTMLViewer;