From f19e0307290ea52f1f12d629bf8257a39424e28a Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Mon, 21 Nov 2022 23:03:28 +0800 Subject: [PATCH] feat: free license tip --- src/routes/setting/License.tsx | 168 +++++++++------------------------ tailwind.config.js | 15 +++ 2 files changed, 58 insertions(+), 125 deletions(-) diff --git a/src/routes/setting/License.tsx b/src/routes/setting/License.tsx index b560077c..77ffc69b 100644 --- a/src/routes/setting/License.tsx +++ b/src/routes/setting/License.tsx @@ -1,151 +1,69 @@ -import { useState, MouseEvent } from "react"; +import { useState, HTMLAttributes } from "react"; import dayjs from "dayjs"; -import styled from "styled-components"; -// import Tippy from "@tippyjs/react"; -// import toast from "react-hot-toast"; -// import { hideAll } from "tippy.js"; -// import Textarea from "../../common/component/styled/Textarea"; import Button from "../../common/component/styled/Button"; import useLicense from "../../common/hook/useLicense"; import LicensePriceListModal from "./LicensePriceListModal"; +import clsx from "clsx"; -const Styled = styled.div` - max-width: 760px; - display: flex; - flex-direction: column; - justify-content: flex-start; - align-items: flex-start; - gap: 15px; - > .license { - position: relative; - width: 100%; - padding: 12px; - border-radius: 5px; - border: 2px solid #557d2340; - background-color: #d1fadf60; - display: flex; - flex-direction: column; - gap: 15px; - &.outdated { - border-color: #ef4444; - background-color: #ef444457; - &:after { - content: "License Outdated"; - position: absolute; - right: 10px; - top: 10px; - background-color: #ef4444; - padding: 5px 4px; - font-size: 14px; - font-weight: bold; - color: #fff; - border-radius: 4px; - } - } - .item { - white-space: nowrap; - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: flex-start; - line-height: 1.2; - .label { - font-size: 13px; - color: #aaa; - &:after { - content: ":"; - } - } - .info { - font-weight: bold; - font-size: 18px; - line-height: 1.4; - &.value { - cursor: pointer; - width: 100%; - white-space: pre-wrap; - word-break: break-all; - &.fold { - white-space: inherit; - overflow: hidden; - text-overflow: ellipsis; - } - } - } - } - } -`; +interface ItemProps extends HTMLAttributes { label: string, data?: string | number | string[], foldable?: boolean } +const Item = ({ label, data, foldable = false, ...rest }: ItemProps) => { + const infoClass = clsx("font-bold w-full cursor-pointer", foldable ? " overflow-hidden text-ellipsis" : "whitespace-pre-wrap break-all"); + if (!data) return null; + return
+ {label} + {Array.isArray(data) ?
    + {data.map((d) => { + return
  • {d}
  • ; + })} +
: + {data} + } +
; +}; export default function License() { const { license: licenseInfo, reachLimit } = useLicense(); const [modalVisible, setModalVisible] = useState(false); + const [base58Fold, setBase58Fold] = useState(true); const handleRenewLicense = () => { toggleModalVisible(); }; const toggleModalVisible = () => { setModalVisible((prev) => !prev); }; - const handleLicenseValueToggle = (evt: MouseEvent) => { - const ele = evt.currentTarget; - ele.classList.toggle("fold"); - if (ele.classList.contains("fold")) { - ele.title = "Click to see full text"; - } else { - ele.title = "Click to fold text"; - } + const handleLicenseValueToggle = () => { + setBase58Fold(pre => !pre); }; - // const disableBtn = !reachLimit; return ( <> - -
-
- Signed - {licenseInfo?.sign ? "Yes" : "Not Yet"} -
-
- Domains -
    - {licenseInfo?.domains.map((d) => { - return
  • {d}
  • ; - })} -
-
-
- User Limit - - {licenseInfo?.user_limit == 99999 ? "No Limit" : licenseInfo?.user_limit} - -
-
- Expired At - - {dayjs(licenseInfo?.expired_at).format("YYYY-MM-DD h:mm:ss A")} - -
-
- Created At - - {dayjs(licenseInfo?.created_at).format("YYYY-MM-DD h:mm:ss A")} - -
-
- License Value - - {licenseInfo?.base58} - -
+
+
+ + + + + +
- +
+

A chance to get a free license upgrade! 🎁

+

+ Getting a free license upgrade by joining our User Test Session + + + Book a time here: https://calendly.com/hansu/han-meeting + + + Or, add WeChat for more information: yanggc_2013 + +

+
+
{modalVisible && ( )} diff --git a/tailwind.config.js b/tailwind.config.js index e8bcd52a..92609349 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -3,6 +3,21 @@ module.exports = { content: ["./src/**/*.{js,jsx,ts,tsx}", "./public/*.html"], theme: { extend: { + colors: { + primary: { + 25: "#F5FEFF", + 50: "#ECFDFF", + 100: "#CFF9FE", + 200: "#A5F0FC", + 300: "#67E3F9", + 400: "#22CCEE", + 500: "#06AED4", + 600: "#088AB2", + 700: "#0E7090", + 800: "#155B75", + 900: "#164C63" + } + }, keyframes: { fadeInUp: { from: {