+
+ {action.icon && action.icon}
+
+
+ {ancestors.length > 0 &&
+ ancestors.map((ancestor) => (
+
+
+ {ancestor.name}
+
+
+ ›
+
+
+ ))}
+ {action.name}
+
+ {action.subtitle && (
+
{action.subtitle}
+ )}
+
+
+ {action.shortcut?.length ? (
+
+ {action.shortcut.map((sc) => (
+
+ {sc}
+
+ ))}
+
+ ) : null}
+
+ );
+ }
+);
+
+const actions = [
+ {
+ id: "user",
+ name: "User",
+ shortcut: ["u"],
+ keywords: "profile",
+ perform: () => (window.location.pathname = "user"),
+ },
+ {
+ id: "user.edit",
+ name: "Edit User",
+ shortcut: ["u e"],
+ keywords: "profile edit settings",
+ perform: () => (window.location.pathname = "user/settings"),
+ },
+ {
+ id: "admin",
+ name: "Admin",
+ shortcut: ["a"],
+ keywords: "home",
+ perform: () => (window.location.pathname = "admin"),
+ },
+ {
+ id: "notes",
+ name: "Notes",
+ shortcut: ["n"],
+ keywords: "posts",
+ perform: () => (window.location.pathname = "admin/notes"),
+ },
+ {
+ id: "notes.new",
+ name: "New Note",
+ shortcut: ["n n"],
+ keywords: "create new",
+ perform: () => (window.location.pathname = "admin/notes/new"),
+ },
+ {
+ id: "channels",
+ name: "Channels",
+ shortcut: ["c"],
+ keywords: "channels",
+ perform: () => (window.location.pathname = "admin/channels"),
+ },
+ {
+ id: "channels.new",
+ name: "New Channel",
+ shortcut: ["n c"],
+ keywords: "create new",
+ perform: () => (window.location.pathname = "admin/channels/new"),
+ },
+ {
+ id: "identities",
+ name: "Identities",
+ shortcut: ["i"],
+ keywords: "identities",
+ perform: () => (window.location.pathname = "admin/identities"),
+ },
+ {
+ id: "identities.new",
+ name: "New Identity",
+ shortcut: ["n i"],
+ keywords: "create new",
+ perform: () => (window.location.pathname = "admin/identities/new"),
+ },
+ {
+ id: "settings",
+ name: "Settings",
+ shortcut: ["s"],
+ keywords: "settings",
+ perform: () => (window.location.pathname = "admin/settings"),
+ },
+ {
+ id: "settings.edit",
+ name: "Edit Settings",
+ shortcut: ["s e"],
+ keywords: "settings edit",
+ perform: () => (window.location.pathname = "admin/settings/edit"),
+ }
+]
+
+const dynamicActionsList = {
+ id: "public.home",
+ name: "Go Home",
+ shortcut: ["x"],
+ keywords: "public",
+ perform: () => (window.location.pathname = "/"),
+}
+
+function DynamicResultsProvider({children}) {
+ //const [search, setSearch] = React.useState("");
+ //useKBar(state => console.log("state"))
+ /*
+ const dynamicActions = React.useMemo(() => {
+ const searchQuery = search
+ //const results = await getResults(search);
+ //return results.map(r => createAction(...));
+ console.log(searchQuery)
+ return dynamicActionsInner
+ }, [search])
+ */
+ // const {query, search, options} = useKBar((state) => ({ search: state.searchQuery }))
+ // const dynamicActions = React.useMemo(() =>{
+ // return dynamicActionsInner
+ // }, [search])
+
+ const { query } = useKBar(state => ({ query: state.query }))
+ const [dynamicActions, setDynamicActions] = React.useState([])
+
+ React.useEffect(() => {
+ console.log(query)
+ //fetchUsers(query).then(setUsers)
+ setDynamicActions(dynamicActionsList)
+ }, [query])
+
+ console.log("mount")
+
+ useRegisterActions(dynamicActionsList, [dynamicActions])
+
+ return ([children])
+}
+
+export default function KBar() {
+ return (
+