-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish conversion from class to functional, underscore and jquery rem…
…oved
- Loading branch information
Showing
20 changed files
with
437 additions
and
375 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import Flex from "./flex"; | ||
import * as globals from "./globals"; | ||
import BarChart from "./barChart"; | ||
|
||
const Comment = ({ dispatch, params, acceptButton, rejectButton, acceptClickHandler, rejectClickHandler, comment, formatTid, conversation, ptptCount }) => { | ||
const getDate = () => { | ||
const date = new Date(+comment.created); | ||
return `${date.getMonth() + 1} / ${date.getUTCDate()} / ${date.getFullYear()}`; | ||
}; | ||
|
||
const getVoteBreakdown = () => { | ||
if (typeof comment.agree_count !== "undefined") { | ||
return ( | ||
<span> | ||
({comment.agree_count} agreed, {comment.disagree_count} disagreed, {comment.pass_count} passed) | ||
</span> | ||
); | ||
} | ||
return ""; | ||
}; | ||
|
||
const styles = { ...globals.paragraph, fontStyle: "italic" }; | ||
|
||
return ( | ||
<Flex | ||
styleOverrides={{ | ||
width: "100%", | ||
marginBottom: 50, | ||
background: comment.index % 2 !== 0 ? "none" : "none", | ||
}} | ||
direction="row" | ||
justifyContent="flex-start" | ||
alignItems="flex-start" | ||
> | ||
<Flex alignItems="baseline" justifyContent="flex-start" styleOverrides={{ width: globals.paragraphWidth }}> | ||
<span style={{ ...styles }}> | ||
{formatTid(comment.tid)} - {comment.is_meta ? "Metadata: " : ""} | ||
{comment.txt} | ||
</span> | ||
</Flex> | ||
<svg width={globals.barChartWidth} height={70}> | ||
<line x1="120" y1="0" x2="120" y2="65" strokeWidth="2" stroke="rgb(245,245,245)" /> | ||
<BarChart conversation={conversation} comment={comment} ptptCount={ptptCount} /> | ||
</svg> | ||
</Flex> | ||
); | ||
}; | ||
|
||
Comment.propTypes = { | ||
dispatch: PropTypes.func, | ||
params: PropTypes.object, | ||
acceptButton: PropTypes.bool, | ||
rejectButton: PropTypes.bool, | ||
acceptClickHandler: PropTypes.func, | ||
rejectClickHandler: PropTypes.func, | ||
comment: PropTypes.object, | ||
formatTid: PropTypes.func, | ||
conversation: PropTypes.object, | ||
ptptCount: PropTypes.number, | ||
}; | ||
|
||
export default Comment; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import React from "react"; | ||
import * as globals from "./globals"; | ||
|
||
const GraphAxes = ({yCenter, xCenter/*, report*/}) => { | ||
return ( | ||
<g> | ||
<line | ||
x1={0 /* magic number is axis padding */} | ||
y1={yCenter} | ||
x2={globals.side /* - 50 */} | ||
y2={yCenter} | ||
style={{ | ||
stroke: "rgb(230,230,230)", | ||
strokeWidth: 1 | ||
}}/> | ||
<line | ||
x1={xCenter} | ||
y1={0 } | ||
x2={xCenter} | ||
y2={globals.side /* - 50 */ /* magic number is axis padding */} | ||
style={{ | ||
stroke: "rgb(230,230,230)", | ||
strokeWidth: 1 | ||
}}/> | ||
</g> | ||
); | ||
}; | ||
|
||
export default GraphAxes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.