Skip to content

Commit a0511e6

Browse files
committed
feat: qa updates
1 parent 8cffc9d commit a0511e6

33 files changed

Lines changed: 602 additions & 298 deletions

front_end/messages/cs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,7 @@
20722072
"switchBackToSlidersHint": "přepněte zpět na posuvníky pro plynulé přizpůsobení",
20732073
"view": "Zobrazit",
20742074
"viewComment": "Zobrazit komentář",
2075+
"viewArticle": "Zobrazit článek",
20752076
"createdTimeAgoBy": "Vytvořeno {timeAgo} uživatelem @{author}",
20762077
"createdTimeAgo": "Vytvořeno {timeAgo}",
20772078
"direction": "Směr",

front_end/messages/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,6 +2070,7 @@
20702070
"redundant": "Redundant",
20712071
"thanksForVoting": "Thanks for voting!",
20722072
"viewComment": "View comment",
2073+
"viewArticle": "View Article",
20732074
"createdTimeAgoBy": "Created {timeAgo} by @{author}",
20742075
"createdTimeAgo": "Created {timeAgo}",
20752076
"direction": "Direction",

front_end/messages/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,7 @@
20722072
"switchBackToSlidersHint": "vuelve a los deslizadores para un ajuste suave",
20732073
"view": "Ver",
20742074
"viewComment": "Ver comentario",
2075+
"viewArticle": "Ver artículo",
20752076
"createdTimeAgoBy": "Creado {timeAgo} por @{author}",
20762077
"createdTimeAgo": "Creado {timeAgo}",
20772078
"direction": "Dirección",

front_end/messages/pt.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,6 +2070,7 @@
20702070
"switchBackToSlidersHint": "volte para os controles deslizantes para um ajuste suave",
20712071
"view": "Visualizar",
20722072
"viewComment": "Ver comentário",
2073+
"viewArticle": "Ver artigo",
20732074
"createdTimeAgoBy": "Criado {timeAgo} por @{author}",
20742075
"createdTimeAgo": "Criado {timeAgo}",
20752076
"direction": "Direção",

front_end/messages/zh-TW.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,7 @@
20692069
"switchBackToSlidersHint": "切換回滑桿以平滑調整",
20702070
"view": "檢視",
20712071
"viewComment": "查看評論",
2072+
"viewArticle": "查看文章",
20722073
"createdTimeAgoBy": "由 @{author} 建立於 {timeAgo}",
20732074
"createdTimeAgo": "建立於 {timeAgo}",
20742075
"direction": "方向",

front_end/messages/zh.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,6 +2074,7 @@
20742074
"switchBackToSlidersHint": "切回滑块以进行更精细的调整",
20752075
"view": "查看",
20762076
"viewComment": "查看评论",
2077+
"viewArticle": "查看文章",
20772078
"createdTimeAgoBy": "由 @{author} 创建于 {timeAgo}",
20782079
"createdTimeAgo": "创建于 {timeAgo}",
20792080
"direction": "方向",

