-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from simonyiszk/presentation-api-layer
Presentation api layer
- Loading branch information
Showing
61 changed files
with
729 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXPO_PUBLIC_API_BASE_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,5 @@ ios | |
.idea | ||
.idea/workspace.xml | ||
|
||
.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ConfigContext } from '@expo/config'; | ||
import { config } from 'dotenv'; | ||
import * as env from 'env-var'; | ||
config(); | ||
|
||
const EXPO_PUBLIC_API_BASE_URL = env.get('EXPO_PUBLIC_API_BASE_URL').required().asString(); | ||
|
||
export default ({ config }: ConfigContext) => { | ||
return { | ||
...config, | ||
extra: { | ||
apiBaseUrl: EXPO_PUBLIC_API_BASE_URL, | ||
...config.extra, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,41 @@ | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import { ScrollView, View } from 'react-native'; | ||
|
||
import { Screen } from '../../../components/base/screen'; | ||
import { ErrorMessage } from '../../../components/common/error-message'; | ||
import { Header } from '../../../components/common/header'; | ||
import { SectionTitle } from '../../../components/common/sectiontitle'; | ||
import { Separator } from '../../../components/common/separator'; | ||
import { Title } from '../../../components/common/title'; | ||
import { NewsList } from '../../../components/news/news-list'; | ||
import { ScheduleList } from '../../../components/schedule/schedule-list'; | ||
import { useSchedule } from '../../../hooks/use-schedule'; | ||
import { news } from '../../../mocks/news'; | ||
import { HomeNewsList } from '../../../components/news/home-news-list'; | ||
import { HomePresentationList } from '../../../components/schedule/home-presentation-list'; | ||
import { PresentationItemSkeleton } from '../../../components/schedule/presentation-item-skeleton'; | ||
import { useConference } from '../../../hooks/use-conference'; | ||
import { useNews } from '../../../hooks/use-news'; | ||
|
||
interface HomePageProps {} | ||
|
||
export default function HomePage({}: HomePageProps) { | ||
const { data } = useSchedule(); | ||
|
||
const conference = useConference(); | ||
const news = useNews(); | ||
return ( | ||
<Screen> | ||
<Header> | ||
<Title>Simonyi Konferencia</Title> | ||
</Header> | ||
<SectionTitle>Előadások</SectionTitle> | ||
<ScheduleList schedule={data ?? []} filterToCurrent filterToUpcoming /> | ||
<View className='w-20 h-1 rounded-full bg-slate-300 mx-5 my-5' /> | ||
<SectionTitle>Hírek</SectionTitle> | ||
<NewsList news={news} /> | ||
<ScrollView className='px-5'> | ||
<View className='mb-40'> | ||
<SectionTitle>Előadások</SectionTitle> | ||
{conference.isLoading && [0, 1].map((i) => <PresentationItemSkeleton key={i} />)} | ||
{conference.isError && <ErrorMessage>Nem sikerült betölteni az előadásokat</ErrorMessage>} | ||
{!conference.isError && !conference.isLoading && ( | ||
<HomePresentationList presentations={conference.data?.presentations ?? []} /> | ||
)} | ||
<Separator /> | ||
<SectionTitle>Hírek</SectionTitle> | ||
{news.data && <HomeNewsList news={news.data.news} />} | ||
</View> | ||
</ScrollView> | ||
</Screen> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { PresentationDetailsPage } from '../../../components/schedule/presentation-details-page'; | ||
import { useSafeId } from '../../../utils/common.utils'; | ||
|
||
export default function PresentationDetails() { | ||
const slug = useSafeId(); | ||
return <PresentationDetailsPage slug={slug} />; | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
import { Screen } from '../../../components/base/screen'; | ||
import { ErrorMessage } from '../../../components/common/error-message'; | ||
import { Header } from '../../../components/common/header'; | ||
import { Title } from '../../../components/common/title'; | ||
import { PresentationItemSkeleton } from '../../../components/schedule/presentation-item-skeleton'; | ||
import { PresentationList } from '../../../components/schedule/presentation-list'; | ||
import { useConference } from '../../../hooks/use-conference'; | ||
|
||
interface PresentationListPageProps {} | ||
|
||
export default function PresentationListPage({}: PresentationListPageProps) { | ||
const { data, isError, isLoading } = useConference(); | ||
return ( | ||
<Screen> | ||
<Header> | ||
<Title>Programterv</Title> | ||
</Header> | ||
{isLoading && [0, 1, 2, 3].map((i) => <PresentationItemSkeleton key={i} />)} | ||
{!isError && !isLoading && <PresentationList presentations={data?.presentations ?? []} />} | ||
{isError && <ErrorMessage>Nem sikerült betölteni az előadásokat</ErrorMessage>} | ||
</Screen> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { PresentationDetailsPage } from '../../../components/schedule/presentation-details-page'; | ||
import { useSafeId } from '../../../utils/common.utils'; | ||
|
||
export default function ScheduleEventDetails() { | ||
const slug = useSafeId(); | ||
return <PresentationDetailsPage slug={slug} />; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,21 @@ | ||
import { QueryClientProvider } from '@tanstack/react-query'; | ||
import { useFonts } from 'expo-font'; | ||
import { Slot, SplashScreen } from 'expo-router'; | ||
import { useEffect } from 'react'; | ||
import { Slot } from 'expo-router'; | ||
import { View } from 'react-native'; | ||
|
||
import { Splash } from '../components/common/splash'; | ||
import { queryClient } from '../config/query-client.config'; | ||
import { FavoriteEventsProvider } from '../contexts/favorite-events.context'; | ||
import { FavoritePresentationsProvider } from '../contexts/favorite-presentations.context'; | ||
|
||
export default function MainLayout() { | ||
const [loaded, error] = useFonts({ | ||
Raleway: require('../assets/fonts/Raleway-Regular.ttf'), | ||
RalewayBold: require('../assets/fonts/Raleway-Bold.ttf'), | ||
RalewayLight: require('../assets/fonts/Raleway-Light.ttf'), | ||
}); | ||
|
||
useEffect(() => { | ||
if (error) throw error; | ||
}, [error]); | ||
|
||
useEffect(() => { | ||
if (loaded) SplashScreen.hideAsync(); | ||
}, [loaded]); | ||
|
||
if (!loaded) return null; | ||
|
||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<FavoriteEventsProvider> | ||
<View className='bg-slate-100 min-h-screen'> | ||
<Slot /> | ||
</View> | ||
</FavoriteEventsProvider> | ||
<Splash> | ||
<FavoritePresentationsProvider> | ||
<View className='bg-slate-100 min-h-screen'> | ||
<Slot /> | ||
</View> | ||
</FavoritePresentationsProvider> | ||
</Splash> | ||
</QueryClientProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ScrollView, View, ViewProps } from 'react-native'; | ||
|
||
import { cn } from '../../utils/common.utils'; | ||
|
||
export function ScrollContent({ className, ...props }: ViewProps) { | ||
return ( | ||
<ScrollView> | ||
<View className={cn('mx-5 pb-40', className)} {...props} /> | ||
</ScrollView> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Feather } from '@expo/vector-icons'; | ||
import { View, ViewProps } from 'react-native'; | ||
|
||
import { cn } from '../../utils/common.utils'; | ||
import { StyledText } from '../base/text'; | ||
|
||
export function ErrorMessage({ className, children, ...props }: ViewProps) { | ||
return ( | ||
<View className={cn('gap-x-2 m-5 flex-row items-center justify-center', className)} {...props}> | ||
<Feather name='alert-circle' size={24} color='#ef4444' /> | ||
<StyledText className='text-red-500 text-xl'>{children}</StyledText> | ||
</View> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import { View, ViewProps } from 'react-native'; | ||
|
||
import { cn } from '../../utils/common.utils'; | ||
|
||
export function Separator({ className, ...props }: ViewProps) { | ||
return <View className={cn('w-20 h-1 rounded-full bg-slate-300 my-5', className)} {...props} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Animated, ViewProps } from 'react-native'; | ||
|
||
import { usePulseAnimation } from '../../utils/animation.utils'; | ||
import { cn } from '../../utils/common.utils'; | ||
|
||
export function SkeletonRectangle({ className, style, ...props }: ViewProps) { | ||
const { opacity } = usePulseAnimation(); | ||
return <Animated.View className={cn('bg-slate-200 rounded-xl', className)} style={[{ opacity }, style]} {...props} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { useFonts } from 'expo-font'; | ||
import { SplashScreen } from 'expo-router'; | ||
import { PropsWithChildren, useEffect } from 'react'; | ||
|
||
import { useConference } from '../../hooks/use-conference'; | ||
import { useNews } from '../../hooks/use-news'; | ||
|
||
export function Splash({ children }: PropsWithChildren) { | ||
const conference = useConference(); | ||
const news = useNews(); | ||
|
||
const [loaded, error] = useFonts({ | ||
Raleway: require('../../assets/fonts/Raleway-Regular.ttf'), | ||
RalewayBold: require('../../assets/fonts/Raleway-Bold.ttf'), | ||
RalewayLight: require('../../assets/fonts/Raleway-Light.ttf'), | ||
}); | ||
|
||
const dataReady = conference.status !== 'pending' && news.status !== 'pending'; | ||
|
||
useEffect(() => { | ||
if (error) throw error; | ||
}, [error]); | ||
|
||
useEffect(() => { | ||
if (loaded && dataReady) SplashScreen.hideAsync(); | ||
}, [loaded, dataReady]); | ||
|
||
if (!loaded || !dataReady) return null; | ||
|
||
return children; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { NewsItemDto } from '../../types/news-api.type'; | ||
import { StyledText } from '../base/text'; | ||
import { NewsItem } from './news-item'; | ||
|
||
interface HomeNewsListProps { | ||
news: NewsItemDto[]; | ||
} | ||
|
||
export function HomeNewsList({ news }: HomeNewsListProps) { | ||
if (news.length === 0) { | ||
return <StyledText className='text-center my-10'>Nincs megjeleníthető hír.</StyledText>; | ||
} | ||
return news.map((newsItem, index) => <NewsItem key={index} newsItem={newsItem} />); | ||
} |
Oops, something went wrong.