Skip to content

Adding image fetching from Unplash API when creating a course, so it looks pretty in the frontend :)#16

Open
Mau-MD wants to merge 90 commits intomainfrom
image_generation
Open

Adding image fetching from Unplash API when creating a course, so it looks pretty in the frontend :)#16
Mau-MD wants to merge 90 commits intomainfrom
image_generation

Conversation

@Mau-MD
Copy link
Owner

@Mau-MD Mau-MD commented Jul 20, 2022

App Context

Learning U is a platform where software engineers can go and learn new technologies in an organized way. They can track their progress and get suggestions about what courses to take in both visual and written ways.

PR Context

Right now the Course and Difficulty Cards have placeholder images and they do not belong to the course that is being generated.

This PR

When creating a course, it fetches from Unsplash API using the course name and gets images that are then returned to the frontend and displayed there. So if a user makes a course about React the Course Card will have an image about React there.

CleanShot.2022-07-19.at.17.05.04.mp4

Next

Fix some styling issues

IMPORTANT:

Since this PR was based in another one, a lot of commits appear here even if they are not related to this PR. In reaility commits start here: adding types for unsplash image links

How to preview a PR on Vercel

  • Go to /login and log in with username admin and password admin123
  • Go to /dashboard

@vercel
Copy link

vercel bot commented Jul 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
learning-u ✅ Ready (Inspect) Visit Preview Jul 20, 2022 at 0:12AM (UTC)

@Mau-MD Mau-MD requested review from ImaMonsta and nosoyilse July 20, 2022 00:11
@Mau-MD Mau-MD added the waiting for another pr Another PR needs to be approved before this gets reviewed label Jul 20, 2022
return resources;
};

export const getResourcesFromCourseAndDifficulty = async (
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: This function name threw me off a little bit, maybe getResourcesFromCourseWithDifficulty

courseId: string;
started?: boolean;
phrase: string;
difficulty: 1 | 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use an enum in here, it will bring clarity to what this difficulty mean.

For instance is 1 the more difficult? or is it 2?

If you use an enum that becomes clear

enum Difficulty {
Easy = 1,
Medium,
Advanced
}

https://www.typescriptlang.org/docs/handbook/enums.html

@@ -0,0 +1,9 @@
import { IResource } from "../types/resource";

export const calculateCourseCompletition = (resources: IResource[]) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this function has to do with this PR?

>
{kind === "video" && (
<>
{kind === "video" &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Owner Author

Choose a reason for hiding this comment

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

Since we are not using documentation type resources, I think im gonna delete it from both the backend and frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for another pr Another PR needs to be approved before this gets reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants