Skip to content

Commit

Permalink
fix: fix search command navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
akazwz authored and TinsFox committed Sep 7, 2024
1 parent 316a6fc commit 6a0513c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/components/layout/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ export function Search({ ...props }: ButtonProps & DialogProps) {
key={`${menuItem.title}-${menuItem.to}`}
value={menuItem.title}
onSelect={() => {
runCommand(() => navigate(menuItem.to))
runCommand(() => navigate(menuItem.to!))
}}
>
<menuItem.icon className="mr-2 size-4" />
{menuItem.title}
{menuItem.to}
{menuItem.label && (
<span
className={cn(
Expand Down
5 changes: 5 additions & 0 deletions src/components/layout/sidebar/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const menus: IMenu[] = [
to: "/dashboard/workplace",
},
],
to: "/dashboard",
},
{
title: "forms",
Expand All @@ -107,6 +108,7 @@ export const menus: IMenu[] = [
to: "/form/advanced-form",
},
],
to: "/form",
},
{
title: "table",
Expand All @@ -131,6 +133,7 @@ export const menus: IMenu[] = [
to: "/list/card-list",
},
],
to: "/list",
},
{
title: "charts",
Expand Down Expand Up @@ -172,6 +175,7 @@ export const menus: IMenu[] = [
to: "/charts/tooltip",
},
],
to: "/charts",
},
{
title: "settings",
Expand All @@ -188,5 +192,6 @@ export const menus: IMenu[] = [
to: "/system/about",
},
],
to: "/system",
},
] as const
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function Component() {
</CardContent>
</Card>
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-7">
<div className="mt-4 grid gap-4 md:grid-cols-2 lg:grid-cols-7">
<Card className="col-span-4">
<CardHeader>
<CardTitle>Overview</CardTitle>
Expand Down
7 changes: 7 additions & 0 deletions src/pages/(admin)/(with-layout)/list/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { redirect } from "react-router-dom"

export const loader = () => redirect(`/list/basic-list`)

export function Component() {
return null
}
7 changes: 7 additions & 0 deletions src/pages/(admin)/(with-layout)/system/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { redirect } from "react-router-dom"

export const loader = () => redirect(`/system/about`)

export function Component() {
return null
}
3 changes: 1 addition & 2 deletions src/pages/(admin)/charts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { redirect } from "react-router-dom"

export const loader = ({
request,
params,
}: {
request: Request
params: { chartName: string }
}) => {
const url = new URL(request.url)
return redirect(`${url.pathname}/${params.chartName}`)
return redirect(`${url.pathname}/area-chart`)
}

0 comments on commit 6a0513c

Please sign in to comment.