fix: use resolveBackendAssetUrl for font and image URLs in ThemePanel and SlidePreviewSection
This commit is contained in:
parent
7b61956dff
commit
a203e61e2f
2 changed files with 7 additions and 5 deletions
|
|
@ -33,6 +33,7 @@ import ThemeApi from '@/app/(presentation-generator)/services/api/theme'
|
|||
import { useFontLoader } from '@/app/(presentation-generator)/hooks/useFontLoad'
|
||||
import Link from 'next/link'
|
||||
import { trackEvent, MixpanelEvent } from '@/utils/mixpanel'
|
||||
import { resolveBackendAssetUrl } from '@/utils/api'
|
||||
|
||||
// Fallback theme used before defaults are loaded from API (unified Theme type)
|
||||
const FALLBACK_THEME: Theme = {
|
||||
|
|
@ -153,7 +154,7 @@ const ThemePanel: React.FC = () => {
|
|||
setUserFonts({
|
||||
fonts: userFonts.fonts.map((font: any) => ({
|
||||
name: font.name,
|
||||
url: `${process.env.NEXT_PUBLIC_FAST_API}${font.url}`,
|
||||
url: resolveBackendAssetUrl(font.url),
|
||||
})),
|
||||
})
|
||||
|
||||
|
|
@ -458,14 +459,14 @@ const ThemePanel: React.FC = () => {
|
|||
setCustomFonts({
|
||||
textFont: {
|
||||
name: font_name,
|
||||
url: `${process.env.NEXT_PUBLIC_FAST_API}${font_url}`,
|
||||
url: resolveBackendAssetUrl(font_url),
|
||||
}
|
||||
})
|
||||
|
||||
// Add the newly uploaded font to userFonts if not already present
|
||||
if (!userFonts.fonts.find(f => f.name === font_name)) {
|
||||
setUserFonts(prev => ({
|
||||
fonts: [...prev.fonts, { name: font_name, url: `${process.env.NEXT_PUBLIC_FAST_API}${font_url}` }]
|
||||
fonts: [...prev.fonts, { name: font_name, url: resolveBackendAssetUrl(font_url) }]
|
||||
}))
|
||||
}
|
||||
toast.success(`Font "${font_name}" uploaded successfully`)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import {
|
|||
Sparkles
|
||||
} from "lucide-react";
|
||||
import { SlidePreviewSectionProps } from "../types";
|
||||
import { resolveBackendAssetUrl } from '@/utils/api'
|
||||
|
||||
|
||||
export const SlidePreviewSection: React.FC<SlidePreviewSectionProps> = ({
|
||||
previewData,
|
||||
|
|
@ -17,7 +19,6 @@ export const SlidePreviewSection: React.FC<SlidePreviewSectionProps> = ({
|
|||
}) => {
|
||||
const slideCount = previewData.slide_image_urls?.length || 0;
|
||||
|
||||
|
||||
return (
|
||||
<div className="my-8 max-w-[1440px] mx-auto">
|
||||
{/* Header Card */}
|
||||
|
|
@ -48,7 +49,7 @@ export const SlidePreviewSection: React.FC<SlidePreviewSectionProps> = ({
|
|||
className="group relative aspect-video w-full max-w-[1280px] mx-auto rounded-xl overflow-hidden "
|
||||
>
|
||||
<img
|
||||
src={`${process.env.NEXT_PUBLIC_FAST_API}${url}`}
|
||||
src={resolveBackendAssetUrl(url)}
|
||||
alt={`Slide ${index + 1}`}
|
||||
className="w-full h-full object-cover"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue