Skip to content

Commit fad5e85

Browse files
author
waleed
committed
removed getAssetUrl in favor of local assets
1 parent 2d8c469 commit fad5e85

15 files changed

Lines changed: 38 additions & 68 deletions

apps/docs/components/ui/lightbox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { useEffect, useRef } from 'react'
4-
import { getVideoUrl } from '@/lib/utils'
4+
import { getAssetUrl } from '@/lib/utils'
55

66
interface LightboxProps {
77
isOpen: boolean
@@ -60,7 +60,7 @@ export function Lightbox({ isOpen, onClose, src, alt, type }: LightboxProps) {
6060
/>
6161
) : (
6262
<video
63-
src={getVideoUrl(src)}
63+
src={getAssetUrl(src)}
6464
autoPlay
6565
loop
6666
muted

apps/docs/components/ui/video.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { useState } from 'react'
4-
import { getVideoUrl } from '@/lib/utils'
4+
import { getAssetUrl } from '@/lib/utils'
55
import { Lightbox } from './lightbox'
66

77
interface VideoProps {
@@ -39,7 +39,7 @@ export function Video({
3939
muted={muted}
4040
playsInline={playsInline}
4141
className={`${className} ${enableLightbox ? 'cursor-pointer transition-opacity hover:opacity-90' : ''}`}
42-
src={getVideoUrl(src)}
42+
src={getAssetUrl(src)}
4343
onClick={handleVideoClick}
4444
/>
4545

apps/docs/lib/utils.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function cn(...inputs: ClassValue[]) {
99
}
1010

1111
/**
12-
* Get the full URL for an asset stored in Vercel Blob or local fallback
12+
* Get the full URL for an asset stored in Vercel Blob
1313
* - If CDN is configured (NEXT_PUBLIC_BLOB_BASE_URL), uses CDN URL
1414
* - Otherwise falls back to local static assets served from root path
1515
*/
@@ -20,12 +20,3 @@ export function getAssetUrl(filename: string) {
2020
}
2121
return `/${filename}`
2222
}
23-
24-
/**
25-
* Get the full URL for a video asset stored in Vercel Blob or local fallback
26-
* - If CDN is configured (NEXT_PUBLIC_BLOB_BASE_URL), uses CDN URL
27-
* - Otherwise falls back to local static assets served from root path
28-
*/
29-
export function getVideoUrl(filename: string) {
30-
return getAssetUrl(filename)
31-
}

apps/sim/app/(landing)/components/testimonials/testimonials.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { useEffect, useState } from 'react'
44
import Image from 'next/image'
5-
import { getAssetUrl } from '@/lib/utils'
65
import { inter } from '@/app/fonts/inter'
76

87
interface Testimonial {
@@ -14,79 +13,78 @@ interface Testimonial {
1413
profileImage: string
1514
}
1615

17-
// Import all testimonials
1816
const allTestimonials: Testimonial[] = [
1917
{
2018
text: "🚨 BREAKING: This startup just dropped the fastest way to build AI agents.\n\nThis Figma-like canvas to build agents will blow your mind.\n\nHere's why this is the best tool for building AI agents:",
2119
name: 'Hasan Toor',
2220
username: '@hasantoxr',
2321
viewCount: '515k',
2422
tweetUrl: 'https://x.com/hasantoxr/status/1912909502036525271',
25-
profileImage: getAssetUrl('twitter/hasan.jpg'),
23+
profileImage: '/twitter/hasan.jpg',
2624
},
2725
{
2826
text: "Drag-and-drop AI workflows for devs who'd rather build agents than babysit them.",
2927
name: 'GitHub Projects',
3028
username: '@GithubProjects',
3129
viewCount: '90.4k',
3230
tweetUrl: 'https://x.com/GithubProjects/status/1906383555707490499',
33-
profileImage: getAssetUrl('twitter/github-projects.jpg'),
31+
profileImage: '/twitter/github-projects.jpg',
3432
},
3533
{
3634
text: "🚨 BREAKING: This startup just dropped the fastest way to build AI agents.\n\nThis Figma-like canvas to build agents will blow your mind.\n\nHere's why this is the best tool for building AI agents:",
3735
name: 'Ryan Lazuka',
3836
username: '@lazukars',
3937
viewCount: '47.4k',
4038
tweetUrl: 'https://x.com/lazukars/status/1913136390503600575',
41-
profileImage: getAssetUrl('twitter/lazukars.png'),
39+
profileImage: '/twitter/lazukars.png',
4240
},
4341
{
4442
text: 'omfggggg this is the zapier of agent building\n\ni always believed that building agents and using ai should not be limited to technical people. i think this solves just that\n\nthe fact that this is also open source makes me so optimistic about the future of building with ai :)))\n\ncongrats @karabegemir & @typingwala !!!',
4543
name: 'nizzy',
4644
username: '@nizzyabi',
4745
viewCount: '6,269',
4846
tweetUrl: 'https://x.com/nizzyabi/status/1907864421227180368',
49-
profileImage: getAssetUrl('twitter/nizzy.jpg'),
47+
profileImage: '/twitter/nizzy.jpg',
5048
},
5149
{
5250
text: 'A very good looking agent workflow builder 🔥 and open source!',
5351
name: 'xyflow',
5452
username: '@xyflowdev',
5553
viewCount: '3,246',
5654
tweetUrl: 'https://x.com/xyflowdev/status/1909501499719438670',
57-
profileImage: getAssetUrl('twitter/xyflow.jpg'),
55+
profileImage: '/twitter/xyflow.jpg',
5856
},
5957
{
6058
text: "One of the best products I've seen in the space, and the hustle and grind I've seen from @karabegemir and @typingwala is insane. Sim is positioned to build something game-changing, and there's no better team for the job.\n\nCongrats on the launch 🚀 🎊 great things ahead!",
6159
name: 'samarth',
6260
username: '@firestorm776',
6361
viewCount: '1,256',
6462
tweetUrl: 'https://x.com/firestorm776/status/1907896097735061598',
65-
profileImage: getAssetUrl('twitter/samarth.jpg'),
63+
profileImage: '/twitter/samarth.jpg',
6664
},
6765
{
6866
text: 'lfgg got access to @simstudioai via @zerodotemail 😎',
6967
name: 'nizzy',
7068
username: '@nizzyabi',
7169
viewCount: '1,762',
7270
tweetUrl: 'https://x.com/nizzyabi/status/1910482357821595944',
73-
profileImage: getAssetUrl('twitter/nizzy.jpg'),
71+
profileImage: '/twitter/nizzy.jpg',
7472
},
7573
{
7674
text: 'Feels like we\'re finally getting a "Photoshop moment" for AI devs—visual, intuitive, and fast enough to keep up with ideas mid-flow.',
7775
name: 'Syamraj K',
7876
username: '@syamrajk',
7977
viewCount: '2,784',
8078
tweetUrl: 'https://x.com/syamrajk/status/1912911980110946491',
81-
profileImage: getAssetUrl('twitter/syamrajk.jpg'),
79+
profileImage: '/twitter/syamrajk.jpg',
8280
},
8381
{
8482
text: 'The use cases are endless. Great work @simstudioai',
8583
name: 'Daniel Kim',
8684
username: '@daniel_zkim',
8785
viewCount: '103',
8886
tweetUrl: 'https://x.com/daniel_zkim/status/1907891273664782708',
89-
profileImage: getAssetUrl('twitter/daniel.jpg'),
87+
profileImage: '/twitter/daniel.jpg',
9088
},
9189
]
9290

@@ -95,11 +93,9 @@ export default function Testimonials() {
9593
const [isTransitioning, setIsTransitioning] = useState(false)
9694
const [isPaused, setIsPaused] = useState(false)
9795

98-
// Create an extended array for smooth infinite scrolling
9996
const extendedTestimonials = [...allTestimonials, ...allTestimonials]
10097

10198
useEffect(() => {
102-
// Set up automatic sliding every 3 seconds
10399
const interval = setInterval(() => {
104100
if (!isPaused) {
105101
setIsTransitioning(true)
@@ -110,17 +106,15 @@ export default function Testimonials() {
110106
return () => clearInterval(interval)
111107
}, [isPaused])
112108

113-
// Reset position when reaching the end for infinite loop
114109
useEffect(() => {
115110
if (currentIndex >= allTestimonials.length) {
116111
setTimeout(() => {
117112
setIsTransitioning(false)
118113
setCurrentIndex(0)
119-
}, 500) // Match transition duration
114+
}, 500)
120115
}
121116
}, [currentIndex])
122117

123-
// Calculate the transform value
124118
const getTransformValue = () => {
125119
// Each card unit (card + separator) takes exactly 25% width
126120
return `translateX(-${currentIndex * 25}%)`

apps/sim/components/emails/enterprise-subscription-email.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '@react-email/components'
1414
import { format } from 'date-fns'
1515
import { getBrandConfig } from '@/lib/branding/branding'
16-
import { env } from '@/lib/env'
16+
import { getEnv } from '@/lib/env'
1717
import { baseStyles } from './base-styles'
1818
import EmailFooter from './footer'
1919

@@ -24,7 +24,7 @@ interface EnterpriseSubscriptionEmailProps {
2424
createdDate?: Date
2525
}
2626

27-
const baseUrl = env.NEXT_PUBLIC_APP_URL || 'https://sim.ai'
27+
const baseUrl = getEnv('NEXT_PUBLIC_APP_URL') || 'https://sim.ai'
2828

2929
export const EnterpriseSubscriptionEmail = ({
3030
userName = 'Valued User',

apps/sim/components/emails/footer.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Container, Img, Link, Section, Text } from '@react-email/components'
22
import { getBrandConfig } from '@/lib/branding/branding'
3-
import { env } from '@/lib/env'
4-
import { getAssetUrl } from '@/lib/utils'
3+
import { getEnv } from '@/lib/env'
54

65
interface UnsubscribeOptions {
76
unsubscribeToken?: string
@@ -14,7 +13,7 @@ interface EmailFooterProps {
1413
}
1514

1615
export const EmailFooter = ({
17-
baseUrl = env.NEXT_PUBLIC_APP_URL || 'https://sim.ai',
16+
baseUrl = getEnv('NEXT_PUBLIC_APP_URL') || 'https://sim.ai',
1817
unsubscribe,
1918
}: EmailFooterProps) => {
2019
const brand = getBrandConfig()
@@ -29,13 +28,13 @@ export const EmailFooter = ({
2928
<tr>
3029
<td align='center' style={{ padding: '0 8px' }}>
3130
<Link href='https://x.com/simdotai' rel='noopener noreferrer'>
32-
<Img src={getAssetUrl('static/x-icon.png')} width='24' height='24' alt='X' />
31+
<Img src={`${baseUrl}/static/x-icon.png`} width='24' height='24' alt='X' />
3332
</Link>
3433
</td>
3534
<td align='center' style={{ padding: '0 8px' }}>
3635
<Link href='https://discord.gg/Hr4UWYEcTT' rel='noopener noreferrer'>
3736
<Img
38-
src={getAssetUrl('static/discord-icon.png')}
37+
src={`${baseUrl}/static/discord-icon.png`}
3938
width='24'
4039
height='24'
4140
alt='Discord'
@@ -45,7 +44,7 @@ export const EmailFooter = ({
4544
<td align='center' style={{ padding: '0 8px' }}>
4645
<Link href='https://github.com/simstudioai/sim' rel='noopener noreferrer'>
4746
<Img
48-
src={getAssetUrl('static/github-icon.png')}
47+
src={`${baseUrl}/static/github-icon.png`}
4948
width='24'
5049
height='24'
5150
alt='GitHub'

apps/sim/components/emails/help-confirmation-email.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '@react-email/components'
1313
import { format } from 'date-fns'
1414
import { getBrandConfig } from '@/lib/branding/branding'
15-
import { env } from '@/lib/env'
15+
import { getEnv } from '@/lib/env'
1616
import { baseStyles } from './base-styles'
1717
import EmailFooter from './footer'
1818

@@ -23,7 +23,7 @@ interface HelpConfirmationEmailProps {
2323
submittedDate?: Date
2424
}
2525

26-
const baseUrl = env.NEXT_PUBLIC_APP_URL || 'https://sim.ai'
26+
const baseUrl = getEnv('NEXT_PUBLIC_APP_URL') || 'https://sim.ai'
2727

2828
const getTypeLabel = (type: string) => {
2929
switch (type) {

apps/sim/components/emails/invitation-email.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '@react-email/components'
1414
import { format } from 'date-fns'
1515
import { getBrandConfig } from '@/lib/branding/branding'
16-
import { env } from '@/lib/env'
16+
import { getEnv } from '@/lib/env'
1717
import { createLogger } from '@/lib/logs/console/logger'
1818
import { baseStyles } from './base-styles'
1919
import EmailFooter from './footer'
@@ -26,7 +26,7 @@ interface InvitationEmailProps {
2626
updatedDate?: Date
2727
}
2828

29-
const baseUrl = env.NEXT_PUBLIC_APP_URL || 'https://sim.ai'
29+
const baseUrl = getEnv('NEXT_PUBLIC_APP_URL') || 'https://sim.ai'
3030

3131
const logger = createLogger('InvitationEmail')
3232

apps/sim/components/emails/otp-verification-email.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
Text,
1212
} from '@react-email/components'
1313
import { getBrandConfig } from '@/lib/branding/branding'
14-
import { env } from '@/lib/env'
14+
import { getEnv } from '@/lib/env'
1515
import { baseStyles } from './base-styles'
1616
import EmailFooter from './footer'
1717

@@ -22,7 +22,7 @@ interface OTPVerificationEmailProps {
2222
chatTitle?: string
2323
}
2424

25-
const baseUrl = env.NEXT_PUBLIC_APP_URL || 'https://sim.ai'
25+
const baseUrl = getEnv('NEXT_PUBLIC_APP_URL') || 'https://sim.ai'
2626

2727
const getSubjectByType = (type: string, brandName: string, chatTitle?: string) => {
2828
switch (type) {

apps/sim/components/emails/plan-welcome-email.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from '@react-email/components'
1515
import EmailFooter from '@/components/emails/footer'
1616
import { getBrandConfig } from '@/lib/branding/branding'
17-
import { env } from '@/lib/env'
17+
import { getEnv } from '@/lib/env'
1818
import { baseStyles } from './base-styles'
1919

2020
interface PlanWelcomeEmailProps {
@@ -31,7 +31,7 @@ export function PlanWelcomeEmail({
3131
createdDate = new Date(),
3232
}: PlanWelcomeEmailProps) {
3333
const brand = getBrandConfig()
34-
const baseUrl = env.NEXT_PUBLIC_APP_URL || 'https://sim.ai'
34+
const baseUrl = getEnv('NEXT_PUBLIC_APP_URL') || 'https://sim.ai'
3535
const cta = loginLink || `${baseUrl}/login`
3636

3737
const previewText = `${brand.name}: Your ${planName} plan is active`

0 commit comments

Comments
 (0)