import { open } from '@tauri-apps/plugin-shell'; import { useLicense } from '@yaakapp-internal/license'; import { formatDistanceToNow } from 'date-fns'; import React, { useState } from 'react'; import { useToggle } from '../../hooks/useToggle'; import { Banner } from '../core/Banner'; import { Button } from '../core/Button'; import { Icon } from '../core/Icon'; import { Link } from '../core/Link'; import { PlainInput } from '../core/PlainInput'; import { HStack, VStack } from '../core/Stacks'; export function SettingsLicense() { const { check, activate } = useLicense(); const [key, setKey] = useState(''); const [activateFormVisible, toggleActivateFormVisible] = useToggle(false); if (check.isPending) { return null; } return (
{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)}.

)}

A commercial license is required if using Yaak within a for-profit organization of two or more people.{' '} Learn More

This helps support the ongoing development of Yaak and ensures continued growth and improvement.{' '}

If you're using Yaak for personal use, no action is needed.

~ Gregory

)} {check.error && {check.error}} {activate.error && {activate.error}} {check.data?.type === 'commercial_use' ? ( ) : ( )} {activateFormVisible && ( { e.preventDefault(); toggleActivateFormVisible(); activate.mutate({ licenseKey: key }); }} > )}
); }