Something went wrong. Try again.
Starship Simulator Controls thoriumsim.com
Something went wrong. Try again.
5.1 kB · 161 lines
TSX
at develop
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162export default function LoginButton(_props: { buttonClassName?: string; size?: string }) { // Deactivating until I have proper Atproto login support return null;}// import { useIssueTracker } from "@thorium/components/useIssueTracker";// import Logo from "@thorium/images/logo.svg?url";// import Button from "@thorium/ui/Button";// import { popoverTransitionClasses } from "@thorium/ui/Dropdown";// import { useEffect, useRef, useState } from "react";// import { Menu, MenuItem, MenuTrigger, Popover, Button as RAButton } from "react-aria-components";
// import { useThoriumAccount } from "../context/ThoriumAccountContext";// import { Icon } from "./ui/Icon";
// // https://stackoverflow.com/a/16861050/4697675// const popupCenter = ({// url,// title,// w,// h,// }: {// url: string;// title: string;// w: number;// h: number;// }) => {// // Fixes dual-screen position Most browsers Firefox// const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;// const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
// const width = window.innerWidth// ? window.innerWidth// : document.documentElement.clientWidth// ? document.documentElement.clientWidth// : window.screen.width;// const height = window.innerHeight// ? window.innerHeight// : document.documentElement.clientHeight// ? document.documentElement.clientHeight// : window.screen.height;
// const systemZoom = width / window.screen.availWidth;// const left = (width - w) / 2 / systemZoom + dualScreenLeft;// const top = (height - h) / 2 / systemZoom + dualScreenTop;// const newWindow = window.open(// url,// title,// `// scrollbars=yes,// width=${w / systemZoom},// height=${h / systemZoom},// top=${top},// left=${left}// `,// );
// newWindow?.focus();// return newWindow;// };
// function AccountMenu({ size = "md" }) {// const { account, logout } = useThoriumAccount();// const { setOpen } = useIssueTracker();// const [noImg, setNoImg] = useState(!account?.profilePictureUrl);// if (!account) return null;// return (// <MenuTrigger>// <RAButton className="inline-flex justify-center">// {noImg ? (// <img// draggable={false}// src={Logo}// alt="Thorium Logo"// className={`avatar ${// size === "sm" ? "h-8 w-8" : "h-10 w-10"// } rounded-full border border-gray-500 object-contain`}// />// ) : (// <img// draggable={false}// className={`avatar ${// size === "sm" ? "h-8 w-8" : "h-10 w-10"// } rounded-full border border-gray-500 object-contain`}// src={account.profilePictureUrl}// alt={account.displayName}// onError={() => setNoImg(true)}// />// )}// </RAButton>// <Popover className={popoverTransitionClasses}>// <Menu className="z-10 mt-2 w-56 divide-y divide-gray-700 rounded-md bg-gray-900 px-1 py-1 text-lg shadow-lg ring-1 ring-gray-300/5 focus:outline-none">// <MenuItem// className="group flex w-full items-center rounded-md px-2 py-2 text-sm text-white data-[isFocused]:bg-purple-900"// onAction={() => {// setOpen(true);// }}// >// <Icon name="circle-dot" className="mr-2" /> Issue Tracker// </MenuItem>// <MenuItem// className="group flex w-full items-center rounded-md px-2 py-2 text-sm text-white data-[isFocused]:bg-purple-900"// onAction={() => logout()}// >// <Icon name="log-out" className="mr-2" /> Logout// </MenuItem>// </Menu>// </Popover>// </MenuTrigger>// );// }
// export default function LoginButton({// buttonClassName = "btn-ghost btn-sm",// size = "md",// }: {// buttonClassName?: string;// size?: string;// }) {// const { login, account, verificationUrl, verifying } = useThoriumAccount();// const linkRef = useRef<HTMLAnchorElement>(null);// const windowRef = useRef<Window | null>(null);// useEffect(() => {// if (verificationUrl) {// if (!windowRef.current) {// windowRef.current = popupCenter({// url: verificationUrl,// title: "Verify your account",// w: 500,// h: 500,// });// }// // linkRef.current?.click();// }// }, [verificationUrl]);
// useEffect(() => {// if (windowRef.current) {// windowRef.current.close();// windowRef.current = null;// }// }, [account]);
// return (// <div className="flex items-center place-self-end self-start">// <a ref={linkRef} href={verificationUrl} target="thorium-account" className="opacity-0">// {" "}// </a>// {!account || verifying ? (// <Button// className={`w-max ${buttonClassName} ${verifying ? "loading" : ""}`}// onClick={() => {// login();// }}// >// {verifying ? "Verifying..." : "Login to Thorium"}// </Button>// ) : null}// {account && <AccountMenu size={size} />}// </div>// );// }