Skip to content

Commit

Permalink
更新接点页面数据
Browse files Browse the repository at this point in the history
  • Loading branch information
zsio committed Aug 29, 2024
1 parent a997e3c commit ef1eef8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
47 changes: 22 additions & 25 deletions src/app/admin/machines/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import {cn} from "@/lib/utils";
import {DotFilledIcon} from "@radix-ui/react-icons";
import React from "react";
import {useHsMachines} from "@/lib/hs-hooks";

interface Props {
params: {
Expand All @@ -21,39 +22,35 @@ interface Props {

export default function Page(props: Props) {

console.log(props)
const allMachine = useHsMachines()
const machine = allMachine.data.find(m => m.id === props.params.id)


// 当前机器:{JSON.stringify(props.params)}

return (
<>

<Breadcrumb className="">
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="/admin/machines">Machines</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>host</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>

<div className="flex justify-between">
<div className="flex items-center">
<span>机器</span>
<DotFilledIcon className={cn("w-6 h-6 text-gray-400", true && "text-green-600")}/>

<div className="flex justify-between items-center mt-8 ">
<div className="flex items-center font-bold text-2xl">
<span>{machine?.givenName}</span>
<DotFilledIcon className={cn("w-6 h-6 text-gray-400", machine?.online && "text-green-600")}/>
</div>
<div>
<button className="btn">Edit</button>
</div>
<div>123</div>
</div>
<Separator className="my-4"/>
<Separator className="my-6"/>
<div className="flex h-5 items-center space-x-4 text-sm">
<div>Blog</div>
<Separator orientation="vertical"/>
<div>Docs</div>
<Separator orientation="vertical"/>
<div>Source</div>
<div className="space-y-1.5">
<p className="text-gray-400">Managed by</p>
<p>{machine?.user.name}</p>
</div>
<Separator orientation="vertical" className="h-12"/>
<div className="space-y-1">
<p>123</p>
<p>123</p>
</div>
</div>
</>
)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/hs-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function useHsMachines(id = "") {
isLoading,
mutate
} = useSWR(
`${HS_BASE_URL}/machine?user=${id}`,
`${HS_BASE_URL}/machine`,
fetcher<{machines: HsMachine[]}>
)
return {data: data?.machines || [], error, isLoading, mutate}
Expand Down

0 comments on commit ef1eef8

Please sign in to comment.