Skip to content

Commit

Permalink
chore: adapt styles and fix some small issues with small improvements…
Browse files Browse the repository at this point in the history
…, further update some libraries (#34)
  • Loading branch information
Duell10111 authored Nov 9, 2024
1 parent 52cbf12 commit 2cbf046
Show file tree
Hide file tree
Showing 33 changed files with 1,144 additions and 881 deletions.
1 change: 1 addition & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"name": "reacttube",
"slug": "reacttube",
"userInterfaceStyle": "dark",
"primaryColor": "#556BFD",
"backgroundColor": "#000000",
"androidStatusBar": {
"barStyle": "light-content",
Expand Down
3 changes: 1 addition & 2 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ if (process.env?.EXPO_TV === '1') {
}
*/

// TODO: Load app.json and check if expoTV true?

if (appJSONConfig.expo.plugins[0][1].isTV) {
console.log("---- Adding TV file extensions ----");
config.resolver.sourceExts.unshift(
...config.resolver.sourceExts.map(e => `tv.${e}`),
);
Expand Down
1,286 changes: 563 additions & 723 deletions package-lock.json

Large diffs are not rendered by default.

75 changes: 40 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"name": "reacttube",
"version": "0.1.2",
"dependencies": {
"@craftzdog/react-native-buffer": "^6.0.5",
"@duell10111/apple-targets": "^0.0.6-alpha.1",
"@craftzdog/react-native-buffer": "6.0.5",
"@duell10111/apple-targets": "0.0.6-alpha.1",
"@gorhom/bottom-sheet": "4.6.4",
"@react-native-clipboard/clipboard": "^1.14.1",
"@react-native-clipboard/clipboard": "1.14.1",
"@react-native-community/slider": "4.5.3",
"@react-navigation/bottom-tabs": "^6.6.1",
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0",
"@rneui/base": "^4.0.0-rc.8",
"@rneui/themed": "^4.0.0-rc.8",
"crypto-browserify": "^3.12.0",
"drizzle-orm": "^0.31.2",
"eslint-config-universe": "^12.1.0",
"event-target-polyfill": "^0.0.3",
"events": "^3.3.0",
"expo": "^51.0.35",
"@react-navigation/material-top-tabs": "6.6.14",
"@react-navigation/native": "6.1.18",
"@react-navigation/native-stack": "6.11.0",
"@rneui/base": "4.0.0-rc.8",
"@rneui/themed": "4.0.0-rc.8",
"crypto-browserify": "3.12.0",
"drizzle-orm": "0.31.2",
"event-target-polyfill": "0.0.3",
"events": "3.3.0",
"expo": "^51.0.38",
"expo-av": "~14.0.7",
"expo-build-properties": "~0.12.5",
"expo-file-system": "~17.0.1",
Expand All @@ -28,35 +28,36 @@
"expo-sqlite": "~14.0.6",
"expo-status-bar": "~1.12.1",
"expo-system-ui": "~3.0.7",
"expo-watch-connectivity": "^0.1.1",
"fast-text-encoding": "^1.0.6",
"expo-watch-connectivity": "0.1.1",
"fast-text-encoding": "1.0.6",
"lodash": "4.17.21",
"luxon": "^3.5.0",
"luxon": "3.5.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "npm:react-native-tvos@^0.75.2-0",
"react-native-awesome-slider": "^2.5.3",
"react-native": "npm:react-native-tvos@^0.75.4-0",
"react-native-awesome-slider": "2.5.3",
"react-native-device-info": "13.0.0",
"react-native-flash-message": "^0.4.2",
"react-native-fs": "^2.20.0",
"react-native-flash-message": "0.4.2",
"react-native-gesture-handler": "~2.18.1",
"react-native-logs": "^5.1.0",
"react-native-mmkv": "^2.12.2",
"react-native-qrcode-svg": "^6.3.2",
"react-native-quick-crypto": "^0.7.4",
"react-native-logs": "5.1.0",
"react-native-mmkv": "2.12.2",
"react-native-pager-view": "^6.4.1",
"react-native-qrcode-svg": "6.3.2",
"react-native-quick-crypto": "0.7.4",
"react-native-reanimated": "~3.15.0",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-redash": "^18.1.3",
"react-native-reanimated-carousel": "3.5.1",
"react-native-redash": "18.1.3",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.34.0",
"react-native-super-grid": "^6.0.1",
"react-native-super-grid": "6.0.1",
"react-native-svg": "15.2.0",
"react-native-track-player": "^4.1.1",
"react-native-url-polyfill": "^1.3.0",
"react-native-tab-view": "3.5.2",
"react-native-track-player": "4.1.1",
"react-native-url-polyfill": "1.3.0",
"react-native-video": "6.6.3",
"rn-native-search-bar": "1.0.0-beta.10",
"stream-browserify": "^3.0.0",
"web-streams-polyfill": "^3.3.3",
"web-streams-polyfill": "3.3.3",
"youtubei.js": "github:Duell10111/YouTube.js#playlist-like"
},
"devDependencies": {
Expand All @@ -70,16 +71,18 @@
"@babel/runtime": "^7.20.0",
"@react-native-tvos/config-tv": "0.0.10",
"@types/lodash": "4.17.10",
"@types/luxon": "^3.4.2",
"@types/luxon": "3.4.2",
"@types/react": "~18.2.14",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"babel-plugin-inline-import": "^3.0.0",
"babel-plugin-module-resolver": "^5.0.0",
"drizzle-kit": "^0.22.6",
"eslint": "^8.56.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"eslint-config-universe": "12.1.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react-hooks": "5.0.0",
"prettier": "3.3.3",
"typescript": "~5.3.3"
},
"expo": {
Expand All @@ -89,8 +92,10 @@
]
}
},
"resolutions": {
"tslib": "2.6.2"
"overrides": {
"@rneui/themed": "4.0.0-rc.8",
"@rneui/base": "4.0.0-rc.8",
"use-latest-callback": "0.1.9"
},
"private": true,
"scripts": {
Expand Down
22 changes: 22 additions & 0 deletions src/components/channel/phone/Channel.tsx
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>
</>
);
}
23 changes: 23 additions & 0 deletions src/components/channel/phone/ChannelContext.tsx
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);
}
32 changes: 32 additions & 0 deletions src/components/channel/phone/ChannelTab.tsx
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()} />
)}
</>
);
}
28 changes: 28 additions & 0 deletions src/components/channel/phone/ChannelTabPhone.tsx
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} />;
}
29 changes: 29 additions & 0 deletions src/components/channel/phone/ChannelTabs.tsx
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>
);
}
2 changes: 1 addition & 1 deletion src/components/elements/phone/ElementCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CommonActions, useNavigation, useRoute} from "@react-navigation/native";
import {useNavigation, useRoute} from "@react-navigation/native";
import {StyleProp, ViewStyle} from "react-native";

