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

refactor(web-domains): 카카오톡 공유하기 모달 이미지 및 멘트 등 각종 이슈 해결 #166

Merged
merged 7 commits into from
Aug 27, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { ClosingButton } from '../../floating-button/components/ClosingButton';
import { ClosingMessage } from '../components/ClosingMessage';
import { useAnswerClosingService } from '../services/useAnswerClosingService';

const KAKAO_SHARE_IMAGE_URL = 'https://file.moring.one/defaults/question_narrow.png';

export const AnswerClosingContainer = () => {
const { meetingId, answerGlobalTime, isOpen, basePath, close } = useAnswerClosingService();
const { meetingId, meetingName, answerGlobalTime, isOpen, basePath, close } = useAnswerClosingService();

return (
<>
Expand All @@ -27,6 +29,8 @@ export const AnswerClosingContainer = () => {
onClose={close}
topTitle="모임원들에게 릴레이 질문을"
bottomTitle="공유해보세요!"
shareDescription={`${meetingName} 모임 질문을 잊진 않으셨나요?`}
shareImageUrl={KAKAO_SHARE_IMAGE_URL}
shareLink={`${basePath}/${meetingId}/answer/opening`}
/>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import { useGetProgressingQuestion } from '@/answer/common/apis/queries/useGetPr
import { answerAtoms } from '@/answer/common/atoms/answer.atom';
import { getWebDomain } from '@/common';
import { useDialogContext } from '@/common/contexts/DialogProvider';
import { useGetMeetingInfo } from '@/home/common/apis/queries/useGetMeetingName';

export const useAnswerClosingService = () => {
const { meetingId } = useParams<{ meetingId: string }>();
const [answerGlobalTime, setAnswerGlobalTime] = useAtom(answerAtoms.answerGlobalTime);
const { data: meetingInfo } = useGetMeetingInfo({});

const { close, isOpen } = useDialogContext();
const meetingName = meetingInfo?.meetings.find((meeting) => meeting.meetingId === Number(meetingId))?.name;
const basePath = getWebDomain();

useGetProgressingQuestion({
Expand All @@ -29,6 +32,7 @@ export const useAnswerClosingService = () => {

return {
meetingId,
meetingName,
answerGlobalTime: answerGlobalTime ?? 0,
isOpen,
close,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ interface ShareToKakaoProps {
shareLink: string;
}

const buttonTextMap: Record<string, string> = {
'https://file.moring.one/defaults/invite_narrow.png': '모임 참여하기',
'https://file.moring.one/defaults/question_narrow.png': '답변하러 가기',
'https://file.moring.one/defaults/new_question_narrow.png': '답변하러 가기',
};

export const generateKakaoShare = ({ shareLink, shareImageUrl, shareDescription }: ShareToKakaoProps) => {
const { Kakao } = window;

Expand All @@ -26,5 +32,14 @@ export const generateKakaoShare = ({ shareLink, shareImageUrl, shareDescription
mobileWebUrl: shareLink,
},
},
buttons: [
{
title: buttonTextMap[shareImageUrl],
link: {
webUrl: shareLink,
mobileWebUrl: shareLink,
},
},
],
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useGatherMemberProfileListService } from '../services/useGatherMemberPr
export const GatherMemberProfileListContainer = () => {
const {
meetingId,
meetingName,
isOpen,
gatherMemberList,
searchInput,
Expand Down Expand Up @@ -40,6 +41,8 @@ export const GatherMemberProfileListContainer = () => {
onClose={inviteModalClose}
topTitle="모임원들을 모링으로"
bottomTitle="초대해보세요!"
shareDescription={`${meetingName} 모임에 여러분들을 초대합니다`}
shareImageUrl="https://file.moring.one/defaults/invite_narrow.png"
shareLink={inviteLink}
/>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getWebDomain } from '@/common';
import { generateInviteLink } from '@/common/utils/generateInviteLink';
import { getKeywordRegex } from '@/common/utils/getKeywordRegex';
import { useGetInviteCode } from '@/home/common/apis/queries/useGetInviteCode';
import { useGetMeetingInfo } from '@/home/common/apis/queries/useGetMeetingName';
import { MemberType } from '@/home/common/apis/schema/useGetProgressingQuestionQuery.type';
import { HomeAtoms } from '@/home/common/atoms/home.atom';

Expand All @@ -30,6 +31,10 @@ export const useGatherMemberProfileListService = () => {
options: { enabled: !!meetingId },
});

const { data: meetingInfo } = useGetMeetingInfo({});

const meetingName = meetingInfo?.meetings.find((meeting) => meeting.meetingId === Number(meetingId))?.name;

const handleChangeSearchInput = (value: string) => {
setSearchInput(value);
};
Expand Down Expand Up @@ -70,6 +75,7 @@ export const useGatherMemberProfileListService = () => {

return {
meetingId,
meetingName,
isOpen,
inviteLink: generateInviteLink(inviteCode?.code) ?? `${getWebDomain()}`,
searchInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface QuestionProps {

export const Question = ({ id, imageUrl, title, usedCount, meetingId }: QuestionProps) => {
const openModal = useModal();
const { refetch } = useRelayQuestionQuery(1);
const { refetch } = useRelayQuestionQuery(id);

const router = useRouter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const CurrentRelayQuestionCountContainer = () => {

if (!activeQuestion || !data) return;

const currentMeetingName = data.meetings.find(({ meetingId }) => meetingId === Number(meetingId))?.name;
const currentMeetingName = data.meetings.find((meeting) => meeting.meetingId === Number(meetingId))?.name;

return (
<>
Expand Down Expand Up @@ -89,7 +89,7 @@ export const CurrentRelayQuestionCountContainer = () => {
topTitle="모임원들에게 릴레이 질문을"
bottomTitle="공유해 보세요!"
shareImageUrl={KAKAO_IMAGE_URL}
shareDescription={`새로운 질문이 도착했어요! 지금 바로 답변 하러 가볼까요? 다음 질문인은 ${activeQuestion.targetMember.name}님이에요`}
shareDescription={`새로운 질문이 도착했어요! 지금 바로 답변 하러 가볼까요? 다음 질문인은 ${activeQuestion?.nextTargetMember?.name || '000'}님이에요`}
shareLink={`${getWebDomain()}/${meetingId}/answer/opening`}
/>
</>
Expand Down
Loading