Skip to content

Commit

Permalink
Merge branch 'main' into kyle/recommendationAlgorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapawar1 authored Apr 21, 2024
2 parents 8135d84 + 70b0844 commit 5f80004
Show file tree
Hide file tree
Showing 53 changed files with 1,847 additions and 482 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ name: Lint
#############################
on:
push:
branches-ignore: [main]
pull_request:
branches: [main]

###############
# Set the Job #
Expand Down
File renamed without changes
Binary file added assets/saved_story.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
248 changes: 158 additions & 90 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@
"expo-status-bar": "~1.6.0",
"html-entities": "^2.4.0",
"react": "18.2.0",
"react-apple-emojis": "^2.2.1",
"react-native": "0.72.10",
"react-native-dom-parser": "^1.5.3",
"react-native-element-dropdown": "^2.10.0",
"react-native-elements": "^3.4.3",
"react-native-emoji": "^1.8.0",
"react-native-emojicon": "^1.0.0",
"react-native-gesture-handler": "~2.12.0",
"react-native-htmlview": "^0.16.0",
"react-native-ionicons": "^4.6.5",
Expand All @@ -66,7 +69,8 @@
"react-native-vector-icons": "^10.0.2",
"react-scroll-to-top": "^3.0.0",
"use-debounce": "^10.0.0",
"validator": "^13.11.0"
"validator": "^13.11.0",
"expo-image": "~1.3.5"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
9 changes: 8 additions & 1 deletion src/app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function TabNav() {

return (
<Tabs
backBehavior="history"
screenOptions={{
tabBarLabelStyle: { fontSize: 14 },
tabBarHideOnKeyboard: true,
Expand All @@ -55,7 +56,6 @@ function TabNav() {
headerShown: false,
tabBarLabel: 'Home',
tabBarIcon: ({ color }) => HomeIcon({ color }),
// tabBarLabelStyle: { borderTopWidth: 12, paddingTop: 12 },
}}
/>
<Tabs.Screen
Expand Down Expand Up @@ -95,6 +95,13 @@ function TabNav() {
href: null,
}}
/>
<Tabs.Screen
name="genre"
options={{
headerShown: false,
href: null,
}}
/>
</Tabs>
);
}
Expand Down
59 changes: 32 additions & 27 deletions src/app/(tabs)/author/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as cheerio from 'cheerio';
import { useLocalSearchParams, router } from 'expo-router';
import { decode } from 'html-entities';
import { useEffect, useState } from 'react';
import { ActivityIndicator, ScrollView, View, Text, Image } from 'react-native';
import { ActivityIndicator, ScrollView, View, Text } from 'react-native';
import { Image } from 'expo-image';
import { SafeAreaView } from 'react-native-safe-area-context';

import styles from './styles';
Expand All @@ -26,41 +27,39 @@ function AuthorScreen() {
useEffect(() => {
setLoading(true);
(async () => {
const storyData: StoryPreview[] = await fetchAuthorStoryPreviews(
parseInt(author as string, 10),
);
const authorData: Author = await fetchAuthor(
parseInt(author as string, 10),
);
try {
setAuthorInfo(authorData);
console.log('TESTING AUTHOR INFO QUERY OUTPUT:', authorInfo);
} catch (error) {
console.log(
`There was an error while trying to output authorinfo ${error}`,
const storyData: StoryPreview[] = await fetchAuthorStoryPreviews(
parseInt(author as string, 10),
);
}
try {
const authorData: Author = await fetchAuthor(
parseInt(author as string, 10),
);

// Assuming these setters do not throw, but if they do, they're caught by the catch block
setAuthorInfo(authorData);
setAuthorStoryPreview(storyData);
console.log('TESTING STORY PREVIEW INFO QUERY OUTPUT:', storyData);
} catch (error) {
console.log(
`There was an error while trying to output author story preview info ${error}`,
);
console.error('There was an error while fetching data:', error);
} finally {
setLoading(false);
}
})().then(() => {
setLoading(false);
});
})();
}, [author]);

const getTextFromHtml = (text: string) => {
return cheerio.load(text).text().trim();
};

return (
<SafeAreaView style={[globalStyles.container, { marginHorizontal: -8 }]}>
<SafeAreaView
style={[globalStyles.tabBarContainer, { paddingHorizontal: 22 }]}
>
{isLoading ? (
<ActivityIndicator />
) : (
<ScrollView
showsVerticalScrollIndicator={false}
bounces={false}
bounces
contentContainerStyle={{ paddingHorizontal: 8 }}
>
<BackButton pressFunction={() => router.back()} />
Expand All @@ -77,7 +76,7 @@ function AuthorScreen() {
numberOfLines={2}
style={globalStyles.h1}
>
{authorInfo.name}
{getTextFromHtml(authorInfo.name)}
</Text>
{authorInfo?.pronouns && (
<Text style={[globalStyles.subHeading2, styles.pronouns]}>
Expand All @@ -92,7 +91,9 @@ function AuthorScreen() {

{authorInfo?.bio && (
<>
<Text style={globalStyles.body1}>{decode(authorInfo.bio)}</Text>
<Text style={globalStyles.body1}>
{getTextFromHtml(authorInfo.bio)}
</Text>
<HorizontalLine />
</>
)}
Expand All @@ -105,7 +106,7 @@ function AuthorScreen() {
Artist's Statement
</Text>
<Text style={globalStyles.body1}>
{decode(authorInfo.artist_statement)}
{getTextFromHtml(authorInfo.artist_statement)}
</Text>
<HorizontalLine />
</>
Expand All @@ -121,6 +122,7 @@ function AuthorScreen() {
{authorStoryPreview?.map(story => (
<PreviewCard
key={story.title}
storyId={story.id}
title={story.title}
image={story.featured_media}
author={story.author_name}
Expand All @@ -135,6 +137,9 @@ function AuthorScreen() {
}
/>
))}

{/* View so there's space between the tab bar and the stories */}
<View style={{ paddingBottom: 10 }} />
</ScrollView>
)}
</SafeAreaView>
Expand Down
1 change: 0 additions & 1 deletion src/app/(tabs)/author/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import colors from '../../../styles/colors';

const styles = StyleSheet.create({
authorCardContainer: {
marginTop: 16,
marginBottom: 8,
flexDirection: 'row',
justifyContent: 'flex-start',
Expand Down
11 changes: 11 additions & 0 deletions src/app/(tabs)/genre/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Stack } from 'expo-router';

function StackLayout() {
return (
<Stack>
<Stack.Screen name="index" options={{ headerShown: false }} />
</Stack>
);
}

export default StackLayout;
Loading

0 comments on commit 5f80004

Please sign in to comment.