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

Modified the highlighted section #381

Merged
merged 6 commits into from
Jul 15, 2024
Merged
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
44 changes: 37 additions & 7 deletions frontend/src/screens/learner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { EffectCards, FreeMode, Navigation, Pagination } from 'swiper/modules';
import { LearnerWelcomeModal } from './learner/learner-welcome-modal';
import { UnsupportedCountryModal } from './learner/unsupported-country-modal';
import { Badge, Box, Container, Flex, Group, Stack, Text, TextInput, Title } from '@mantine/core';
import { IconSearch, IconX, IconPlus, IconMinus } from '@tabler/icons-react';
import { IconSearch, IconX, IconChevronDown, IconPlus, IconMinus } from '@tabler/icons-react';
import { groupBy, filter } from 'lodash';
import { colors } from '@theme'
import { useEffect, useMemo, useState } from 'react';
Expand All @@ -21,23 +21,53 @@ const HighlightedStudies: FC = () => {
const { highlightedStudies } = useParticipantStudies()
const isMobile = useIsMobileDevice()

const scrollToStudies = () => {
const element = document.getElementById('all-studies-unique-id')
element?.scrollIntoView({ behavior: 'smooth' })
}

if (!highlightedStudies.length) return null

return (
<Box bg={colors.navy} py='md'>
<Container>
<Stack>
<Title c='white' order={2}>Highlighted Studies</Title>
{isMobile ?
<MobileStudyCards studies={highlightedStudies} /> :
<DesktopStudyCards studies={highlightedStudies} />
}
<Group align='center' justify='space-between'>
{isMobile ?
<MobileStudyCards studies={highlightedStudies} /> :
<>
<CuratedStudies />
<div style={{ width: '70%' }}><DesktopStudyCards studies={highlightedStudies} /></div>
</>
}
</Group>
<Group c={colors.green} justify='center' align='center'>
<Stack justify='center' align='center' gap='0' style={{ cursor: 'pointer' }} onClick={()=> scrollToStudies()}>
<Text size='sm'>View all studies</Text>
<IconChevronDown size='1.5rem'/>
</Stack>
</Group>
</Stack>
</Container>
</Box>
)
}

const CuratedStudies: FC = () => {

return (
<Stack c={colors.white} w='23%'>
<Title order={2}>Curated Studies</Title>
<Title order={5} mt='-1.2rem'>by our learning scientists</Title>

<Stack>
<Text pr='1.5rem'>Deepen your understanding of learning habits with scientific studies currated by our team of education researchers.</Text>
<Text>Accelerate your growth and tailor your path to your own needs.</Text>
</Stack>
</Stack>
)
}

const LearnerDashboard = () => {
const env = useEnvironment()

Expand Down Expand Up @@ -90,7 +120,7 @@ export const SearchBar: FC<{search: string, setSearch: (search: string) => void}

export const StudiesTitle: FC<{search: string, filteredStudies: ParticipantStudy[]}> = () => {
return (
<Title order={2}>All Studies</Title>
<Title order={2} id='all-studies-unique-id'>All Studies</Title>
)
}

Expand Down