Skip to content

Commit

Permalink
Reactivate LastFM importer
Browse files Browse the repository at this point in the history
After merging PR #1339 we will want to reactivate the LastFM Importer that we deactivated with PR #1334
  • Loading branch information
MonkeyDo committed Mar 16, 2021
1 parent d05fd9c commit 76430a8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 35 deletions.
4 changes: 2 additions & 2 deletions listenbrainz/webserver/static/js/src/LastFMImporter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ describe("LastFmImporter Page", () => {
expect(wrapper.html()).toMatchSnapshot();
});

xit("modal renders when button clicked", () => {
it("modal renders when button clicked", () => {
const wrapper = shallow(<LastFmImporter {...props} />);
// Simulate submiting the form
wrapper.find("form").simulate("submit", {
Expand All @@ -303,7 +303,7 @@ describe("LastFmImporter Page", () => {
expect(wrapper.exists("LastFMImporterModal")).toBe(true);
});

xit("submit button is disabled when input is empty", () => {
it("submit button is disabled when input is empty", () => {
const wrapper = shallow(<LastFmImporter {...props} />);
// Make sure that the input is empty
wrapper.setState({ lastfmUsername: "" });
Expand Down
57 changes: 25 additions & 32 deletions listenbrainz/webserver/static/js/src/LastFMImporter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { IconProp } from "@fortawesome/fontawesome-svg-core";
import APIService from "./APIService";
import Scrobble from "./Scrobble";

import LastFMImporterModal from "./LastFMImporterModal";

export type ImporterProps = {
Expand Down Expand Up @@ -423,39 +422,33 @@ export default class LastFmImporter extends React.Component<
render() {
const { show, canClose, lastfmUsername, msg } = this.state;
return (
<div className="alert alert-danger">
We are having some issues with the LastFM importer, but we are working
on fixing it. Please try again later. Our apologies for the delay!
<div className="Importer">
<form onSubmit={this.handleSubmit}>
<input
type="text"
onChange={this.handleChange}
value={lastfmUsername}
placeholder="Last.fm Username"
size={30}
/>
<input type="submit" value="Import Now!" disabled={!lastfmUsername} />
</form>
{show && (
<LastFMImporterModal onClose={this.toggleModal} disable={!canClose}>
<img
src="/static/img/listenbrainz-logo.svg"
height="75"
className="img-responsive"
alt=""
/>
<br />
<br />
<div>{msg}</div>
<br />
</LastFMImporterModal>
)}
</div>
);
// return (
// <div className="Importer">
// <form onSubmit={this.handleSubmit}>
// <input
// type="text"
// onChange={this.handleChange}
// value={lastfmUsername}
// placeholder="Last.fm Username"
// size={30}
// />
// <input type="submit" value="Import Now!" disabled={!lastfmUsername} />
// </form>
// {show && (
// <LastFMImporterModal onClose={this.toggleModal} disable={!canClose}>
// <img
// src="/static/img/listenbrainz-logo.svg"
// height="75"
// className="img-responsive"
// alt=""
// />
// <br />
// <br />
// <div>{msg}</div>
// <br />
// </LastFMImporterModal>
// )}
// </div>
// );
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`LastFmImporter Page renders 1`] = `"<div class=\\"alert alert-danger\\">We are having some issues with the LastFM importer, but we are working on fixing it. Please try again later. Our apologies for the delay!</div>"`;
exports[`LastFmImporter Page renders 1`] = `"<div class=\\"Importer\\"><form><input type=\\"text\\" placeholder=\\"Last.fm Username\\" size=\\"30\\" value=\\"\\"><input type=\\"submit\\" disabled=\\"\\" value=\\"Import Now!\\"></form></div>"`;

0 comments on commit 76430a8

Please sign in to comment.