import {PlaylistCard} from "@/components/elements/phone/PlaylistCard";
Expand Down
3 changes: 2 additions & 1 deletion src/components/elements/phone/HorizontalElementsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export function HorizontalElementsList({
<ElementCard
element={item}
// textStyle={textStyle}
style={[videoSegmentStyle, {marginHorizontal: 10, width: 200}]}
style={[videoSegmentStyle, {marginHorizontal: 10}]}
width={300}
/>
);
},
Expand Down
12 changes: 8 additions & 4 deletions src/components/elements/phone/VideoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
StyleSheet,
Text,
TouchableNativeFeedback,
useWindowDimensions,
View,
ViewStyle,
} from "react-native";
Expand All @@ -23,9 +22,8 @@ interface VideoCardProps {
width?: ViewStyle["width"];
}

export function VideoCard({element, style, onPress}: VideoCardProps) {
export function VideoCard({element, style, onPress, width}: VideoCardProps) {
const {style: appStyle} = useAppStyle();
const {width} = useWindowDimensions();

const progressVideo = element?.thumbnailOverlays?.videoProgress
? element.thumbnailOverlays.videoProgress * 100
Expand All @@ -42,7 +40,13 @@ export function VideoCard({element, style, onPress}: VideoCardProps) {
}, [element]);

return (
<View style={[styles.container, {minWidth: 150, maxWidth: width}, style]}>
<View
style={[
styles.container,
{minWidth: 150, maxWidth: width},
{width},
style,
]}>
<TouchableNativeFeedback onPress={onPress}>
<View style={[styles.segmentContainer]}>
<Image
Expand Down
1 change: 1 addition & 0 deletions src/components/elements/tv/HorizontalElementsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function HorizontalElementsList({
element={item}
// textStyle={textStyle}
style={[videoSegmentStyle, {marginHorizontal: 10}]}
width={300}
/>
);
}
Expand Down
11 changes: 9 additions & 2 deletions src/components/grid/GridFeedPhone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {useCallback} from "react";
import {FlatList, ListRenderItem, StyleProp, ViewStyle} from "react-native";

import {ElementCard} from "@/components/elements/phone/ElementCard";
import {HorizontalSection} from "@/components/grid/HorizontalSection";
import PageSectionList from "@/components/segments/PageSectionList";
import {HorizontalData} from "@/extraction/ShelfExtraction";
import {ElementData} from "@/extraction/Types";
Expand All @@ -18,7 +19,7 @@ export function GridFeedPhone({items, onEndReached}: GridFeedPhoneProps) {
({item}) => {
if ("data" in item) {
return (
<PageSectionList
<HorizontalSection
headerText={item.title}
content={item as HorizontalData}
// horizontalListSegmentStyle={props.horizontalListSegmentStyle}
Expand All @@ -41,5 +42,11 @@ export function GridFeedPhone({items, onEndReached}: GridFeedPhoneProps) {
[],
);

return <FlatList data={items} renderItem={renderItem} />;
return (
<FlatList
data={items}
renderItem={renderItem}
onEndReached={onEndReached}
/>
);
}
Loading

0 comments on commit 2cbf046

Please sign in to comment.