fix: 修復review-design頁面例句圖片顯示和TypeScript類型錯誤
- 修正mockCardData中exampleImage的類型從null改為undefined - 為SentenceReorderTest組件添加exampleImage和onImageClick屬性傳遞 - 確保所有支援圖片的測試組件都能正確顯示例句圖片 - 修復TypeScript類型不匹配錯誤 (string|null vs string|undefined) - 完善SentenceFillTest、SentenceReorderTest、SentenceSpeakingTest的圖片功能 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
589a22b89d
commit
b913d13543
|
|
@ -1,30 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DramaLing.Api.Models.Entities;
|
||||
|
||||
public class CardSet
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public string Color { get; set; } = "bg-blue-500";
|
||||
|
||||
public int CardCount { get; set; } = 0;
|
||||
|
||||
public bool IsDefault { get; set; } = false;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Navigation Properties
|
||||
public virtual User User { get; set; } = null!;
|
||||
public virtual ICollection<Flashcard> Flashcards { get; set; } = new List<Flashcard>();
|
||||
}
|
||||
|
|
@ -47,7 +47,11 @@ export default function ReviewTestsPage() {
|
|||
exampleTranslation: currentCard.exampleTranslation,
|
||||
pronunciation: currentCard.pronunciation,
|
||||
difficultyLevel: currentCard.difficultyLevel,
|
||||
translation: currentCard.translation
|
||||
translation: currentCard.translation,
|
||||
// 從 flashcardExampleImages 提取圖片URL
|
||||
exampleImage: currentCard.flashcardExampleImages?.[0]?.exampleImage ?
|
||||
`http://localhost:5008/images/examples/${currentCard.flashcardExampleImages[0].exampleImage.relativePath}` :
|
||||
undefined
|
||||
} : {
|
||||
word: "loading...",
|
||||
definition: "Loading...",
|
||||
|
|
@ -55,7 +59,8 @@ export default function ReviewTestsPage() {
|
|||
exampleTranslation: "載入中...",
|
||||
pronunciation: "",
|
||||
difficultyLevel: "A1",
|
||||
translation: "載入中"
|
||||
translation: "載入中",
|
||||
exampleImage: undefined
|
||||
}
|
||||
|
||||
// 選項題選項 - 從資料中生成
|
||||
|
|
@ -186,7 +191,7 @@ export default function ReviewTestsPage() {
|
|||
exampleTranslation={mockCardData.exampleTranslation}
|
||||
pronunciation={mockCardData.pronunciation}
|
||||
difficultyLevel={mockCardData.difficultyLevel}
|
||||
exampleImage="https://via.placeholder.com/400x200?text=Example+Image"
|
||||
exampleImage={mockCardData.exampleImage}
|
||||
onAnswer={handleAnswer}
|
||||
onReportError={handleReportError}
|
||||
onImageClick={handleImageClick}
|
||||
|
|
@ -200,8 +205,10 @@ export default function ReviewTestsPage() {
|
|||
example={mockCardData.example}
|
||||
exampleTranslation={mockCardData.exampleTranslation}
|
||||
difficultyLevel={mockCardData.difficultyLevel}
|
||||
exampleImage={mockCardData.exampleImage}
|
||||
onAnswer={handleAnswer}
|
||||
onReportError={handleReportError}
|
||||
onImageClick={handleImageClick}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
|
@ -235,7 +242,7 @@ export default function ReviewTestsPage() {
|
|||
example={mockCardData.example}
|
||||
exampleTranslation={mockCardData.exampleTranslation}
|
||||
difficultyLevel={mockCardData.difficultyLevel}
|
||||
exampleImage="https://via.placeholder.com/400x200?text=Speaking+Test"
|
||||
exampleImage={mockCardData.exampleImage}
|
||||
onAnswer={handleAnswer}
|
||||
onReportError={handleReportError}
|
||||
onImageClick={handleImageClick}
|
||||
|
|
|
|||
Loading…
Reference in New Issue