Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

대댓글 기능 QA (Mention id > orgId 로 변경 및 useRef 훅 사용) #822

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions packages/react-mentions/dist/react-mentions.cjs.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,11 +894,11 @@ function Suggestion(_ref) {
return suggestion;
}

var id = suggestion.id,
var orgId = suggestion.orgId,
display = suggestion.display;

if (id === undefined || !display) {
return id;
if (orgId === undefined || !display) {
return orgId;
}

return display;
Expand Down Expand Up @@ -1436,22 +1436,16 @@ var MentionsInput = /*#__PURE__*/function (_React$Component) {

if (navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')) {
// Safari 브라우저인 경우
console.log('safari');

if (ev.nativeEvent.composed && selectionStart === selectionEnd) {
_this.updateMentionsQueries(_this.inputElement.value, selectionStart);
}
} else if (/iPhone|iPad|iPod/.test(navigator.userAgent) && !navigator.userAgent.includes('Safari')) {
// WKWebView 또는 다른 iOS WebView인 경우
console.log('webview');

if (ev.nativeEvent.composed && selectionStart === selectionEnd) {
_this.updateMentionsQueries(_this.inputElement.value, selectionStart);
}
} else {
// 다른 브라우저의 경우
console.log('other browser');

if (ev.nativeEvent.isComposing && selectionStart === selectionEnd) {
_this.updateMentionsQueries(_this.inputElement.value, selectionStart);
}
Expand Down
9 changes: 3 additions & 6 deletions packages/react-mentions/dist/react-mentions.cjs.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ function Suggestion(_ref) {
onMouseEnter: onMouseEnter
}), getDisplay = function() {
if ("string" == typeof suggestion) return suggestion;
var id = suggestion.id, display = suggestion.display;
return void 0 !== id && display ? display : id;
var orgId = suggestion.orgId, display = suggestion.display;
return void 0 !== orgId && display ? display : orgId;
}, renderHighlightedDisplay = function(display) {
var i = getSubstringIndex(display, query, ignoreAccents);
return -1 === i ? React__default.createElement("span", style("display"), display) : React__default.createElement("span", style("display"), display.substring(0, i), React__default.createElement("b", style("highlight"), display.substring(i, i + query.length)), display.substring(i + query.length));
Expand Down Expand Up @@ -898,10 +898,7 @@ var makeTriggerRegex = function(trigger) {
setSelectionAfterMentionChange: setSelectionAfterMentionChange
});
var mentions = getMentions(newValue, config);
navigator.userAgent.includes("Safari") && !navigator.userAgent.includes("Chrome") ? (console.log("safari"),
ev.nativeEvent.composed && selectionStart === selectionEnd && _this.updateMentionsQueries(_this.inputElement.value, selectionStart)) : /iPhone|iPad|iPod/.test(navigator.userAgent) && !navigator.userAgent.includes("Safari") ? (console.log("webview"),
ev.nativeEvent.composed && selectionStart === selectionEnd && _this.updateMentionsQueries(_this.inputElement.value, selectionStart)) : (console.log("other browser"),
ev.nativeEvent.isComposing && selectionStart === selectionEnd && _this.updateMentionsQueries(_this.inputElement.value, selectionStart));
navigator.userAgent.includes("Safari") && !navigator.userAgent.includes("Chrome") ? ev.nativeEvent.composed && selectionStart === selectionEnd && _this.updateMentionsQueries(_this.inputElement.value, selectionStart) : /iPhone|iPad|iPod/.test(navigator.userAgent) && !navigator.userAgent.includes("Safari") ? ev.nativeEvent.composed && selectionStart === selectionEnd && _this.updateMentionsQueries(_this.inputElement.value, selectionStart) : ev.nativeEvent.isComposing && selectionStart === selectionEnd && _this.updateMentionsQueries(_this.inputElement.value, selectionStart);
var eventMock = {
target: {
value: newValue
Expand Down
12 changes: 3 additions & 9 deletions packages/react-mentions/dist/react-mentions.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,11 +886,11 @@ function Suggestion(_ref) {
return suggestion;
}

var id = suggestion.id,
var orgId = suggestion.orgId,
display = suggestion.display;

if (id === undefined || !display) {
return id;
if (orgId === undefined || !display) {
return orgId;
}

return display;
Expand Down Expand Up @@ -1428,22 +1428,16 @@ var MentionsInput = /*#__PURE__*/function (_React$Component) {

if (navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')) {
// Safari 브라우저인 경우
console.log('safari');

if (ev.nativeEvent.composed && selectionStart === selectionEnd) {
_this.updateMentionsQueries(_this.inputElement.value, selectionStart);
}
} else if (/iPhone|iPad|iPod/.test(navigator.userAgent) && !navigator.userAgent.includes('Safari')) {
// WKWebView 또는 다른 iOS WebView인 경우
console.log('webview');

if (ev.nativeEvent.composed && selectionStart === selectionEnd) {
_this.updateMentionsQueries(_this.inputElement.value, selectionStart);
}
} else {
// 다른 브라우저의 경우
console.log('other browser');

if (ev.nativeEvent.isComposing && selectionStart === selectionEnd) {
_this.updateMentionsQueries(_this.inputElement.value, selectionStart);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FeedCommentViewer from '../FeedCommentViewer/FeedCommentViewer';
import FeedActionButton from '../FeedActionButton/FeedActionButton';
import { useOverlay } from '@hooks/useOverlay/Index';
import ConfirmModal from '@components/modal/ConfirmModal';
import { useState } from 'react';
import { useRef, useState } from 'react';
import { useDeleteComment } from '@api/post/hooks';
import { useRouter } from 'next/router';
import { useMutation, useQueryClient } from '@tanstack/react-query';
Expand Down Expand Up @@ -37,7 +37,7 @@ export default function FeedCommentContainer({ comment, isMine, postUserId, onCl
const overlay = useOverlay();
const [editMode, setEditMode] = useState(false);
const [showMoreReComments, setShowMoreReComments] = useState(false);
const replyLength = comment?.replies?.length;
const initialReplyLength = useRef<number>(comment?.replies?.length);

const { mutate: mutateDeleteComment } = useDeleteComment(query.id as string);

Expand Down Expand Up @@ -102,15 +102,15 @@ export default function FeedCommentContainer({ comment, isMine, postUserId, onCl
onClickLike={onClickLike}
/>
)}
{comment?.replies?.length >= 2 && !showMoreReComments ? (
{initialReplyLength.current >= 2 && !showMoreReComments ? (
<LoadMoreReCommentsButton onClick={() => setShowMoreReComments(!showMoreReComments)}>
<ReplyPointIcon style={{ marginRight: '12px' }} />
<Avatar
src={comment.replies[replyLength - 1].user.profileImage || ''}
src={comment.replies[comment?.replies?.length - 1].user.profileImage || ''}
alt={comment.user.name}
sx={{ width: 28, height: 28 }}
/>
<SReplyButton>{comment.replies[replyLength - 1].user.name}님이 답글을 달았습니다</SReplyButton>
<SReplyButton>{comment.replies[comment?.replies?.length - 1].user.name}님이 답글을 달았습니다</SReplyButton>
<MessageIconWrapper>
<SMessageIcon />
<SMessageHoverIcon />
Expand Down
Loading