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

[Feat] 프로필 공유 개선 #563

Merged
merged 5 commits into from
Feb 14, 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
Binary file modified public/og-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions src/app/mypage/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ function Header() {
};
const handleClickShare = async () => {
if (!data) return;

eventLogger.logEvent(EVENT_LOG_CATEGORY.MY_PAGE, EVENT_LOG_NAME.MY_PAGE.CLICK_SHARE);

const shareText = `10mm - ${data.nickname}님을\n팔로우하고 습관을 만들어보아요!\n\n${
window.location.origin + ROUTER.PROFILE.DETAIL(data.memberId) + '?urlShare=true'
}`;

try {
window.navigator.share({
title: '10mm - 내 프로필 링크 공유하기',
text: window.location.origin + ROUTER.PROFILE.DETAIL(data.memberId),
text: shareText,
});
} catch (e) {
await copyClipBoard(window.location.origin + ROUTER.PROFILE.DETAIL(data.memberId));
await copyClipBoard(shareText);
triggerSnackBar({
message: '링크가 복사되었습니다.',
offset: 'appBar',
Expand Down
23 changes: 21 additions & 2 deletions src/app/profile/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { useRouter } from 'next/navigation';
import { useFollowsCountTargetId } from '@/apis/follow';
import { useGetMembersById, useGetMembersMe } from '@/apis/member';
import { useGetMissionStack } from '@/apis/mission';
Expand All @@ -9,17 +10,35 @@ import FollowButton from '@/app/profile/[id]/FollowButton';
import ProfileContent from '@/app/profile/[id]/ProfileContent';
import BottomDim from '@/components/BottomDim/BottomDim';
import Header from '@/components/Header/Header';
import { ROUTER } from '@/constants/router';
import { css } from '@styled-system/css';

function FollowProfilePage({ params }: { params: { id: string } }) {
function FollowProfilePage({
params,
searchParams,
}: {
params: { id: string };
searchParams: {
profileShare?: string;
};
}) {
const { data: followCountData, isFetching } = useFollowsCountTargetId(Number(params.id));
const { data } = useGetMembersById(Number(params.id));
const { data: symbolStackData } = useGetMissionStack(params.id);
const { data: memebersMeData } = useGetMembersMe();
const isMyself = memebersMeData?.memberId === Number(params.id);
const router = useRouter();
const handleBack = () => {
router.push(ROUTER.HOME);
};
return (
<main className={backgroundCss}>
<Header rightAction={'none'} headerBgColor={'transparent'} iconColor={'icon.primary'} />
<Header
rightAction={'none'}
headerBgColor={'transparent'}
iconColor={'icon.primary'}
onBackAction={searchParams.profileShare ? handleBack : undefined}
/>
<ProfileContent
memberId={Number(params.id)}
nickname={data?.nickname || ''}
Expand Down
1 change: 1 addition & 0 deletions src/constants/eventLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const EVENT_LOG_NAME = {
CLICK_LEVEL_BANNER: 'click/levelBanner',
CLICK_FOLLOW_FOLLOW: 'click/followFollow',
CLICK_SETTING: 'click/setting',
CLICK_SHARE: 'click/share',
},
FOLLOW_LIST: {
CLICK_FOLLOW_BUTTON: 'click/followButton',
Expand Down
Loading