import {
JSX,
Match,
ParentComponent,
Show,
Suspense,
Switch,
createResource,
createSignal
} from "solid-js";
import {
Collapsible,
Checkbox as KCheckbox,
Dialog,
Separator
} from "@kobalte/core";
import { useMegaStore } from "~/state/megaStore";
import check from "~/assets/icons/check.svg";
import { MutinyTagItem } from "~/utils/tags";
import { generateGradient } from "~/utils/gradientHash";
import close from "~/assets/icons/close.svg";
import { A } from "solid-start";
import down from "~/assets/icons/down.svg";
import { LoadingIndicator, DecryptDialog } from "~/components";
import { LoadingSpinner } from "@mutinywallet/ui";
import { useI18n } from "~/i18n/context";
export const SmallHeader: ParentComponent<{ class?: string }> = (props) => {
return (
);
};
export const Card: ParentComponent<{
title?: string | null;
titleElement?: JSX.Element;
}> = (props) => {
return (
{props.title && {props.title}}
{props.titleElement && props.titleElement}
{props.children}
);
};
export const InnerCard: ParentComponent<{ title?: string }> = (props) => {
return (
{props.title && {props.title}}
{props.children}
);
};
export const FancyCard: ParentComponent<{
title?: string;
subtitle?: string;
tag?: JSX.Element;
}> = (props) => {
return (
{props.children}
);
};
export const SettingsCard: ParentComponent<{
title?: string;
}> = (props) => {
return (
{props.title}
{props.children}
);
};
export const Collapser: ParentComponent<{
title: string;
defaultOpen?: boolean;
activityLight?: "on" | "off";
}> = (props) => {
return (
{props.children}
);
};
export const SafeArea: ParentComponent = (props) => {
return (
{/*
*/}
{props.children}
{/*
*/}
);
};
export const DefaultMain: ParentComponent = (props) => {
return (
{props.children}
{/* CSS is hard sometimes */}
);
};
export const FullscreenLoader = () => {
const i18n = useI18n();
const [waitedTooLong, setWaitedTooLong] = createSignal(false);
setTimeout(() => {
setWaitedTooLong(true);
}, 10000);
return (
);
};
export const MutinyWalletGuard: ParentComponent = (props) => {
const [state, _] = useMegaStore();
return (
}>
{props.children}
);
};
export const Hr = () => ;
export const LargeHeader: ParentComponent<{
action?: JSX.Element;
centered?: boolean;
}> = (props) => {
return (
{props.children}
{props.action}
);
};
export const VStack: ParentComponent<{
biggap?: boolean;
smallgap?: boolean;
}> = (props) => {
return (
{props.children}
);
};
export const HStack: ParentComponent<{ biggap?: boolean }> = (props) => {
return (
{props.children}
);
};
export const SmallAmount: ParentComponent<{
amount: number | bigint;
sign?: string;
}> = (props) => {
return (
{props.sign ? `${props.sign} ` : ""}
{props.amount.toLocaleString()} SATS
);
};
export const NiceP: ParentComponent = (props) => {
return {props.children}
;
};
export const TinyText: ParentComponent = (props) => {
return {props.children}
;
};
export const TinyButton: ParentComponent<{
onClick: () => void;
tag?: MutinyTagItem;
}> = (props) => {
// TODO: don't need to run this if it's not a contact
const [gradient] = createResource(async () => {
return generateGradient(props.tag?.name || "?");
});
const bg = () =>
props.tag?.name && props.tag?.kind === "Contact"
? gradient()
: "rgb(255 255 255 / 0.1)";
return (
);
};
export const Indicator: ParentComponent = (props) => {
return (
{props.children}
);
};
export function Checkbox(props: {
label: string;
checked: boolean;
onChange: (checked: boolean) => void;
caption?: string;
}) {
return (
{props.label}
{props.caption}
);
}
export function ModalCloseButton() {
return (
);
}
export const SIMPLE_OVERLAY = "fixed inset-0 z-50 bg-black/20 backdrop-blur-md";
export const SIMPLE_DIALOG_POSITIONER =
"fixed inset-0 z-50 flex items-center justify-center";
export const SIMPLE_DIALOG_CONTENT =
"max-w-[500px] w-[90vw] max-h-[100dvh] overflow-y-scroll disable-scrollbars mx-4 p-4 bg-neutral-800/80 backdrop-blur-md shadow-xl rounded-xl border border-white/10";
export const SimpleDialog: ParentComponent<{
title: string;
open: boolean;
setOpen?: (open: boolean) => void;
}> = (props) => {
return (
{props.title}
{props.children}
);
};