File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed
backend/components/collaborator/AddForm
config/app/locale/en-US/json/backend
global/components/form/InputError Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 1- import React , { useEffect , useState } from "react" ;
1+ import { useEffect , useState } from "react" ;
22import PropTypes from "prop-types" ;
33import { FormContext } from "helpers/contexts" ;
44import Form , { Unwrapped } from "global/components/form" ;
55import InputError from "global/components/form/InputError" ;
6- import { useTranslation } from "react-i18next" ;
6+ import { useTranslation , Trans } from "react-i18next" ;
77import { useNavigate } from "react-router-dom-v5-compat" ;
88import { makersAPI , collaboratorsAPI } from "api" ;
99import { useApiCallback } from "hooks" ;
1010import capitalize from "lodash/capitalize" ;
11+ import * as Styled from "./styles" ;
1112
1213export default function AddCollaboratorForm ( {
1314 entityId,
@@ -53,7 +54,12 @@ export default function AddCollaboratorForm({
5354 if ( ! maker ?. id ) {
5455 return setFormErrors ( [
5556 {
56- detail : t ( "projects.contributor_maker_error" ) ,
57+ detail : (
58+ < Trans
59+ i18nKey = "projects.contributor_maker_error"
60+ components = { [ < Styled . ErrorLink to = "/backend/records/makers" /> ] }
61+ />
62+ ) ,
5763 source : "maker"
5864 }
5965 ] ) ;
Original file line number Diff line number Diff line change 11import styled from "@emotion/styled" ;
2+ import { Link } from "react-router-dom-v5-compat" ;
23
34export const RoleButton = styled . button `
45 display: flex;
@@ -22,3 +23,9 @@ export const RoleGroup = styled.div`
2223 margin-block-start: 40px;
2324 }
2425` ;
26+
27+ export const ErrorLink = styled ( Link ) `
28+ &:hover {
29+ color: var(--color);
30+ }
31+ ` ;
Original file line number Diff line number Diff line change 1111 "manage_resource_collections" : " Manage Resource Collections" ,
1212 "contributors_header" : " Manage Contributors" ,
1313 "add_contributor_label" : " Add Contributor" ,
14- "contributor_maker_error" : " Maker is required. If adding a new maker, you must first create the maker in the records tab before adding as a collaborator ." ,
14+ "contributor_maker_error" : " Maker is required. If this is a new maker, you must <0> first create the maker</0> before adding as a contributor ." ,
1515 "contributor_role_error" : " Please select at least one role." ,
1616 "forms" : {
1717 "title_label" : " Title" ,
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export default class InputError extends Component {
1616 } ;
1717
1818 errorString ( error ) {
19+ if ( typeof error . detail === "object" ) return error . detail ;
1920 if ( error . detail . split ( "." ) . length > 1 ) {
2021 return error . detail ;
2122 }
You can’t perform that action at this time.
0 commit comments