Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions admin/src/react-components/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,35 @@ AvatarLink.propTypes = {
};

export const IdentityEditLink = withStyles(styles)(({ record = {}, classes }) => (
<a href={`#/identities/${record.id}`} className={classes.fieldLink}>
Edit Identity
</a>
));

export const IdentityCreateLink = withStyles(styles)(({ record, classes }) => (
<a href={`#/identities/create?account_id=${record.id}`} className={classes.fieldLink}>
<a href={`#/identities/create?account_id=${record.id}`} className={classes.fieldLink}>
Create Identity
</a>
) : (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not syntactically correct JavaScript

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ty. Fixed the JSX syntax issue and simplified the guard for missing record.id.

Also updated the test steps for clearer reproduction.

<span className={classes.disabledLink}>Create Identity</span>
));

if (!record?.id) {
console.warn("Missing record.id for IdentityCreateLink");
}

export const IdentityCreateLink = withStyles(styles)(({ record, classes }) => {
if (!record || !record.id) {
console.warn("IdentityCreateLink: missing record.id", record);
return (
<span className={classes.fieldLink} style={{ opacity: 0.5, cursor: "not-allowed" }}>
Create Identity
</span>
);
}

return (
<a href={`#/identities/create?account_id=${record.id}`} className={classes.fieldLink}>
Create Identity
</a>
);
});


SceneLink.propTypes = {
source: PropTypes.string.isRequired,
record: PropTypes.object,
Expand Down