From f4037ce6fbf69e1e50fba3ece0dad199aef9cc05 Mon Sep 17 00:00:00 2001 From: Kiwi Date: Wed, 13 Feb 2019 17:11:13 +0100 Subject: [PATCH] [CORL-260] Bring back sorting (#2186) * feat: sort stream * feat: add FieldSet component to ui * feat: make accessible and add feature test * test: fix snapshots --- .../ClosingCommentStreamsConfig.tsx | 7 +- .../components/CommentEditingConfig.tsx | 3 +- .../components/CommentLengthConfig.tsx | 3 +- .../general/components/GuidelinesConfig.tsx | 5 +- .../moderation/components/AkismetConfig.tsx | 5 +- .../components/PerspectiveConfig.tsx | 7 +- .../__snapshots__/general.spec.tsx.snap | 18 +- .../__snapshots__/moderation.spec.tsx.snap | 10 +- .../__snapshots__/initLocalState.spec.ts.snap | 1 + .../client/stream/local/initLocalState.ts | 5 + src/core/client/stream/local/local.graphql | 1 + .../SetStreamOrderByMutation.spec.ts | 21 ++ .../mutations/SetStreamOrderByMutation.ts | 31 ++ .../tabs/comments/components/Divider.css | 5 + .../tabs/comments/components/Divider.tsx | 6 + .../tabs/comments/components/SortMenu.css | 8 + .../comments/components/SortMenu.spec.tsx | 53 +++ .../tabs/comments/components/SortMenu.tsx | 70 ++++ .../tabs/comments/components/Stream.spec.tsx | 6 + .../tabs/comments/components/Stream.tsx | 86 ++--- .../__snapshots__/SortMenu.spec.tsx.snap | 119 +++++++ .../__snapshots__/Stream.spec.tsx.snap | 16 + .../containers/StreamContainer.spec.tsx | 2 + .../comments/containers/StreamContainer.tsx | 27 +- .../StreamContainer.spec.tsx.snap | 12 + .../comments/queries/StreamQuery.spec.tsx | 6 +- .../tabs/comments/queries/StreamQuery.tsx | 80 +++-- .../__snapshots__/StreamQuery.spec.tsx.snap | 1 + .../__snapshots__/renderStream.spec.tsx.snap | 59 ++++ .../__snapshots__/sortStream.spec.tsx.snap | 310 ++++++++++++++++++ .../client/stream/test/comments/create.ts | 1 + .../stream/test/comments/sortStream.spec.tsx | 81 +++++ .../ui/components/FieldSet/FieldSet.css | 4 + .../ui/components/FieldSet/FieldSet.mdx | 10 + .../ui/components/FieldSet/FieldSet.spec.tsx | 14 + .../ui/components/FieldSet/FieldSet.tsx | 26 ++ .../__snapshots__/FieldSet.spec.tsx.snap | 9 + .../client/ui/components/FieldSet/index.ts | 1 + .../ui/components/SelectField/SelectField.css | 4 +- .../ui/components/SelectField/SelectField.tsx | 15 +- .../__snapshots__/SelectField.spec.tsx.snap | 2 +- src/core/client/ui/components/index.ts | 1 + src/locales/en-US/stream.ftl | 6 + 43 files changed, 1047 insertions(+), 110 deletions(-) create mode 100644 src/core/client/stream/mutations/SetStreamOrderByMutation.spec.ts create mode 100644 src/core/client/stream/mutations/SetStreamOrderByMutation.ts create mode 100644 src/core/client/stream/tabs/comments/components/Divider.css create mode 100644 src/core/client/stream/tabs/comments/components/Divider.tsx create mode 100644 src/core/client/stream/tabs/comments/components/SortMenu.css create mode 100644 src/core/client/stream/tabs/comments/components/SortMenu.spec.tsx create mode 100644 src/core/client/stream/tabs/comments/components/SortMenu.tsx create mode 100644 src/core/client/stream/tabs/comments/components/__snapshots__/SortMenu.spec.tsx.snap create mode 100644 src/core/client/stream/test/comments/__snapshots__/sortStream.spec.tsx.snap create mode 100644 src/core/client/stream/test/comments/sortStream.spec.tsx create mode 100644 src/core/client/ui/components/FieldSet/FieldSet.css create mode 100644 src/core/client/ui/components/FieldSet/FieldSet.mdx create mode 100644 src/core/client/ui/components/FieldSet/FieldSet.spec.tsx create mode 100644 src/core/client/ui/components/FieldSet/FieldSet.tsx create mode 100644 src/core/client/ui/components/FieldSet/__snapshots__/FieldSet.spec.tsx.snap create mode 100644 src/core/client/ui/components/FieldSet/index.ts diff --git a/src/core/client/admin/routes/configure/sections/general/components/ClosingCommentStreamsConfig.tsx b/src/core/client/admin/routes/configure/sections/general/components/ClosingCommentStreamsConfig.tsx index 1ccd8d68a..7634ab452 100644 --- a/src/core/client/admin/routes/configure/sections/general/components/ClosingCommentStreamsConfig.tsx +++ b/src/core/client/admin/routes/configure/sections/general/components/ClosingCommentStreamsConfig.tsx @@ -3,6 +3,7 @@ import React, { StatelessComponent } from "react"; import { DURATION_UNIT, DurationField } from "talk-framework/components"; import { + FieldSet, FormField, HorizontalGutter, InputLabel, @@ -27,7 +28,7 @@ interface Props { const ClosingCommentStreamsConfig: StatelessComponent = ({ disabled, }) => ( - + }>
Closing Comment Streams
@@ -40,13 +41,13 @@ const ClosingCommentStreamsConfig: StatelessComponent = ({ story’s publication - + }> Close Comments Automatically - + }> Close Comments After diff --git a/src/core/client/admin/routes/configure/sections/general/components/CommentEditingConfig.tsx b/src/core/client/admin/routes/configure/sections/general/components/CommentEditingConfig.tsx index 66caffd14..499c0df03 100644 --- a/src/core/client/admin/routes/configure/sections/general/components/CommentEditingConfig.tsx +++ b/src/core/client/admin/routes/configure/sections/general/components/CommentEditingConfig.tsx @@ -9,6 +9,7 @@ import { validateWholeNumberGreaterThanOrEqual, } from "talk-framework/lib/validation"; import { + FieldSet, FormField, HorizontalGutter, InputLabel, @@ -38,7 +39,7 @@ const CommentEditingConfig: StatelessComponent = ({ disabled }) => ( - + }> Comment Edit Timeframe diff --git a/src/core/client/admin/routes/configure/sections/general/components/CommentLengthConfig.tsx b/src/core/client/admin/routes/configure/sections/general/components/CommentLengthConfig.tsx index 05f2c5e4c..0f1a80426 100644 --- a/src/core/client/admin/routes/configure/sections/general/components/CommentLengthConfig.tsx +++ b/src/core/client/admin/routes/configure/sections/general/components/CommentLengthConfig.tsx @@ -8,6 +8,7 @@ import { validateWholeNumberGreaterThan, } from "talk-framework/lib/validation"; import { + FieldSet, FormField, HorizontalGutter, InputLabel, @@ -38,7 +39,7 @@ interface Props { } const CommentLengthConfig: StatelessComponent = ({ disabled }) => ( - + }>
Comment Length
diff --git a/src/core/client/admin/routes/configure/sections/general/components/GuidelinesConfig.tsx b/src/core/client/admin/routes/configure/sections/general/components/GuidelinesConfig.tsx index 06a6f7654..314c9c65a 100644 --- a/src/core/client/admin/routes/configure/sections/general/components/GuidelinesConfig.tsx +++ b/src/core/client/admin/routes/configure/sections/general/components/GuidelinesConfig.tsx @@ -4,6 +4,7 @@ import { Field } from "react-final-form"; import { ExternalLink } from "talk-framework/lib/i18n/components"; import { + FieldSet, FormField, HorizontalGutter, InputLabel, @@ -21,12 +22,12 @@ interface Props { } const GuidelinesConfig: StatelessComponent = ({ disabled }) => ( - + }>
Community Guidelines Summary
- + }> Show Community Guidelines Summary diff --git a/src/core/client/admin/routes/configure/sections/moderation/components/AkismetConfig.tsx b/src/core/client/admin/routes/configure/sections/moderation/components/AkismetConfig.tsx index 3580d7252..dd39120e2 100644 --- a/src/core/client/admin/routes/configure/sections/moderation/components/AkismetConfig.tsx +++ b/src/core/client/admin/routes/configure/sections/moderation/components/AkismetConfig.tsx @@ -10,6 +10,7 @@ import { Validator, } from "talk-framework/lib/validation"; import { + FieldSet, FormField, HorizontalGutter, InputLabel, @@ -38,7 +39,7 @@ const AkismetConfig: StatelessComponent = ({ disabled }) => { return ""; }; return ( - + }>
Akismet Spam Detection Filter
@@ -57,7 +58,7 @@ const AkismetConfig: StatelessComponent = ({ disabled }) => {
- + }> Spam Detection Filter diff --git a/src/core/client/admin/routes/configure/sections/moderation/components/PerspectiveConfig.tsx b/src/core/client/admin/routes/configure/sections/moderation/components/PerspectiveConfig.tsx index 5ce2e34e0..d078bac69 100644 --- a/src/core/client/admin/routes/configure/sections/moderation/components/PerspectiveConfig.tsx +++ b/src/core/client/admin/routes/configure/sections/moderation/components/PerspectiveConfig.tsx @@ -14,6 +14,7 @@ import { Validator, } from "talk-framework/lib/validation"; import { + FieldSet, FormField, HorizontalGutter, InputDescription, @@ -49,7 +50,7 @@ const PerspectiveConfig: StatelessComponent = ({ disabled }) => { return ""; }; return ( - + }>
Perspective Toxic Comment Filter
@@ -66,7 +67,7 @@ const PerspectiveConfig: StatelessComponent = ({ disabled }) => { - + }> Spam Detection Filter @@ -126,7 +127,7 @@ const PerspectiveConfig: StatelessComponent = ({ disabled }) => { - + }> Allow Google to Store Comment Data 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 abc5cc521..206d4ef91 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 @@ -108,7 +108,7 @@ exports[`renders configure general 1`] = ` data-testid="configure-generalContainer" >