Remove unused state and simplify Link components in QuizRunner and EntryPage
This commit is contained in:
@@ -549,11 +549,7 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt
|
|||||||
Home
|
Home
|
||||||
</Link>
|
</Link>
|
||||||
{entryLink && (
|
{entryLink && (
|
||||||
<Link
|
<Link className="button button--ghost" to={entryLink}>
|
||||||
className="button button--ghost"
|
|
||||||
to={entryLink}
|
|
||||||
state={{ fromSummary: true }}
|
|
||||||
>
|
|
||||||
Back to learn page
|
Back to learn page
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
@@ -570,7 +566,7 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt
|
|||||||
{idx + 1}. {question.prompt_en || 'Question'}
|
{idx + 1}. {question.prompt_en || 'Question'}
|
||||||
</div>
|
</div>
|
||||||
{isRandomMode && (
|
{isRandomMode && (
|
||||||
<Link className="entry-link" to={entryHref} state={{ fromSummary: true }}>
|
<Link className="entry-link" to={entryHref}>
|
||||||
Learn page »
|
Learn page »
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { fetchEntry } from '../api';
|
import { fetchEntry } from '../api';
|
||||||
import VideoPlayer from '../components/VideoPlayer';
|
import VideoPlayer from '../components/VideoPlayer';
|
||||||
import { ConversationPanel, GrammarPanel, KeyPhrasePanel, VocabPanel } from '../components/ItemPanels';
|
import { ConversationPanel, GrammarPanel, KeyPhrasePanel, VocabPanel } from '../components/ItemPanels';
|
||||||
@@ -8,7 +8,6 @@ import type { EntryDetail } from '../types';
|
|||||||
|
|
||||||
export default function EntryPage() {
|
export default function EntryPage() {
|
||||||
const { idEncoded } = useParams();
|
const { idEncoded } = useParams();
|
||||||
const location = useLocation();
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [entry, setEntry] = useState<EntryDetail | null>(null);
|
const [entry, setEntry] = useState<EntryDetail | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
@@ -40,15 +39,11 @@ export default function EntryPage() {
|
|||||||
|
|
||||||
const quizLink = `/quiz?mode=entry&id=${encodeURIComponent(entry.id)}`;
|
const quizLink = `/quiz?mode=entry&id=${encodeURIComponent(entry.id)}`;
|
||||||
const ig = entry.ig_meta;
|
const ig = entry.ig_meta;
|
||||||
const fromSummary = Boolean(location.state && (location.state as any).fromSummary);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="entry-page">
|
<div className="entry-page">
|
||||||
<div className="crumbs row-between">
|
<div className="crumbs row-between">
|
||||||
<button className="button button--ghost" onClick={() => navigate(-1)}>← Back</button>
|
<button className="button button--ghost" onClick={() => navigate(-1)}>← Back</button>
|
||||||
{fromSummary && (
|
|
||||||
<button className="button button--ghost" onClick={() => navigate(-1)}>Back to summary</button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="page-header">
|
<div className="page-header">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user