From 28d5a2a019357c2f3421f1388953a969eafc61d3 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 3 Dec 2024 10:09:44 -0800 Subject: [PATCH] Add copy --- .../components/Settings/SettingsLicense.tsx | 50 +++++++++++++------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src-web/components/Settings/SettingsLicense.tsx b/src-web/components/Settings/SettingsLicense.tsx index 7d7d83c7..82b2042e 100644 --- a/src-web/components/Settings/SettingsLicense.tsx +++ b/src-web/components/Settings/SettingsLicense.tsx @@ -1,8 +1,11 @@ -import { useLicense } from '@yaakapp-internal/license'; -import { format, formatDistanceToNow } from 'date-fns'; import { open } from '@tauri-apps/plugin-shell'; +import { useLicense } from '@yaakapp-internal/license'; +import classNames from 'classnames'; +import { format, formatDistanceToNow } from 'date-fns'; import React, { useState } from 'react'; +import { useCopy } from '../../hooks/useCopy'; import { useSettings } from '../../hooks/useSettings'; +import { useTimedBoolean } from '../../hooks/useTimedBoolean'; import { useToggle } from '../../hooks/useToggle'; import { Banner } from '../core/Banner'; import { Button } from '../core/Button'; @@ -19,34 +22,36 @@ export function SettingsLicense() { const settings = useSettings(); const specialAnnouncement = settings.createdAt < '2024-12-02' && check.data?.type === 'trial_ended'; + const [copied, setCopied] = useTimedBoolean(); + const copy = useCopy({ disableToast: true }); return ( -
+
+ {check.data?.type === 'personal_use' && You're} + {check.data?.type === 'commercial_use' && ( + + License active! Enjoy using Yaak for commercial use. + + )} {check.data?.type === 'trialing' && ( Your trial ends in {formatDistanceToNow(check.data.end)}. If you're using Yaak for commercial use, please purchase a commercial use license. )} - {check.data?.type === 'trial_ended' && ( - + {check.data?.type === 'trial_ended' && !specialAnnouncement && ( + Your trial ended on {format(check.data.end, 'MMMM dd, yyyy')}. A commercial-use license is required if you use Yaak within a for-profit organization of two or more people. )} - {check.data?.type === 'personal_use' && You're} - {check.data?.type === 'commercial_use' && ( - - License active! Enjoy using Yaak for commercial use. - - )} {check.error && {check.error}} {activate.error && {activate.error}} {specialAnnouncement && ( - +

Thank you for being an early supporter of Yaak!

@@ -60,8 +65,25 @@ export function SettingsLicense() { Announcement Post.

- As a thank-you, enter code EARLYAAK at checkout for 50% off - your first year of the individual plan. + As a thank-you, enter code{' '} + {' '} + at checkout for 50% off your first year of the individual plan.

~ Greg