Skip to content

Commit

Permalink
feat: connect the install button to the correct platform URL
Browse files Browse the repository at this point in the history
  • Loading branch information
zstix committed Jul 26, 2021
1 parent 3c25c6b commit 8d911ba
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/InstallButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Button, Dropdown, Link } from '@newrelic/gatsby-theme-newrelic';
import { css } from '@emotion/react';
import getPackNr1Url from '../utils/get-pack-nr1-url';
import { NR1_LOGIN_URL } from '../data/constants';

const sampleItems = new Array(10).fill().map((_, i) => i + 1);

Expand All @@ -10,8 +12,14 @@ const createMenuItems = (items, index) =>
<Dropdown.MenuItem key={index}>{item}</Dropdown.MenuItem>
));

const createInstallLink = () => {
return `https://one.newrelic.com/launcher/nr1-core.explorer`;
const createInstallLink = (packId) => {
const platformUrl = getPackNr1Url(packId, true); // FIXME: remove `true` when deployed
const url = new URL(
`?return_to=${encodeURIComponent(platformUrl)}`,
NR1_LOGIN_URL
);

return url.href;
};

const InstallButton = ({ title, ...props }) => {
Expand Down

0 comments on commit 8d911ba

Please sign in to comment.