Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 5d8fa56

Browse files
committed
feat: add link to Connect Project
ref issue #51
1 parent 3f1d9cb commit 5d8fa56

File tree

7 files changed

+54
-5
lines changed

7 files changed

+54
-5
lines changed

config/development.js

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ module.exports = {
44
*/
55
TOPCODER_COMMUNITY_WEBSITE_URL: "https://topcoder-dev.com",
66

7+
/**
8+
* URL of Topcoder Connect Website
9+
*/
10+
CONNECT_WEBSITE_URL: "https://connect.topcoder-dev.com",
11+
712
/**
813
* Email to report issues to
914
*/

config/production.js

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ module.exports = {
44
*/
55
TOPCODER_COMMUNITY_WEBSITE_URL: "https://topcoder.com",
66

7+
/**
8+
* URL of Topcoder Connect Website
9+
*/
10+
CONNECT_WEBSITE_URL: "https://connect.topcoder.com",
11+
712
/**
813
* Email to report issues to
914
*/

src/routes/MyTeamsDetails/components/TeamSummary/index.jsx

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import React from "react";
77
import PT from "prop-types";
88
import DataItem from "components/DataItem";
99
import {
10+
formatConnectProjectUrl,
1011
formatMoney,
1112
formatRemainingTimeForTeam,
1213
formatReportIssueUrl,
@@ -39,6 +40,14 @@ const TeamSummary = ({ team }) => {
3940
</div>
4041

4142
<div styleName="actions">
43+
<Button
44+
href={formatConnectProjectUrl(team.id)}
45+
target="_blank"
46+
type="secondary"
47+
size="medium"
48+
>
49+
Open in Connect
50+
</Button>
4251
<Button
4352
type="warning"
4453
size="medium"

src/routes/MyTeamsDetails/components/TeamSummary/styles.module.scss

+10-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,14 @@
1919
}
2020

2121
.actions {
22-
margin-top: 20px;
22+
display: flex;
23+
flex-wrap: wrap;
24+
25+
> * {
26+
margin-top: 20px;
27+
}
28+
29+
> *:not(:last-child) {
30+
margin-right: 10px;
31+
}
2332
}

src/routes/MyTeamsDetails/index.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import TeamSummary from "./components/TeamSummary";
1515
import TeamMembers from "./components/TeamMembers";
1616
import TeamPositions from "./components/TeamPositions";
1717
import withAuthentication from "../../hoc/withAuthentication";
18-
import { useAsync } from "react-use";
1918

2019
const MyTeamsDetails = ({ teamId }) => {
2120
const [team, loadingError] = useData(getTeamById, teamId);

src/routes/MyTeamsList/components/TeamCard/index.jsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import "./styles.module.scss";
77
import _ from "lodash";
88
import { Link } from "@reach/router";
99
import DataItem from "components/DataItem";
10-
import moment from "moment";
11-
import { DAY_FORMAT } from "constants";
1210
import IconCalendar from "../../../../assets/images/icon-calendar.svg";
1311
import IconClock from "../../../../assets/images/icon-clock.svg";
1412
import IconMoney from "../../../../assets/images/icon-money.svg";
@@ -18,6 +16,7 @@ import {
1816
formatMoney,
1917
formatRemainingTimeForTeam,
2018
formatReportIssueUrl,
19+
formatConnectProjectUrl,
2120
} from "utils/format";
2221
import AvatarGroup from "components/AvatarGroup";
2322
import ThreeDotsMenu from "components/ThreeDotsMenu";
@@ -28,6 +27,15 @@ const TeamCard = ({ team }) => {
2827
<div styleName="three-dots-menu">
2928
<ThreeDotsMenu
3029
options={[
30+
{
31+
label: "Open in Connect",
32+
action: () => {
33+
window.open(formatConnectProjectUrl(team.id));
34+
},
35+
},
36+
{
37+
separator: true,
38+
},
3139
{
3240
label: "Report an Issue",
3341
action: () => {

src/utils/format.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@
33
*/
44
import _ from "lodash";
55
import { RATE_TYPE } from "constants";
6-
import { EMAIL_REPORT_ISSUE, EMAIL_REQUEST_EXTENSION } from "../../config";
6+
import {
7+
EMAIL_REPORT_ISSUE,
8+
EMAIL_REQUEST_EXTENSION,
9+
CONNECT_WEBSITE_URL,
10+
} from "../../config";
711
import moment from "moment";
812
import { DAY_FORMAT } from "constants/";
913

14+
/**
15+
* Format URL to the project (team) in Connect App.
16+
*
17+
* @param {string|number} teamId team (project) id
18+
*
19+
* @returns {string} URL to Connect project
20+
*/
21+
export const formatConnectProjectUrl = (teamId) =>
22+
`${CONNECT_WEBSITE_URL}/projects/${teamId}`;
23+
1024
/**
1125
* Formats number with base word in singular or plural form depend on the number.
1226
*

0 commit comments

Comments
 (0)