-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[home] Implement backend queries & restyle StoryPreview component #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. A couple styling issues I noticed:
- There is a white box on top of the bottom nav on iOS.
- The buttons don't render properly on iOS.
- The dropshadows are cut out on the right of the search screen on both iOS and Android.
- More of a design call but the carousels aren't apparent to the user because the two cards fit perfectly on the screen after reloading. You could either adjust the sizing of these cards or add an arrow?
Upto you, if you'd want to handle these now or later but just wanted to point these out.
} else { | ||
return data[0].username as string; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just highlighting that we should ensure username will actually be a string and not undefined here
src/app/(tabs)/home/index.tsx
Outdated
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); | ||
}); | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the fetches do not depend on each other, we can just use a Promise.all
to fetch these concurrently.
I would also recommend putting this in a try-catch block. If there are any expected errors here, and we'd want to still display the other responses then we should introduce an error state. This would also us to properly render error messages and still render the other values appropriately
bff8bcd
to
700a6b2
Compare
What's new in this PR
Relevant Links
Notion Sprint Task
N/A
Online sources
N/A
Related PRs
Previous home screen frontend PR: #19
How to review
Next steps
Tests Performed, Edge Cases
N/A
Screenshots
CC: @akshaynthakur @sauhardjain @surajr10