import React from "react"; import { useUserContext } from "./UserContext"; import { Avatar, Box, Button, Flex, Modal, Paper, TextInput, Title, } from "@mantine/core"; import { useDisclosure } from "@mantine/hooks"; import { NavigateButton } from "./NavigateButton"; import { Link } from "react-router"; export const AuthorizeMastodonModal: React.FC<{ opened: boolean; onClose: () => void; }> = ({ opened, onClose }) => { const [serverName, setServerName] = React.useState("rubber.social"); const [loading, setLoading] = React.useState(false); const handleClick = React.useCallback(() => { setLoading(true); fetch(`/api/mastodon_oauth?server=${encodeURI(serverName)}`) .then((response) => response.json()) .then((json) => { if (json["url"]) { window.location.href = json["url"]; } }); }, []); return ( setServerName(event.currentTarget.value)} /> ); }; export const Profile: React.FC = () => { const { username, telegram_photo_url, mastodon_server, mastodon_username } = useUserContext(); const [opened, { open, close }] = useDisclosure(false); const mastodon_account = React.useMemo( () => `@${mastodon_username}@${mastodon_server}`, [mastodon_server, mastodon_username], ); return ( <> {username} Return to dashboard Mastodon ); };