Skip to content

Commit 8e8cea9

Browse files
committed
feat: 채널톡 추가 및 헤더 로고 동작 추가
1 parent 8af3ea3 commit 8e8cea9

File tree

7 files changed

+45
-6
lines changed

7 files changed

+45
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"test": "jest"
1414
},
1515
"dependencies": {
16+
"@channel.io/channel-web-sdk-loader": "^2.0.0",
1617
"@sentry/nextjs": "^8.47.0",
1718
"@tanstack/react-query": "^5.61.3",
1819
"@tanstack/react-query-devtools": "^5.62.11",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/layout.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as sentry from '@sentry/nextjs';
55
import type { Metadata } from 'next';
66
import { ReactNode } from 'react';
77
import './globals.css';
8-
import { QueryProvider } from '@/components';
8+
import { ChannelTalkProvider, QueryProvider } from '@/components';
99

1010
export const metadata: Metadata = {
1111
title: 'Velog Dashboard',
@@ -23,8 +23,10 @@ export default function RootLayout({
2323
<body className={`${NotoSansKr.className} w-full bg-BG-MAIN`}>
2424
<sentry.ErrorBoundary>
2525
<QueryProvider>
26-
<ToastContainer autoClose={2000} />
27-
{children}
26+
<ChannelTalkProvider>
27+
<ToastContainer autoClose={2000} />
28+
{children}
29+
</ChannelTalkProvider>
2830
</QueryProvider>
2931
</sentry.ErrorBoundary>
3032
</body>

src/components/auth-required/header/Section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ type PropType<T extends clickType> = T extends 'link'
2424
? Partial<BaseType> & {
2525
clickType: 'function';
2626
action: () => void;
27-
children: React.ReactNode | React.ReactNode[];
27+
children: React.ReactNode;
2828
}
2929
: T extends 'none'
3030
? Partial<BaseType> & {
3131
clickType: 'none';
3232
action?: undefined;
33-
children: React.ReactNode | React.ReactNode[];
33+
children: React.ReactNode;
3434
}
3535
: never;
3636

src/components/auth-required/header/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ export const Header = () => {
6262
return (
6363
<nav className="w-full max-MBI:flex max-MBI:justify-center">
6464
<div className="flex w-fit">
65-
<Section clickType="none">
65+
<Section
66+
clickType="function"
67+
action={() => router.replace(`/main${PARAMS.MAIN}`)}
68+
>
6669
<Image
6770
width={35}
6871
height={35}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use client';
2+
3+
import * as ChannelService from '@channel.io/channel-web-sdk-loader';
4+
import { useEffect } from 'react';
5+
6+
const ChannelTalkServiceLoader = () => {
7+
const CHANNELTALK_PLUGIN_KEY = process.env.NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY;
8+
if (!CHANNELTALK_PLUGIN_KEY) {
9+
throw new Error('ABORT_MS가 ENV에서 설정되지 않았습니다');
10+
}
11+
console.log(CHANNELTALK_PLUGIN_KEY);
12+
13+
ChannelService.loadScript();
14+
ChannelService.boot({ pluginKey: CHANNELTALK_PLUGIN_KEY });
15+
};
16+
17+
export const ChannelTalkProvider = ({
18+
children,
19+
}: {
20+
children: React.ReactNode;
21+
}) => {
22+
useEffect(() => ChannelTalkServiceLoader(), []);
23+
return <>{children}</>;
24+
};

src/components/common/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './ChannelTalkProvider';
12
export * from './QueryProvider';
23
export * from './ArriveSoon';
34
export * from './Dropdown';

0 commit comments

Comments
 (0)