Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix misaligned gocardless credential popover #3942

Merged
merged 2 commits into from
Dec 9, 2024
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-strict-ignore
import React, { useEffect, useRef, useState } from 'react';
import React, { useEffect, useState } from 'react';
import { DialogTrigger } from 'react-aria-components';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';

Expand Down Expand Up @@ -30,13 +30,12 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
const { t } = useTranslation();
const syncServerStatus = useSyncServerStatus();
const dispatch = useDispatch();
const [isGoCardlessSetupComplete, setIsGoCardlessSetupComplete] =
useState(null);
const [isSimpleFinSetupComplete, setIsSimpleFinSetupComplete] =
useState(null);
const [menuGoCardlessOpen, setGoCardlessMenuOpen] = useState<boolean>(false);
const triggerRef = useRef(null);
const [menuSimplefinOpen, setSimplefinMenuOpen] = useState<boolean>(false);
const [isGoCardlessSetupComplete, setIsGoCardlessSetupComplete] = useState<
boolean | null
>(null);
const [isSimpleFinSetupComplete, setIsSimpleFinSetupComplete] = useState<
boolean | null
>(null);

const onConnectGoCardless = () => {
if (!isGoCardlessSetupComplete) {
Expand Down Expand Up @@ -139,7 +138,6 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
value: null,
}).then(() => {
setIsGoCardlessSetupComplete(false);
setGoCardlessMenuOpen(false);
});
});
};
Expand All @@ -154,7 +152,6 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
value: null,
}).then(() => {
setIsSimpleFinSetupComplete(false);
setSimplefinMenuOpen(false);
});
});
};
Expand Down Expand Up @@ -248,12 +245,10 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
: t('Set up GoCardless for bank sync')}
</ButtonWithLoading>
{isGoCardlessSetupComplete && (
<>
<DialogTrigger>
<Button
ref={triggerRef}
variant="bare"
onPress={() => setGoCardlessMenuOpen(true)}
aria-label="GoCardless menu"
aria-label={t('GoCardless menu')}
>
<SvgDotsHorizontalTriple
width={15}
Expand All @@ -262,11 +257,7 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
/>
</Button>

<Popover
triggerRef={triggerRef}
isOpen={menuGoCardlessOpen}
onOpenChange={() => setGoCardlessMenuOpen(false)}
>
<Popover>
<Menu
onMenuSelect={item => {
if (item === 'reconfigure') {
Expand All @@ -281,7 +272,7 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
]}
/>
</Popover>
</>
</DialogTrigger>
)}
</View>
<Text style={{ lineHeight: '1.4em', fontSize: 15 }}>
Expand Down Expand Up @@ -317,24 +308,15 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
: t('Set up SimpleFIN for bank sync')}
</ButtonWithLoading>
{isSimpleFinSetupComplete && (
<>
<Button
ref={triggerRef}
variant="bare"
onPress={() => setSimplefinMenuOpen(true)}
aria-label="SimpleFIN menu"
>
<DialogTrigger>
<Button variant="bare" aria-label={t('SimpleFIN menu')}>
<SvgDotsHorizontalTriple
width={15}
height={15}
style={{ transform: 'rotateZ(90deg)' }}
/>
</Button>
<Popover
triggerRef={triggerRef}
isOpen={menuSimplefinOpen}
onOpenChange={() => setSimplefinMenuOpen(false)}
>
<Popover>
<Menu
onMenuSelect={item => {
if (item === 'reconfigure') {
Expand All @@ -349,7 +331,7 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
]}
/>
</Popover>
</>
</DialogTrigger>
)}
</View>
<Text style={{ lineHeight: '1.4em', fontSize: 15 }}>
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/types/server-handlers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export interface ServerHandlers {

'account-move': (arg: { id; targetId }) => Promise<unknown>;

'secret-set': (arg: { name: string; value: string }) => Promise<null>;
'secret-set': (arg: { name: string; value: string | null }) => Promise<null>;
'secret-check': (arg: string) => Promise<string | { error?: string }>;

'gocardless-poll-web-token': (arg: {
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3942.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MatissJanis]
---

Fix misaligned gocardless credential popover.
Loading