Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add disqus to submission details #1358

Merged
merged 2 commits into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ a.blueButton {

.createdOn {
margin-top: 16px;
margin-bottom: 16px;
font-size: 13px;

.datetime {
Expand Down Expand Up @@ -867,6 +868,21 @@ a.blueButton {
.tagsContainer {
margin-top: 16px;
}

.discussionContainer {
.title {
font-size: 18px;
color: #689bd6;
width: 100%;
border-bottom: 1px solid #bfcbd5;
padding-bottom: 5px;
margin-bottom: 16px;
}

.disqus {
padding: 15px;
}
}
}

@media only screen and (max-width: 425px) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { combineLatest, of } from "rxjs";
import Tooltip from "rc-tooltip";
import TagsSelector from "components/Proposal/Create/SchemeForms/TagsSelector";
import Reputation from "components/Account/Reputation";
import { DiscussionEmbed } from "disqus-react";
import { getProposalSubmission, getSubmissionVoterHasVoted, getCompetitionVotes, CompetitionStatus } from "./utils";
import * as css from "./Competitions.scss";

Expand Down Expand Up @@ -55,6 +56,8 @@ class SubmissionDetails extends React.Component<IProps, null> {
this.props.handleRedeem();
}

private disqusConfig = { url: "", identifier: "", title: "" };

public render(): RenderOutput {

const competition = this.props.proposalState.competition;
Expand All @@ -73,6 +76,10 @@ class SubmissionDetails extends React.Component<IProps, null> {
const canRedeem = isWinner && competitionIsOver && !isRedeemed && (submission.beneficiary === this.props.currentAccountAddress);
const tags = submission.tags;

this.disqusConfig.title = submission.title;
this.disqusConfig.url = window.location.toString();
this.disqusConfig.identifier = submission.id;

return (
<div className={css.submissionDetails}>
<div className={css.header}>
Expand Down Expand Up @@ -140,6 +147,14 @@ class SubmissionDetails extends React.Component<IProps, null> {
}

<div className={css.createdOn}>Created: <div className={css.datetime}>{formatFriendlyDateForLocalTimezone(competition.createdAt)}</div></div>

<div className={css.discussionContainer}>
<div className={css.title}>Discussion</div>
<div className={css.disqus}>
<DiscussionEmbed shortname={process.env.DISQUS_SITE} config={this.disqusConfig}/>
</div>
</div>

</div>
);
}
Expand Down