Версия 1.2.16 Добавлено изображение-заставка для показа при импорте статей, если изображение утеряно.
This commit is contained in:
parent
0251d5788f
commit
d1f87e539f
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vite-react-typescript-starter",
|
||||
"private": true,
|
||||
"version": "1.2.15",
|
||||
"version": "1.2.16",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
BIN
public/images/lost-image.webp
Normal file
BIN
public/images/lost-image.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 282 KiB |
@ -5,6 +5,7 @@ import { Article, CategoryTitles, CityTitles } from '../types';
|
||||
import { FileJson, Save, ChevronLeft, ChevronRight, Edit2 } from 'lucide-react';
|
||||
|
||||
const ARTICLES_PER_PAGE = 10;
|
||||
const fallbackImg = '/images/lost-image.webp';
|
||||
|
||||
export function ImportArticlesPage() {
|
||||
const [articles, setArticles] = useState<Article[]>([]);
|
||||
@ -192,6 +193,23 @@ export function ImportArticlesPage() {
|
||||
{CategoryTitles[article.categoryId]} · {CityTitles[article.cityId]} · {article.readTime} min read
|
||||
</div>
|
||||
|
||||
<div className="mt-4">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
|
||||
<div className="border rounded-md p-2 bg-gray-50">
|
||||
<img
|
||||
src={article.coverImage}
|
||||
alt={""}
|
||||
className="w-full h-48 object-cover rounded-md mb-2"
|
||||
onError={(e) => {
|
||||
const target = e.currentTarget;
|
||||
target.onerror = null;
|
||||
target.src = fallbackImg;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-2">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Автор:</label>
|
||||
<input
|
||||
@ -241,6 +259,11 @@ export function ImportArticlesPage() {
|
||||
src={imageUrl}
|
||||
alt={`image-${index + 1}`}
|
||||
className="w-full h-48 object-cover rounded-md mb-2"
|
||||
onError={(e) => {
|
||||
const target = e.currentTarget;
|
||||
target.onerror = null;
|
||||
target.src = fallbackImg;
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user