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
- Figure component: Use Next.js Image with fade-in transition - Video component: Simplify to thin wrapper, use consistently - next.config: Enable AVIF/WebP formats, add responsive sizes - Standardize video usage across MDX files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sushmithamallesh committed
Jan 28, 2026 at 15:26 UTC
447c7908250e33c3061d4a1ec8d7b514b45770f6
5 files changed
+29
-16
docs/components/figure.tsx
+19
-7
@@ -1,5 +1,7 @@
1
'use client';
2
3
+import { useState } from 'react';
4
+import Image from 'next/image';
5
import Zoom from 'react-medium-image-zoom';
6
import 'react-medium-image-zoom/dist/styles.css';
7
import { cn } from '@/lib/utils';
@@ -23,22 +25,32 @@ const sizeClasses: Record<FigureSize, string> = {
25
full: 'max-w-full', // Full-width diagrams
26
};
27
28
+const sizesAttr: Record<FigureSize, string> = {
29
+ sm: '(max-width: 300px) 100vw, 300px',
30
+ md: '(max-width: 500px) 100vw, 500px',
31
+ lg: '(max-width: 700px) 100vw, 700px',
32
+ full: '(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px',
33
+};
34
+
35
export function Figure({ src, alt, caption, size = 'full', className, width, height }: FigureProps) {
36
+ const [isLoaded, setIsLoaded] = useState(false);
37
const isConstrained = size !== 'full';
38
39
return (
40
<figure className={cn('my-8', isConstrained && 'flex flex-col items-center', className)}>
31
- <Zoom>
32
- <img
41
+ <Zoom zoomImg={{ src }}>
42
+ <Image
43
src={src}
44
alt={alt}
35
- width={width}
36
- height={height}
37
- loading="lazy"
45
+ width={width || 1200}
46
+ height={height || 800}
47
+ sizes={sizesAttr[size]}
48
+ onLoad={() => setIsLoaded(true)}
49
className={cn(
39
- 'rounded-lg border border-fd-border',
50
+ 'rounded-lg border border-fd-border transition-opacity duration-300',
51
+ isLoaded ? 'opacity-100' : 'opacity-0',
52
sizeClasses[size],
41
- isConstrained ? 'w-auto' : 'w-full'
53
+ isConstrained ? 'w-auto h-auto' : 'w-full h-auto'
54
)}
55
/>
56
</Zoom>
docs/components/video.tsx
-2
@@ -1,5 +1,3 @@
1
-'use client';
2
-
1
import { cn } from '@/lib/utils';
2
3
interface VideoProps {
docs/content/docs/authentication.mdx
+1
-1
@@ -6,7 +6,7 @@ keywords: [connect link, oauth, auth config]
6
7
Composio simplifies authentication with Connect Links: hosted pages where users securely connect their accounts.
8
9
-<video src="/images/connect-link-auth-flow-recording.mp4" autoPlay loop muted playsInline className="rounded-lg border" />
9
+<Video src="/images/connect-link-auth-flow-recording.mp4" autoPlay />
10
11
## In-chat authentication
12
docs/content/reference/index.mdx
+2
-6
@@ -17,9 +17,7 @@ Include your API key in the `x-api-key` header.
17
2. Navigate to **Settings**
18
3. In **Project Settings**, copy the key from the **API Keys** section
19
20
-<video autoPlay loop muted playsInline controls width="100%">
21
- <source src="/videos/fetch-project-key.mp4" type="video/mp4" />
22
-</video>
20
+<Video src="/videos/fetch-project-key.mp4" autoPlay />
21
22
### Organization API Key
23
@@ -31,6 +29,4 @@ For organization-level access, use the `x-org-api-key` header.
29
2. Navigate to **Organization Settings** → **General Settings**
30
3. Copy the token under **Organization Access Tokens**
31
34
-<video autoPlay loop muted playsInline controls width="100%">
35
- <source src="/videos/fetch-org-key.mp4" type="video/mp4" />
36
-</video>
32
+<Video src="/videos/fetch-org-key.mp4" autoPlay />
docs/next.config.mjs
+7
@@ -11,6 +11,13 @@ const config = {
11
turbopack: {
12
root: __dirname,
13
},
14
+ images: {
15
+ // Enable modern image formats for better compression
16
+ formats: ['image/avif', 'image/webp'],
17
+ // Responsive breakpoints for srcset generation
18
+ deviceSizes: [640, 750, 828, 1080, 1200, 1920],
19
+ imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
20
+ },
21
async rewrites() {
22
return [
23
// Serve markdown for AI agents: /any/path.md → /llms.mdx/any/path