prepend base path for command palette links

This commit is contained in:
henrygd
2025-04-05 17:34:33 -04:00
parent 80df0efccd
commit 9a8071c314

View File

@@ -22,7 +22,7 @@ import {
import { memo, useEffect, useMemo } from "react" import { memo, useEffect, useMemo } from "react"
import { $systems } from "@/lib/stores" import { $systems } from "@/lib/stores"
import { getHostDisplayValue, isAdmin, listen } from "@/lib/utils" import { getHostDisplayValue, isAdmin, listen } from "@/lib/utils"
import { $router, basePath, navigate } from "./router" import { $router, basePath, navigate, prependBasePath } from "./router"
import { Trans } from "@lingui/react/macro" import { Trans } from "@lingui/react/macro"
import { t } from "@lingui/core/macro" import { t } from "@lingui/core/macro"
import { getPagePath } from "@nanostores/router" import { getPagePath } from "@nanostores/router"
@@ -133,7 +133,7 @@ export default memo(function CommandPalette({ open, setOpen }: { open: boolean;
keywords={["pocketbase"]} keywords={["pocketbase"]}
onSelect={() => { onSelect={() => {
setOpen(false) setOpen(false)
window.open("/_/", "_blank") window.open(prependBasePath("/_/"), "_blank")
}} }}
> >
<UsersIcon className="me-2 h-4 w-4" /> <UsersIcon className="me-2 h-4 w-4" />
@@ -147,7 +147,7 @@ export default memo(function CommandPalette({ open, setOpen }: { open: boolean;
<CommandItem <CommandItem
onSelect={() => { onSelect={() => {
setOpen(false) setOpen(false)
window.open("/_/#/logs", "_blank") window.open(prependBasePath("/_/#/logs"), "_blank")
}} }}
> >
<LogsIcon className="me-2 h-4 w-4" /> <LogsIcon className="me-2 h-4 w-4" />
@@ -161,7 +161,7 @@ export default memo(function CommandPalette({ open, setOpen }: { open: boolean;
<CommandItem <CommandItem
onSelect={() => { onSelect={() => {
setOpen(false) setOpen(false)
window.open("/_/#/settings/backups", "_blank") window.open(prependBasePath("/_/#/settings/backups"), "_blank")
}} }}
> >
<DatabaseBackupIcon className="me-2 h-4 w-4" /> <DatabaseBackupIcon className="me-2 h-4 w-4" />
@@ -176,7 +176,7 @@ export default memo(function CommandPalette({ open, setOpen }: { open: boolean;
keywords={["email"]} keywords={["email"]}
onSelect={() => { onSelect={() => {
setOpen(false) setOpen(false)
window.open("/_/#/settings/mail", "_blank") window.open(prependBasePath("/_/#/settings/mail"), "_blank")
}} }}
> >
<MailIcon className="me-2 h-4 w-4" /> <MailIcon className="me-2 h-4 w-4" />