fix(ui):修正影响编译的问题。

This commit is contained in:
徐涛 2024-04-07 21:38:05 +08:00
parent 019652ca67
commit 86d7823aae
5 changed files with 12 additions and 22 deletions

View File

@ -9,9 +9,9 @@ export function LicenseCode() {
const licenseCode = useLicenseCodeStore((state) => state.licenceCode);
const copyLicenseCode = async () => {
if (not(isEmpty(licenseCode))) {
await navigator.clipboard.writeText(licenseCode);
await navigator.clipboard.writeText(licenseCode ?? "");
notifications.show({
title: "授权码已复制",
message: "授权码已复制",
color: "green",
});
}

View File

@ -80,7 +80,7 @@ async function generateLicense(form: LicenseInfoForm, selectedProducts: string[]
const validDays = now.add(validYears, "year").diff(now, "day");
if (isEmpty(selectedProducts)) {
notifications.show({
title: "至少需要选择一个产品",
message: "至少需要选择一个产品",
color: "red",
});
return "";

View File

@ -22,7 +22,7 @@ export const useProductsStore = create<ProductsStore>((set, get) => ({
append: (code: string) => {
const selectedProduct: Product | undefined = find(propEq(code, "id"), get().products);
set((state) => ({
selectedProducts: uniq([...state.selectedProducts, code, ...(selectedProduct.couple ?? [])]),
selectedProducts: uniq([...state.selectedProducts, code, ...(selectedProduct?.couple ?? [])]),
}));
},
remove: (code: string) =>

View File

@ -4,5 +4,11 @@ export const theme = createTheme({
focusRing: "never",
fontSmoothing: true,
defaultRadius: "xs",
lineHeights: "xs",
lineHeights: {
xs: "1.2",
sm: "1.25",
md: "1.35",
lg: "1.4",
xl: "1.5",
},
});

View File

@ -1,21 +1,5 @@
import cx, { ClassDictionary } from "clsx";
import { defaultTo, isEmpty, isNil, prop } from "ramda";
import { ChangeHandler } from "react-hook-form";
export function convertFormEvent(
name: string,
event: InputEvent,
property: string = "value",
defaultValue?: unknown = null
): Parameters<ChangeHandler> {
return {
target: {
name,
value: defaultTo(defaultValue)(prop(property, event.currentTarget)),
},
type: event.type,
};
}
import { isEmpty, isNil, prop } from "ramda";
export function composite(classesDefination: ClassDictionary, ...classes: string[]) {
/** @type {import("clsx").ClassArray} */