front_end/src/app/(main)/questions/[id]/components/key_factors/comment_detail_panel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type Props = {
2020
comment: BECommentType | null;
2121
isLoading: boolean;
2222
onScrollToComment: () => void;
23+
onReplyToComment: () => void;
2324
onSelectKeyFactor: (keyFactor: KeyFactor) => void;
2425
onVoteChange: (voteScore: number, userVote: VoteDirection | null) => void;
2526
onCmmToggle: (enabled: boolean) => void;
@@ -32,6 +33,7 @@ const CommentDetailPanel: FC<Props> = ({
3233
comment,
3334
isLoading,
3435
onScrollToComment,
36+
onReplyToComment,
3537
onSelectKeyFactor,
3638
onVoteChange,
3739
onCmmToggle,
@@ -127,7 +129,7 @@ const CommentDetailPanel: FC<Props> = ({
127129
<CommentActionBar
128130
comment={comment}
129131
post={post}
130-
onReply={onScrollToComment}
132+
onReply={onReplyToComment}
131133
onScrollToLink={onScrollToComment}
132134
onVoteChange={onVoteChange}
133135
onCmmToggle={onCmmToggle}

front_end/src/app/(main)/questions/[id]/components/key_factors/hooks.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
44

55
import useCoherenceLinksContext from "@/app/(main)/components/coherence_links_provider";
66
import { useCommentsFeed } from "@/app/(main)/components/comments_feed_provider";
7+
import { useQuestionLayoutSafe } from "@/app/(main)/questions/[id]/components/question_layout/question_layout_context";
78
import {
89
addKeyFactorsToComment,
910
createComment,
@@ -485,6 +486,7 @@ export const useKeyFactorDelete = () => {
485486
export const useKeyFactorModeration = () => {
486487
const t = useTranslations();
487488
const { setCurrentModal } = useModal();
489+
const questionLayout = useQuestionLayoutSafe();
488490
const { combinedKeyFactors, setCombinedKeyFactors } = useCommentsFeed();
489491
const [doReportKeyFactor] = useServerAction(reportKeyFactor);
490492

@@ -535,11 +537,13 @@ export const useKeyFactorModeration = () => {
535537
optimisticallyAddReplyEnsuringParent(kf.comment_id, text),
536538
onFinalize: finalizeReply,
537539
onRemove: removeTempReply,
540+
onSubmitted: () => questionLayout?.closeKeyFactorOverlay(),
538541
},
539542
});
540543
},
541544
[
542545
setCurrentModal,
546+
questionLayout,
543547
optimisticallyAddReplyEnsuringParent,
544548
finalizeReply,
545549
removeTempReply,

front_end/src/app/(main)/questions/[id]/components/key_factors/item_view/base_rate/key_factor_base_rate.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { useTranslations } from "next-intl";
55
import { KeyFactor, KeyFactorVoteTypes } from "@/types/comment";
66
import cn from "@/utils/core/cn";
77

8-
import KeyFactorStrengthItem from "../key_factor_strength_item";
8+
import KeyFactorStrengthItem, {
9+
ImpactVoteHandler,
10+
} from "../key_factor_strength_item";
911
import KeyFactorText from "../key_factor_text";
1012
import KeyFactorBaseRateFrequency from "./key_factor_base_rate_frequency";
1113
import KeyFactorBaseRateTrend from "./key_factor_base_rate_trend";
@@ -15,6 +17,7 @@ type Props = {
1517
mode?: "forecaster" | "consumer";
1618
isCompact?: boolean;
1719
isSuggested?: boolean;
20+
impactVoteRef?: React.MutableRefObject<ImpactVoteHandler | null>;
1821
onVotePanelToggle?: (open: boolean) => void;
1922
onDownvotePanelToggle?: (open: boolean) => void;
2023
onMorePanelToggle?: (open: boolean) => void;
@@ -26,6 +29,7 @@ const KeyFactorBaseRate: React.FC<Props> = ({
2629
isCompact,
2730
mode,
2831
isSuggested,
32+
impactVoteRef,
2933
onVotePanelToggle,
3034
onDownvotePanelToggle,
3135
onMorePanelToggle,
@@ -45,6 +49,7 @@ const KeyFactorBaseRate: React.FC<Props> = ({
4549
isCompact={isCompact}
4650
mode={mode}
4751
voteType={KeyFactorVoteTypes.DIRECTION}
52+
impactVoteRef={impactVoteRef}
4853
onVotePanelToggle={onVotePanelToggle}
4954
onDownvotePanelToggle={onDownvotePanelToggle}
5055
onMorePanelToggle={onMorePanelToggle}

front_end/src/app/(main)/questions/[id]/components/key_factors/item_view/index.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { FC } from "react";
3+
import { FC, useRef } from "react";
44

55
import { useCommentsFeed } from "@/app/(main)/components/comments_feed_provider";
66
import { ImpactMetadata, KeyFactor } from "@/types/comment";
@@ -10,6 +10,7 @@ import { getImpactDirectionFromMetadata } from "@/utils/key_factors";
1010
import KeyFactorBaseRate from "./base_rate/key_factor_base_rate";
1111
import KeyFactorDriver from "./driver/key_factor_driver";
1212
import KeyFactorCardContainer from "./key_factor_card_container";
13+
import { ImpactVoteHandler } from "./key_factor_strength_item";
1314
import KeyFactorVotePanels, {
1415
useKeyFactorVotePanels,
1516
} from "./key_factor_vote_panels";
@@ -62,8 +63,11 @@ export const KeyFactorItem: FC<Props> = ({
6263
handleUpvotePanelToggle,
6364
handleDownvotePanelToggle,
6465
handleMorePanelToggle,
66+
closeAllPanels,
6567
} = useKeyFactorVotePanels();
6668

69+
const impactVoteRef = useRef<ImpactVoteHandler | null>(null);
70+
6771
return (
6872
<div ref={impactPanel.anchorRef} className="self-start">
6973
<KeyFactorCardContainer
@@ -72,7 +76,10 @@ export const KeyFactorItem: FC<Props> = ({
7276
linkToComment={linkToComment}
7377
isCompact={isCompact}
7478
mode={mode}
75-
onClick={onClick}
79+
onClick={() => {
80+
closeAllPanels();
81+
onClick?.();
82+
}}
7683
className={className}
7784
impactDirection={impactDirection}
7885
impactStrength={impactStrength}
@@ -82,6 +89,7 @@ export const KeyFactorItem: FC<Props> = ({
8289
keyFactor={liveKeyFactor}
8390
mode={mode}
8491
isCompact={isCompact}
92+
impactVoteRef={impactVoteRef}
8593
onVotePanelToggle={handleUpvotePanelToggle}
8694
onDownvotePanelToggle={handleDownvotePanelToggle}
8795
onMorePanelToggle={handleMorePanelToggle}
@@ -94,6 +102,7 @@ export const KeyFactorItem: FC<Props> = ({
94102
isCompact={isCompact}
95103
mode={mode}
96104
isSuggested={isSuggested}
105+
impactVoteRef={impactVoteRef}
97106
onVotePanelToggle={handleUpvotePanelToggle}
98107
onDownvotePanelToggle={handleDownvotePanelToggle}
99108
onMorePanelToggle={handleMorePanelToggle}
@@ -105,6 +114,7 @@ export const KeyFactorItem: FC<Props> = ({
105114
keyFactor={liveKeyFactor}
106115
mode={mode}
107116
isCompact={isCompact}
117+
impactVoteRef={impactVoteRef}
108118
onVotePanelToggle={handleUpvotePanelToggle}
109119
onDownvotePanelToggle={handleDownvotePanelToggle}
110120
onMorePanelToggle={handleMorePanelToggle}
@@ -122,6 +132,7 @@ export const KeyFactorItem: FC<Props> = ({
122132
inline={inlineVotePanels}
123133
keyFactor={liveKeyFactor}
124134
projectPermission={projectPermission}
135+
onImpactSelect={(option) => impactVoteRef.current?.(option)}
125136
/>
126137
</div>
127138
);

0 commit comments

Comments
 (0)