Skip to content

Commit

Permalink
Merge branch 'main' into justin/save-story-button
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapawar1 authored Apr 14, 2024
2 parents e67c29e + 860d346 commit e889732
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 48 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
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,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 Down
3 changes: 3 additions & 0 deletions src/app/(tabs)/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,12 @@ function SettingsScreen() {
options={[
'American Indian/Alaska Native',
'Asian',
'Hispanic/Latinx',
'Middle Eastern',
'Black or African American',
'Native Hawaiian or other Pacific Islander',
'White',
'Not Listed Here',
'Prefer Not to Disclose',
]}
label="Race/Ethnicity"
Expand Down
3 changes: 3 additions & 0 deletions src/app/auth/onboarding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,12 @@ function OnboardingScreen() {
options={[
'American Indian/Alaska Native',
'Asian',
'Hispanic/Latinx',
'Middle Eastern',
'Black or African American',
'Native Hawaiian or other Pacific Islander',
'White',
'Not Listed Here',
'Prefer Not to Disclose',
]}
label="Race/Ethnicity"
Expand Down
7 changes: 6 additions & 1 deletion src/app/auth/resetPassword/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import colors from '../../../styles/colors';
import globalStyles from '../../../styles/globalStyles';
import { useSession } from '../../../utils/AuthContext';
import PasswordComplexityText from '../../../components/PasswordComplexityText/PasswordComplexityText';
import { isPasswordSameAsBefore } from '../../../queries/profiles';

function ResetPasswordScreen() {
const { updateUser, signOut } = useSession();
const { session, updateUser, signOut } = useSession();
const [password, setPassword] = useState('');
const [passwordTextHidden, setPasswordTextHidden] = useState(true);
const [confirmPassword, setConfirmPassword] = useState('');
Expand All @@ -36,6 +37,9 @@ function ResetPasswordScreen() {

const checkPassword = (text: string) => {
if (text !== '') {
isPasswordSameAsBefore(text, session?.user?.id).then(isSame =>
setIsDifferent(!isSame),
);
setHasUppercase(text !== text.toLowerCase());
setHasLowercase(text !== text.toUpperCase());
setHasNumber(/[0-9]/.test(text));
Expand Down Expand Up @@ -70,6 +74,7 @@ function ResetPasswordScreen() {
const { error } = await updateUser({ password });

if (error) {
console.error(error);
Alert.alert('Updating password failed');
} else {
await signOut();
Expand Down
42 changes: 18 additions & 24 deletions src/components/ContentCard/ContentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import styles from './styles';
import { addUserStoryToReadingList } from '../../queries/savedStories';
import globalStyles from '../../styles/globalStyles';
import { useSession } from '../../utils/AuthContext';
import Emoji from 'react-native-emoji';

type ContentCardProps = {
title: string;
Expand Down Expand Up @@ -64,33 +65,26 @@ function ContentCard({
</Text>
</View>
<View style={styles.buttons}>
<View>
<TouchableOpacity
onPress={() => saveStory()}
style={{ flexDirection: 'row' }}
>
<Image
style={styles.reactions}
source={require('./savedStoriesIcon.png')}
/>
<Image
style={styles.reactions}
source={require('./savedStoriesIcon.png')}
/>
<Image
style={styles.reactions}
source={require('./savedStoriesIcon.png')}
/>
<View style={styles.reactionNumber}>
<Text style={[globalStyles.subtext, styles.reactionText]}>
14{/*change number to work*/}
</Text>
</View>
</TouchableOpacity>
<View style={{ flexDirection: 'row', gap: -7 }}>
<View style={[styles.reactions, { backgroundColor: '#FFCCCB' }]}>
<Emoji name="heart" />
</View>
<View style={[styles.reactions, { backgroundColor: '#FFD580' }]}>
<Emoji name="clap" />
</View>
<View style={[styles.reactions, { backgroundColor: '#89CFF0' }]}>
<Emoji name="muscle" />
</View>
{/* heart, clap, muscle, cry, ??? */}
<View style={styles.reactionNumber}>
<Text style={[globalStyles.subtext, styles.reactionText]}>
14{/*change number to work*/}
</Text>
</View>
</View>
<TouchableOpacity onPress={() => saveStory()}>
<Image
style={{ width: 30, height: 30 }}
style={styles.saveStoryImage}
source={require('./savedStoriesIcon.png')}
/>
</TouchableOpacity>
Expand Down
22 changes: 15 additions & 7 deletions src/components/ContentCard/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,26 @@ const styles = StyleSheet.create({
color: colors.grey,
},
reactionNumber: {
marginLeft: 15,
marginTop: 10,
marginLeft: 14,
marginTop: 16,
},
reactions: {
width: 20,
height: 20,
borderRadius: 20 / 2,
width: 30,
height: 30,
borderRadius: 30 / 2,
borderWidth: 1,
backgroundColor: '#89CFF0', //different per emoji reaction
backgroundColor: 'transparent', //different per emoji reaction
borderColor: 'white',
marginTop: 10,
marginRight: -10,
marginRight: -5, // -10
overflow: 'hidden',
justifyContent: 'center',
paddingLeft: 3,
},
saveStoryImage: {
width: 30,
height: 30,
marginTop: 10,
},
buttons: {
flexDirection: 'row',
Expand Down
47 changes: 38 additions & 9 deletions src/components/PreviewCard/PreviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import {
Image,
Pressable,
Text,
TouchableOpacity,
View,
} from 'react-native';
import Emoji from 'react-native-emoji';

import styles from './styles';
import globalStyles from '../../styles/globalStyles';
Expand All @@ -32,18 +34,28 @@ function PreviewCard({
tags,
pressFunction,
}: PreviewCardProps) {
const saveStory = () => {
console.log("testing '+' icon does something for story " + title);
};

return (
<Pressable onPress={pressFunction}>
<View style={styles.card}>
<View style={styles.titleContainer}>
<Text numberOfLines={1} style={[globalStyles.h3, styles.title]}>
{title}
</Text>
<TouchableOpacity onPress={() => saveStory()}>
<Image
style={{ width: 30, height: 30 }}
source={require('./savedStoriesIcon.png')}
/>
</TouchableOpacity>
</View>
<View style={styles.body}>
<Image
style={styles.image}
source={{ uri: image == '' ? placeholderImage : image }}
source={{ uri: image === '' ? placeholderImage : image }}
/>
<View style={styles.cardTextContainer}>
<View style={styles.authorContainer}>
Expand All @@ -59,23 +71,40 @@ function PreviewCard({
numberOfLines={3}
style={[globalStyles.subtext, styles.storyDescription]}
>
"{cheerio.load(excerpt.html).text()}"
"{cheerio.load(excerpt.html ?? '').text()}"
</Text>
</View>
</View>
<View style={styles.tagsContainer}>
<View style={styles.tagsRow}>
<View style={styles.tag}>
<Text key={tags[0]} style={globalStyles.button1}>
{tags[0]}
<View style={{ flexDirection: 'row', gap: -7 }}>
<View style={[styles.reactions, { backgroundColor: '#FFCCCB' }]}>
<Emoji name="heart" />
</View>
<View style={[styles.reactions, { backgroundColor: '#FFD580' }]}>
<Emoji name="clap" />
</View>
<View style={[styles.reactions, { backgroundColor: '#89CFF0' }]}>
<Emoji name="muscle" />
</View>
{/* heart, clap, muscle, cry, ??? */}
<View style={styles.reactionNumber}>
<Text style={[globalStyles.subtext, styles.reactionText]}>
14{/*change number to work*/}
</Text>
</View>
</View>
<View style={styles.moreTags}>
<Pressable>
<View style={styles.tagsRow}>
{(tags?.length ?? 0) > 0 && (
<View style={styles.tag}>
<Text key={tags[0]} style={globalStyles.button1}>
{tags[0]}
</Text>
</View>
)}
<Pressable style={styles.moreTags}>
<Text style={[globalStyles.subtext, styles.moreTagsText]}>
{' '}
+ {tags.length - 1} more tags
+ {(tags?.length ?? 1) - 1}
</Text>
</Pressable>
</View>
Expand Down
Binary file added src/components/PreviewCard/savedStoriesIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e889732

Please sign in to comment.