import * as React from 'react';
import Modal from 'react-modal';
import { Link } from 'react-router';
+import { FormattedMessage } from 'react-intl';
import { Organization } from '../../app/types';
import UpgradeOrganizationBox from '../../components/common/UpgradeOrganizationBox';
import VisibilitySelector from '../../components/common/VisibilitySelector';
}
export default class CreateProjectForm extends React.PureComponent<Props, State> {
+ closeButton: HTMLElement | null;
mounted: boolean;
constructor(props: Props) {
this.mounted = true;
}
+ componentDidUpdate() {
+ // wrap with `setImmediate` because of https://github.com/reactjs/react-modal/issues/338
+ setImmediate(() => {
+ if (this.closeButton) {
+ this.closeButton.focus();
+ }
+ });
+ }
+
componentWillUnmount() {
this.mounted = false;
}
<div className="modal-body">
<div className="alert alert-success">
- Project <Link to={getProjectUrl(createdProject.key)}>
- {createdProject.name}
- </Link>{' '}
- has been successfully created.
+ <FormattedMessage
+ defaultMessage={translate(
+ 'projects_management.project_has_been_successfully_created'
+ )}
+ id="projects_management.project_has_been_successfully_created"
+ values={{
+ project: (
+ <Link to={getProjectUrl(createdProject.key)}>{createdProject.name}</Link>
+ )
+ }}
+ />
</div>
</div>
<footer className="modal-foot">
- <a href="#" id="create-project-close" onClick={this.handleCancelClick}>
+ <a
+ href="#"
+ id="create-project-close"
+ onClick={this.handleCancelClick}
+ ref={node => (this.closeButton = node)}>
{translate('close')}
</a>
</footer>
<div
className="alert alert-success"
>
- Project
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to={
+ <FormattedMessage
+ defaultMessage="projects_management.project_has_been_successfully_created"
+ id="projects_management.project_has_been_successfully_created"
+ values={
Object {
- "pathname": "/dashboard",
- "query": Object {
- "branch": undefined,
- "id": "name",
- },
+ "project": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/dashboard",
+ "query": Object {
+ "branch": undefined,
+ "id": "name",
+ },
+ }
+ }
+ >
+ name
+ </Link>,
}
}
- >
- name
- </Link>
-
- has been successfully created.
+ />
</div>
</div>
<footer
projects_management.delete_resource_confirmation=Are you sure you want to delete "{0}"?
projects_management.delete_selected_warning=You're about to delete {0} selected items.
projects_management.delete_all_warning=You're about to delete all {0} items.
+projects_management.project_has_been_successfully_created=Project {project} has been successfully created.
#------------------------------------------------------------------------------