Skip to content

Commit

Permalink
fix: bug in electron on mac os meaning transak not rendered when back…
Browse files Browse the repository at this point in the history
…ground of window is transparent

Co-authored-by: Jean Ribeiro <[email protected]>
  • Loading branch information
nicole-obrien and jeeanribeiro committed Aug 15, 2024
1 parent 0df1286 commit 26d25cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { TransakCryptoCurrency } from '@auxiliary/transak'
import { Button, Icon, IconName, Spinner, Text } from '@bloomwalletio/ui'
import { DISCORD_URL } from '@contexts/settings'
import { openUrlInBrowser, Platform } from '@core/app'
import { IS_MAC, openUrlInBrowser, Platform } from '@core/app'
import { localize } from '@core/i18n'
import { FiatCurrency } from '@core/market'
import { SupportedNetworkId } from '@core/network'
Expand Down Expand Up @@ -118,11 +118,14 @@
</div>
{/if}
</div>
{#if IS_MAC}
<div class="h-8 w-full"></div>
{/if}
</div>

<style>
.transak-container {
width: 30rem;
height: min(70vh, 700px);
height: min(80vh, 750px);
}
</style>
15 changes: 9 additions & 6 deletions packages/desktop/lib/electron/preloads/transak.preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ function observeStyleChanges(targetNode: Element): void {
window.addEventListener('DOMContentLoaded', () => {
observeStyleChanges(window.document.documentElement)

const appRoot = window.document.getElementById('appRoot')
if (appRoot) {
appRoot.style.borderBottomLeftRadius = '32px'
appRoot.style.borderBottomRightRadius = '32px'
appRoot.style.overflow = 'hidden'
// TODO: Potential bug in electron means that the page is not rendered properly on Mac when the background is transparent
if (process.platform !== 'darwin') {
const appRoot = window.document.getElementById('appRoot')
if (appRoot) {
appRoot.style.borderBottomLeftRadius = '32px'
appRoot.style.borderBottomRightRadius = '32px'
appRoot.style.overflow = 'hidden'
}
window.document.documentElement.style.backgroundColor = 'transparent'
}
window.document.documentElement.style.backgroundColor = 'transparent'
})

0 comments on commit 26d25cb

Please sign in to comment.