``update Add platform-specific back button for Android, replace header layout, use LoadingSpinner, and refactor imports in Lesson page component
``
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
|
IonButton,
|
||||||
|
IonButtons,
|
||||||
IonContent,
|
IonContent,
|
||||||
IonHeader,
|
IonHeader,
|
||||||
|
IonIcon,
|
||||||
IonItem,
|
IonItem,
|
||||||
IonList,
|
IonList,
|
||||||
IonPage,
|
IonPage,
|
||||||
@@ -15,20 +18,18 @@ import { useEffect, useState } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useParams } from 'react-router';
|
import { useParams } from 'react-router';
|
||||||
import ExitButton from '../../components/ExitButton';
|
import ExitButton from '../../components/ExitButton';
|
||||||
import { LoadingScreen } from '../../components/LoadingScreen';
|
import { LoadingScreen, LoadingSpinner } from '../../components/LoadingScreen';
|
||||||
import CongratConnectiveConqueror from '../../components/Modal/Congratulation/ConnectiveConqueror';
|
import CongratConnectiveConqueror from '../../components/Modal/Congratulation/ConnectiveConqueror';
|
||||||
import CongratGenius from '../../components/Modal/Congratulation/Genius';
|
import CongratGenius from '../../components/Modal/Congratulation/Genius';
|
||||||
import CongratHardworker from '../../components/Modal/Congratulation/Hardworker';
|
import CongratHardworker from '../../components/Modal/Congratulation/Hardworker';
|
||||||
import CongratListeningProgress from '../../components/Modal/Congratulation/ListeningProgress';
|
import CongratListeningProgress from '../../components/Modal/Congratulation/ListeningProgress';
|
||||||
import CongratMatchmaking from '../../components/Modal/Congratulation/Matchmaking';
|
import CongratMatchmaking from '../../components/Modal/Congratulation/Matchmaking';
|
||||||
import { LESSON_LINK } from '../../constants';
|
|
||||||
import { useMyIonStore } from '../../contexts/MyIonStore';
|
|
||||||
import { listLessonCategories } from '../../public_data/listLessonCategories';
|
|
||||||
import LessonContainer from './LessonContainer';
|
import LessonContainer from './LessonContainer';
|
||||||
import useHelloworld from '../../hooks/useHelloworld';
|
|
||||||
import useListAllLessonTypes from '../../hooks/useListAllLessonTypes';
|
import useListAllLessonTypes from '../../hooks/useListAllLessonTypes';
|
||||||
import LessonsTypes, { LessonsType } from '../../types/LessonsTypes';
|
import { LessonsType } from '../../types/LessonsTypes';
|
||||||
import useListCategoriesByLessonId from '../../hooks/useListCategoriesByLessonId';
|
import { ellipsisHorizontal, ellipsisVertical, personCircle, search } from 'ionicons/icons';
|
||||||
|
import { Capacitor } from '@capacitor/core';
|
||||||
|
import { RUNNING_PLATFORM } from '../../constants';
|
||||||
|
|
||||||
const Lesson: React.FC = () => {
|
const Lesson: React.FC = () => {
|
||||||
const { act_category } = useParams<{ act_category: string }>();
|
const { act_category } = useParams<{ act_category: string }>();
|
||||||
@@ -60,30 +61,25 @@ const Lesson: React.FC = () => {
|
|||||||
<IonPage>
|
<IonPage>
|
||||||
<IonHeader className="ion-no-border">
|
<IonHeader className="ion-no-border">
|
||||||
<IonToolbar>
|
<IonToolbar>
|
||||||
<div
|
{/* show when scroll up */}
|
||||||
style={{
|
|
||||||
//
|
{RUNNING_PLATFORM == 'android' ? (
|
||||||
display: 'flex',
|
<IonButtons slot="primary">
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
alignItems: 'center',
|
|
||||||
padding: '0 0.5rem 0 0.5rem',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IonTitle size="large" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
||||||
{t('Lesson')}
|
|
||||||
</IonTitle>
|
|
||||||
<div>
|
|
||||||
<ExitButton />
|
<ExitButton />
|
||||||
</div>
|
</IonButtons>
|
||||||
</div>
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
<IonTitle>{t('lesson')}</IonTitle>
|
||||||
</IonToolbar>
|
</IonToolbar>
|
||||||
</IonHeader>
|
</IonHeader>
|
||||||
|
|
||||||
<IonContent fullscreen>
|
<IonContent fullscreen>
|
||||||
<IonHeader collapse="condense">
|
<IonHeader collapse="condense">
|
||||||
|
{/* show when no scrolling */}
|
||||||
<IonToolbar>
|
<IonToolbar>
|
||||||
<IonTitle size="large" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
<IonTitle size="large" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
||||||
<div>{'Lesson'}</div>
|
<div>{t('lesson')}</div>
|
||||||
</IonTitle>
|
</IonTitle>
|
||||||
</IonToolbar>
|
</IonToolbar>
|
||||||
</IonHeader>
|
</IonHeader>
|
||||||
@@ -113,7 +109,7 @@ const Lesson: React.FC = () => {
|
|||||||
{lessonTypes[active_lesson_idx]?.id ? (
|
{lessonTypes[active_lesson_idx]?.id ? (
|
||||||
<LessonContainer lesson_type_id={lessonTypes[active_lesson_idx].id} />
|
<LessonContainer lesson_type_id={lessonTypes[active_lesson_idx].id} />
|
||||||
) : (
|
) : (
|
||||||
<>loading (id undefined)</>
|
<LoadingSpinner />
|
||||||
)}
|
)}
|
||||||
{/* */}
|
{/* */}
|
||||||
<CongratGenius />
|
<CongratGenius />
|
||||||
|
Reference in New Issue
Block a user