Fix asset paths (#623)
This commit is contained in:
parent
bfeffa069f
commit
f663ad5d52
2 changed files with 15 additions and 4 deletions
|
|
@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from 'react';
|
|||
import { createPortal } from 'react-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getPresetBanners, PresetBanner } from '../../utils/bannersService';
|
||||
import { getApiPath } from '../../config/paths';
|
||||
import { getApiPath, getAssetPath } from '../../config/paths';
|
||||
|
||||
interface BannerEditModalProps {
|
||||
isOpen: boolean;
|
||||
|
|
@ -225,7 +225,15 @@ const BannerEditModal: React.FC<BannerEditModalProps> = ({
|
|||
</h3>
|
||||
<div className="relative inline-block w-full">
|
||||
<img
|
||||
src={imagePreview}
|
||||
src={
|
||||
imagePreview.startsWith(
|
||||
'data:'
|
||||
)
|
||||
? imagePreview
|
||||
: getAssetPath(
|
||||
imagePreview
|
||||
)
|
||||
}
|
||||
alt="Banner preview"
|
||||
className="w-full h-48 object-cover rounded-md border border-gray-300 dark:border-gray-600"
|
||||
/>
|
||||
|
|
@ -265,7 +273,9 @@ const BannerEditModal: React.FC<BannerEditModalProps> = ({
|
|||
}`}
|
||||
>
|
||||
<img
|
||||
src={banner.url}
|
||||
src={getAssetPath(
|
||||
banner.url
|
||||
)}
|
||||
alt={`Banner by ${banner.creator}`}
|
||||
className="w-full h-24 object-cover"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
getCreatorFromBannerUrl,
|
||||
isPresetBanner,
|
||||
} from '../../utils/bannersService';
|
||||
import { getAssetPath } from '../../config/paths';
|
||||
|
||||
interface ProjectBannerProps {
|
||||
project: Project;
|
||||
|
|
@ -47,7 +48,7 @@ const ProjectBanner: React.FC<ProjectBannerProps> = ({
|
|||
<div className="mb-6 overflow-hidden relative group">
|
||||
{project.image_url ? (
|
||||
<img
|
||||
src={project.image_url}
|
||||
src={getAssetPath(project.image_url)}
|
||||
alt={project.name}
|
||||
className="w-full h-[282px] object-cover"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue