mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-25 00:11:52 +08:00
style: react component prop readonly
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Button, type ButtonProps } from "@/components/ui/button.tsx";
|
import { Button, type ButtonProps } from "@/components/ui/button";
|
||||||
import { Check, Copy } from "lucide-react";
|
import { Check, Copy } from "lucide-react";
|
||||||
import { type HTMLProps, type ReactNode, useCallback, useEffect, useState } from "react";
|
import { type HTMLProps, type ReactNode, useCallback, useEffect, useState } from "react";
|
||||||
import { CopyToClipboard } from "react-copy-to-clipboard";
|
import { CopyToClipboard } from "react-copy-to-clipboard";
|
||||||
@@ -12,7 +12,7 @@ interface CopyButtonProps extends ButtonProps {
|
|||||||
src?: string;
|
src?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CopyButton({ value }: CopyButtonProps) {
|
export function CopyButton({ value }: Readonly<CopyButtonProps>) {
|
||||||
const [hasCopied, setHasCopied] = useState(false);
|
const [hasCopied, setHasCopied] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ interface CopyableFieldProps {
|
|||||||
text?: string;
|
text?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CopyableField({ label, value, text }: CopyableFieldProps) {
|
export function CopyableField({ label, value, text }: Readonly<CopyableFieldProps>) {
|
||||||
const [hasCopied, setHasCopied] = useState(false);
|
const [hasCopied, setHasCopied] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ export function ShellResult({
|
|||||||
allPackResults,
|
allPackResults,
|
||||||
packMethod,
|
packMethod,
|
||||||
generateResult,
|
generateResult,
|
||||||
}: {
|
}: Readonly<{
|
||||||
packResult: string | undefined;
|
packResult: string | undefined;
|
||||||
allPackResults: Map<string, string> | undefined;
|
allPackResults: Map<string, string> | undefined;
|
||||||
packMethod: string;
|
packMethod: string;
|
||||||
generateResult?: GenerateResult;
|
generateResult?: GenerateResult;
|
||||||
}) {
|
}>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
if (!generateResult) {
|
if (!generateResult) {
|
||||||
return <QuickUsage />;
|
return <QuickUsage />;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { UrlPatternFormField } from "./urlpattern-field";
|
|||||||
export function AntSwordTabContent({
|
export function AntSwordTabContent({
|
||||||
form,
|
form,
|
||||||
shellTypes,
|
shellTypes,
|
||||||
}: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { UrlPatternFormField } from "./urlpattern-field";
|
|||||||
export function BehinderTabContent({
|
export function BehinderTabContent({
|
||||||
form,
|
form,
|
||||||
shellTypes,
|
shellTypes,
|
||||||
}: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { FormSchema } from "@/types/schema.ts";
|
|||||||
import { FormProvider, UseFormReturn } from "react-hook-form";
|
import { FormProvider, UseFormReturn } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export function OptionalClassFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
export function OptionalClassFormField({ form }: Readonly<{ form: UseFormReturn<FormSchema> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { UrlPatternFormField } from "./urlpattern-field";
|
|||||||
export function CommandTabContent({
|
export function CommandTabContent({
|
||||||
form,
|
form,
|
||||||
shellTypes,
|
shellTypes,
|
||||||
}: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { UrlPatternFormField } from "./urlpattern-field";
|
|||||||
export function GodzillaTabContent({
|
export function GodzillaTabContent({
|
||||||
form,
|
form,
|
||||||
shellTypes,
|
shellTypes,
|
||||||
}: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ import { OptionalClassFormField } from "./classname-field";
|
|||||||
import { ShellTypeFormField } from "./shelltype-field";
|
import { ShellTypeFormField } from "./shelltype-field";
|
||||||
import { UrlPatternFormField } from "./urlpattern-field";
|
import { UrlPatternFormField } from "./urlpattern-field";
|
||||||
|
|
||||||
export function NeoRegTabContent({ form, shellTypes }: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
export function NeoRegTabContent({
|
||||||
|
form,
|
||||||
|
shellTypes,
|
||||||
|
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
export function ShellTypeFormField({
|
export function ShellTypeFormField({
|
||||||
form,
|
form,
|
||||||
shellTypes,
|
shellTypes,
|
||||||
}: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
@@ -24,8 +24,8 @@ export function ShellTypeFormField({
|
|||||||
<SelectValue placeholder={t("placeholders.select")} />
|
<SelectValue placeholder={t("placeholders.select")} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<SelectContent key={shellTypes.join(",")}>
|
<SelectContent key={shellTypes?.join(",")}>
|
||||||
{shellTypes.length ? (
|
{shellTypes?.length ? (
|
||||||
shellTypes.map((v) => (
|
shellTypes.map((v) => (
|
||||||
<SelectItem key={v} value={v}>
|
<SelectItem key={v} value={v}>
|
||||||
{v}
|
{v}
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ import { OptionalClassFormField } from "./classname-field";
|
|||||||
import { ShellTypeFormField } from "./shelltype-field";
|
import { ShellTypeFormField } from "./shelltype-field";
|
||||||
import { UrlPatternFormField } from "./urlpattern-field";
|
import { UrlPatternFormField } from "./urlpattern-field";
|
||||||
|
|
||||||
export function Suo5TabContent({ form, shellTypes }: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
export function Suo5TabContent({
|
||||||
|
form,
|
||||||
|
shellTypes,
|
||||||
|
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { FormSchema } from "@/types/schema.ts";
|
|||||||
import { FormProvider, UseFormReturn } from "react-hook-form";
|
import { FormProvider, UseFormReturn } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export function UrlPatternFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
export function UrlPatternFormField({ form }: Readonly<{ form: UseFormReturn<FormSchema> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
|
|||||||
Reference in New Issue
Block a user