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

Refactor/5813 change links implementation #125

Merged
merged 5 commits into from
Aug 20, 2024

Conversation

HavierD
Copy link
Contributor

@HavierD HavierD commented Aug 20, 2024

Changes:

  1. For the links showing in the search page
    image
    and the ones in detail page link panel, they are all links under "distribution" in geonetwork.
    So now using relation related to tell these links from all links.

  2. Also change relation for metadata link (self -> describedby), and thumbnail links (thumbnail -> preview);

  3. Optimize some code for better display. Now, the display won't be weird in some bad case (e.g., if a part of a data is empty, such as a contact doesn't have link).

@HavierD HavierD requested a review from NekoLyn August 20, 2024 04:29
Copy link
Contributor

@NekoLyn NekoLyn left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -31,7 +32,7 @@ const MetadataContactList: React.FC<MetadataContactListProps> = ({
<MailOutlineIcon />
</Grid>
<Grid item md={11} sx={{ textAlign: "left", whiteSpace: "normal" }}>
<Link href={`mailto:${contact.emails[0]}`}>
<Link href={`mailto:${email ? email : ""}`}>
Copy link
Contributor

@NekoLyn NekoLyn Aug 20, 2024

Choose a reason for hiding this comment

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

do you think can use email ?? "" here? because here email is a string and you check it is undefined or not

but just be careful: ? is used for truthiness check and ?? is used for null check.
so when check a number or boolean it will be tricky and should carefully decide which is correct for use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just don't want any falsy data in most of the case so i use ternary operator a lot. But because almost all the data are strings actually, so both ways are all doing the same thing for these cases. Thank you for your reminding😊

@HavierD HavierD merged commit ed4d808 into main Aug 20, 2024
2 checks passed
@HavierD HavierD deleted the refactor/5813-change-links-implementation branch August 20, 2024 05:12
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