@breadcoop/ui 1.0.28 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-FWCSY2DS.mjs +37 -0
- package/dist/components/LiftedButton/LiftedButton.d.mts +29 -0
- package/dist/components/LiftedButton/LiftedButton.mjs +149 -0
- package/dist/components/LiftedButton/LiftedButtonPresets.d.mts +55 -0
- package/dist/components/LiftedButton/LiftedButtonPresets.mjs +85 -0
- package/dist/components/LiftedButton/index.d.mts +2 -0
- package/dist/components/LiftedButton/index.mjs +0 -0
- package/dist/components/Logo/Logo.d.mts +29 -0
- package/dist/components/Logo/Logo.mjs +273 -0
- package/dist/components/Logo/index.d.mts +3 -0
- package/dist/components/Logo/index.mjs +5 -0
- package/dist/components/auth/button-shell.d.mts +5 -0
- package/dist/components/auth/button-shell.mjs +8 -0
- package/dist/components/auth/index.d.mts +5 -0
- package/dist/components/auth/index.mjs +5 -0
- package/dist/components/auth/login-button-general.d.mts +13 -0
- package/dist/components/auth/login-button-general.mjs +80 -0
- package/dist/components/auth/login-button-privy.d.mts +13 -0
- package/dist/components/auth/login-button-privy.mjs +64 -0
- package/dist/components/auth/login-button.d.mts +8 -0
- package/dist/components/auth/login-button.mjs +32 -0
- package/dist/components/buttons/button.d.mts +20 -0
- package/dist/components/buttons/button.mjs +93 -0
- package/dist/components/buttons/copy-icon.d.mts +10 -0
- package/dist/components/buttons/copy-icon.mjs +44 -0
- package/dist/components/buttons/index.d.mts +6 -0
- package/dist/components/buttons/index.mjs +7 -0
- package/dist/components/chip/chip.d.mts +12 -0
- package/dist/components/chip/chip.mjs +34 -0
- package/dist/components/connected-user/context.d.mts +14 -0
- package/dist/components/connected-user/context.mjs +22 -0
- package/dist/components/connected-user/index.d.mts +6 -0
- package/dist/components/connected-user/index.mjs +7 -0
- package/dist/components/connected-user/interface.d.mts +16 -0
- package/dist/components/connected-user/interface.mjs +0 -0
- package/dist/components/connected-user/privy-provider.d.mts +10 -0
- package/dist/components/connected-user/privy-provider.mjs +55 -0
- package/dist/components/connected-user/provider-general.d.mts +10 -0
- package/dist/components/connected-user/provider-general.mjs +38 -0
- package/dist/components/connected-user/provider.d.mts +9 -0
- package/dist/components/connected-user/provider.mjs +15 -0
- package/dist/components/footer/footer.d.mts +11 -0
- package/dist/components/footer/footer.mjs +222 -0
- package/dist/components/loading-icon.d.mts +9 -0
- package/dist/components/loading-icon.mjs +49 -0
- package/dist/components/navbar/account-menu.d.mts +15 -0
- package/dist/components/navbar/account-menu.mjs +48 -0
- package/dist/components/navbar/account-section.d.mts +14 -0
- package/dist/components/navbar/account-section.mjs +68 -0
- package/dist/components/navbar/account-widget-item.d.mts +12 -0
- package/dist/components/navbar/account-widget-item.mjs +21 -0
- package/dist/components/navbar/account-widget.d.mts +22 -0
- package/dist/components/navbar/account-widget.mjs +118 -0
- package/dist/components/navbar/index.d.mts +11 -0
- package/dist/components/navbar/index.mjs +10 -0
- package/dist/components/navbar/log-out.d.mts +7 -0
- package/dist/components/navbar/log-out.mjs +34 -0
- package/dist/components/navbar/navbar-menu.d.mts +12 -0
- package/dist/components/navbar/navbar-menu.mjs +57 -0
- package/dist/components/navbar/navbar.d.mts +25 -0
- package/dist/components/navbar/navbar.mjs +63 -0
- package/dist/components/navbar/solidarity-apps.d.mts +17 -0
- package/dist/components/navbar/solidarity-apps.mjs +167 -0
- package/dist/components/typography/Typography.d.mts +42 -0
- package/dist/components/typography/Typography.mjs +52 -0
- package/dist/components/typography/formatted-dec-num.d.mts +15 -0
- package/dist/components/typography/formatted-dec-num.mjs +40 -0
- package/dist/constansts/links.d.mts +26 -0
- package/dist/constansts/links.mjs +27 -0
- package/dist/constansts/tools.d.mts +23 -0
- package/dist/constansts/tools.mjs +52 -0
- package/dist/context/index.d.mts +5 -0
- package/dist/context/index.mjs +5 -0
- package/dist/context/lib.d.mts +31 -0
- package/dist/context/lib.mjs +33 -0
- package/dist/hooks/index.d.mts +4 -0
- package/dist/hooks/index.mjs +7 -0
- package/dist/hooks/use-auto-connect.d.mts +8 -0
- package/dist/hooks/use-auto-connect.mjs +39 -0
- package/dist/hooks/use-bread-balance.d.mts +13 -0
- package/dist/hooks/use-bread-balance.mjs +32 -0
- package/dist/hooks/use-copy-to-clipboard.d.mts +9 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +26 -0
- package/dist/index.d.mts +33 -304
- package/dist/index.mjs +41 -1
- package/dist/interface/app.d.mts +3 -0
- package/dist/interface/app.mjs +0 -0
- package/dist/tailwind-preset.js +1 -0
- package/dist/theme.css +1 -0
- package/dist/utils/app.d.mts +19 -0
- package/dist/utils/app.mjs +21 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.mjs +9 -0
- package/dist/utils/copy-to-clipboard.d.mts +3 -0
- package/dist/utils/copy-to-clipboard.mjs +10 -0
- package/dist/utils/cssValidation.d.mts +7 -0
- package/dist/utils/cssValidation.mjs +44 -0
- package/dist/utils/formatter.d.mts +3 -0
- package/dist/utils/formatter.mjs +13 -0
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.mjs +7 -0
- package/dist/utils/truncate-address.d.mts +3 -0
- package/dist/utils/truncate-address.mjs +5 -0
- package/package.json +9 -10
- package/tailwind-preset.js +1 -0
- package/theme.css +1 -0
- package/dist/index.d.ts +0 -304
- package/dist/index.js +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import "../chunk-FWCSY2DS.mjs";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../utils/index.mjs";
|
|
4
|
+
function LoadingIcon({
|
|
5
|
+
app,
|
|
6
|
+
className
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ jsx("div", { className: cn("relative w-8 h-8", className), children: /* @__PURE__ */ jsxs(
|
|
9
|
+
"svg",
|
|
10
|
+
{
|
|
11
|
+
className: "w-full h-full transform -rotate-90",
|
|
12
|
+
viewBox: "0 0 120 120",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ jsx(
|
|
15
|
+
"circle",
|
|
16
|
+
{
|
|
17
|
+
cx: "60",
|
|
18
|
+
cy: "60",
|
|
19
|
+
r: "50",
|
|
20
|
+
fill: "none",
|
|
21
|
+
strokeWidth: "20",
|
|
22
|
+
className: app === "fund" ? "stroke-orange-2" : app === "stacks" ? "stroke-[#B9D5FF]" : "stroke-[#CBE9E5]"
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
"circle",
|
|
27
|
+
{
|
|
28
|
+
cx: "60",
|
|
29
|
+
cy: "60",
|
|
30
|
+
r: "50",
|
|
31
|
+
fill: "none",
|
|
32
|
+
strokeWidth: "20",
|
|
33
|
+
strokeDasharray: "314",
|
|
34
|
+
strokeDashoffset: "235",
|
|
35
|
+
strokeLinecap: "round",
|
|
36
|
+
className: cn(
|
|
37
|
+
"origin-center animate-spin",
|
|
38
|
+
app === "fund" ? "stroke-orange-0" : app === "stacks" ? "stroke-primary-blue" : "stroke-primary-jade"
|
|
39
|
+
),
|
|
40
|
+
style: { animationDuration: "2s" }
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
LoadingIcon
|
|
49
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
import { NavAccountDetailsProps } from './account-widget.mjs';
|
|
4
|
+
import { App } from '../../interface/app.mjs';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'wagmi';
|
|
7
|
+
import '@wagmi/core';
|
|
8
|
+
|
|
9
|
+
interface AccountMenuProps extends Pick<NavAccountDetailsProps, "widgetItems" | "ensNameResult" | "actionItems"> {
|
|
10
|
+
userAddress: Address;
|
|
11
|
+
app: App;
|
|
12
|
+
}
|
|
13
|
+
declare const AccountMenu: ({ userAddress, ensNameResult, app, widgetItems, actionItems }: AccountMenuProps) => react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { type AccountMenuProps, AccountMenu as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import * as NavigationMenu from "@radix-ui/react-navigation-menu";
|
|
5
|
+
import { Body } from "../typography/Typography.mjs";
|
|
6
|
+
import { truncateAddress } from "../../utils/truncate-address.mjs";
|
|
7
|
+
import { CaretDownIcon } from "@phosphor-icons/react";
|
|
8
|
+
import NavAccountDetails from "./account-widget.mjs";
|
|
9
|
+
import { appsConfig } from "../../utils/app.mjs";
|
|
10
|
+
const AccountMenu = ({
|
|
11
|
+
userAddress,
|
|
12
|
+
ensNameResult,
|
|
13
|
+
app,
|
|
14
|
+
widgetItems,
|
|
15
|
+
actionItems
|
|
16
|
+
}) => {
|
|
17
|
+
return /* @__PURE__ */ jsxs(NavigationMenu.Root, { className: "relative", children: [
|
|
18
|
+
/* @__PURE__ */ jsx(NavigationMenu.List, { children: /* @__PURE__ */ jsxs(NavigationMenu.Item, { children: [
|
|
19
|
+
/* @__PURE__ */ jsx(NavigationMenu.Trigger, { className: "group w-full", children: /* @__PURE__ */ jsxs(
|
|
20
|
+
Body,
|
|
21
|
+
{
|
|
22
|
+
bold: true,
|
|
23
|
+
className: "w-full flex items-center justify-center gap-2.5 truncate text-ellipsis py-3 px-6 bg-paper-2 border border-surface-ink font-bold",
|
|
24
|
+
children: [
|
|
25
|
+
ensNameResult.data || truncateAddress(userAddress || ""),
|
|
26
|
+
/* @__PURE__ */ jsx("span", { className: appsConfig[app].text, children: /* @__PURE__ */ jsx(CaretDownIcon, {}) })
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
) }),
|
|
30
|
+
/* @__PURE__ */ jsx(NavigationMenu.Content, { className: "w-max", children: /* @__PURE__ */ jsx(
|
|
31
|
+
NavAccountDetails,
|
|
32
|
+
{
|
|
33
|
+
className: "border w-full md:w-screen md:max-w-110.75 md:bg-paper-main md:border-paper-2",
|
|
34
|
+
userAddress,
|
|
35
|
+
ensNameResult,
|
|
36
|
+
app,
|
|
37
|
+
widgetItems,
|
|
38
|
+
actionItems
|
|
39
|
+
}
|
|
40
|
+
) })
|
|
41
|
+
] }) }),
|
|
42
|
+
/* @__PURE__ */ jsx(NavigationMenu.Viewport, { className: "nav-account-menu absolute top-14 right-0 z-20 left-0 md:left-auto" })
|
|
43
|
+
] });
|
|
44
|
+
};
|
|
45
|
+
var account_menu_default = AccountMenu;
|
|
46
|
+
export {
|
|
47
|
+
account_menu_default as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { App } from '../../interface/app.mjs';
|
|
3
|
+
import { NavAccountDetailsProps } from './account-widget.mjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'wagmi';
|
|
6
|
+
import '@wagmi/core';
|
|
7
|
+
import 'viem';
|
|
8
|
+
|
|
9
|
+
interface AccountSectionProps extends Pick<NavAccountDetailsProps, "widgetItems" | "actionItems"> {
|
|
10
|
+
app: App;
|
|
11
|
+
}
|
|
12
|
+
declare const AccountSection: ({ app, widgetItems, actionItems }: AccountSectionProps) => react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { AccountSection as default };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useAccount, useEnsName } from "wagmi";
|
|
5
|
+
import { usePrivy, useWallets } from "@privy-io/react-auth";
|
|
6
|
+
import { LoginButton } from "../auth/index.mjs";
|
|
7
|
+
import { useConnectedUser } from "../connected-user/index.mjs";
|
|
8
|
+
import AccountMenu from "./account-menu.mjs";
|
|
9
|
+
import { SignInIcon } from "@phosphor-icons/react/dist/ssr";
|
|
10
|
+
import { useAuthProvider } from "../../context/lib.mjs";
|
|
11
|
+
import { useMemo } from "react";
|
|
12
|
+
const AccountSection = ({ app, widgetItems, actionItems }) => {
|
|
13
|
+
const { user } = useConnectedUser();
|
|
14
|
+
const authProvider = useAuthProvider();
|
|
15
|
+
const { address: wagmiAddress } = useAccount();
|
|
16
|
+
const wagmiEnsName = useEnsName({
|
|
17
|
+
address: wagmiAddress,
|
|
18
|
+
query: { enabled: Boolean(wagmiAddress) && authProvider === "general" }
|
|
19
|
+
});
|
|
20
|
+
const { ready: privyReady } = usePrivy();
|
|
21
|
+
const { wallets } = useWallets();
|
|
22
|
+
const { address, ensNameResult } = useMemo(() => {
|
|
23
|
+
if (authProvider === "privy") {
|
|
24
|
+
const activeWallet = wallets.find(
|
|
25
|
+
(wallet) => {
|
|
26
|
+
var _a;
|
|
27
|
+
return wallet.walletClientType === "privy" || wallet.walletClientType === "embedded_wallet" || ((_a = wallet.walletClientType) == null ? void 0 : _a.includes("embedded"));
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
return {
|
|
31
|
+
address: activeWallet == null ? void 0 : activeWallet.address,
|
|
32
|
+
ensNameResult: {
|
|
33
|
+
data: void 0,
|
|
34
|
+
isLoading: !privyReady,
|
|
35
|
+
isError: false
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
address: wagmiAddress,
|
|
41
|
+
ensNameResult: wagmiEnsName
|
|
42
|
+
};
|
|
43
|
+
}, [authProvider, wallets, privyReady, wagmiAddress, wagmiEnsName]);
|
|
44
|
+
if (user.status === "CONNECTED" && address) {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
AccountMenu,
|
|
47
|
+
{
|
|
48
|
+
widgetItems,
|
|
49
|
+
actionItems,
|
|
50
|
+
userAddress: address,
|
|
51
|
+
ensNameResult,
|
|
52
|
+
app
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return /* @__PURE__ */ jsx("div", { className: "mt-6 md:mt-0", children: /* @__PURE__ */ jsx(
|
|
57
|
+
LoginButton,
|
|
58
|
+
{
|
|
59
|
+
app,
|
|
60
|
+
status: user.status,
|
|
61
|
+
rightIcon: /* @__PURE__ */ jsx(SignInIcon, { size: 24 })
|
|
62
|
+
}
|
|
63
|
+
) });
|
|
64
|
+
};
|
|
65
|
+
var account_section_default = AccountSection;
|
|
66
|
+
export {
|
|
67
|
+
account_section_default as default
|
|
68
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Icon } from '@phosphor-icons/react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
declare const NavAccountWidgetItem: ({ I, label, children, appIconColor, }: {
|
|
6
|
+
I: Icon;
|
|
7
|
+
appIconColor: string;
|
|
8
|
+
label: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { NavAccountWidgetItem as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { Body } from "../typography/Typography.mjs";
|
|
6
|
+
const NavAccountWidgetItem = ({
|
|
7
|
+
I,
|
|
8
|
+
label,
|
|
9
|
+
children,
|
|
10
|
+
appIconColor
|
|
11
|
+
}) => {
|
|
12
|
+
return /* @__PURE__ */ jsxs("li", { className: clsx("flex items-center justify-start gap-2"), children: [
|
|
13
|
+
/* @__PURE__ */ jsx(I, { size: 24, className: appIconColor }),
|
|
14
|
+
/* @__PURE__ */ jsx(Body, { className: "mr-auto ml-2", children: label }),
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-2", children })
|
|
16
|
+
] });
|
|
17
|
+
};
|
|
18
|
+
var account_widget_item_default = NavAccountWidgetItem;
|
|
19
|
+
export {
|
|
20
|
+
account_widget_item_default as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { UseEnsNameReturnType } from 'wagmi';
|
|
4
|
+
import { GetEnsNameReturnType } from '@wagmi/core';
|
|
5
|
+
import { App } from '../../interface/app.mjs';
|
|
6
|
+
import { Address } from 'viem';
|
|
7
|
+
|
|
8
|
+
interface NavAccountDetailsProps {
|
|
9
|
+
userAddress: Address;
|
|
10
|
+
ensNameResult: UseEnsNameReturnType<GetEnsNameReturnType> | {
|
|
11
|
+
data: string | undefined;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
isError: boolean;
|
|
14
|
+
};
|
|
15
|
+
className?: string;
|
|
16
|
+
app: App;
|
|
17
|
+
widgetItems?: ReactNode;
|
|
18
|
+
actionItems?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const NavAccountDetails: ({ className, userAddress, ensNameResult, app, widgetItems, actionItems, }: NavAccountDetailsProps) => react_jsx_runtime.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { type NavAccountDetailsProps, NavAccountDetails as default };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import {
|
|
5
|
+
ArrowUpRightIcon,
|
|
6
|
+
GraphIcon,
|
|
7
|
+
UserCircleIcon,
|
|
8
|
+
WalletIcon
|
|
9
|
+
} from "@phosphor-icons/react";
|
|
10
|
+
import clsx from "clsx";
|
|
11
|
+
import { Body } from "../typography/Typography.mjs";
|
|
12
|
+
import { truncateAddress } from "../../utils/truncate-address.mjs";
|
|
13
|
+
import { Logo } from "../Logo/index.mjs";
|
|
14
|
+
import LogoutButton from "./log-out.mjs";
|
|
15
|
+
import { appsConfig } from "../../utils/app.mjs";
|
|
16
|
+
import { useBreadBalance } from "../../hooks/use-bread-balance.mjs";
|
|
17
|
+
import NavAccountWidgetItem from "./account-widget-item.mjs";
|
|
18
|
+
import { FormattedDecimalNumber } from "../typography/formatted-dec-num.mjs";
|
|
19
|
+
import { CopyButtonIcon } from "../buttons/index.mjs";
|
|
20
|
+
import { useConnectedUser } from "../connected-user/index.mjs";
|
|
21
|
+
const chainsIcon = {
|
|
22
|
+
100: "/gnosis_icon.svg"
|
|
23
|
+
};
|
|
24
|
+
const NavAccountDetails = ({
|
|
25
|
+
className,
|
|
26
|
+
userAddress,
|
|
27
|
+
ensNameResult,
|
|
28
|
+
app,
|
|
29
|
+
widgetItems,
|
|
30
|
+
actionItems
|
|
31
|
+
}) => {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
const { BREAD } = useBreadBalance({ address: userAddress });
|
|
34
|
+
const { user } = useConnectedUser();
|
|
35
|
+
const appIconColor = appsConfig[app].text;
|
|
36
|
+
const chain = user.status === "CONNECTED" || user.status === "UNSUPPORTED_CHAIN" ? user.chain : void 0;
|
|
37
|
+
const blockExplorerUrl = (_b = (_a = chain == null ? void 0 : chain.blockExplorers) == null ? void 0 : _a.default.url) != null ? _b : "https://gnosisscan.io";
|
|
38
|
+
const scanLink = `${blockExplorerUrl}/address/`;
|
|
39
|
+
const chainName = (_c = chain == null ? void 0 : chain.name) != null ? _c : "Unknown";
|
|
40
|
+
const chainIcon = chain ? chainsIcon[chain.id] : void 0;
|
|
41
|
+
return /* @__PURE__ */ jsxs(
|
|
42
|
+
"section",
|
|
43
|
+
{
|
|
44
|
+
className: clsx(
|
|
45
|
+
"bg-paper-2 p-5 flex flex-col gap-4 w-full max-w-md",
|
|
46
|
+
className
|
|
47
|
+
),
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxs(
|
|
50
|
+
NavAccountWidgetItem,
|
|
51
|
+
{
|
|
52
|
+
I: UserCircleIcon,
|
|
53
|
+
appIconColor,
|
|
54
|
+
label: ensNameResult.data || truncateAddress(userAddress || ""),
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
CopyButtonIcon,
|
|
58
|
+
{
|
|
59
|
+
textToCopy: ensNameResult.data || userAddress
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
"a",
|
|
64
|
+
{
|
|
65
|
+
href: scanLink + (userAddress || ""),
|
|
66
|
+
className: "text-surface-grey",
|
|
67
|
+
target: "_blank",
|
|
68
|
+
rel: "noopener noreferrer",
|
|
69
|
+
children: /* @__PURE__ */ jsx(ArrowUpRightIcon, { size: 24 })
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
NavAccountWidgetItem,
|
|
77
|
+
{
|
|
78
|
+
I: WalletIcon,
|
|
79
|
+
appIconColor,
|
|
80
|
+
label: "Bread Balance",
|
|
81
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Logo, { size: 24 }),
|
|
83
|
+
/* @__PURE__ */ jsx(Body, { children: /* @__PURE__ */ jsx(FormattedDecimalNumber, { value: BREAD }) })
|
|
84
|
+
] })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
widgetItems,
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
NavAccountWidgetItem,
|
|
90
|
+
{
|
|
91
|
+
I: GraphIcon,
|
|
92
|
+
appIconColor,
|
|
93
|
+
label: "Network",
|
|
94
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center", children: [
|
|
95
|
+
chainIcon && /* @__PURE__ */ jsx(
|
|
96
|
+
"img",
|
|
97
|
+
{
|
|
98
|
+
src: chainIcon,
|
|
99
|
+
alt: "",
|
|
100
|
+
width: 24,
|
|
101
|
+
height: 24,
|
|
102
|
+
className: "mr-2"
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(Body, { className: "font-bold", children: chainName })
|
|
106
|
+
] })
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
actionItems,
|
|
110
|
+
/* @__PURE__ */ jsx(LogoutButton, { className: "mt-1" })
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
var account_widget_default = NavAccountDetails;
|
|
116
|
+
export {
|
|
117
|
+
account_widget_default as default
|
|
118
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { NavSolidarityApps, NavSolidarityAppsDesktop } from './solidarity-apps.mjs';
|
|
2
|
+
export { Navbar } from './navbar.mjs';
|
|
3
|
+
export { default as NavAccountWidgetItem } from './account-widget-item.mjs';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import '../../interface/app.mjs';
|
|
6
|
+
import 'react';
|
|
7
|
+
import './account-widget.mjs';
|
|
8
|
+
import 'wagmi';
|
|
9
|
+
import '@wagmi/core';
|
|
10
|
+
import 'viem';
|
|
11
|
+
import '@phosphor-icons/react';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
2
|
+
import { NavSolidarityApps, NavSolidarityAppsDesktop } from "./solidarity-apps.mjs";
|
|
3
|
+
import { Navbar } from "./navbar.mjs";
|
|
4
|
+
import { default as default2 } from "./account-widget-item.mjs";
|
|
5
|
+
export {
|
|
6
|
+
default2 as NavAccountWidgetItem,
|
|
7
|
+
NavSolidarityApps,
|
|
8
|
+
NavSolidarityAppsDesktop,
|
|
9
|
+
Navbar
|
|
10
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { SignOutIcon } from "@phosphor-icons/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { useDisconnect } from "wagmi";
|
|
7
|
+
import { usePrivy } from "@privy-io/react-auth";
|
|
8
|
+
import LiftedButton from "../LiftedButton/LiftedButton.mjs";
|
|
9
|
+
import { useAuthProvider } from "../../context/lib.mjs";
|
|
10
|
+
const LogoutButton = ({ className }) => {
|
|
11
|
+
const authProvider = useAuthProvider();
|
|
12
|
+
const { disconnect: wagmiDisconnect } = useDisconnect();
|
|
13
|
+
const { logout: privyLogout } = usePrivy();
|
|
14
|
+
const handleLogout = () => {
|
|
15
|
+
if (authProvider === "privy") {
|
|
16
|
+
privyLogout();
|
|
17
|
+
} else {
|
|
18
|
+
wagmiDisconnect();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsx("div", { className: clsx("lifted-button-container", className), children: /* @__PURE__ */ jsx(
|
|
22
|
+
LiftedButton,
|
|
23
|
+
{
|
|
24
|
+
preset: "burn",
|
|
25
|
+
rightIcon: /* @__PURE__ */ jsx(SignOutIcon, {}),
|
|
26
|
+
onClick: handleLogout,
|
|
27
|
+
children: "Sign out"
|
|
28
|
+
}
|
|
29
|
+
) });
|
|
30
|
+
};
|
|
31
|
+
var log_out_default = LogoutButton;
|
|
32
|
+
export {
|
|
33
|
+
log_out_default as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface NavbarMenuProps {
|
|
5
|
+
textClassName: string;
|
|
6
|
+
mobileHeader: ReactNode;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare function NavbarMenu({ textClassName, mobileHeader, children, footer, }: NavbarMenuProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { NavbarMenu };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
import { ListIcon, XIcon } from "@phosphor-icons/react/dist/ssr";
|
|
6
|
+
function NavbarMenu({
|
|
7
|
+
textClassName,
|
|
8
|
+
mobileHeader,
|
|
9
|
+
children,
|
|
10
|
+
footer
|
|
11
|
+
}) {
|
|
12
|
+
const menuRef = useRef(null);
|
|
13
|
+
const toggleMenu = (close = false) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (close) {
|
|
16
|
+
(_a = menuRef.current) == null ? void 0 : _a.classList.remove("translate-x-0!");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
(_b = menuRef.current) == null ? void 0 : _b.classList.toggle("translate-x-0!");
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
"button",
|
|
24
|
+
{
|
|
25
|
+
onClick: () => toggleMenu(),
|
|
26
|
+
className: `ml-auto relative w-10 h-10 flex flex-col items-center justify-center space-y-1.5 focus:outline-none group md:hidden ${textClassName}`,
|
|
27
|
+
"aria-label": "Toggle menu",
|
|
28
|
+
children: /* @__PURE__ */ jsx(ListIcon, { size: 32 })
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ jsxs(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
ref: menuRef,
|
|
35
|
+
className: "bg-paper-main fixed overflow-y-scroll top-0 left-0 z-50 h-screen w-screen py-2.5 px-6 transition-transform translate-x-full md:static md:h-auto md:w-auto md:translate-x-0 md:py-0 md:px-0 md:flex md:items-center md:justify-end md:overflow-x-visible md:overflow-y-visible md:transition-none md:z-auto",
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-6 md:hidden", children: [
|
|
38
|
+
mobileHeader,
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
className: `z-60 h-8 w-8 ml-auto block md:hidden ${textClassName}`,
|
|
43
|
+
onClick: () => toggleMenu(true),
|
|
44
|
+
children: /* @__PURE__ */ jsx(XIcon, { size: 32 })
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx("div", { onClick: () => toggleMenu(true), children }),
|
|
49
|
+
footer
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
NavbarMenu
|
|
57
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, ComponentType, AnchorHTMLAttributes } from 'react';
|
|
3
|
+
import { App } from '../../interface/app.mjs';
|
|
4
|
+
import { NavAccountDetailsProps } from './account-widget.mjs';
|
|
5
|
+
import 'wagmi';
|
|
6
|
+
import '@wagmi/core';
|
|
7
|
+
import 'viem';
|
|
8
|
+
|
|
9
|
+
type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
10
|
+
href: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
interface NavbarProps extends Pick<NavAccountDetailsProps, "widgetItems" | "actionItems"> {
|
|
14
|
+
app: App;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The link component of your framework (next/link, react-router-dom Link, etc).
|
|
19
|
+
* Must accept `href`.
|
|
20
|
+
*/
|
|
21
|
+
Link: ComponentType<LinkProps>;
|
|
22
|
+
}
|
|
23
|
+
declare function Navbar({ app, children, className, widgetItems, actionItems, Link, }: NavbarProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { Navbar };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { NavSolidarityApps, NavSolidarityAppsDesktop } from "./solidarity-apps.mjs";
|
|
4
|
+
import { Logo } from "../Logo/index.mjs";
|
|
5
|
+
import { appsConfig } from "../../utils/app.mjs";
|
|
6
|
+
import AccountSection from "./account-section.mjs";
|
|
7
|
+
import { NavbarMenu } from "./navbar-menu.mjs";
|
|
8
|
+
function Navbar({
|
|
9
|
+
app,
|
|
10
|
+
children,
|
|
11
|
+
className = "",
|
|
12
|
+
widgetItems,
|
|
13
|
+
actionItems,
|
|
14
|
+
Link
|
|
15
|
+
}) {
|
|
16
|
+
const appConfig = appsConfig[app];
|
|
17
|
+
const logoColor = app === "net" ? "jade" : app === "stacks" ? "blue" : "orange";
|
|
18
|
+
const logoText = app === "net" ? "Safety Net" : app === "stacks" ? "Stacks" : "Solidarity fund";
|
|
19
|
+
return /* @__PURE__ */ jsxs(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: `relative py-2.5 flex items-center justify-between ${className}`,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxs(Link, { href: "/", children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Logo, { size: 24, color: logoColor, className: "md:hidden" }),
|
|
26
|
+
/* @__PURE__ */ jsx("span", { className: "hidden md:block lg:text-2xl", children: /* @__PURE__ */ jsx(Logo, { text: "BREAD", size: 24, color: logoColor }) })
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ jsx(NavSolidarityAppsDesktop, { app, label: logoText }),
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
NavbarMenu,
|
|
31
|
+
{
|
|
32
|
+
textClassName: appConfig.text,
|
|
33
|
+
mobileHeader: /* @__PURE__ */ jsx(Link, { href: "/", children: /* @__PURE__ */ jsx(Logo, { color: logoColor, text: logoText }) }),
|
|
34
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
NavSolidarityApps,
|
|
37
|
+
{
|
|
38
|
+
showTitle: true,
|
|
39
|
+
showSelected: true,
|
|
40
|
+
rearranged: true,
|
|
41
|
+
current: app,
|
|
42
|
+
className: "mt-6 md:hidden"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
AccountSection,
|
|
47
|
+
{
|
|
48
|
+
app,
|
|
49
|
+
widgetItems,
|
|
50
|
+
actionItems
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] }),
|
|
54
|
+
children
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
Navbar
|
|
63
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { App } from '../../interface/app.mjs';
|
|
3
|
+
|
|
4
|
+
interface NavSolidarityAppsProps {
|
|
5
|
+
current?: App;
|
|
6
|
+
className?: string;
|
|
7
|
+
showTitle?: boolean;
|
|
8
|
+
showSelected?: boolean;
|
|
9
|
+
rearranged?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const NavSolidarityApps: ({ current, className, showTitle, showSelected, rearranged, }: NavSolidarityAppsProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare const NavSolidarityAppsDesktop: ({ label, app, }: {
|
|
13
|
+
app: App;
|
|
14
|
+
label: string;
|
|
15
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { NavSolidarityApps, NavSolidarityAppsDesktop };
|