Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

perf(docs): Optimize image and video loading performance

Sushmithamallesh447c7908250e
diff --git a/docs/components/figure.tsx b/docs/components/figure.tsx
index 1406e408d..0071b4907 100644
--- a/docs/components/figure.tsx
+++ b/docs/components/figure.tsx
@@ -1,5 +1,7 @@
'use client';
+import { useState } from 'react';
+import Image from 'next/image';
import Zoom from 'react-medium-image-zoom';
import 'react-medium-image-zoom/dist/styles.css';
import { cn } from '@/lib/utils';
@@ -23,22 +25,32 @@ const sizeClasses: Record<FigureSize, string> = {
full: 'max-w-full', // Full-width diagrams
};
+const sizesAttr: Record<FigureSize, string> = {
+ sm: '(max-width: 300px) 100vw, 300px',
+ md: '(max-width: 500px) 100vw, 500px',
+ lg: '(max-width: 700px) 100vw, 700px',
+ full: '(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px',
+};
+
export function Figure({ src, alt, caption, size = 'full', className, width, height }: FigureProps) {
+ const [isLoaded, setIsLoaded] = useState(false);
const isConstrained = size !== 'full';
return (
<figure className={cn('my-8', isConstrained && 'flex flex-col items-center', className)}>
- <Zoom>
- <img
+ <Zoom zoomImg={{ src }}>
+ <Image
src={src}
alt={alt}
- width={width}
- height={height}
- loading="lazy"
+ width={width || 1200}
+ height={height || 800}
+ sizes={sizesAttr[size]}
+ onLoad={() => setIsLoaded(true)}
className={cn(
- 'rounded-lg border border-fd-border',
+ 'rounded-lg border border-fd-border transition-opacity duration-300',
+ isLoaded ? 'opacity-100' : 'opacity-0',
sizeClasses[size],
- isConstrained ? 'w-auto' : 'w-full'
+ isConstrained ? 'w-auto h-auto' : 'w-full h-auto'
)}
/>
</Zoom>
diff --git a/docs/components/video.tsx b/docs/components/video.tsx
index 4a093238d..b3061133c 100644
--- a/docs/components/video.tsx
+++ b/docs/components/video.tsx
@@ -1,5 +1,3 @@
-'use client';
-
import { cn } from '@/lib/utils';
interface VideoProps {
diff --git a/docs/content/docs/authentication.mdx b/docs/content/docs/authentication.mdx
index d3c415016..899bf69a4 100644
--- a/docs/content/docs/authentication.mdx
+++ b/docs/content/docs/authentication.mdx
@@ -6,7 +6,7 @@ keywords: [connect link, oauth, auth config]
Composio simplifies authentication with Connect Links: hosted pages where users securely connect their accounts.
-<video src="/images/connect-link-auth-flow-recording.mp4" autoPlay loop muted playsInline className="rounded-lg border" />
+<Video src="/images/connect-link-auth-flow-recording.mp4" autoPlay />
## In-chat authentication
diff --git a/docs/content/reference/index.mdx b/docs/content/reference/index.mdx
index 72ae5338a..aaa8195a6 100644
--- a/docs/content/reference/index.mdx
+++ b/docs/content/reference/index.mdx
@@ -17,9 +17,7 @@ Include your API key in the `x-api-key` header.
2. Navigate to **Settings**
3. In **Project Settings**, copy the key from the **API Keys** section
-<video autoPlay loop muted playsInline controls width="100%">
- <source src="/videos/fetch-project-key.mp4" type="video/mp4" />
-</video>
+<Video src="/videos/fetch-project-key.mp4" autoPlay />
### Organization API Key
@@ -31,6 +29,4 @@ For organization-level access, use the `x-org-api-key` header.
2. Navigate to **Organization Settings** → **General Settings**
3. Copy the token under **Organization Access Tokens**
-<video autoPlay loop muted playsInline controls width="100%">
- <source src="/videos/fetch-org-key.mp4" type="video/mp4" />
-</video>
+<Video src="/videos/fetch-org-key.mp4" autoPlay />
diff --git a/docs/next.config.mjs b/docs/next.config.mjs
index 2724f709f..88f469f7f 100644
--- a/docs/next.config.mjs
+++ b/docs/next.config.mjs
@@ -11,6 +11,13 @@ const config = {
turbopack: {
root: __dirname,
},
+ images: {
+ // Enable modern image formats for better compression
+ formats: ['image/avif', 'image/webp'],
+ // Responsive breakpoints for srcset generation
+ deviceSizes: [640, 750, 828, 1080, 1200, 1920],
+ imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
+ },
async rewrites() {
return [
// Serve markdown for AI agents: /any/path.md → /llms.mdx/any/path