From 30f0ca9ee57b380b7ef748df9f380f3a394825c9 Mon Sep 17 00:00:00 2001 From: Akshay Thakur Date: Fri, 3 Nov 2023 01:32:06 -0700 Subject: [PATCH 1/5] done restyling home screen --- assets/icons.tsx | 2 + src/app/(tabs)/home/index.tsx | 125 +++++++++++------- src/app/(tabs)/home/styles.ts | 34 ++--- src/app/(tabs)/search/index.tsx | 6 +- src/app/settings.tsx | 2 +- src/components/ContentCard/ContentCard.tsx | 2 +- src/components/ContentCard/styles.ts | 4 +- src/components/PreviewCard/PreviewCard.tsx | 73 ++++++++++ .../{SearchCard => PreviewCard}/styles.ts | 61 ++++++--- src/components/SearchCard/SearchCard.tsx | 51 ------- src/queries/profiles.tsx | 15 +++ src/queries/stories.tsx | 57 +++++++- src/queries/types.tsx | 7 + src/styles/colors.ts | 8 +- src/styles/globalStyles.ts | 25 ++-- 15 files changed, 316 insertions(+), 156 deletions(-) create mode 100644 src/components/PreviewCard/PreviewCard.tsx rename src/components/{SearchCard => PreviewCard}/styles.ts (54%) delete mode 100644 src/components/SearchCard/SearchCard.tsx create mode 100644 src/queries/profiles.tsx diff --git a/assets/icons.tsx b/assets/icons.tsx index 03a92b5f..7a5ed2ea 100644 --- a/assets/icons.tsx +++ b/assets/icons.tsx @@ -6,12 +6,14 @@ export type IconType = | 'home_outline' | 'document_outline' | 'search_outline' + | 'settings_gear' | 'close_modal_button'; const IconSvgs: Record = { home_outline: , search_outline: , document_outline: , + settings_gear: , close_modal_button: ( ([]); + const [featuredStoriesDescription, setFeaturedStoriesDescription] = + useState(''); + const [recommendedStories, setRecommendedStories] = useState([]); + const [newStories, setNewStories] = useState([]); + + useEffect(() => { + (async () => { + const usernameResponse = await fetchUsername(user?.id); + setUsername(usernameResponse); + const featuredStoryResponse: StoryPreview[] = + await fetchFeaturedStoryPreviews(); + setFeaturedStories(featuredStoryResponse); + const featuredStoryDescriptionResponse: string = + await fetchFeaturedStoriesDescription(); + setFeaturedStoriesDescription(featuredStoryDescriptionResponse); + const recommendedStoriesResponse: StoryCard[] = + await fetchRecommendedStories(); + setRecommendedStories(recommendedStoriesResponse); + const newStoriesResponse: StoryCard[] = await fetchNewStories(); + setNewStories(newStoriesResponse); + })().finally(() => { + setLoading(false); + }); + }, []); return ( - + + {loading && ( + + Loading + + )} - Welcome, Brenda - -