mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 04:30:06 +00:00
feat: 调整安装脚本复制位置
This commit is contained in:
@@ -4,9 +4,10 @@ import {
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import { ButtonProps } from "@/components/ui/button"
|
||||
import { Button, ButtonProps } from "@/components/ui/button"
|
||||
import { forwardRef, useState } from "react"
|
||||
import { IconButton } from "./xui/icon-button"
|
||||
import { Check, Clipboard } from "lucide-react"
|
||||
import { t } from "i18next"
|
||||
|
||||
export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
||||
const [copy, setCopy] = useState(false);
|
||||
@@ -17,16 +18,17 @@ export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((p
|
||||
await navigator.clipboard.writeText("stub");
|
||||
setTimeout(() => {
|
||||
setCopy(false);
|
||||
}, 2 * 1000);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<IconButton {...props} ref={ref} variant="outline" size="icon" icon={
|
||||
copy ? "check" : "clipboard"
|
||||
} />
|
||||
<Button {...props} ref={ref}>
|
||||
{copy ? <Check /> : <Clipboard />}
|
||||
{t("InstallCommands")}
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
<DropdownMenuItem onClick={switchState}>Linux</DropdownMenuItem>
|
||||
|
||||
@@ -36,7 +36,7 @@ export default function ServerPage() {
|
||||
toast(t("Error"), {
|
||||
description: t("Results.ErrorFetchingResource", { error: error.message }),
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [error]);
|
||||
|
||||
const columns: ColumnDef<Server>[] = [
|
||||
@@ -46,7 +46,7 @@ export default function ServerPage() {
|
||||
<Checkbox
|
||||
checked={
|
||||
table.getIsAllPageRowsSelected() ||
|
||||
(table.getIsSomePageRowsSelected() && "indeterminate")
|
||||
(table.getIsSomePageRowsSelected() && "indeterminate")
|
||||
}
|
||||
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
|
||||
aria-label="Select all"
|
||||
@@ -108,11 +108,6 @@ export default function ServerPage() {
|
||||
accessorKey: "hideForGuest",
|
||||
accessorFn: (row) => row.hide_for_guest ?? false,
|
||||
},
|
||||
{
|
||||
id: "installCommands",
|
||||
header: t("InstallCommands"),
|
||||
cell: () => <InstallCommandsMenu />,
|
||||
},
|
||||
{
|
||||
id: "note",
|
||||
header: t("Note"),
|
||||
@@ -187,13 +182,14 @@ export default function ServerPage() {
|
||||
return;
|
||||
}
|
||||
toast(t("Done"), {
|
||||
description: t("Results.ForceUpdate")
|
||||
+ (resp.success?.length ? t(`Success`) + ` [${resp.success.join(",")}]` : "")
|
||||
+ (resp.failure?.length ? t(`Failure`) + ` [${resp.failure.join(",")}]` : "")
|
||||
+ (resp.offline?.length ? t(`Offline`) + ` [${resp.offline.join(",")}]` : "")
|
||||
description: t("Results.ForceUpdate")
|
||||
+ (resp.success?.length ? t(`Success`) + ` [${resp.success.join(",")}]` : "")
|
||||
+ (resp.failure?.length ? t(`Failure`) + ` [${resp.failure.join(",")}]` : "")
|
||||
+ (resp.offline?.length ? t(`Offline`) + ` [${resp.offline.join(",")}]` : "")
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<InstallCommandsMenu className="bg-blue-700" />
|
||||
</HeaderButtonGroup>
|
||||
</div>
|
||||
<Table>
|
||||
|
||||
Reference in New Issue
Block a user