Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(onboarding): dot navigation and add more slides #2848

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 178 additions & 0 deletions src/assets/img/illustration_otherSchedules.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
253 changes: 253 additions & 0 deletions src/assets/img/illustration_territories.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/features/app_start/shared/illustration/index.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const SlideItem: FC<BoxProps> = styled(Box)(
justifyContent: 'space-between',
height: '100%',
gap: '24px',
cursor: 'grabbing',
rhahao marked this conversation as resolved.
Show resolved Hide resolved
[theme.breakpoints.up('mobile')]: {
padding: '0px 24px',
},
Expand Down
160 changes: 43 additions & 117 deletions src/features/app_start/shared/illustration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@ import 'swiper/css/pagination';
import { Box, IconButton } from '@mui/material';
import { IconEllipse } from '@icons/index';
import { Swiper, SwiperSlide } from 'swiper/react';
import { useAppTranslation } from '@hooks/index';
import { Autoplay, Pagination } from 'swiper/modules';
import { createNumbersArray } from '@utils/common';
import { SlideItem } from './index.styles';
import useIllustration from './useIllustration';
import MeetingSchedules from '@assets/img/illustration_meetingSchedules.svg?url';
import MinistryAssignments from '@assets/img/illustration_ministryAssignments.svg?url';
import MultiPlattform from '@assets/img/illustration_multiPlattform.svg?url';
import Secretary from '@assets/img/illustration_secretary.svg?url';
import Typography from '@components/typography';

const StartupIllustration = () => {
const { t } = useAppTranslation();

const { index, setIndex, dotSize, handleSlide, swiperRef } =
useIllustration();
const {
currentImage,
setCurrentImage,
dotSize,
handleSlide,
swiperRef,
slides,
} = useIllustration();

return (
<Box
Expand Down Expand Up @@ -50,108 +48,34 @@ const StartupIllustration = () => {
modules={[Autoplay, Pagination]}
className="mySwiper"
style={{ height: '100%' }}
onRealIndexChange={(swiper) => setIndex(swiper.realIndex)}
onRealIndexChange={(swiper) => setCurrentImage(swiper.realIndex)}
>
<SwiperSlide>
<SlideItem>
<Box>
<Typography
className="h1"
color="var(--always-white)"
sx={{ marginBottom: '24px' }}
>
{t('tr_illustrationMinistryAssignmentsHeader')}
</Typography>
<Typography
className="body-regular"
color="var(--always-white)"
>
{t('tr_illustrationMinistryAssignmentsDescription')}
</Typography>
</Box>
<img
alt=""
src={MinistryAssignments}
style={{ width: '100%', height: 'auto' }}
/>
</SlideItem>
</SwiperSlide>

<SwiperSlide>
<SlideItem>
<Box>
<Typography
className="h1"
color="var(--always-white)"
sx={{ marginBottom: '24px' }}
>
{t('tr_illustrationMultiPlattformHeader')}
</Typography>
<Typography
className="body-regular"
color="var(--always-white)"
>
{t('tr_illustrationMultiPlattformDescription')}
</Typography>
</Box>
<img
alt=""
src={MultiPlattform}
style={{ width: '100%', height: 'auto' }}
/>
</SlideItem>
</SwiperSlide>

<SwiperSlide>
<SlideItem>
<Box>
<Typography
className="h1"
color="var(--always-white)"
sx={{ marginBottom: '24px' }}
>
{t('tr_illustrationMeetingSchedulesHeader')}
</Typography>
<Typography
className="body-regular"
color="var(--always-white)"
>
{t('tr_illustrationMeetingSchedulesDescription')}
</Typography>
</Box>
<img
alt=""
src={MeetingSchedules}
style={{ width: '100%', height: 'auto' }}
/>
</SlideItem>
</SwiperSlide>

<SwiperSlide>
<SlideItem>
<Box>
<Typography
className="h1"
color="var(--always-white)"
sx={{ marginBottom: '24px' }}
>
{t('tr_illustrationSecretaryHeader')}
</Typography>
<Typography
className="body-regular"
color="var(--always-white)"
>
{t('tr_illustrationSecretaryDescription')}
</Typography>
</Box>

<img
alt=""
src={Secretary}
style={{ width: '100%', height: 'auto' }}
/>
</SlideItem>
</SwiperSlide>
{slides.map((slide) => (
<SwiperSlide key={slide.title}>
<SlideItem>
<Box>
<Typography
className="h1"
color="var(--always-white)"
sx={{ marginBottom: '24px' }}
>
{slide.title}
</Typography>
<Typography
className="body-regular"
color="var(--always-white)"
>
{slide.desc}
</Typography>
</Box>
<img
alt=""
src={slide.src}
style={{ width: '100%', height: 'auto' }}
rhahao marked this conversation as resolved.
Show resolved Hide resolved
/>
</SlideItem>
</SwiperSlide>
))}
</Swiper>
</Box>

Expand All @@ -163,22 +87,24 @@ const StartupIllustration = () => {
gap: { mobile: '12px', laptop: '16px' },
}}
>
{createNumbersArray(4).map((n) => (
{slides.map((item, index) => (
<IconButton
key={n}
key={item.title}
disableRipple
sx={{
opacity: n === index ? 1 : 0.48,
opacity: currentImage === index ? 1 : 0.48,
padding: 0,
margin: 0,
width: { mobile: '12px', laptop: '16px' },
}}
onClick={() => handleSlide(n)}
onClick={() => handleSlide(index)}
>
<IconEllipse
color="var(--always-white)"
width={n === index ? dotSize.active : dotSize.inactive}
height={n === index ? dotSize.active : dotSize.inactive}
width={currentImage === index ? dotSize.active : dotSize.inactive}
height={
currentImage === index ? dotSize.active : dotSize.inactive
}
rhahao marked this conversation as resolved.
Show resolved Hide resolved
/>
</IconButton>
))}
Expand Down
67 changes: 61 additions & 6 deletions src/features/app_start/shared/illustration/useIllustration.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,83 @@
import { useRef, useState } from 'react';
import { useMemo, useRef, useState } from 'react';
import { useMediaQuery, useTheme } from '@mui/material';
import { SwiperRef } from 'swiper/react';
import { useAppTranslation } from '@hooks/index';
import MeetingSchedules from '@assets/img/illustration_meetingSchedules.svg?url';
import MinistryAssignments from '@assets/img/illustration_ministryAssignments.svg?url';
import MultiPlattform from '@assets/img/illustration_multiPlattform.svg?url';
import OtherSchedules from '@assets/img/illustration_otherSchedules.svg?url';
import Secretary from '@assets/img/illustration_secretary.svg?url';
import Territories from '@assets/img/illustration_territories.svg?url';

const useIllustration = () => {
const { t } = useAppTranslation();

const theme = useTheme();
const swiperRef = useRef<SwiperRef>();

const laptopUp = useMediaQuery(theme.breakpoints.up('laptop'), {
noSsr: true,
});

const [index, setIndex] = useState(0);
const [currentImage, setCurrentImage] = useState(0);

const dotSize = useMemo(() => {
if (laptopUp) {
return { active: 16, inactive: 12 };
}

const dotSize = laptopUp
? { active: 16, inactive: 12 }
: { active: 12, inactive: 8 };
return { active: 12, inactive: 8 };
}, [laptopUp]);

const slides = useMemo(() => {
return [
{
title: t('tr_illustrationMinistryAssignmentsHeader'),
desc: t('tr_illustrationMinistryAssignmentsDescription'),
src: MinistryAssignments,
},
{
title: t('tr_illustrationMultiPlattformHeader'),
desc: t('tr_illustrationMultiPlattformDescription'),
src: MultiPlattform,
},
{
title: t('tr_illustrationMeetingSchedulesHeader'),
desc: t('tr_illustrationMeetingSchedulesDescription'),
src: MeetingSchedules,
},
{
title: t('tr_illustrationSecretaryHeader'),
desc: t('tr_illustrationSecretaryDescription'),
src: Secretary,
},
{
title: t('tr_illustrationOtherSchedulesHeader'),
desc: t('tr_illustrationOtherSchedulesDescription'),
src: OtherSchedules,
},
{
title: t('tr_illustrationTerritoriesHeader'),
desc: t('tr_illustrationTerritoriesDescription'),
src: Territories,
},
];
}, [t]);
rhahao marked this conversation as resolved.
Show resolved Hide resolved

const handleSlide = (n) => {
if (swiperRef.current) {
swiperRef.current.swiper.slideToLoop(n);
}
};

return { index, dotSize, setIndex, handleSlide, swiperRef };
return {
currentImage,
dotSize,
setCurrentImage,
handleSlide,
swiperRef,
slides,
};
};

export default useIllustration;
3 changes: 3 additions & 0 deletions src/features/whats_new/image_viewer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import 'swiper/css';
import 'swiper/css/pagination';

import { Box } from '@mui/material';
import { Swiper, SwiperSlide } from 'swiper/react';
import { Autoplay, Pagination } from 'swiper/modules';
Expand Down
6 changes: 5 additions & 1 deletion src/locales/en/onboarding.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,9 @@
"tr_dataManagementTitle": "Data management",
"tr_dataManagementDesc": "<p>You can access, correct, delete, or export your data in your profile settings or by contacting us at <a href='mailto:[email protected]'>[email protected]</a>. You can withdraw your consent anytime by deleting your account. Organized only collects data and cookies essential for app functionality. Data entered by your congregation’s elders is not managed by us. Your data (name, email, IP, device ID) is kept only as long as needed for app use, until your account is deleted, or as required by law.</p>",
"tr_mfaVerifyTitle": "Let’s make sure it is you",
"tr_mfaVerifyDesc": "Enter a code from your authenticator app"
"tr_mfaVerifyDesc": "Enter a code from your authenticator app",
"tr_illustrationTerritoriesHeader": "Manage territories effortlessly",
"tr_illustrationTerritoriesDescription": "View and edit territories, see overdue and lost cards. Track “Do not calls”, assignment history and print new cards. Assign a territory to publisher, and they’ll see it in their list of territories. Track coverage statistics and export S-13 document.",
"tr_illustrationOtherSchedulesHeader": "Many other useful schedules",
"tr_illustrationOtherSchedulesDescription": "Organized makes scheduling hall cleaning, circuit overseer visit, hall mentencance work, public witnessing, congregation duties and other parts of congregation life easies for appointed brothers and easier to track and take part for publishers."
}