import { CopyToClipboard } from "react-copy-to-clipboard"; import { Flex } from "reflexbox/styled-components"; import React, { useState } from "react"; import styled from "styled-components"; import QRCode from "qrcode.react"; import { useStoreActions, useStoreState } from "../store"; import { Col, RowCenterH, RowCenter } from "./Layout"; import { useFormState } from "react-use-form-state"; import { removeProtocol } from "../utils"; import { Link } from "../store/links"; import { useMessage } from "../hooks"; import TextInput from "./TextInput"; import Animation from "./Animation"; import Checkbox from "./Checkbox"; import { Button } from "./Button"; import Tooltip from "./Tooltip"; import Modal from "./Modal"; import Text from "./Text"; import Icon from "./Icon"; const SubmitIconWrapper = styled.div` content: ""; position: absolute; top: 0; right: 12px; width: 64px; height: 100%; display: flex; justify-content: center; align-items: center; cursor: pointer; :hover svg { fill: #673ab7; } @media only screen and (max-width: 448px) { right: 8px; width: 40px; } `; const ShortenedLink = styled(Text)` border-bottom: 2px dotted #aaa; cursor: pointer; transition: all 0.2s ease; :hover { opacity: 0.5; } `; interface Form { target: string; customurl?: string; password?: string; showAdvanced?: boolean; } const Shortener = () => { const { isAuthenticated } = useStoreState(s => s.auth); const [domain] = useStoreState(s => s.settings.domains); const submit = useStoreActions(s => s.links.submit); const [link, setLink] = useState(null); const [message, setMessage] = useMessage(3000); const [loading, setLoading] = useState(false); const [qrModal, setQRModal] = useState(false); const [copied, setCopied] = useMessage(3000); const [formState, { raw, password, text, label }] = useFormState