mirror of
https://github.com/lucasrcsantana/story-generator.git
synced 2025-12-18 14:27:51 +00:00
This commit is contained in:
parent
e154dd2372
commit
62594f5e62
@ -1,4 +1,5 @@
|
|||||||
import { splitIntoSyllables } from './syllableSplitter';
|
import { splitIntoSyllables } from './syllableSplitter';
|
||||||
|
import { test, expect } from 'vitest';
|
||||||
|
|
||||||
test('Separação silábica básica', () => {
|
test('Separação silábica básica', () => {
|
||||||
expect(splitIntoSyllables('casa')).toEqual(['ca', 'sa']);
|
expect(splitIntoSyllables('casa')).toEqual(['ca', 'sa']);
|
||||||
|
|||||||
@ -10,9 +10,10 @@ import * as Dialog from '@radix-ui/react-dialog';
|
|||||||
import { ExerciseSuggestions } from '../../components/learning/ExerciseSuggestions';
|
import { ExerciseSuggestions } from '../../components/learning/ExerciseSuggestions';
|
||||||
import { TextCaseToggle } from '../../components/ui/text-case-toggle';
|
import { TextCaseToggle } from '../../components/ui/text-case-toggle';
|
||||||
import { AdaptiveText, AdaptiveTitle, AdaptiveParagraph } from '../../components/ui/adaptive-text';
|
import { AdaptiveText, AdaptiveTitle, AdaptiveParagraph } from '../../components/ui/adaptive-text';
|
||||||
import { useUppercasePreference } from '../../hooks/useUppercasePreference';
|
|
||||||
import { useSession } from '../../hooks/useSession';
|
import { useSession } from '../../hooks/useSession';
|
||||||
import { useSyllables } from '../../features/syllables/hooks/useSyllables';
|
import { useSyllables } from '../../features/syllables/hooks/useSyllables';
|
||||||
|
import { useUppercasePreference } from '../../hooks/useUppercasePreference';
|
||||||
|
|
||||||
|
|
||||||
interface StoryRecording {
|
interface StoryRecording {
|
||||||
id: string;
|
id: string;
|
||||||
@ -41,6 +42,9 @@ function RecordingHistoryCard({ recording }: { recording: StoryRecording }) {
|
|||||||
const [isConverting, setIsConverting] = React.useState(false);
|
const [isConverting, setIsConverting] = React.useState(false);
|
||||||
const [mp3Url, setMp3Url] = React.useState<string | null>(null);
|
const [mp3Url, setMp3Url] = React.useState<string | null>(null);
|
||||||
const [conversionError, setConversionError] = React.useState<string | null>(null);
|
const [conversionError, setConversionError] = React.useState<string | null>(null);
|
||||||
|
const { session } = useSession();
|
||||||
|
const { isUpperCase } = useUppercasePreference(session?.user?.id);
|
||||||
|
const { isHighlighted } = useSyllables();
|
||||||
|
|
||||||
// Verificar suporte ao formato WebM
|
// Verificar suporte ao formato WebM
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@ -397,6 +401,7 @@ export function StoryPage() {
|
|||||||
const { isUpperCase, toggleUppercase, isLoading } = useUppercasePreference(session?.user?.id);
|
const { isUpperCase, toggleUppercase, isLoading } = useUppercasePreference(session?.user?.id);
|
||||||
const { isHighlighted, toggleHighlight } = useSyllables();
|
const { isHighlighted, toggleHighlight } = useSyllables();
|
||||||
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const fetchStory = async () => {
|
const fetchStory = async () => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -252,7 +252,7 @@ export function StudentDashboardPage() {
|
|||||||
{story.cover && (
|
{story.cover && (
|
||||||
<div className="relative aspect-video">
|
<div className="relative aspect-video">
|
||||||
<img
|
<img
|
||||||
src={`${story.cover[0].image_url}?width=400&height=300&quality=80&format=webp`}
|
src={`${story.cover.image_url}?width=400&height=300&quality=80&format=webp`}
|
||||||
alt={story.title}
|
alt={story.title}
|
||||||
className="w-full h-48 object-cover"
|
className="w-full h-48 object-cover"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
|||||||
@ -32,9 +32,7 @@ export function StudentStoriesPage() {
|
|||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
.eq('student_id', session.user.id)
|
.eq('student_id', session.user.id)
|
||||||
.order('created_at', { ascending: false })
|
.order('created_at', { ascending: false });
|
||||||
.order('page_number', { foreignTable: 'story_pages', ascending: true })
|
|
||||||
.limit(1, { foreignTable: 'story_pages' });
|
|
||||||
|
|
||||||
if (statusFilter !== 'all') {
|
if (statusFilter !== 'all') {
|
||||||
query.eq('status', statusFilter);
|
query.eq('status', statusFilter);
|
||||||
@ -205,15 +203,15 @@ export function StudentStoriesPage() {
|
|||||||
className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden cursor-pointer hover:shadow-md transition"
|
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}`)}
|
onClick={() => navigate(`/aluno/historias/${story.id}`)}
|
||||||
>
|
>
|
||||||
{!story.pages?.[0]?.image_url && (
|
{!story.cover?.image_url && (
|
||||||
<div className="bg-gray-100 aspect-video flex items-center justify-center">
|
<div className="bg-gray-100 aspect-video flex items-center justify-center">
|
||||||
<BookOpen className="h-12 w-12 text-gray-400" />
|
<BookOpen className="h-12 w-12 text-gray-400" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{story.pages?.[0]?.image_url && (
|
{story.cover?.image_url && (
|
||||||
<div className="relative aspect-video">
|
<div className="relative aspect-video">
|
||||||
<img
|
<img
|
||||||
src={story.pages[0].image_url}
|
src={story.cover.image_url}
|
||||||
alt={`Capa da história: ${story.title}`}
|
alt={`Capa da história: ${story.title}`}
|
||||||
className="w-full h-48 object-cover"
|
className="w-full h-48 object-cover"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user