Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import extImg from '/assets/onBoarding/icons/ext.svg';
import pinImg from '/assets/onBoarding/icons/pin.svg';
const FinalStep = () => {
return (
<div className="flex h-full flex-col items-center">
<div className="flex h-full flex-col items-center px-[3.2rem]">
<img src={dotori} className="mb-[1.2rem]" alt="dotori" />
<p className="head2 text-font-black-1">Pinback에 오신 걸 환영해요</p>
<p className="body2-m text-font-gray-3 mb-[1.4rem] mt-[0.8rem] text-center">
Expand Down
24 changes: 18 additions & 6 deletions apps/extension/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ import MainPop from './pages/MainPop';
import { useState, useEffect } from 'react';
import { useGetArticleSaved } from '@apis/query/queries';
import { usePageMeta } from './hooks/usePageMeta';
import LogOutPop from './pages/LogOutPop';
const App = () => {
const { url } = usePageMeta();
const { data: isSaved } = useGetArticleSaved(url);

const [isDuplicatePop, setIsDuplicatePop] = useState(false);
const [mainPopType, setMainPopType] = useState<'add' | 'edit'>('add');
const [isToken, setIsToken] = useState<boolean | null>(null);

useEffect(() => {
chrome.storage.local.get('token', (result) => {
setIsToken(!!result.token);
});
}, []);
Comment on lines +14 to +20
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

토큰 확인 전 로딩 상태 처리 필요

isTokennull(초기값)일 때 falsy로 평가되어 LogOutPop이 렌더링됩니다. 이로 인해 로그인된 사용자도 토큰 확인이 완료되기 전까지 잠깐 로그아웃 화면을 보게 됩니다.

로딩 상태를 명시적으로 처리하는 것을 권장합니다:

🔎 수정 제안
   const [isToken, setIsToken] = useState<boolean | null>(null);

+  // 토큰 확인 중일 때 로딩 표시
+  if (isToken === null) {
+    return null; // 또는 로딩 스피너
+  }

   return (
     <>
-      {/* <LogOutPop /> */}
       {isToken ? (

Also applies to: 39-50

🤖 Prompt for AI Agents
In apps/extension/src/App.tsx around lines 14 to 20 (and similarly at 39-50),
the component treats isToken null as falsy and immediately renders the LogOutPop
before chrome.storage check completes; change the logic to explicitly represent
loading (keep isToken initial value null) and avoid rendering auth-dependent UI
while isToken === null: add a loading branch (or return null / a spinner) until
chrome.storage callback sets isToken to true/false, and ensure all conditional
renders that currently check falsy values use explicit comparisons (isToken ===
true / isToken === false) so users don't see the logout screen briefly.

useEffect(() => {
if (isSaved?.data) {
setIsDuplicatePop(true);
Expand All @@ -28,13 +35,18 @@ const App = () => {

return (
<>
{isDuplicatePop ? (
<DuplicatePop
onLeftClick={handleDuplicateLeftClick}
onRightClick={handleDuplicateRightClick}
/>
{/* <LogOutPop /> */}
{isToken ? (
isDuplicatePop ? (
<DuplicatePop
onLeftClick={handleDuplicateLeftClick}
onRightClick={handleDuplicateRightClick}
/>
) : (
<MainPop type={mainPopType} />
)
) : (
<MainPop type={mainPopType} savedData={isSaved?.data} />
<LogOutPop />
)}
</>
);
Expand Down
5 changes: 5 additions & 0 deletions apps/extension/src/assets/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/extension/src/hooks/usePageMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const usePageMeta = () => {
// // chrome-extension:// 은 내부 페이지로 취급하지 않음

// if (isInternalChromePage || !imageUrl?.title) {
// window.close();
//
// return;
// }
setMeta(newMeta);
Expand Down
34 changes: 34 additions & 0 deletions apps/extension/src/pages/LogOutPop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Icon } from '@pinback/design-system/icons';

const LogOutPop = () => {
return (
<div className="bg-white-bg common-shadow flex h-[35.5rem] w-[31.2rem] flex-col items-center justify-center rounded-[1.2rem] px-[3.2rem] py-[2.4rem]">
<div className="mr-auto">
<Icon name="main_logo" width={72} height={20} />
</div>
<div className="flex items-center justify-center pb-[1rem] pt-[0.8rem] text-center">
<Icon name="logout_chippi.2512" width={132} height={132} />
</div>
<p className="sub2-sb mb-[0.4rem] text-black">
치삐를 만나려면 로그인이 필요해요!
</p>
<p className="body4-r text-font-gray-3 px-[4.15rem] text-center">
지금 로그인하고 북마크한 정보의
<br /> 리마인드 알람을 받아보세요
</p>
<button
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

button은 type 명시적으로 지정해주세요!

className="sub4-sb mt-[1.6rem] flex h-[4.4rem] w-[25.15rem] items-center justify-between rounded-full border border-gray-100 bg-white px-[2rem]"
type="button"
onClick={() => {
chrome.tabs.create({
url: 'https://www.pinback.today/onboarding?step=SOCIAL_LOGIN',
});
}}
>
<Icon name="google" width={21} height={21} />
구글 계정으로 로그인/회원가입
</button>
</div>
);
};
export default LogOutPop;
17 changes: 3 additions & 14 deletions apps/extension/src/pages/MainPop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
import { useState, useEffect } from 'react';
import { usePageMeta } from '@hooks/usePageMeta';
import { useSaveBookmark } from '@hooks/useSaveBookmarks';
import { Icon } from '@pinback/design-system/icons';

import Header from '@shared/components/Header';
import {
usePostArticle,
useGetCategoriesExtension,
Expand Down Expand Up @@ -221,7 +220,6 @@ const MainPop = ({ type, savedData }: MainPopProps) => {
date: isRemindOn ? currentDate : date,
time: isRemindOn ? currentTime : time,
});
//window.close();
},
}
);
Expand Down Expand Up @@ -284,18 +282,9 @@ const MainPop = ({ type, savedData }: MainPopProps) => {
onRightClick={saveHandleCategory}
/>
)}
<div className="flex flex-col justify-between gap-[1.6rem] rounded-[12px] bg-white px-[3.2rem] py-[2.4rem] text-black">
<div className="mr-auto">
<Icon
name="main_logo"
width={72}
height={20}
onClick={() => {
chrome.tabs.create({ url: 'https://www.pinback.today/' });
}}
/>
</div>

<div className="flex flex-col justify-between gap-[1.6rem] rounded-[12px] bg-white px-[3.2rem] py-[2.4rem] text-black">
<Header />
{loading ? (
<div className="bg-gray100 h-[6.8rem] w-[full] animate-pulse rounded-[4px]" />
) : (
Expand Down
23 changes: 23 additions & 0 deletions apps/extension/src/shared/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Icon } from '@pinback/design-system/icons';
import { useState } from 'react';
const Header = () => {
const [isHover, setIsHover] = useState(false);
return (
<header className="flex items-center justify-between">
<Icon
name={isHover ? 'ext_home2' : 'ext_home1'}
width={28}
height={28}
className="cursor-pointer"
onMouseEnter={() => setIsHover(true)}
onMouseLeave={() => setIsHover(false)}
onClick={() => {
chrome.tabs.create({ url: 'https://www.pinback.today/' });
}}
/>
<Icon name="main_logo" width={72} height={20} />
</header>
);
};

export default Header;
3 changes: 2 additions & 1 deletion apps/extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
"@components/*": ["src/components/*"],
"@utils/*": ["src/utils/*"],
"@apis/*": ["src/apis/*"],
"@hooks/*":["src/hooks/*"],
"@hooks/*": ["src/hooks/*"],
"@constants/*": ["src/constants/*"],
"@shared-types/*": ["src/types/*"],
"@api/*": ["src/api/*"],
"@shared/*": ["src/shared/*"]
}
},
"include": ["src/**/*", "manifest.json", "popup.html", "vite.config.ts"],
Expand Down
4 changes: 4 additions & 0 deletions packages/design-system/src/icons/iconNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
export const iconNames = [
'chippi_profile',
'dotori',
'ext_home1',
'ext_home2',
'extension_pop',
'extension_thumb',
'google',
'ic_arrow_down_active',
'ic_arrow_down_disable',
'ic_bookmark_active',
Expand All @@ -17,6 +20,7 @@ export const iconNames = [
'ic_info',
'ic_plus',
'logo',
'logout_chippi.2512',
'main_header_logo',
'main_logo',
'saved',
Expand Down
12 changes: 1 addition & 11 deletions packages/design-system/src/icons/source/chippi_profile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/design-system/src/icons/source/ext_home1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/design-system/src/icons/source/ext_home2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/design-system/src/icons/source/google.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 1 addition & 10 deletions packages/design-system/src/icons/source/tooltip_1.svg
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

툴팁 이미지 변경된거같은데 이부분은 파일 뺴고 올려주실 수 있나요?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 1 addition & 10 deletions packages/design-system/src/icons/source/tooltip_2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 1 addition & 10 deletions packages/design-system/src/icons/source/tooltip_3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 1 addition & 10 deletions packages/design-system/src/icons/source/tooltip_4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 1 addition & 10 deletions packages/design-system/src/icons/source/tooltip_5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading