mirror of
https://github.com/wassname/talk.git
synced 2026-07-30 12:40:41 +08:00
[CORL-732] allow navigation via j/k in single comment view (#2712)
* allow navigation via j/k in single comment view * update snaps
This commit is contained in:
committed by
Wyatt Johnson
parent
ddedf4dc7e
commit
09cf8c5490
@@ -113,6 +113,7 @@ const Queue: FunctionComponent<Props> = ({
|
||||
<QueueWrapper
|
||||
comments={comments}
|
||||
singleView={singleView}
|
||||
selected={selectedComment}
|
||||
card={(comment, i) => (
|
||||
<ModerateCardContainer
|
||||
key={comment.id}
|
||||
|
||||
@@ -14,27 +14,33 @@ interface Props {
|
||||
c: { id: string } & PropTypesOf<typeof ModerateCardContainer>["comment"],
|
||||
i: number
|
||||
) => ReactNode;
|
||||
selected: number | null;
|
||||
}
|
||||
|
||||
const QueueWrapper: FunctionComponent<Props> = ({
|
||||
singleView,
|
||||
card,
|
||||
comments,
|
||||
selected,
|
||||
}) => {
|
||||
const commentsQueue = singleView ? [comments[0]] : comments;
|
||||
if (singleView) {
|
||||
return (
|
||||
<>
|
||||
{commentsQueue
|
||||
{comments
|
||||
// FIXME (Nick/Wyatt): Investigate why comments are coming back null
|
||||
.filter(c => Boolean(c))
|
||||
.map((c, i) => card(c, i))}
|
||||
.map((c, i) => {
|
||||
if (i === selected) {
|
||||
return card(c, i);
|
||||
}
|
||||
return null;
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<TransitionGroup component={null} appear={false} enter={false} exit>
|
||||
{commentsQueue
|
||||
{comments
|
||||
// FIXME (Nick/Wyatt): Investigate why comments are coming back null
|
||||
.filter(c => Boolean(c))
|
||||
.map((c, i) => (
|
||||
|
||||
@@ -8,6 +8,7 @@ exports[`renders correctly with load more 1`] = `
|
||||
<QueueWrapper
|
||||
card={[Function]}
|
||||
comments={Array []}
|
||||
selected={0}
|
||||
singleView={false}
|
||||
/>
|
||||
<ForwardRef(forwardRef)
|
||||
@@ -34,6 +35,7 @@ exports[`renders correctly without load more 1`] = `
|
||||
<QueueWrapper
|
||||
card={[Function]}
|
||||
comments={Array []}
|
||||
selected={0}
|
||||
singleView={false}
|
||||
/>
|
||||
<UserHistoryDrawer
|
||||
|
||||
Reference in New Issue
Block a user