mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 00:58:32 +02:00
Add beta feedback badge
This commit is contained in:
@@ -1,15 +1,20 @@
|
|||||||
|
import { openUrl } from '@tauri-apps/plugin-opener';
|
||||||
import type { LicenseCheckStatus } from '@yaakapp-internal/license';
|
import type { LicenseCheckStatus } from '@yaakapp-internal/license';
|
||||||
import { useLicense } from '@yaakapp-internal/license';
|
import { useLicense } from '@yaakapp-internal/license';
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
import { appInfo } from '../hooks/useAppInfo';
|
import { appInfo } from '../hooks/useAppInfo';
|
||||||
import { useOpenSettings } from '../hooks/useOpenSettings';
|
import { useOpenSettings } from '../hooks/useOpenSettings';
|
||||||
import type { ButtonProps } from './core/Button';
|
import type { ButtonProps } from './core/Button';
|
||||||
import { Button } from './core/Button';
|
import { Button } from './core/Button';
|
||||||
|
import {HStack} from "./core/Stacks";
|
||||||
import { SettingsTab } from './Settings/SettingsTab';
|
import { SettingsTab } from './Settings/SettingsTab';
|
||||||
|
import { Icon } from './core/Icon';
|
||||||
|
|
||||||
const details: Record<
|
const details: Record<
|
||||||
LicenseCheckStatus['type'] | 'dev',
|
LicenseCheckStatus['type'] | 'dev' | 'beta',
|
||||||
{ label: string; color: ButtonProps['color'] } | null
|
{ label: ReactNode; color: ButtonProps['color'] } | null
|
||||||
> = {
|
> = {
|
||||||
|
beta: { label: <HStack space={1}><span>Beta Feedback</span><Icon size="xs" icon='external_link'/></HStack>, color: 'success' },
|
||||||
dev: { label: 'Develop', color: 'secondary' },
|
dev: { label: 'Develop', color: 'secondary' },
|
||||||
commercial_use: null,
|
commercial_use: null,
|
||||||
invalid_license: { label: 'License Error', color: 'danger' },
|
invalid_license: { label: 'License Error', color: 'danger' },
|
||||||
@@ -25,7 +30,11 @@ export function LicenseBadge() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkType = appInfo.isDev ? 'dev' : check.data.type;
|
const checkType = appInfo.version.includes('beta')
|
||||||
|
? 'beta'
|
||||||
|
: appInfo.isDev
|
||||||
|
? 'dev'
|
||||||
|
: check.data.type;
|
||||||
const detail = details[checkType];
|
const detail = details[checkType];
|
||||||
if (detail == null) {
|
if (detail == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -36,7 +45,13 @@ export function LicenseBadge() {
|
|||||||
size="2xs"
|
size="2xs"
|
||||||
variant="border"
|
variant="border"
|
||||||
className="!rounded-full mx-1"
|
className="!rounded-full mx-1"
|
||||||
onClick={() => openSettings.mutate()}
|
onClick={async () => {
|
||||||
|
if (checkType === 'beta') {
|
||||||
|
await openUrl('https://feedback.yaak.app/p/yaak-20-feedback');
|
||||||
|
} else {
|
||||||
|
openSettings.mutate();
|
||||||
|
}
|
||||||
|
}}
|
||||||
color={detail.color}
|
color={detail.color}
|
||||||
event={{ id: 'license-badge', status: check.data.type }}
|
event={{ id: 'license-badge', status: check.data.type }}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user