Skip to content
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

[author] Implement author screen #38

Merged
merged 13 commits into from
Nov 29, 2023
Merged

[author] Implement author screen #38

merged 13 commits into from
Nov 29, 2023

Conversation

emilysunaryo
Copy link
Contributor

What's new in this PR

  • implemented supabase queries for author information
    - fetchAuthor takes in an authorID and returns author info object as shown in the types.tsx file
    - fetchAllAuthorStoryPreviews takes in the same authorID, utilizes the fetch_author_story_preview query to return a list
    of objects of stories written by the author that matches the authorID input
  • Implemented routing from stories page to author page (right now we have a hardcoded value of '2778' being passed from the story to the author when we click the authorImage and authorName)
  • Implemented AuthorCard component with basic frontend styling

Relevant Links

Screen.Recording.2023-11-06.at.9.48.49.PM.mov

Notion Sprint Task

https://www.notion.so/calblueprint/b885547588f4406bb7f6f8153be99bb9?v=6572442cb5c644a9bd1c298d53a85eec&p=6fd60acf45644446ab3e6e842ebf5f4c&pm=s

Online sources

Related PRs

Waiting for Marcos StoryScreen PR to be able to dynamically load an AuthorID as a params to route to an author page

How to review

Next steps

  • need to update SearchCard to display part of the excerpt when it loads
  • need to implement routing for the SearchCard on the authors page to be able to route back to the story that is clicked
  • clean up or figure out problem of casting in the fetchAuthor query (return data as unknown as AuthorInfo[];) --> we are currently casting the object as unknown which may not be optimal
  • figure out styling for back button on author page, implement the correct icon

Tests Performed, Edge Cases

N/A

Screenshots

CC: @akshaynthakur

Copy link
Collaborator

@akshaynthakur akshaynthakur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a lot of nitpicks with styling, but I didn't include all of them. Please pull up the Figma and go through every margin, size, and color again, there are a lot of issues. If you need help identifying what they are and how to implement them, please let me know.

Also, please rename your PR to match the title of your notion sprint task

@@ -9,3 +9,12 @@ export interface StoryPreview {
tone: string[];
genre_medium: string[];
}

export interface AuthorInfo {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just call this type Author?

}
}

export async function fetchAllAuthorStoryPreviews(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency, this should be named fetchAuthorStoryPreviews.

export async function fetchAllAuthorStoryPreviews(
author_id: number,
): Promise<StoryPreview[]> {
const { data, error } = await supabase.rpc('fetch_author_story_preview', {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename your supabase function to be fetch_author_story_previews

const { data, error } = await supabase.rpc('fetch_author_story_preview', {
input_author_id: author_id,
});
console.log('TESTING QUERY OUTPUT:', data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

src/components/AuthorCard/AuthorCard.tsx Show resolved Hide resolved
flexDirection: 'row',
justifyContent: 'flex-start',
flexWrap: 'wrap',
paddingTop: 10,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete: add padding when you're using the component, not by definition

src/components/AuthorCard/AuthorCard.tsx Show resolved Hide resolved
src/components/AuthorCard/AuthorCard.tsx Show resolved Hide resolved
src/components/AuthorCard/AuthorCard.tsx Show resolved Hide resolved
src/components/AuthorCard/AuthorCard.tsx Show resolved Hide resolved
@akshaynthakur akshaynthakur changed the title Emily/author card [author] Implement author screen Nov 15, 2023
@akshaynthakur akshaynthakur merged commit b869e48 into main Nov 29, 2023
2 checks passed
@akshaynthakur akshaynthakur deleted the emily/authorCard branch November 29, 2023 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants