diff --git a/src/core/client/admin/routes/Configure/sections/General/GeneralConfig.tsx b/src/core/client/admin/routes/Configure/sections/General/GeneralConfig.tsx index c273ea200..ec5156681 100644 --- a/src/core/client/admin/routes/Configure/sections/General/GeneralConfig.tsx +++ b/src/core/client/admin/routes/Configure/sections/General/GeneralConfig.tsx @@ -8,6 +8,7 @@ import ClosingCommentStreamsConfigContainer from "./ClosingCommentStreamsConfigC import CommentEditingConfigContainer from "./CommentEditingConfigContainer"; import CommentLengthConfigContainer from "./CommentLengthConfigContainer"; import GuidelinesConfigContainer from "./GuidelinesConfigContainer"; +import ReactionConfigContainer from "./ReactionConfigContainer"; import SitewideCommentingConfigContainer from "./SitewideCommentingConfigContainer"; interface Props { @@ -16,6 +17,7 @@ interface Props { PropTypesOf["settings"] & PropTypesOf["settings"] & PropTypesOf["settings"] & + PropTypesOf["settings"] & PropTypesOf["settings"] & PropTypesOf["settings"]; onInitValues: (values: any) => void; @@ -57,6 +59,11 @@ const General: FunctionComponent = ({ settings={settings} onInitValues={onInitValues} /> + ); diff --git a/src/core/client/admin/routes/Configure/sections/General/GeneralConfigContainer.tsx b/src/core/client/admin/routes/Configure/sections/General/GeneralConfigContainer.tsx index a4dd02d9d..6cb8ccc4c 100644 --- a/src/core/client/admin/routes/Configure/sections/General/GeneralConfigContainer.tsx +++ b/src/core/client/admin/routes/Configure/sections/General/GeneralConfigContainer.tsx @@ -51,6 +51,7 @@ const enhanced = withFragmentContainer({ ...ClosedStreamMessageConfigContainer_settings ...ClosingCommentStreamsConfigContainer_settings ...SitewideCommentingConfigContainer_settings + ...ReactionConfigContainer_settings } `, })(GeneralConfigContainer); diff --git a/src/core/client/admin/routes/Configure/sections/General/ReactionConfig.css b/src/core/client/admin/routes/Configure/sections/General/ReactionConfig.css new file mode 100644 index 000000000..e164cc8a7 --- /dev/null +++ b/src/core/client/admin/routes/Configure/sections/General/ReactionConfig.css @@ -0,0 +1,8 @@ +.textInput { + min-width: 300px; +} + +.reactionButton { + cursor: not-allowed !important; + color: var(--palette-grey-main) !important; +} \ No newline at end of file diff --git a/src/core/client/admin/routes/Configure/sections/General/ReactionConfig.tsx b/src/core/client/admin/routes/Configure/sections/General/ReactionConfig.tsx new file mode 100644 index 000000000..ace016784 --- /dev/null +++ b/src/core/client/admin/routes/Configure/sections/General/ReactionConfig.tsx @@ -0,0 +1,168 @@ +import { Localized } from "fluent-react/compat"; +import React, { FunctionComponent } from "react"; +import { Field } from "react-final-form"; + +import { ReactionConfigContainer_settings as SettingsData } from "coral-admin/__generated__/ReactionConfigContainer_settings.graphql"; +import { required } from "coral-framework/lib/validation"; +import ReactionButton from "coral-stream/tabs/Comments/Comment/ReactionButton/ReactionButton"; +import { + FieldSet, + Flex, + FormField, + HorizontalGutter, + InputLabel, + Option, + SelectField, + TextField, + Typography, +} from "coral-ui/components"; + +import Header from "../../Header"; +import ValidationMessage from "../../ValidationMessage"; + +import styles from "./ReactionConfig.css"; + +interface Props { + disabled: boolean; + settings: SettingsData; +} + +const ReactionsConfig: FunctionComponent = ({ disabled, settings }) => ( + }> + +
Reactions
+
+ }> + + Allow your community to engage with one another and express themselves + with one-click reactions. By default, Coral allows commenters to + "Respect" each other's comments, but you may customize reaction text + based on the needs of your community. + + + + + + {({ input, meta }) => ( + + + + Reaction label + + + + + + + + + Preview + + null} + /> + + + )} + + + + + {({ input, meta }) => ( + + + + Active reaction label + + + + + + + + + Preview + + null} + /> + + + )} + + + + + {({ input, meta }) => ( + + + + Sort label + + + + + + + + + Preview + + + + Sort By + + + {" "} + + + + + )} + + + +
+); + +export default ReactionsConfig; diff --git a/src/core/client/admin/routes/Configure/sections/General/ReactionConfigContainer.tsx b/src/core/client/admin/routes/Configure/sections/General/ReactionConfigContainer.tsx new file mode 100644 index 000000000..f6c488bbc --- /dev/null +++ b/src/core/client/admin/routes/Configure/sections/General/ReactionConfigContainer.tsx @@ -0,0 +1,41 @@ +import React from "react"; +import { graphql } from "react-relay"; + +import { ReactionConfigContainer_settings as SettingsData } from "coral-admin/__generated__/ReactionConfigContainer_settings.graphql"; +import { withFragmentContainer } from "coral-framework/lib/relay"; + +import ReactionConfig from "./ReactionConfig"; + +interface Props { + settings: SettingsData; + onInitValues: (values: SettingsData) => void; + disabled: boolean; +} + +class ReactionConfigContainer extends React.Component { + constructor(props: Props) { + super(props); + props.onInitValues(props.settings); + } + + public render() { + const { disabled, settings } = this.props; + return ; + } +} + +const enhanced = withFragmentContainer({ + settings: graphql` + fragment ReactionConfigContainer_settings on Settings { + reaction { + label + labelActive + sortLabel + icon + iconActive + } + } + `, +})(ReactionConfigContainer); + +export default enhanced; diff --git a/src/core/client/admin/test/configure/__snapshots__/general.spec.tsx.snap b/src/core/client/admin/test/configure/__snapshots__/general.spec.tsx.snap index 4ca942623..c7347eba3 100644 --- a/src/core/client/admin/test/configure/__snapshots__/general.spec.tsx.snap +++ b/src/core/client/admin/test/configure/__snapshots__/general.spec.tsx.snap @@ -737,6 +737,219 @@ moderation panel. /> +
+ + Reactions + +

+ Allow your community to engage with one another and express themselves +with one-click reactions. By default, Coral allows commenters to +"Respect" each other's comments, but you may customize reaction text +based on the needs of your community. +

+
+
+
+
+ +
+ +
+
+
+

+ Preview +

+ +
+
+
+
+
+
+ +
+ +
+
+
+

+ Preview +

+ +
+
+
+
+
+
+ +
+ +
+
+
+

+ Preview +

+
+

+ Sort by +

+ + + + + + +
+
+
+
+
+
diff --git a/src/core/client/admin/test/fixtures.ts b/src/core/client/admin/test/fixtures.ts index 378a5f224..02613af82 100644 --- a/src/core/client/admin/test/fixtures.ts +++ b/src/core/client/admin/test/fixtures.ts @@ -46,6 +46,12 @@ export const settings = createFixture({ timeout: 604800, message: "Comments are closed on this story.", }, + reaction: { + label: "Reaction", + labelActive: "reacted", + sortLabel: "Reactions", + icon: "icon", + }, email: { enabled: true, }, diff --git a/src/core/client/stream/tabs/Comments/Comment/ReactionButton/ReactionButton.tsx b/src/core/client/stream/tabs/Comments/Comment/ReactionButton/ReactionButton.tsx index 82be0cd4f..8b1c4c8ee 100644 --- a/src/core/client/stream/tabs/Comments/Comment/ReactionButton/ReactionButton.tsx +++ b/src/core/client/stream/tabs/Comments/Comment/ReactionButton/ReactionButton.tsx @@ -2,6 +2,7 @@ import cn from "classnames"; import React from "react"; import { Button, ButtonIcon, MatchMedia } from "coral-ui/components"; +import { ButtonProps } from "coral-ui/components/Button"; import styles from "./ReactionButton.css"; @@ -14,19 +15,20 @@ interface ReactionButtonProps { icon: string; iconActive: string | null; readOnly?: boolean; - // color: string; + className?: string; + color?: typeof styles & ButtonProps["color"]; } class ReactionButton extends React.Component { public render() { - const { totalReactions, reacted, readOnly } = this.props; + const { totalReactions, reacted, readOnly, className } = this.props; return (