Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

feat(client): add chat url link to chapters #998

Merged

Conversation

Ismailtlem
Copy link
Member

  • I have read Chapter's contributing guidelines.
  • My pull request has a descriptive title (not a vague title like Update README.md).
  • My pull request targets the main branch of Chapter.

Related to #104

@gitpod-io
Copy link

gitpod-io bot commented Apr 10, 2022

@ghost
Copy link

ghost commented Apr 10, 2022

CodeSee Review Map:

Review these changes using an interactive CodeSee Map

Review in an interactive map

View more CodeSee Maps

Legend

CodeSee Map Legend

Copy link
Contributor

@ojeytonwilliams ojeytonwilliams left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together, @Ismailtlem, it's working nicely.

I noticed a few minor issues:

@@ -22,6 +22,7 @@ model chapters {
region String
country String
imageUrl String
chatUrl String @default("")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
chatUrl String @default("")
chatUrl String?

We don't need to specify the default, since it's optional.

label: 'Chat link',
placeholder: 'https://discord.gg/KVUmVXA',
required: false,
type: 'text',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type: 'text',
type: 'url',

They're all going to be urls, I think.

Comment on lines 63 to 66
<Heading size="md" color={'gray.700'}>
Chat Link:
</Heading>
<Link>{data.chapter.chatUrl}</Link>
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you make this conditional on the chatUrl existing? It looks a little odd to see Chat Link: without the link.

Comment on lines 28 to 29
@Field(() => String)
chatUrl: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Field(() => String)
chatUrl: string;
@Field(() => String, { nullable: true })
chatUrl?: string | null;

This is necessary if we make the field optional. Unfortunately, the fact it can now be null needs to be handled by ChapterForm. For now it's fine to use

defaultValue={defaultValues[key] ?? undefined}

it's ugly, but it'll do until I come up with something nicer.

Comment on lines 55 to 56
@Field(() => String)
chatUrl: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Field(() => String)
chatUrl: string;
@Field(() => String, { nullable: true })
chatUrl?: string | null;

Comment on lines 13 to 14
@Field(() => String)
chatUrl: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Field(() => String)
chatUrl: string;
@Field(() => String, { nullable: true })
chatUrl?: string | null;

@ojeytonwilliams
Copy link
Contributor

Thanks @Ismailtlem it all LGTM, now 👍

@ojeytonwilliams ojeytonwilliams merged commit f84323f into freeCodeCamp:main Apr 15, 2022
@allella
Copy link
Contributor

allella commented Apr 15, 2022

@all-contributors add @Ismailtlem for code

@allcontributors
Copy link
Contributor

@allella

I've put up a pull request to add @Ismailtlem! 🎉

@Ismailtlem Ismailtlem deleted the feat/add-chat-url-link branch April 16, 2022 14:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants