Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 922bcba

Browse files
authored
fix: 241211 몇가지 수정 #patch (#64)
* 고양이 선택 부분 gap 조정 * yarn audit fix 실행 * 입력한 고양이 이름이 아닌 고정값으로 * template 이미지 적용 * 휴식대기 화면 상단 마진 축소 하단의 휴식 시작하기 버튼과 겹침을 방지하기 위함 * 최소화 창 사이즈 높이 더 줄이기 * 최소화 화면의 글자 이미지에 맞춰 중앙정렬 * 휴식 화면 간격 조정하면서 다른 화면도 비슷하게 수정 * 상하단 패딩 수정 * 창을 닫았다 다시 열면 ipc 통신이 원할하지 않는 부분 수정 트레이의 종료 버튼을 누르기 전까지 계속 실행되도록 수정
1 parent c7ff384 commit 922bcba

File tree

9 files changed

+512
-491
lines changed

9 files changed

+512
-491
lines changed

package.json

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"lint": "eslint --ext .ts,.tsx ."
1313
},
1414
"devDependencies": {
15-
"@electron-forge/cli": "^7.4.0",
16-
"@electron-forge/maker-deb": "^7.4.0",
17-
"@electron-forge/maker-rpm": "^7.4.0",
18-
"@electron-forge/maker-squirrel": "^7.4.0",
19-
"@electron-forge/maker-zip": "^7.4.0",
20-
"@electron-forge/plugin-auto-unpack-natives": "^7.4.0",
21-
"@electron-forge/plugin-fuses": "^7.4.0",
22-
"@electron-forge/plugin-vite": "^7.4.0",
23-
"@electron-forge/publisher-github": "^7.4.0",
15+
"@electron-forge/cli": "^7.6.0",
16+
"@electron-forge/maker-deb": "^7.6.0",
17+
"@electron-forge/maker-rpm": "^7.6.0",
18+
"@electron-forge/maker-squirrel": "^7.6.0",
19+
"@electron-forge/maker-zip": "^7.6.0",
20+
"@electron-forge/plugin-auto-unpack-natives": "^7.6.0",
21+
"@electron-forge/plugin-fuses": "^7.6.0",
22+
"@electron-forge/plugin-vite": "^7.6.0",
23+
"@electron-forge/publisher-github": "^7.6.0",
2424
"@electron/fuses": "^1.8.0",
2525
"@types/node": "^20.14.10",
2626
"@types/react": "^18.3.3",
@@ -38,10 +38,10 @@
3838
"postcss": "^8.4.39",
3939
"prettier": "^3.3.2",
4040
"prettier-plugin-tailwindcss": "^0.6.6",
41-
"tailwindcss": "^3.4.4",
41+
"tailwindcss": "^3.4.16",
4242
"ts-node": "^10.0.0",
4343
"typescript": "~4.5.4",
44-
"vite": "^5.0.12",
44+
"vite": "^5.4.11",
4545
"vite-plugin-svgr": "^4.2.0"
4646
},
4747
"author": {
@@ -88,5 +88,10 @@
8888
"update-electron-app": "^3.0.0",
8989
"usehooks-ts": "^3.1.0",
9090
"vaul": "^0.9.1"
91+
},
92+
"resolutions": {
93+
"cross-spawn": "^7.0.3",
94+
"path-to-regexp": "^0.1.10",
95+
"body-parser": "^1.20.3"
9196
}
9297
}

src/main/main.ts

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,24 @@ updateElectronApp({
1212
},
1313
});
1414

15+
let mainWindow: BrowserWindow | null = null;
16+
let tray: Tray | null = null;
17+
let forceQuit = false;
18+
1519
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
1620
if (require('electron-squirrel-startup')) {
21+
forceQuit = true;
1722
app.quit();
1823
}
1924

2025
const WindowSizeMap = {
21-
minimized: { width: 400, height: 220 },
26+
minimized: { width: 400, height: 200 },
2227
normal: { width: 400, height: 720 },
2328
};
2429

