``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 {
|
||||
arrowBackCircleOutline,
|
||||
chevronBack,
|
||||
chevronForward,
|
||||
close,
|
||||
heart,
|
||||
heartOutline,
|
||||
play,
|
||||
volumeHighOutline,
|
||||
@@ -17,24 +15,15 @@ import { useParams } from 'react-router';
|
||||
import { useGlobalAudioPlayer } from 'react-use-audio-player';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import { LoadingScreen } from '../../../components/LoadingScreen';
|
||||
import RemoveFavoritePrompt from '../../../components/RemoveFavoritePrompt';
|
||||
import { LESSON_LINK } from '../../../constants';
|
||||
import { LESSON_LINK, POCKETBASE_URL } from '../../../constants';
|
||||
import { useMyIonFavorite } from '../../../contexts/MyIonFavorite';
|
||||
//
|
||||
import { useMyIonStore } from '../../../contexts/MyIonStore';
|
||||
import ILesson from '../../../interfaces/ILesson';
|
||||
import ILessonCategory from '../../../interfaces/ILessonCategory';
|
||||
import IWordCard from '../../../interfaces/IWordCard';
|
||||
import {
|
||||
getFavLessonVocabularyLink,
|
||||
getLessonVocabularyLink,
|
||||
getLessonVocabularyLinkString,
|
||||
} from '../../Lesson/getLessonWordLink';
|
||||
import { getFavLessonVocabularyLink, getLessonVocabularyLinkString } from '../../Lesson/getLessonWordLink';
|
||||
import { AudioControls } from './AudioControls';
|
||||
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 [loading, setLoading] = useState<boolean>(true);
|
||||
@@ -56,7 +45,7 @@ const WordPage: React.FC = () => {
|
||||
let { status, data: tempResult } = useGetVocabularyRoute(lesson_idx, cat_idx);
|
||||
|
||||
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(() => {
|
||||
@@ -143,11 +132,7 @@ const WordPage: React.FC = () => {
|
||||
// href={getLessonVocabularyLink(lesson_idx, cat_idx, Math.max(0, parseInt(word_idx) - 1).toString())}
|
||||
onClick={() => {
|
||||
router.push(
|
||||
getLessonVocabularyLinkString(
|
||||
lesson_idx,
|
||||
cat_idx,
|
||||
Math.max(0, parseInt(word_idx) - 1).toString(),
|
||||
),
|
||||
getLessonVocabularyLinkString(lesson_idx, cat_idx, Math.max(0, parseInt(word_idx) - 1).toString())
|
||||
);
|
||||
}}
|
||||
>
|
||||
@@ -203,8 +188,8 @@ const WordPage: React.FC = () => {
|
||||
getLessonVocabularyLinkString(
|
||||
lesson_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