-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adapt styles and fix some small issues with small improvements…
…, further update some libraries (#34)
- Loading branch information
1 parent
52cbf12
commit 2cbf046
Showing
33 changed files
with
1,144 additions
and
881 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
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
Large diffs are not rendered by default.
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
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,22 @@ | ||
import ChannelHeader from "@/components/channel/ChannelHeader"; | ||
import {ChannelContext} from "@/components/channel/phone/ChannelContext"; | ||
import {ChannelTabs} from "@/components/channel/phone/ChannelTabs"; | ||
import {YTChannel} from "@/extraction/Types"; | ||
|
||
interface Props { | ||
channel: YTChannel; | ||
} | ||
|
||
export function Channel({channel}: Props) { | ||
return ( | ||
<> | ||
<ChannelHeader | ||
channelName={channel.title} | ||
imgURL={channel.thumbnail.url} | ||
/> | ||
<ChannelContext channel={channel}> | ||
<ChannelTabs channelTypes={channel.tabTypes} /> | ||
</ChannelContext> | ||
</> | ||
); | ||
} |
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,23 @@ | ||
import React, {createContext, useContext} from "react"; | ||
|
||
import {YTChannel} from "@/extraction/Types"; | ||
|
||
interface ChannelContextType { | ||
channel: YTChannel; | ||
} | ||
|
||
// @ts-ignore Should never be the case | ||
const ChannelCTX = createContext<ChannelContextType>({}); | ||
|
||
interface ChannelContextProps { | ||
channel: YTChannel; | ||
children: React.ReactElement; | ||
} | ||
|
||
export function ChannelContext({channel, children}: ChannelContextProps) { | ||
return <ChannelCTX.Provider value={{channel}} children={children} />; | ||
} | ||
|
||
export function useChannelContext() { | ||
return useContext(ChannelCTX); | ||
} |
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,32 @@ | ||
import DeviceInfo from "react-native-device-info"; | ||
|
||
import {GridFeedPhone} from "@/components/grid/GridFeedPhone"; | ||
import GridFeedViewPhone from "@/components/grid/GridFeedViewPhone"; | ||
import {YTChannel} from "@/extraction/Types"; | ||
import useChannelTab, {ChannelTabType} from "@/hooks/channel/useChannelTab"; | ||
|
||
interface ChannelTabProps { | ||
channel: YTChannel; | ||
type: ChannelTabType; | ||
} | ||
|
||
export function ChannelTab({channel, type}: ChannelTabProps) { | ||
const {data, fetchMore} = useChannelTab(channel, type); | ||
|
||
if (!data) return null; | ||
|
||
return ( | ||
<> | ||
{/*<Text style={{color: "white"}}>{`Channel Tab: ${type}`}</Text>*/} | ||
{type === "Shorts" || (type === "Videos" && DeviceInfo.isTablet()) ? ( | ||
<GridFeedViewPhone | ||
items={data} | ||
onEndReached={() => fetchMore()} | ||
itemDimension={type === "Shorts" ? 150 : 300} | ||
/> | ||
) : ( | ||
<GridFeedPhone items={data} onEndReached={() => fetchMore()} /> | ||
)} | ||
</> | ||
); | ||
} |
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,28 @@ | ||
import {MaterialTopTabScreenProps} from "@react-navigation/material-top-tabs"; | ||
import {useMemo} from "react"; | ||
|
||
import {useChannelContext} from "@/components/channel/phone/ChannelContext"; | ||
import {ChannelTab} from "@/components/channel/phone/ChannelTab"; | ||
import {RootChannelTabParamList} from "@/components/channel/phone/ChannelTabs"; | ||
import {ChannelTabType} from "@/hooks/channel/useChannelTab"; | ||
|
||
type Props = MaterialTopTabScreenProps<RootChannelTabParamList>; | ||
|
||
export function ChannelTabPhone({navigation, route}: Props) { | ||
const type = useMemo<ChannelTabType>(() => { | ||
switch (route.name) { | ||
case "Home": | ||
default: | ||
return "Home"; | ||
case "Videos": | ||
return "Videos"; | ||
case "Shorts": | ||
return "Shorts"; | ||
case "Playlists": | ||
return "Playlists"; | ||
} | ||
}, [route]); | ||
const {channel} = useChannelContext(); | ||
|
||
return <ChannelTab channel={channel} type={type} />; | ||
} |
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,29 @@ | ||
import {createMaterialTopTabNavigator} from "@react-navigation/material-top-tabs"; | ||
|
||
import {ChannelTabPhone} from "@/components/channel/phone/ChannelTabPhone"; | ||
import {YTChannelTabType} from "@/extraction/Types"; | ||
|
||
export type RootChannelTabParamList = { | ||
Home: undefined; | ||
Videos: undefined; | ||
Playlists: undefined; | ||
Shorts: undefined; | ||
About: undefined; | ||
}; | ||
|
||
const Tab = createMaterialTopTabNavigator<RootChannelTabParamList>(); | ||
|
||
interface ChannelTabsProps { | ||
channelTypes: YTChannelTabType[]; | ||
} | ||
|
||
export function ChannelTabs({channelTypes}: ChannelTabsProps) { | ||
return ( | ||
<Tab.Navigator> | ||
{/* TODO: Check if Type exists in Param List and filter outer out*/} | ||
{channelTypes.map((channel: YTChannelTabType) => ( | ||
<Tab.Screen name={channel} component={ChannelTabPhone} /> | ||
))} | ||
</Tab.Navigator> | ||
); | ||
} |
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
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
Oops, something went wrong.