2530
const createWindow = () => {
2631
// Create the browser window.
27-
const mainWindow = new BrowserWindow({
32+
const browserWindow = new BrowserWindow({
2833
webPreferences: {
2934
preload: path.join(__dirname, 'preload.js'),
3035
webSecurity: false,
@@ -39,25 +44,34 @@ const createWindow = () => {
3944

4045
// and load the index.html of the app.
4146
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
42-
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
47+
browserWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
4348
} else {
44-
mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
49+
browserWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
4550
}
4651

4752
// // Open the DevTools.
48-
// mainWindow.webContents.openDevTools();
53+
// browserWindow.webContents.openDevTools();
4954

5055
// @note: 외부 링크 클릭 시 별도 브라우저로 열도록 설정함
5156
// 외부 링크 여부는 url이 https://로 시작하는지로 판단함
52-
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
57+
browserWindow.webContents.setWindowOpenHandler(({ url }) => {
5358
if (url.startsWith('https://')) {
5459
shell.openExternal(url);
5560
return { action: 'deny' };
5661
}
5762
return { action: 'allow' };
5863
});
5964

60-
return mainWindow;
65+
// @see: https://stackoverflow.com/questions/38309240/object-has-been-destroyed-when-open-secondary-child-window-in-electron-js/39135293
66+
// 창이 닫히지 않고 숨겨지도록 설정함
67+
browserWindow.on('close', (event) => {
68+
if (!forceQuit) {
69+
event.preventDefault();
70+
browserWindow?.hide();
71+
}
72+
});
73+
74+
return browserWindow;
6175
};
6276

6377
const trayIconMap: Record<string, string> = {
@@ -72,7 +86,11 @@ const trayIconMap: Record<string, string> = {
7286
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADoSURBVHgB3ZIxDoIwFIb/Eg7gEWBxldFNiLOJR+AG6g3AY+Cio6NxcDK66cgN8AawmLjVV62JkhYrOBi/5IWmr+/j5bXAr8N0Cc55Rh9HmdytgeMWuJwLMGvO4mRSKSSZL8qUss3yLnvtK2bTJBIrC2o86EgPik0+eqx0wh5q8nmH3b5qd6EV0vwc6C5DEAwAt72n6Re3AKf5zcba8yQc8mpy8VMZrXK9rXD6qEZIMrk+UbjPSdUMOzBn9fYENyeCCeJRU4Qy8kYyw24j1IEKva/JpLD8fEI0QXRTR2ZX5AoZAWMsxd9wBR1E9hNu08zLAAAAAElFTkSuQmCC',
7387
};
7488
const getTrayIcon = (icon: string): NativeImage => {
75-
return nativeImage.createFromDataURL(trayIconMap[icon] ?? trayIconMap.default);
89+
const image = nativeImage.createFromDataURL(trayIconMap[icon] ?? trayIconMap.default);
90+
// https://stackoverflow.com/questions/41664208/electron-tray-icon-change-depending-on-dark-theme
91+
// @note: 템플릿 이미지 설정을 해줘야 배경에 맞춰 자동으로 아이콘 색상 변경됨
92+
image.setTemplateImage(true);
93+
return image;
7694
};
7795

7896
const createTray = (mainWindow: BrowserWindow) => {
@@ -88,15 +106,18 @@ const createTray = (mainWindow: BrowserWindow) => {
88106
},
89107
},
90108
{ type: 'separator' },
91-
{ label: '종료', role: 'quit' },
109+
{
110+
label: '종료',
111+
click: () => {
112+
forceQuit = true;
113+
app.quit();
114+
},
115+
},
92116
]);
93117
tray.setContextMenu(contextMenu);
94118
return tray;
95119
};
96120

97-
let mainWindow: BrowserWindow | null = null;
98-
let tray: Tray | null = null;
99-
100121
// This method will be called when Electron has finished
101122
// initialization and is ready to create browser windows.
102123
// Some APIs can only be used after this event occurs.
@@ -109,6 +130,7 @@ app.on('ready', () => {
109130
// explicitly with Cmd + Q.
110131
app.on('window-all-closed', () => {
111132
if (process.platform !== 'darwin') {
133+
forceQuit = true;
112134
app.quit();
113135
}
114136
});
@@ -154,7 +176,7 @@ app.whenReady().then(() => {
154176
});
155177
ipcMain.handle('get-minimized', () => {
156178
const [, height] = mainWindow?.getMinimumSize() || [0, 0];
157-
return height === 220;
179+
return height === WindowSizeMap.minimized.height;
158180
});
159181
ipcMain.handle('set-minimized', (event, isMinimized: boolean) => {
160182
if (isMinimized) {

src/renderer/pages/pomodoro.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { FocusScreen, HomeScreen, RestScreen, RestWaitScreen } from '@/widgets/p
2121

2222
// @note: 개발할 때, 초과시간까지 빠르게 테스트하기 위해 설정함
2323
// 원래대로 하고 싶으면 false로 변경해서 사용하면 됩니다
24-
const isFastForward = import.meta.env.DEV;
24+
const isFastForward = false; //import.meta.env.DEV;
2525
const taping = (ms: number) => (isFastForward ? Math.floor(ms / 60) : ms);
2626

2727
const focusExceedMaxTime = taping(minutesToMs(60));

src/renderer/pages/selection.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ const alarmMessageMap: Record<CatType, string> = {
3535
BLACK: '어디갔나옹...',
3636
THREE_COLOR: '내가 여기있는데 어디갔냐옹!',
3737
};
38+
const typeNameMap: Record<CatType, string> = {
39+
CHEESE: '치즈냥',
40+
BLACK: '까만냥',
41+
THREE_COLOR: '삼색냥',
42+
};
3843
const RIVE_STATE_MACHINE_NAME = 'State Machine_selectCat';
3944

4045
const Selection = () => {
@@ -49,6 +54,7 @@ const Selection = () => {
4954
no: cat.no,
5055
name: cat.name,
5156
type: cat.type,
57+
typeName: typeNameMap[cat.type],
5258
id: String(cat.no),
5359
iconName: iconNameMap[cat.type],
5460
adjective: adjectiveMap[cat.type],
@@ -95,7 +101,7 @@ const Selection = () => {
95101
<Frame>
96102
<Frame.NavBar title="고양이 선택" onBack={handleClickBackButton} />
97103

98-
<div className="flex w-full flex-col gap-[42px]">
104+
<div className="flex w-full flex-col gap-[24px]">
99105
<div className="flex flex-col gap-1">
100106
<h1 className="header-3 text-text-primary">어떤 고양이와 함께할까요?</h1>
101107
<p className="body-r text-text-secondary">언제든지 다른 고양이와 함께할 수 있어요</p>
@@ -148,7 +154,8 @@ const Selection = () => {
148154
selectedCatId === cat.id ? 'text-text-primary' : 'text-text-secondary',
149155
)}
150156
>
151-
{cat.name}
157+
{/* @note: 유저가 입력한 고양이 이름이 아닌 종류에 대한 이름을 보여준다 */}
158+
{cat.typeName}
152159
</span>
153160
</SelectGroupItem>
154161
))}

src/renderer/widgets/pomodoro/ui/focus-screen.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const FocusScreen = ({
6868
</div>
6969
</header>
7070
<div className="flex items-center p-6 pt-3">
71-
<div>
71+
<div className="flex flex-col items-start justify-center">
7272
<h2 className="body-sb flex gap-1 text-text-tertiary">
7373
<Icon name={getCategoryIconName(currentCategory)} size="sm" />
7474
{currentCategory}
@@ -78,14 +78,16 @@ export const FocusScreen = ({
7878
seconds={seconds}
7979
className="mb-1 mt-2 gap-xs text-[40px] font-bold leading-[48px] tracking-[-.02em] text-text-primary"
8080
/>
81-
<div className={cn('flex items-center gap-xs', isExceed ? 'opacity-100' : 'opacity-0')}>
82-
<Time
83-
minutes={exceedMinutes}
84-
seconds={exceedSeconds}
85-
className="header-5 gap-0 text-text-accent-1"
86-
/>
87-
<span className="header-5 text-text-accent-1">초과</span>
88-
</div>
81+
{isExceed && (
82+
<div className="flex items-center gap-xs">
83+
<Time
84+
minutes={exceedMinutes}
85+
seconds={exceedSeconds}
86+
className="header-5 gap-0 text-text-accent-1"
87+
/>
88+
<span className="header-5 text-text-accent-1">초과</span>
89+
</div>
90+
)}
8991
</div>
9092
<div className="flex-1" />
9193
<img src={hairballImage} width="86" height="86" />
@@ -97,7 +99,7 @@ export const FocusScreen = ({
9799
return (
98100
<SimpleLayout>
99101
<div className="relative flex h-full flex-col">
100-
<header className="flex p-4">
102+
<header className="flex px-4 py-2">
101103
<div className="subBody-sb flex w-[80px] gap-sm rounded-xs bg-background-secondary p-md text-text-tertiary">
102104
<Icon name={getCategoryIconName(currentCategory)} size="sm" />
103105
{currentCategory}
@@ -148,22 +150,22 @@ export const FocusScreen = ({
148150
<Time
149151
minutes={exceedMinutes}
150152
seconds={exceedSeconds}
151-
className="header-4 gap-0 text-text-accent-1"
153+
className="header-4 gap-0 text-text-accent-red"
152154
/>
153-
<span className="header-4 text-text-accent-1">초과</span>
155+
<span className="header-4 text-text-accent-red">초과</span>
154156
</div>
155157
</div>
156158
</main>
157-
<div className="flex w-full flex-col items-center pb-5">
159+
<div className="flex w-full flex-col items-center gap-2 pb-5">
158160
<Button
159161
variant={isExceed ? 'primary' : 'secondary'}
160-
className="w-[200px] p-xl"
162+
className="h-[60px] w-[200px] p-xl"
161163
size="lg"
162164
onClick={handleRest}
163165
>
164166
휴식하기
165167
</Button>
166-
<Button variant="text-secondary" size="md" onClick={handleEnd}>
168+
<Button variant="text-secondary" size="md" className="h-[40px]" onClick={handleEnd}>
167169
집중 끝내기
168170
</Button>
169171
</div>

src/renderer/widgets/pomodoro/ui/rest-screen.tsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const RestScreen = ({
7171
</div>
7272
</header>
7373
<div className="flex items-center p-6 pt-3">
74-
<div>
74+
<div className="flex flex-col items-start justify-center">
7575
<h2 className="body-sb flex gap-1 text-text-tertiary">
7676
<Icon name={getCategoryIconName(currentCategory)} size="sm" />
7777
{currentCategory}
@@ -81,14 +81,16 @@ export const RestScreen = ({
8181
seconds={seconds}
8282
className="mb-1 mt-2 gap-xs text-[40px] font-bold leading-[48px] tracking-[-.02em] text-text-primary"
8383
/>
84-
<div className={cn('flex items-center gap-xs', isExceed ? 'opacity-100' : 'opacity-0')}>
85-
<Time
86-
minutes={exceedMinutes}
87-
seconds={exceedSeconds}
88-
className="header-5 gap-0 text-text-accent-1"
89-
/>
90-
<span className="header-5 text-text-accent-1">초과</span>
91-
</div>
84+
{isExceed && (
85+
<div className="flex items-center gap-xs">
86+
<Time
87+
minutes={exceedMinutes}
88+
seconds={exceedSeconds}
89+
className="header-5 gap-0 text-text-accent-1"
90+
/>
91+
<span className="header-5 text-text-accent-1">초과</span>
92+
</div>
93+
)}
9294
</div>
9395
<div className="flex-1" />
9496
<img src={hairballImage} width="86" height="86" />
@@ -100,7 +102,7 @@ export const RestScreen = ({
100102
return (
101103
<SimpleLayout>
102104
<div className="relative flex h-full flex-col">
103-
<header className="flex p-4">
105+
<header className="flex px-4 py-2">
104106
<div className="subBody-sb flex h-[40px] items-center gap-sm rounded-xs bg-background-secondary px-3 py-2 text-text-tertiary">
105107
<Icon name={getCategoryIconName(currentCategory)} size="sm" />
106108
{currentCategory}
@@ -122,7 +124,7 @@ export const RestScreen = ({
122124
</div>
123125
</header>
124126

125-
<main className="flex flex-1 flex-col items-center justify-center gap-5">
127+
<main className="flex flex-1 flex-col items-center justify-center gap-4">
126128
<Tooltip
127129
content={!isExceed ? '쉬는게 제일 좋다냥' : '이제 다시 사냥놀이 하자냥!'}
128130
color="white"
@@ -185,11 +187,16 @@ export const RestScreen = ({
185187
</div>
186188
</main>
187189

188-
<div className="flex w-full flex-col items-center pb-5">
189-
<Button variant="secondary" className="w-[200px]" size="lg" onClick={handleFocus}>
190+
<div className="flex w-full flex-col items-center gap-2 pb-5">
191+
<Button
192+
variant="secondary"
193+
className="h-[60px] w-[200px]"
194+
size="lg"
195+
onClick={handleFocus}
196+
>
190197
한번 더 집중하기
191198
</Button>
192-
<Button variant="text-secondary" size="md" onClick={handleEnd}>
199+
<Button variant="text-secondary" size="md" className="h-[40px]" onClick={handleEnd}>
193200
집중 끝내기
194201
</Button>
195202
</div>

src/renderer/widgets/pomodoro/ui/rest-wait-screen.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const RestWaitScreen = ({
3838
return (
3939
<SimpleLayout>
4040
<div className="flex h-full flex-col">
41-
<header className="h-[56px]" />
41+
<header className="h-[16px]" />
4242
<main className="flex flex-1 flex-col items-center justify-center gap-5">
4343
<div className="flex flex-col items-center justify-center gap-sm">
4444
<CategoryChip category={currentCategory} />
@@ -110,11 +110,16 @@ export const RestWaitScreen = ({
110110
</SelectGroup>
111111
</div>
112112
</main>
113-
<div className="flex w-full flex-col items-center pb-5">
114-
<Button variant="primary" className="w-[200px] p-xl" size="lg" onClick={handleRest}>
113+
<div className="flex w-full flex-col items-center gap-2 pb-5">
114+
<Button
115+
variant="primary"
116+
className="h-[60px] w-[200px] p-xl"
117+
size="lg"
118+
onClick={handleRest}
119+
>
115120
휴식 시작하기
116121
</Button>
117-
<Button variant="text-secondary" size="md" onClick={handleEnd}>
122+
<Button variant="text-secondary" size="md" className="h-[40px]" onClick={handleEnd}>
118123
집중 끝내기
119124
</Button>
120125
</div>

tailwind.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ module.exports = {
134134
inverse: colors.white,
135135
accent: {
136136
1: colors.orange[500],
137+
red: colors.red[300],
137138
},
138139
},
139140

0 commit comments

Comments
 (0)