Skip to content

Commit

Permalink
chore: remove topup tip (#2950)
Browse files Browse the repository at this point in the history
* chore: remove topup tip

* fix: test

---------

Co-authored-by: René Aaron <[email protected]>
  • Loading branch information
bumi and reneaaron authored Dec 20, 2023
1 parent 21d5d54 commit a5181a7
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 98 deletions.
1 change: 0 additions & 1 deletion src/app/components/Tips/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe("Tips", () => {
</I18nextProvider>
);

expect(await screen.findByText("Buy Bitcoin")).toBeInTheDocument();
expect(await screen.findByText("Alby Demo")).toBeInTheDocument();
expect(await screen.findByText("Nostr")).toBeInTheDocument();
});
Expand Down
9 changes: 0 additions & 9 deletions src/app/components/Tips/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Link } from "react-router-dom";
import TipCard from "~/app/components/TipCard";
import { useAccount } from "~/app/context/AccountContext";
import { useTips } from "~/app/hooks/useTips";
import BuyBitcoinTipCardIcon from "~/app/icons/BuyBitcoinTipCardIcon";
import DemoTipCardIcon from "~/app/icons/DemoTipCardIcon";
import MnemonicTipCardIcon from "~/app/icons/MnemonicTipCardIcon";
import { classNames } from "~/app/utils";
Expand All @@ -21,14 +20,6 @@ export default function Tips() {
const tipCardConfigs = useMemo(
() =>
({
[TIPS.TOP_UP_WALLET]: {
background:
"bg-white dark:bg-surface-02dp hover:bg-orange-50 dark:hover:bg-orange-900",
border: "border-orange-500",
arrow: "text-orange-500",
backgroundIcon: <BuyBitcoinTipCardIcon />,
link: "https://getalby.com/topup",
},
[TIPS.DEMO]: {
background:
"bg-white dark:bg-surface-02dp hover:bg-yellow-50 dark:hover:bg-yellow-900",
Expand Down
65 changes: 0 additions & 65 deletions src/app/hooks/useTips.test.ts

This file was deleted.

25 changes: 3 additions & 22 deletions src/app/hooks/useTips.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
import { useAccount } from "~/app/context/AccountContext";
import { useSettings } from "~/app/context/SettingsContext";
import { isAlbyLNDHubAccount, isAlbyOAuthAccount } from "~/app/utils";
import { TIPS } from "~/common/constants";

const DEFAULT_TIPS = [TIPS.TOP_UP_WALLET, TIPS.MNEMONIC];
const DEFAULT_TIPS = [TIPS.MNEMONIC];

export const filterTips = (
closedTips: TIPS[],
isAlbyOAuthAccount: boolean,
isAlbyLNDHubAccount: boolean
) => {
export const filterTips = (closedTips: TIPS[]) => {
return DEFAULT_TIPS.filter((tip: TIPS) => {
if (closedTips.includes(tip)) return false;

if (
tip === TIPS.TOP_UP_WALLET &&
!isAlbyOAuthAccount &&
!isAlbyLNDHubAccount
)
return false;

return true;
});
};

export const useTips = () => {
const { settings, updateSetting } = useSettings();
const { account } = useAccount();

const tips = filterTips(
settings.closedTips,
isAlbyOAuthAccount(account?.connectorType),
isAlbyLNDHubAccount(account?.alias, account?.connectorType)
);
const tips = filterTips(settings.closedTips);

const closeTip = (tip: TIPS) => {
updateSetting({
Expand Down
1 change: 0 additions & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ export enum CURRENCIES {
}

export enum TIPS {
TOP_UP_WALLET = "top_up_wallet",
DEMO = "demo",
MNEMONIC = "mnemonic",
}

0 comments on commit a5181a7

Please sign in to comment.