diff --git a/.gitignore b/.gitignore index 8a22c6d..aab0b66 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ dist-react dist-electron release *.local +release # Editor directories and files .vscode/* diff --git a/package.json b/package.json index f124b3c..03d74a5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "build": "tsc && vite build", "preview": "vite preview", "transpile:electron": "tsc --project src/electron/tsconfig.json", - "dist:mac": "npm run transpile:electron && npm run build && electron-builder --mac --arm64", + "dist:mac": "npm run transpile:electron && npm run build && electron-builder --mac --x64 --arm64", "dist:win": "npm run transpile:electron && npm run build && electron-builder --win --x64", "dist:linux": "npm run transpile:electron && npm run build && electron-builder --linux --x64", "test:e2e": "playwright test", @@ -68,6 +68,14 @@ "to": "assets" } ], + "mac": { + "target": ["dmg"], + "icon": "build/icon.icns", + "extendInfo": { + "LSUIElement": false, + "LSBackgroundOnly": false + } + }, "win": { "target": [ { diff --git a/src/electron/main.ts b/src/electron/main.ts index 2e54a50..9a4da34 100644 --- a/src/electron/main.ts +++ b/src/electron/main.ts @@ -94,8 +94,8 @@ app.on("ready", async () => { alwaysOnTop: true, skipTaskbar: true, autoHideMenuBar: true, - frame: process.platform === "darwin" ? false : true, - show: false, // speed improvement + frame: true, + show: false, icon: resolveIcon(), webPreferences: { devTools: true, @@ -105,6 +105,10 @@ app.on("ready", async () => { }, }); + win.setAlwaysOnTop(true, 'screen-saver'); + win.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }); + win.setFullScreenable(false); + mainWindow = win; // ------------------------------------ diff --git a/src/electron/utils/utilityFunctions.ts b/src/electron/utils/utilityFunctions.ts index be4d974..c09a7ab 100644 --- a/src/electron/utils/utilityFunctions.ts +++ b/src/electron/utils/utilityFunctions.ts @@ -137,11 +137,14 @@ export const getRunningAppsList = async () => { thumbnailSize: { width: 150, height: 150 } // Optional: set thumbnail size }); + console.log(sources, "Sources Retrieved"); + const app = sources.map(source => ({ name: source.name, pid: source.id, // thumbnail: source.thumbnail // Can be used as screenshot })); + return app } catch (error) { return [] diff --git a/src/ui/utils/quillConfig.tsx b/src/ui/utils/quillConfig.tsx new file mode 100644 index 0000000..7767691 --- /dev/null +++ b/src/ui/utils/quillConfig.tsx @@ -0,0 +1,14 @@ +import ReactQuill from "react-quill-new"; +import Quill from "quill"; +// import ImageResize from "quill-image-resize-module-react"; + +// Quill.register("modules/imageResize", ImageResize); + +export const quillModules = { + toolbar: [ + [{ header: [1, 2, 3, false] }], + ["bold", "italic", "underline"], + ["image", "link"], + ], + // imageResize: {}, +}; diff --git a/src/ui/utils/timeDisplay.tsx b/src/ui/utils/timeDisplay.tsx new file mode 100644 index 0000000..13e6e3b --- /dev/null +++ b/src/ui/utils/timeDisplay.tsx @@ -0,0 +1,41 @@ +// utils/timeDisplay.js +export const getDisplayTime = (project:any, trackingData:any) => { + if (!project) return "0h 0m 0s"; + + // If tracking is active, calculate current time based on server time + session time + if (trackingData?.isTracking && trackingData.startTime) { + const baseSeconds = parseTimeStringToSeconds(project.totalWorkTime); + const sessionSeconds = Math.floor((Date.now() - trackingData.startTime) / 1000); + const totalSeconds = baseSeconds + sessionSeconds; + return formatSecondsToTimeString(totalSeconds); + } + + // If not tracking, just return the server's totalWorkTime + return project.totalWorkTime; +}; + +export const parseTimeStringToSeconds = (timeString:any) => { + if (!timeString || typeof timeString !== 'string') return 0; + + try { + const hourMatch = timeString.match(/(\d+)h/); + const minMatch = timeString.match(/(\d+)m/); + const secMatch = timeString.match(/(\d+)s/); + + const hours = hourMatch ? parseInt(hourMatch[1]) : 0; + const minutes = minMatch ? parseInt(minMatch[1]) : 0; + const seconds = secMatch ? parseInt(secMatch[1]) : 0; + + return hours * 3600 + minutes * 60 + seconds; + } catch (error) { + console.error('Error parsing time string:', timeString, error); + return 0; + } +}; + +export const formatSecondsToTimeString = (totalSeconds:any) => { + const hours = Math.floor(totalSeconds / 3600); + const minutes = Math.floor((totalSeconds % 3600) / 60); + const seconds = totalSeconds % 60; + return `${hours}h ${minutes}m ${seconds}s`; +}; \ No newline at end of file diff --git a/src/ui/utils/timeParser.tsx b/src/ui/utils/timeParser.tsx new file mode 100644 index 0000000..009dfb7 --- /dev/null +++ b/src/ui/utils/timeParser.tsx @@ -0,0 +1,20 @@ +// utils/timeParser.js +export const parseTimeStringToMs = (timeString:string) => { + if (!timeString) return 0; + + const hourMatch = timeString.match(/(\d+)h/); + const minMatch = timeString.match(/(\d+)m/); + const secMatch = timeString.match(/(\d+)s/); + + const hours = hourMatch ? parseInt(hourMatch[1]) : 0; + const minutes = minMatch ? parseInt(minMatch[1]) : 0; + const seconds = secMatch ? parseInt(secMatch[1]) : 0; + + return (hours * 3600 + minutes * 60 + seconds) * 1000; +}; + +export const parseTimeStringToSeconds = (timeString:string) => { + return Math.floor(parseTimeStringToMs(timeString) / 1000); +}; + +