Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sajjadmrx committed Dec 15, 2023
2 parents 3125cd9 + 7b9e4c3 commit 07ef369
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 42 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: BuildCode

on:
push:

paths-ignore:
- "*.yml"
- ".github/*"
jobs:
build:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
- "*.md"
- ".github/ISSUE_TEMPLATE/*"
- ".github/assets/*"
- ".github/*"
- "*.md"
jobs:
publish_on_linux:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

# v1.0.4

- رفع شدن مشکل خارج شدن برنامه از صفحه هنگام جا به جا کردن [pull #17](https://github.com/sajjadmrx/btime-desktop/pull/17)
- رفع شدن جا به جا(drag) کردن برنامه یا [#16](https://github.com/sajjadmrx/btime-desktop/issues/16)
- اضافه شدن دنبال کردن تم سیستم

# v1.0.3

- بهبود border ها @ali0sam
Expand Down
46 changes: 40 additions & 6 deletions electron/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, BrowserWindow, Menu, nativeImage, shell, Tray, nativeTheme } from 'electron'
import { app, BrowserWindow, Menu, nativeImage, shell, Tray, nativeTheme, screen } from 'electron'
import path from 'node:path'
import { store } from './store';
import { join } from "node:path";
Expand Down Expand Up @@ -57,7 +57,7 @@ async function createWindow() {
nodeIntegration: true,
contextIsolation: true,
},
height: 180,
height: 190,
width: 170,
frame: false,
transparent: true,
Expand Down Expand Up @@ -93,6 +93,31 @@ async function createWindow() {
}

nativeTheme.themeSource = store.get("theme")
win.on("moved", () => {
if (win) {
let { x, y } = win.getBounds();
const { width, height } = screen.getPrimaryDisplay().workAreaSize;

// Check if the window is out of bounds and adjust the position
if (x < 0) {
x = 0;
} else if (x + win.getBounds().width > width) {
x = width - win.getBounds().width;
}

if (y < 0) {
y = 0;
} else if (y + win.getBounds().height > height) {
y = height - win.getBounds().height;
}

// Set the new bounds if adjustments were made
win.setBounds({ x, y, width: win.getBounds().width, height: win.getBounds().height });

// Save the new position
store.set("bounds", { x, y });
}
});

update(win, app)
}
Expand Down Expand Up @@ -163,8 +188,17 @@ function getContextMenu() {
},
{
label: "Theme",
icon: getIcon("icons/theme.png"),
icon: getIcon("icons/theme.png").resize({ height: 19, width: 19 }),
submenu: [
{
label: "System",
icon: currentTheme == "system" && getIcon("icons/checked.png"),
click: function () {
nativeTheme.themeSource = "system"
store.set("theme", "system")
createTray()
},
},
{
label: "Dark",
icon: currentTheme == "dark" && getIcon("icons/checked.png"),
Expand All @@ -187,7 +221,7 @@ function getContextMenu() {
},
{
label: "Options",
icon: getIcon("icons/options.png"),
icon: getIcon("icons/options.png").resize({ height: 19, width: 19 }),
submenu: [
{
label: "AlwaysOnTop",
Expand Down Expand Up @@ -228,7 +262,7 @@ function getContextMenu() {
},
{
label: "Website",
icon: getIcon("icons/link.png"),
icon: getIcon("icons/link.png").resize({ height: 19, width: 19 }),
click: function () {
shell.openExternal("https://github.com/sajjadmrx/btime-desktop");
},
Expand All @@ -244,4 +278,4 @@ function getContextMenu() {
]);

return contextMenu
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "btime-desktop",
"private": true,
"version": "1.0.3",
"version": "1.0.4",
"author": {
"name": "sajjadmrx",
"url": "https://github.com/sajjadmrx"
Expand Down
Binary file modified public/icons/checked.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/link.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/options.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/power.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/setting.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/show.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/theme.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 1 addition & 26 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function App() {
"(prefers-color-scheme: dark)"
);
handleColorSchemeChange(colorSchemeMediaQuery);

colorSchemeMediaQuery.addEventListener("change", handleColorSchemeChange);
return () => {
colorSchemeMediaQuery.removeEventListener(
Expand All @@ -41,32 +42,6 @@ function App() {
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLave}
>
<div className={`fixed inline bottom-[140px] left-2 moveable`}>
<IconButton
variant="text"
color="blue-gray"
size="sm"
className={` moveable ${!showArrows && "hidden"} `}
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1}
stroke="currentColor"
className="h-6 w-6 test"
>
<g id="move / Chevron_Right_MD">
<path
id="Vector"
d="M12 21V12M12 21L15 18M12 21L9 18M12 12V3M12 12H3M12 12H21M12 3L9 6M12 3L15 6M3 12L6 15M3 12L6 9M21 12L18 9M21 12L18 15"
strokeLinecap="round"
strokeLinejoin="round"
/>
</g>
</svg>
</IconButton>
</div>
<Slider showArrows={showArrows} />
</div>
</>
Expand Down
6 changes: 3 additions & 3 deletions src/components/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export function Slider(prop: Prop) {
<>
<Carousel
loop={true}
className="rounded-xl test"
className="rounded-xl"
prevArrow={({ handlePrev }) => (
<IconButton
variant="text"
size="sm"
color="blue-gray"
onClick={handlePrev}
className={`!absolute top-2/4 left-4 -translate-y-2/4 ${
className={`!absolute top-2/4 dark:text-white arrow_btn left-4 -translate-y-2/4 ${
!showArrows && "hidden"
} `}
>
Expand Down Expand Up @@ -59,7 +59,7 @@ export function Slider(prop: Prop) {
size="sm"
color="blue-gray"
onClick={handleNext}
className={`!absolute top-2/4 !right-4 -translate-y-2/4 ${
className={`!absolute top-2/4 dark:text-white arrow_btn !right-4 -translate-y-2/4 ${
!showArrows && "hidden"
} `}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/sliders/gregorian/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function GregorianSlider(prop: Prop) {
const { currentTime } = prop;
return (
<div className="flex h-screen items-center justify-center">
<div className="flex flex-col items-center justify-center gap-4">
<div className="flex flex-col items-center justify-center gap-4 moveable w-[40%]">
<div className="select-none text-gray-600 text-gray-trasnparent dark:text-[#eee] font-[balooTamma]">
{currentTime.locale("en").format("dddd")}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/sliders/jalali/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export function JalaliSlider(prop: Prop) {
const { currentTime } = prop;

return (
<div className="flex h-screen items-center justify-center">
<div className="flex flex-col items-center justify-center gap-4">
<div className="flex h-screen items-center justify-center ">
<div className="flex flex-col items-center justify-center gap-4 moveable w-[40%]">
<div className="select-none text-gray-600 text-gray-trasnparent dark:text-[#eee]">
{currentTime.locale("fa").format("dddd")}
</div>
<div className="text-6xl select-none text-gray-600 text-gray-trasnparent dark:text-[#eee]">
<div className="text-6xl select-none text-gray-600 text-gray-trasnparent dark:text-[#eee] ">
{currentTime.locale("fa").jDate()}
</div>
<div className="flex flex-row gap-3 text-gray-600 text-gray-trasnparent dark:text-[#eee]">
Expand Down
4 changes: 3 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ body {

.moveable {
-webkit-app-region: drag;
z-index: 4;
}

@media (prefers-color-scheme: dark) {
Expand All @@ -91,4 +90,7 @@ body {
body.transparent-active .text-gray-trasnparent {
color: #e0e0e0;
}
body.transparent-active .arrow_btn {
color: #e0e0e0;
}
}

0 comments on commit 07ef369

Please sign in to comment.