Skip to content
Merged
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.35.0] - 2025-04-23

### Added

- Added warning message styles for PDF reports. PR: [bfx-report#429](https://github.com/bitfinexcom/bfx-report/pull/429)
- Added ability to continue the `Tax Report` generation without `delisted` currencies. PR: [bfx-reports-framework#449](https://github.com/bitfinexcom/bfx-reports-framework/pull/449)
- Added ability to deduct trading fees in the `Tax Report`. Added a flag `shouldFeesBeDeducted` to use that via a checkbox in the UI. PR: [bfx-reports-framework#450](https://github.com/bitfinexcom/bfx-reports-framework/pull/450)
- Added native behavior to minimize and close the loading window. The main reason is to provide the ability to `minimize` and then `restore` the loading window on all OSs as each OS has a specific behavior. Also added a close button to be able to interrupt the app startup. PR: [bfx-report-electron#530](https://github.com/bitfinexcom/bfx-report-electron/pull/530)
- Implemented `Credit Line` wallet representation in the `Balances` section. Added `Credit Line` wallet support in the columns filters. PR: [bfx-report-ui#920](https://github.com/bitfinexcom/bfx-report-ui/pull/920)
- Implemented UI theme selection binding with Electron wrapper. The main idea is to have synchronized theme in UI and Electron-specific menus, modals, etc. PR: [bfx-report-ui#921](https://github.com/bitfinexcom/bfx-report-ui/pull/921)

### Changed

- Actualized the `Tax Report` data handling. PR: [bfx-report-ui#922](https://github.com/bitfinexcom/bfx-report-ui/pull/922)
- Disabled `Concentration Risk` refresh button during initial synchronization to prevent report generation errors. Added a corresponding notice to communicate this to the user. PR: [bfx-report-ui#923](https://github.com/bitfinexcom/bfx-report-ui/pull/923)

## [4.34.1] - 2025-04-09

### Added
Expand Down
2 changes: 1 addition & 1 deletion bfx-reports-framework
4 changes: 2 additions & 2 deletions 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
@@ -1,6 +1,6 @@
{
"name": "bfx-report-electron",
"version": "4.34.1",
"version": "4.35.0",
"repository": "https://github.com/bitfinexcom/bfx-report-electron",
"description": "Reporting tool",
"author": "bitfinex.com",
Expand Down
4 changes: 3 additions & 1 deletion src/enforce-macos-app-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ module.exports = async () => {
description: i18next
.t('enforceMacOSAppLocation.loadingWindow.description'),
isRequiredToCloseAllWins: true,
isIndeterminateMode: true
isIndeterminateMode: true,
shouldCloseBtnBeShown: true,
shouldMinimizeBtnBeShown: true
})

app.moveToApplicationsFolder({
Expand Down
16 changes: 14 additions & 2 deletions src/helpers/manage-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const hideWindow = (win, opts) => {
!win ||
typeof win !== 'object' ||
win.isDestroyed() ||
!win.isVisible()
(
!win.isVisible() &&
!win.isMinimized()
)
) {
resolve()

Expand All @@ -25,6 +28,9 @@ const hideWindow = (win, opts) => {
if (shouldWinBeBlurred) {
win.blur()
}
if (win.isMinimized()) {
win.restore()
}

win.hide()
} catch (err) {
Expand All @@ -45,7 +51,10 @@ const showWindow = (win, opts) => {
!win ||
typeof win !== 'object' ||
win.isDestroyed() ||
win.isVisible()
(
win.isVisible() &&
!win.isMinimized()
)
) {
resolve()

Expand All @@ -60,6 +69,9 @@ const showWindow = (win, opts) => {
resolve()
})

if (win.isMinimized()) {
win.restore()
}
if (shouldWinBeShownInactive) {
win.showInactive()

Expand Down
16 changes: 12 additions & 4 deletions src/window-creators/change-loading-win-visibility-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const _closeAllWindows = () => {
return Promise.all(promises)
}

const _setParentWindow = (noParent) => {
const setParentToLoadingWindow = (noParent) => {
// TODO: The reason for it related to the electronjs issue:
// `[Bug]: Wrong main window hidden state on macOS when using 'parent' option`
// https://github.com/electron/electron/issues/29732
Expand Down Expand Up @@ -198,7 +198,9 @@ const showLoadingWindow = async (opts) => {
isRequiredToCloseAllWins = false,
isNotRunProgressLoaderRequired = false,
isIndeterminateMode = false,
noParent = false
noParent = false,
shouldCloseBtnBeShown,
shouldMinimizeBtnBeShown
} = opts ?? {}

if (
Expand All @@ -210,7 +212,7 @@ const showLoadingWindow = async (opts) => {
.createLoadingWindow()
}

_setParentWindow(isRequiredToCloseAllWins || noParent)
setParentToLoadingWindow(isRequiredToCloseAllWins || noParent)

const _progress = Number.isFinite(progress)
? Math.floor(progress * 100) / 100
Expand All @@ -223,6 +225,11 @@ const showLoadingWindow = async (opts) => {
_runProgressLoader({ progress: _progress, isIndeterminateMode })
}

GeneralIpcChannelHandlers
.sendLoadingBtnStates(wins.loadingWindow, {
shouldCloseBtnBeShown: shouldCloseBtnBeShown ?? false,
shouldMinimizeBtnBeShown: shouldMinimizeBtnBeShown ?? false
})
await setLoadingDescription({ progress: _progress, description })

if (!wins.loadingWindow.isVisible()) {
Expand Down Expand Up @@ -269,5 +276,6 @@ const hideLoadingWindow = async (opts) => {
module.exports = {
showLoadingWindow,
hideLoadingWindow,
setLoadingDescription
setLoadingDescription,
setParentToLoadingWindow
}
35 changes: 19 additions & 16 deletions src/window-creators/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const windowStateKeeper = require('./window-state-keeper')
const createMenu = require('../create-menu')
const {
showLoadingWindow,
hideLoadingWindow
hideLoadingWindow,
setParentToLoadingWindow
} = require('./change-loading-win-visibility-state')
const {
showWindow,
Expand Down Expand Up @@ -176,15 +177,20 @@ const _createWindow = async (
}

if (!pathname) {
const props = await createLoadingWindow()
props.win.setAlwaysOnTop(true)
await showLoadingWindow({
shouldCloseBtnBeShown: true,
shouldMinimizeBtnBeShown: true,
noParent: true
})
wins.loadingWindow.setAlwaysOnTop(true)

return res
}
if (props.center) {
centerWindow(wins[winName])
}

setParentToLoadingWindow()
await showWindow(wins[winName])

return res
Expand All @@ -197,7 +203,8 @@ const _createChildWindow = async (
) => {
const {
width = 500,
height = 500
height = 500,
noParent
} = { ...opts }

const point = electron.screen.getCursorScreenPoint()
Expand All @@ -224,7 +231,12 @@ const _createChildWindow = async (
// TODO: The reason for it related to the electronjs issue:
// `[Bug]: Wrong main window hidden state on macOS when using 'parent' option`
// https://github.com/electron/electron/issues/29732
parent: isMac ? null : wins.mainWindow,
parent: (
isMac ||
noParent
)
? null
: wins.mainWindow,
alwaysOnTop: isMac,

...opts
Expand Down Expand Up @@ -317,24 +329,15 @@ const createMainWindow = async ({
}

const createLoadingWindow = async () => {
if (
wins.loadingWindow &&
typeof wins.loadingWindow === 'object' &&
!wins.loadingWindow.isDestroyed()
) {
await showLoadingWindow()

return { win: wins.loadingWindow }
}

const winProps = await _createChildWindow(
pathToLayoutAppInit,
'loadingWindow',
{
width: 350,
height: 350,
maximizable: false,
fullscreenable: false
fullscreenable: false,
noParent: true
}
)

Expand Down
68 changes: 58 additions & 10 deletions src/window-creators/layouts/app-init.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
padding: 5px;
}

.minimize-btn {
.window-btn {
position: relative;
display: block;
display: inline-block;
width: 30px;
height: 30px;
border-radius: 50%;
Expand All @@ -46,21 +46,44 @@
cursor: pointer;
}

.minimize-btn::after {
.window-btn__minimize::after {
content: "";
display: block;
position: absolute;
width: 12px;
height: 1px;
background-color: var(--btnMinimizeAfterBg, #9b9a9a);
background-color: var(--btnWindowAfterBg, #9b9a9a);
bottom: 9px;
left: calc((30px - 12px) / 2);
}

.minimize-btn:hover,
.minimize-btn:active,
.minimize-btn:focus {
background-color: var(--btnMinimizeHoverBg, #9b9a9a);
.window-btn__close::before, .window-btn__close::after {
content: "";
display: block;
position: absolute;
width: 17px; /* sqrt(12^2 + 12^2) where 12px width */
height: 1px;
background-color: var(--btnWindowAfterBg, #9b9a9a);
bottom: calc((11px / 2) + 9px);
left: calc((30px - 17px) / 2);
}

.window-btn__close::before {
transform: rotate(45deg);
}

.window-btn__close::after {
transform: rotate(-45deg);
}

.window-btn:hover,
.window-btn:active,
.window-btn:focus {
background-color: var(--btnWindowHoverBg, #9b9a9a);
}

.window-btn--disabled {
display: none;
}

.lds-roller {
Expand Down Expand Up @@ -236,7 +259,8 @@

<body class="body">
<div class="win-control-btn">
<div id="minBtn" class="minimize-btn"></div>
<div id="minBtn" class="window-btn window-btn__minimize window-btn--disabled"></div>
<div id="closeBtn" class="window-btn window-btn__close window-btn--disabled"></div>
</div>
<div class="lds-roller">
<div></div>
Expand All @@ -259,10 +283,18 @@
const rollers = document.getElementsByClassName('lds-roller')
const descriptionElem = document.getElementById('description')
const minBtnElem = document.getElementById('minBtn')
const closeBtnElem = document.getElementById('closeBtn')

minBtnElem.onclick = async () => {
try {
await window.bfxReportElectronApi?.hideLoadingWindow()
await window.bfxReportElectronApi?.minimizeLoadingWindow()
} catch (err) {
console.error(err)
}
}
closeBtnElem.onclick = async () => {
try {
await window.bfxReportElectronApi?.closeLoadingWindow()
} catch (err) {
console.error(err)
}
Expand All @@ -274,6 +306,22 @@
}
}, 2500)

window.bfxReportElectronApi?.onLoadingBtnStates((args) => {
try {
if (args?.shouldMinimizeBtnBeShown) {
minBtnElem.classList.remove('window-btn--disabled')
} else {
minBtnElem.classList.add('window-btn--disabled')
}
if (args?.shouldCloseBtnBeShown) {
closeBtnElem.classList.remove('window-btn--disabled')
} else {
closeBtnElem.classList.add('window-btn--disabled')
}
} catch (err) {
console.debug(err)
}
})
window.bfxReportElectronApi?.onLoadingDescription((args) => {
try {
if (typeof args?.description !== 'string') {
Expand Down
12 changes: 6 additions & 6 deletions src/window-creators/layouts/themes.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
--btnPrimaryHoverColor: #102331;
--btnHoverBg: #19354a;
--btnPrimaryHoverBg: #4c88c8;
--btnMinimizeBg: var(--bgColor);
--btnMinimizeAfterBg: #9b9a9a;
--btnMinimizeHoverBg: #19354a;
--btnWindowBg: var(--bgColor);
--btnWindowAfterBg: #9b9a9a;
--btnWindowHoverBg: #19354a;

/* radio */
--radioInputBorder: #334A59;
Expand Down Expand Up @@ -72,9 +72,9 @@
--btnPrimaryHoverColor: #ffffff;
--btnHoverBg: #d8ecfb;
--btnPrimaryHoverBg: #4c88c8;
--btnMinimizeBg: var(--bgColor);
--btnMinimizeAfterBg: #9b9a9a;
--btnMinimizeHoverBg: #e5e5e5;
--btnWindowBg: var(--bgColor);
--btnWindowAfterBg: #9b9a9a;
--btnWindowHoverBg: #e5e5e5;

/* radio */
--radioInputBorder: #102331;
Expand Down
Loading