``update Remove unused components, imports, and refactor file URL generation in WordPage component
``
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
import { IonButton, IonButtons, IonContent, IonIcon, IonModal, IonPage, IonToolbar, useIonRouter } from '@ionic/react';
|
import { IonButton, IonContent, IonIcon, IonPage, useIonRouter } from '@ionic/react';
|
||||||
import './style.css';
|
import './style.css';
|
||||||
import {
|
import {
|
||||||
arrowBackCircleOutline,
|
arrowBackCircleOutline,
|
||||||
chevronBack,
|
chevronBack,
|
||||||
chevronForward,
|
chevronForward,
|
||||||
close,
|
|
||||||
heart,
|
|
||||||
heartOutline,
|
heartOutline,
|
||||||
play,
|
play,
|
||||||
volumeHighOutline,
|
volumeHighOutline,
|
||||||
@@ -17,24 +15,15 @@ import { useParams } from 'react-router';
|
|||||||
import { useGlobalAudioPlayer } from 'react-use-audio-player';
|
import { useGlobalAudioPlayer } from 'react-use-audio-player';
|
||||||
import remarkGfm from 'remark-gfm';
|
import remarkGfm from 'remark-gfm';
|
||||||
import { LoadingScreen } from '../../../components/LoadingScreen';
|
import { LoadingScreen } from '../../../components/LoadingScreen';
|
||||||
import RemoveFavoritePrompt from '../../../components/RemoveFavoritePrompt';
|
import { LESSON_LINK, POCKETBASE_URL } from '../../../constants';
|
||||||
import { LESSON_LINK } from '../../../constants';
|
|
||||||
import { useMyIonFavorite } from '../../../contexts/MyIonFavorite';
|
import { useMyIonFavorite } from '../../../contexts/MyIonFavorite';
|
||||||
//
|
//
|
||||||
import { useMyIonStore } from '../../../contexts/MyIonStore';
|
|
||||||
import ILesson from '../../../interfaces/ILesson';
|
import ILesson from '../../../interfaces/ILesson';
|
||||||
import ILessonCategory from '../../../interfaces/ILessonCategory';
|
import ILessonCategory from '../../../interfaces/ILessonCategory';
|
||||||
import IWordCard from '../../../interfaces/IWordCard';
|
import IWordCard from '../../../interfaces/IWordCard';
|
||||||
import {
|
import { getFavLessonVocabularyLink, getLessonVocabularyLinkString } from '../../Lesson/getLessonWordLink';
|
||||||
getFavLessonVocabularyLink,
|
|
||||||
getLessonVocabularyLink,
|
|
||||||
getLessonVocabularyLinkString,
|
|
||||||
} from '../../Lesson/getLessonWordLink';
|
|
||||||
import { AudioControls } from './AudioControls';
|
import { AudioControls } from './AudioControls';
|
||||||
import useGetVocabularyRoute from '../../../hooks/useGetVocabularyRoute';
|
import useGetVocabularyRoute from '../../../hooks/useGetVocabularyRoute';
|
||||||
import { UseQueryResult } from '@tanstack/react-query';
|
|
||||||
import { ListResult } from 'pocketbase';
|
|
||||||
import LessonsTypes from '../../../types/LessonsTypes';
|
|
||||||
|
|
||||||
const WordPage: React.FC = () => {
|
const WordPage: React.FC = () => {
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
@@ -56,7 +45,7 @@ const WordPage: React.FC = () => {
|
|||||||
let { status, data: tempResult } = useGetVocabularyRoute(lesson_idx, cat_idx);
|
let { status, data: tempResult } = useGetVocabularyRoute(lesson_idx, cat_idx);
|
||||||
|
|
||||||
function getFile(recordId: string, fileName: string) {
|
function getFile(recordId: string, fileName: string) {
|
||||||
return `http://127.0.0.1:8090/api/files/Vocabularies/${recordId}/${fileName}`;
|
return `${POCKETBASE_URL}/api/files/Vocabularies/${recordId}/${fileName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -143,11 +132,7 @@ const WordPage: React.FC = () => {
|
|||||||
// href={getLessonVocabularyLink(lesson_idx, cat_idx, Math.max(0, parseInt(word_idx) - 1).toString())}
|
// href={getLessonVocabularyLink(lesson_idx, cat_idx, Math.max(0, parseInt(word_idx) - 1).toString())}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
router.push(
|
router.push(
|
||||||
getLessonVocabularyLinkString(
|
getLessonVocabularyLinkString(lesson_idx, cat_idx, Math.max(0, parseInt(word_idx) - 1).toString())
|
||||||
lesson_idx,
|
|
||||||
cat_idx,
|
|
||||||
Math.max(0, parseInt(word_idx) - 1).toString(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -203,8 +188,8 @@ const WordPage: React.FC = () => {
|
|||||||
getLessonVocabularyLinkString(
|
getLessonVocabularyLinkString(
|
||||||
lesson_idx,
|
lesson_idx,
|
||||||
cat_idx,
|
cat_idx,
|
||||||
Math.min(tempResult.items.length - 1, parseInt(word_idx) + 1).toString(),
|
Math.min(tempResult.items.length - 1, parseInt(word_idx) + 1).toString()
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user