Skip to content

Commit

Permalink
Fullscreen button navigate to current page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Mahda committed Dec 16, 2024
1 parent 0b85f72 commit 488765d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/browser-wallet/src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ bgMessageHandler.handleMessage(
createWeb3IdProofHandler
);

bgMessageHandler.handleMessage(createMessageTypeFilter(InternalMessageType.OpenFullscreen), () => {
chrome.tabs.create({ url: chrome.runtime.getURL('popup.html#fullscreen') });
bgMessageHandler.handleMessage(createMessageTypeFilter(InternalMessageType.OpenFullscreen), ({ payload = '' }) => {
chrome.tabs.create({ url: chrome.runtime.getURL(`popup.html${payload}#fullscreen`) });
});

const NOT_WHITELISTED = 'Site is not whitelisted';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import React from 'react';
import { useLocation } from 'react-router-dom';
import ArrowsOut from '@assets/svgX/arrows-out-simple.svg';
import { popupMessageHandler } from '@popup/shared/message-handler';
import { InternalMessageType } from '@messaging';

export default function Fullscreen() {
const location = useLocation();

return (
<div className="main-header__fullscreen">
<button
type="button"
className="main-header__fullscreen_button"
onClick={() => {
popupMessageHandler.sendInternalMessage(InternalMessageType.OpenFullscreen);
popupMessageHandler.sendInternalMessage(
InternalMessageType.OpenFullscreen,
`?navTo=${location.pathname}`
);
}}
>
<span className="text__additional_small">Fullscreen</span>
Expand Down
1 change: 1 addition & 0 deletions packages/browser-wallet/src/popup/shared/window-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ import { spawnedPopupUrl, web3IdProofPopupUrl } from '@shared/constants/url';
export const isSpawnedWindow = window.location.href.includes(spawnedPopupUrl);
export const isSpawnedWeb3IdProofWindow = window.location.href.includes(web3IdProofPopupUrl);
export const isFullscreenWindow = window.location.hash === '#fullscreen';
export const haveInitialEntry = new URL(window.location.href).searchParams.get('navTo');
13 changes: 11 additions & 2 deletions packages/browser-wallet/src/popup/shell/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import { noOp } from 'wallet-common-helpers';

import { Dimensions, large, medium, small } from '@popup/constants/dimensions';
import { popupMessageHandler } from '@popup/shared/message-handler';
import { isFullscreenWindow, isSpawnedWeb3IdProofWindow, isSpawnedWindow } from '@popup/shared/window-helpers';
import {
haveInitialEntry,
isFullscreenWindow,
isSpawnedWeb3IdProofWindow,
isSpawnedWindow,
} from '@popup/shared/window-helpers';
import { networkConfigurationAtom, themeAtom, uiStyleAtom } from '@popup/store/settings';
import { Theme as ThemeType, UiStyle } from '@shared/storage/types';
import BlockChainParametersContext from '@popup/shared/BlockChainParametersProvider';
Expand Down Expand Up @@ -136,7 +141,11 @@ export default function Root() {

return (
<Provider>
<MemoryRouter initialEntries={[uiStyle.value === UiStyle.Old ? '/account' : absoluteRoutes.home.path]}>
<MemoryRouter
initialEntries={[
haveInitialEntry || (uiStyle.value === UiStyle.Old && '/account') || absoluteRoutes.home.path,
]}
>
<Scaling>
<Network>
<Theme>
Expand Down

0 comments on commit 488765d

Please sign in to comment.