mirror of
https://github.com/lucasrcsantana/story-generator.git
synced 2025-12-16 21:37:51 +00:00
fix: Corrigindo capas das histórias
This commit is contained in:
parent
ea5c5e87f1
commit
e154dd2372
@ -293,6 +293,7 @@ function RecordingHistoryCard({ recording }: { recording: StoryRecording }) {
|
||||
text={recording.transcription || 'Transcrição não disponível'}
|
||||
isUpperCase={isUpperCase}
|
||||
className="text-sm text-gray-600 whitespace-pre-wrap"
|
||||
highlightSyllables={isHighlighted}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -77,7 +77,7 @@ export function StudentDashboardPage() {
|
||||
.eq('student_id', session.user.id)
|
||||
.eq('story_pages.page_number', 1) // Garante que pegamos a primeira página
|
||||
.order('created_at', { ascending: false })
|
||||
.limit(3);
|
||||
.limit(6);
|
||||
|
||||
if (error) throw error;
|
||||
setRecentStories(data || []);
|
||||
@ -252,10 +252,7 @@ export function StudentDashboardPage() {
|
||||
{story.cover && (
|
||||
<div className="relative aspect-video">
|
||||
<img
|
||||
src={supabase.storage
|
||||
.from('story-images')
|
||||
.getPublicUrl(story.cover.image_url).data.publicUrl +
|
||||
`?width=400&height=300&quality=80&format=webp`}
|
||||
src={`${story.cover[0].image_url}?width=400&height=300&quality=80&format=webp`}
|
||||
alt={story.title}
|
||||
className="w-full h-48 object-cover"
|
||||
loading="lazy"
|
||||
|
||||
@ -25,8 +25,16 @@ export function StudentStoriesPage() {
|
||||
|
||||
const query = supabase
|
||||
.from('stories')
|
||||
.select('*')
|
||||
.eq('student_id', session.user.id);
|
||||
.select(`
|
||||
*,
|
||||
pages:story_pages (
|
||||
image_url
|
||||
)
|
||||
`)
|
||||
.eq('student_id', session.user.id)
|
||||
.order('created_at', { ascending: false })
|
||||
.order('page_number', { foreignTable: 'story_pages', ascending: true })
|
||||
.limit(1, { foreignTable: 'story_pages' });
|
||||
|
||||
if (statusFilter !== 'all') {
|
||||
query.eq('status', statusFilter);
|
||||
@ -197,16 +205,21 @@ export function StudentStoriesPage() {
|
||||
className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden cursor-pointer hover:shadow-md transition"
|
||||
onClick={() => navigate(`/aluno/historias/${story.id}`)}
|
||||
>
|
||||
{story.cover && (
|
||||
{!story.pages?.[0]?.image_url && (
|
||||
<div className="bg-gray-100 aspect-video flex items-center justify-center">
|
||||
<BookOpen className="h-12 w-12 text-gray-400" />
|
||||
</div>
|
||||
)}
|
||||
{story.pages?.[0]?.image_url && (
|
||||
<div className="relative aspect-video">
|
||||
<img
|
||||
src={supabase.storage
|
||||
.from('story-images')
|
||||
.getPublicUrl(story.cover.image_url).data.publicUrl +
|
||||
`?width=400&height=300&quality=80&format=webp`}
|
||||
alt={story.title}
|
||||
src={story.pages[0].image_url}
|
||||
alt={`Capa da história: ${story.title}`}
|
||||
className="w-full h-48 object-cover"
|
||||
loading="lazy"
|
||||
onError={(e) => {
|
||||
e.currentTarget.style.display = 'none';
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user