Skip to content

Commit 7a7f681

Browse files
πŸ› οΈ fix: mainWindow reload on upload-video error in Electron app
πŸ“ style: adjust floating window height and refactor Floating component styles βž• feat: replace PauseIcon with StopCircle from lucide-react in Floating component - In the Electron main process, added a line to reload the mainWindow in the event of an upload-video error. This ensures the UI is refreshed and can handle the error more gracefully. - Adjusted the floating window's height from 130px to 140px to better accommodate UI elements. - Refactored the Floating component by importing styles consistently with double quotes, adding the `StopCircle` icon from `lucide-react` for a more intuitive UI, and removing the unused `PauseIcon`. This improves code readability and user interaction with the recording controls.
1 parent 0a42e6b commit 7a7f681

2 files changed

Lines changed: 8 additions & 28 deletions

File tree

β€Žapps/desktop/electron/main.tsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ ipcMain.handle('upload-video', async (_, uploadFile, uploadLink: string) => {
468468
tags: { module: "uploadVideo" },
469469
extra: { error }
470470
});
471+
mainWindow?.reload();
471472
}
472473
});
473474

@@ -847,7 +848,7 @@ const requestPermissions = async (permission: string): Promise<boolean> => {
847848
function createFloatingWindow() {
848849
const floatingWindow = new BrowserWindow({
849850
width: 60,
850-
height: 130,
851+
height: 140,
851852
x: 0,
852853
y: 0,
853854
resizable: false,

β€Žapps/desktop/src/components/Floating.tsxβ€Ž

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useEffect, useState } from "react";
2-
import styles from '../styles/Floating.module.css';
2+
import styles from "../styles/Floating.module.css";
3+
import { StopCircle } from "lucide-react";
34

45
const DragIcon: React.FC = () => {
56
return (
@@ -25,26 +26,6 @@ const DragIcon: React.FC = () => {
2526
);
2627
};
2728

28-
export const PauseIcon: React.FC = () => {
29-
return (
30-
<svg
31-
xmlns="http://www.w3.org/2000/svg"
32-
width="24"
33-
height="24"
34-
viewBox="0 0 24 24"
35-
fill="none"
36-
stroke="currentColor"
37-
strokeWidth="2"
38-
strokeLinecap="round"
39-
strokeLinejoin="round"
40-
className="lucide lucide-stop-circle"
41-
>
42-
<circle cx="12" cy="12" r="10" />
43-
<rect width="6" height="6" x="9" y="9" />
44-
</svg>
45-
);
46-
};
47-
4829
const stopRecording = async () => {
4930
console.log("stop recording");
5031
await window.electron.stopRecording();
@@ -82,24 +63,22 @@ export const Floating = () => {
8263
return (
8364
<div
8465
style={{
85-
width: "100%",
86-
height: "100%",
8766
display: "flex",
8867
justifyContent: "center",
8968
alignItems: "center",
9069
}}
91-
className={`${styles.draggableArea} m-0 p-0 bg-white dark:bg-gray-800 overflow-hidden`}
70+
className={`${styles.draggableArea} h-screen w-screen m-0 p-0 bg-white dark:bg-gray-800 overflow-hidden`}
9271
>
93-
<div className="divide-y divide-gray-300 dark:divide-gray-600 rounded-md shadow-md md:flex md:divide-y-0 bg-gray-50 dark:bg-gray-700">
72+
<div className="h-full divide-y divide-gray-300 dark:divide-gray-600 rounded-md shadow-md md:flex md:divide-y-0 bg-gray-50 dark:bg-gray-700">
9473
<button
95-
className="group flex w-full items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-600"
74+
className="group flex w-full items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-600 cursor-pointer"
9675
onClick={() => {
9776
setTimer(0);
9877
stopRecording();
9978
}}
10079
>
10180
<span className="flex items-center px-4 py-4 text-sm font-medium text-gray-900 dark:text-gray-200">
102-
<PauseIcon />
81+
<StopCircle className={"text-red-400"} />
10382
</span>
10483
</button>
10584
<span className="group flex w-full items-center justify-center border-t border-b border-gray-300 dark:border-gray-600">

0 commit comments

Comments
Β (0)