Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Make browser extension popout use full height/width in all browsers (#909)
Leendert de Borst0d5fd551333a
diff --git a/apps/browser-extension/package.json b/apps/browser-extension/package.jsonindex 23b987cf9..541fef69d 100644--- a/apps/browser-extension/package.json+++ b/apps/browser-extension/package.json@@ -8,6 +8,7 @@"dev:chrome": "wxt -b chrome","dev:firefox": "wxt -b firefox","dev:edge": "wxt -b edge",+ "dev:safari": "wxt -b safari","build:chrome": "wxt build -b chrome","build:firefox": "wxt build -b firefox","build:edge": "wxt build -b edge",diff --git a/apps/browser-extension/src/assets/tailwind.css b/apps/browser-extension/src/assets/tailwind.cssindex bd6213e1d..9c7bb866c 100644--- a/apps/browser-extension/src/assets/tailwind.css+++ b/apps/browser-extension/src/assets/tailwind.css@@ -1,3 +1,13 @@@tailwind base;@tailwind components;-@tailwind utilities;\ No newline at end of file+@tailwind utilities;++@media (max-width: 400px) {+ html, body {+ width: 350px;+ max-width: 350px;+ height: 600px;+ max-height: 600px;+ overflow: hidden;+ }+ }diff --git a/apps/browser-extension/src/entrypoints/popup/App.tsx b/apps/browser-extension/src/entrypoints/popup/App.tsxindex de5b7f924..a7807a30d 100644--- a/apps/browser-extension/src/entrypoints/popup/App.tsx+++ b/apps/browser-extension/src/entrypoints/popup/App.tsx@@ -74,7 +74,7 @@ const App: React.FC = () => {return (<Router>- <div className="min-h-screen min-w-[350px] bg-white dark:bg-gray-900 flex flex-col">+ <div className="min-h-screen min-w-[350px] bg-white dark:bg-gray-900 flex flex-col max-h-[600px]">{isLoading && (<div className="fixed inset-0 bg-white dark:bg-gray-900 z-50 flex items-center justify-center"><LoadingSpinner />@@ -92,7 +92,6 @@ const App: React.FC = () => {style={{paddingTop: '64px',height: 'calc(100% - 120px)',- maxHeight: '600px',}}><div className="p-4 mb-16">diff --git a/apps/browser-extension/src/entrypoints/popup/main.tsx b/apps/browser-extension/src/entrypoints/popup/main.tsxindex 2b9770446..419c51587 100644--- a/apps/browser-extension/src/entrypoints/popup/main.tsx+++ b/apps/browser-extension/src/entrypoints/popup/main.tsx@@ -8,11 +8,6 @@ import { LoadingProvider } from '@/entrypoints/popup/context/LoadingContext';import { ThemeProvider } from '@/entrypoints/popup/context/ThemeContext';import { WebApiProvider } from '@/entrypoints/popup/context/WebApiContext';-import { setupExpandedMode } from '@/utils/ExpandedMode';--// Run before React initializes to ensure the popup is always a fixed width except for when explicitly expanded.-setupExpandedMode();-const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);root.render(<DbProvider>diff --git a/apps/browser-extension/src/entrypoints/popup/pages/CredentialDetails.tsx b/apps/browser-extension/src/entrypoints/popup/pages/CredentialDetails.tsxindex dec8d49e0..b883f14e5 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/CredentialDetails.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/CredentialDetails.tsx@@ -40,8 +40,8 @@ const CredentialDetails: React.FC = (): React.ReactElement => {* Open the credential details in a new expanded popup.*/const openInNewPopup = useCallback((): void => {- const width = 380;- const height = 600;+ const width = 800;+ const height = 1000;const left = window.screen.width / 2 - width / 2;const top = window.screen.height / 2 - height / 2;@@ -58,21 +58,7 @@ const CredentialDetails: React.FC = (): React.ReactElement => {* Navigate to the edit page for this credential.*/const handleEdit = useCallback((): void => {- if (isPopup()) {- window.close();- const width = 380;- const height = 600;- const left = window.screen.width / 2 - width / 2;- const top = window.screen.height / 2 - height / 2;-- window.open(- `popup.html?expanded=true#/credentials/${id}/edit`,- 'CredentialAddEdit',- `width=${width},height=${height},left=${left},top=${top},popup=true`- );- } else {- navigate(`/credentials/${id}/edit`);- }+ navigate(`/credentials/${id}/edit`);}, [id, navigate]);useEffect(() => {diff --git a/apps/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx b/apps/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsxindex 1f57b4a27..3a57aafa9 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx@@ -31,15 +31,6 @@ const EmailDetails: React.FC = (): React.ReactElement => {const { setHeaderButtons } = useHeaderButtons();const [headerButtonsConfigured, setHeaderButtonsConfigured] = useState(false);- /**- * Make sure the initial loading state is set to false when this component is loaded itself.- */- useEffect(() => {- if (!isLoading) {- setIsInitialLoading(false);- }- }, [setIsInitialLoading, isLoading]);-useEffect(() => {// For popup windows, ensure we have proper history state for navigationif (isPopup()) {@@ -70,11 +61,12 @@ const EmailDetails: React.FC = (): React.ReactElement => {setError(err instanceof Error ? err.message : 'An error occurred');} finally {setIsLoading(false);+ setIsInitialLoading(false);}};loadEmail();- }, [id, dbContext?.sqliteClient, webApi, setIsLoading]);+ }, [id, dbContext?.sqliteClient, webApi, setIsLoading, setIsInitialLoading]);/*** Handle deleting an email.diff --git a/apps/browser-extension/src/entrypoints/popup/pages/EmailsList.tsx b/apps/browser-extension/src/entrypoints/popup/pages/EmailsList.tsxindex bd5374aa0..81dd43ec3 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/EmailsList.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/EmailsList.tsx@@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';import LoadingSpinner from '@/entrypoints/popup/components/LoadingSpinner';import ReloadButton from '@/entrypoints/popup/components/ReloadButton';import { useDb } from '@/entrypoints/popup/context/DbContext';+import { useLoading } from '@/entrypoints/popup/context/LoadingContext';import { useWebApi } from '@/entrypoints/popup/context/WebApiContext';import type { MailboxBulkRequest, MailboxBulkResponse, MailboxEmail } from '@/utils/dist/shared/models/webapi';@@ -19,6 +20,7 @@ const EmailsList: React.FC = () => {const webApi = useWebApi();const [error, setError] = useState<string | null>(null);const [emails, setEmails] = useState<MailboxEmail[]>([]);+ const { setIsInitialLoading } = useLoading();/*** Loading state with minimum duration for more fluid UX.@@ -63,8 +65,9 @@ const EmailsList: React.FC = () => {setError(err instanceof Error ? err.message : 'An error occurred');} finally {setIsLoading(false);+ setIsInitialLoading(false);}- }, [dbContext?.sqliteClient, webApi, setIsLoading]);+ }, [dbContext?.sqliteClient, webApi, setIsLoading, setIsInitialLoading]);useEffect(() => {loadEmails();diff --git a/apps/browser-extension/src/entrypoints/popup/pages/Settings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/Settings.tsxindex 4e0784b19..c88af1b3f 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/Settings.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/Settings.tsx@@ -10,8 +10,9 @@ import { useTheme } from '@/entrypoints/popup/context/ThemeContext';import { AppInfo } from '@/utils/AppInfo';import { DISABLED_SITES_KEY, GLOBAL_AUTOFILL_POPUP_ENABLED_KEY, GLOBAL_CONTEXT_MENU_ENABLED_KEY, TEMPORARY_DISABLED_SITES_KEY } from '@/utils/Constants';-import { storage } from "#imports";-import { browser } from "#imports";+import { useLoading } from '../context/LoadingContext';++import { storage, browser } from "#imports";/*** Popup settings type.@@ -32,6 +33,7 @@ const Settings: React.FC = () => {const { theme, setTheme } = useTheme();const authContext = useAuth();const { setHeaderButtons } = useHeaderButtons();+ const { setIsInitialLoading } = useLoading();const [settings, setSettings] = useState<PopupSettings>({disabledUrls: [],temporaryDisabledUrls: {},@@ -69,7 +71,7 @@ const Settings: React.FC = () => {<div className="flex items-center gap-2"><HeaderButtononClick={openClientTab}- title="Open Client"+ title="Open web app"iconType={HeaderIconType.EXTERNAL_LINK}/></div>@@ -110,7 +112,8 @@ const Settings: React.FC = () => {isGloballyEnabled,isContextMenuEnabled});- }, []);+ setIsInitialLoading(false);+ }, [setIsInitialLoading]);useEffect(() => {loadSettings();diff --git a/apps/browser-extension/src/utils/ExpandedMode.ts b/apps/browser-extension/src/utils/ExpandedMode.tsdeleted file mode 100644index e5d7d1dd5..000000000--- a/apps/browser-extension/src/utils/ExpandedMode.ts+++ /dev/null@@ -1,20 +0,0 @@-/**- * Setup the expanded mode.- */-export function setupExpandedMode() : void {- /**- * This runs once when imported and checks if the popup was opened in expanded mode with unlimited width.- * If not, it sets the width to 350px to force the default popup to a fixed width.- * This is used to ensure the popup is always a fixed width, even if some content like email preview- * is too wide to fit in the default width. Some browsers like Firefox and Safari will then try to- * expand the popup to the width of the content, which can cause the popup to become too wide and bad UX.- *- * You can test this by opening the popup and then clicking on the email preview. If the popup width does- * not change, it works. Then if you expand/popout the extension, the content of the page should adjust- * to the new width of the resizable popup.- */- const urlParams = new URLSearchParams(window.location.search);- if (!urlParams.get('expanded')) {- document.documentElement.classList.add('max-w-[350px]');- }-}