Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed frame, alwaysOnTop enabled, draggable window and resizing #333

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"@types/jest": "^29.5.12",
"@types/node": "22.1.0",
"@types/node": "^22.1.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-test-renderer": "^18.3.0",
Expand Down
1 change: 1 addition & 0 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { registerRefreshHandler, destroyRefreshHandler } from "./refreshHandler"
// }

let mainWindow: BrowserWindow | null = null
let miniWindow: BrowserWindow | null = null

if (process.env.NODE_ENV === 'production') {
const sourceMapSupport = require('source-map-support')
Expand Down
6 changes: 5 additions & 1 deletion src/main/windowHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const registerWindowHandlers = () => {
const windowCache: WindowCache = {};

// 👉 register window handlers
ipcMain.on('open-new-window', (event, url, width, height) => {
ipcMain.on('open-new-window', (event, url, width, height, alwaysOnTop, frame, minWidth, minHeight) => {
// Check if the window for this URL already exists
if (windowCache[url]) {
// Focus the existing window if it exists
Expand All @@ -22,7 +22,11 @@ export const registerWindowHandlers = () => {

const newWindow = new BrowserWindow({
width,
minWidth: 200,
height,
minHeight: 50,
alwaysOnTop: true,
frame: false,
webPreferences: {
webSecurity: false,
preload: app.isPackaged
Expand Down
1 change: 1 addition & 0 deletions src/renderer/config/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const languages: DropdownConfigType[] = [
{ value: 'en', label: 'English' },
{ value: 'si', label: 'Sinhala' },
{ value: 'no', label: 'Norwegian' },
{ value: 'ba', label: 'Bosanski'},
]

const themes: DropdownConfigType[] = [
Expand Down
12 changes: 11 additions & 1 deletion src/renderer/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* {
@apply border-border;
}

body {
@apply bg-background text-foreground;
}
Expand All @@ -28,3 +28,13 @@
@apply bg-foreground/60;
}
}

@layer dashboard {
* {
-webkit-app-region: drag;
}

button {
-webkit-app-region: no-drag;
}
}
47 changes: 47 additions & 0 deletions src/renderer/i18n/ba.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"Welcome": "Ovo je desktop aplikacija koja dohvaća Vaše vrijednosti šećera u krvi uz pomoć LibreLinkUp",
"Settings": "Postavke",
"General": "Općenito",
"Account": "Račun",

"First Name": "Ime",
"Last Name": "Prezime",

"System": "Sistem",
"Dark": "Tamno",
"Light": "Svijetlo",

"German": "Njemački",
"English": "Engleski",
"Sinhala": "Sinhalski",
"Norwegian": "Norveški",

"Germany": "Njemačka",
"European Union": "Evropska Unija",
"European Union 2": "Evropska Unija 2",
"United States": "Sjedinjene Američke Države",
"Asia/Pacific": "Azija/Tihi okean",
"Canada": "Kanada",
"Japan": "Japan",
"United Arab Emirates": "Ujedinjeni Arapski Emirati",
"France": "Francuska",
"Australia": "Australija",

"getCredentialsTitle": "Kako dobiti credentials",
"getCredentialsStep1": "As sharing person, open your <1>Libre smartphone app</1>, go to <3>Connected Apps</3>, click on <5>Manage</5> next to LibreLinkUp, click on <7>Add connection</7> and input the details for the account you wish to use with LibreLinkUpDesktop.",
"getCredentialsStep1Link": "https://play.google.com/store/apps/details?id=com.freestylelibre3.app.de",

"getCredentialsStep2": "Sačuvajte credentials u Vaš upravitelj lozinkama. Možete ih koristiti za sebe ili ih možete podijeliti sa drugima.",
"getCredentialsStep3": "Unesite credentials na ovu login stranicu.",
"getCredentialsStep4": "To je to. 😄",

"Username": "Korisničko ime",
"Password": "Lozinka",
"Login": "Uloguj se",
"Country": "Država",
"Language": "Jezik",
"SelectCountry": "Odaberi državu",
"SelectLanguage": "Odaberi jezik",
"Theme": "Tema",
"Unit": "Mjerna jedinica"
}
4 changes: 4 additions & 0 deletions src/renderer/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import en from "./en.json"
import si from "./si.json"
import no from "./no.json"
import de from "./de.json"
import ba from "./ba.json"

i18next.use(initReactI18next).init({
// lng: 'en', // if you're using a language detector, do not define the lng option
Expand All @@ -22,5 +23,8 @@ i18next.use(initReactI18next).init({
de: {
translation: de,
},
ba: {
translation: ba,
},
},
})
25 changes: 18 additions & 7 deletions src/renderer/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BaseLayout } from "@/layouts/base-layout"
import { useAuthStore } from "@/stores/auth"
import { getCGMData } from "@/lib/linkup"
import { TrendArrow } from "@/components/ui/trend-arrow"
import { GearIcon } from "@radix-ui/react-icons"
import { GearIcon, OpenInNewWindowIcon } from "@radix-ui/react-icons"
import { useNavigate } from "react-router-dom"
import { LoadingScreen } from "@/components/ui/loading"
import { useClearSession } from "@/hooks/session"
Expand Down Expand Up @@ -66,6 +66,11 @@ export default function DashboardPage() {
openNewWindow(path, 1024, 768)
}

const openMinimizedNewWindow = (path: string) => {
setRedirectTo(path);
openNewWindow(path, 200, 50)
}

if (!isReady) {
return <LoadingScreen />
}
Expand All @@ -76,18 +81,24 @@ export default function DashboardPage() {
graphData?.glucoseMeasurement?.ValueInMgPerDl ?? 1,
graphData?.targetLow ?? 1,
graphData?.targetHigh ?? 1
)} flex justify-center items-center`}
)} flex left-2 p-3 items-center`}
>
<button
onClick={() => openSettings('/settings/general')}
className="absolute top-5 right-5 hover:bg-white/20 p-2 rounded-md transition-all"
className="absolute right-1 items-center p-1 hover:bg-white/20 rounded-md transition-all"
>
<GearIcon className="text-white h-5 w-5" />
</button>
<button
onClick={() => openMinimizedNewWindow('/dashboard')}
className="absolute right-10 items-center p-1 hover:bg-white/20 rounded-md transition-all"
>
<GearIcon className="text-white h-6 w-6" />
<OpenInNewWindowIcon className="text-white h-5 w-5" />
</button>
<div className="flex items-center gap-3">
<p className="text-white text-3xl font-semibold">{getUserValue(graphData?.glucoseMeasurement?.ValueInMgPerDl) + ' ' + getUserUnit() }</p>
<div className="flex justify-center items-center h-12 w-12 rounded-full bg-white/25">
<TrendArrow className="h-9 w-9 text-white" trend={graphData?.glucoseMeasurement?.TrendArrow ?? 1} />
<p className="text-white text-1xl font-semibold">{getUserValue(graphData?.glucoseMeasurement?.ValueInMgPerDl) + ' ' + getUserUnit() }</p>
<div className="flex justify-center items-center h-6 w-6 rounded-full bg-white/25">
<TrendArrow className="h-5 w-5 items-center text-white" trend={graphData?.glucoseMeasurement?.TrendArrow ?? 1} />
</div>
</div>
</BaseLayout>
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/pages/settings/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export default function SettingsGeneralPage() {
const resultUnit = useAuthStore((state) => state.resultUnit)
const setResultUnit = useAuthStore((state) => state.setResultUnit)



const { setTheme } = useTheme()
const setAndRefreshTheme = (t: ThemeType) => {
setTheme(t)
Expand Down