diff --git a/packages/plugs/core/core.plug.yaml b/packages/plugs/core/core.plug.yaml
index c0461ff8..61946ad3 100644
--- a/packages/plugs/core/core.plug.yaml
+++ b/packages/plugs/core/core.plug.yaml
@@ -123,8 +123,6 @@ functions:
command:
name: "Template: Quick Note"
key: "Alt-Shift-n"
- shortcut:
- label: "Quick note"
quickTaskCommand:
path: ./template.ts:quickTaskCommand
command:
diff --git a/packages/plugs/query/query.plug.yaml b/packages/plugs/query/query.plug.yaml
index be5634ec..6656de7a 100644
--- a/packages/plugs/query/query.plug.yaml
+++ b/packages/plugs/query/query.plug.yaml
@@ -10,8 +10,6 @@ functions:
command:
name: "Materialized Queries: Update"
key: "Alt-q"
- shortcut:
- label: "Update queries"
events:
- editor:pageLoaded
indexData:
diff --git a/packages/web/components/top_bar.tsx b/packages/web/components/top_bar.tsx
index 12c4568a..6cd43a37 100644
--- a/packages/web/components/top_bar.tsx
+++ b/packages/web/components/top_bar.tsx
@@ -1,5 +1,6 @@
-import { useEffect, useState } from "react";
-import { ShortcutItem, Notification } from "../types";
+import { faRunning } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Notification } from "../types";
function prettyName(s: string | undefined): string {
if (!s) {
@@ -12,33 +13,19 @@ export function TopBar({
pageName,
unsavedChanges,
notifications,
- shortcutItems,
onClick,
+ onActionClick,
lhs,
rhs,
}: {
pageName?: string;
unsavedChanges: boolean;
notifications: Notification[];
- shortcutItems: ShortcutItem[];
onClick: () => void;
+ onActionClick: () => void;
lhs?: React.ReactNode;
rhs?: React.ReactNode;
}) {
- const [menuExpanded, setMenuExpanded] = useState(false);
-
- useEffect(() => {
- function closer() {
- setMenuExpanded(false);
- }
-
- document.addEventListener("click", closer);
-
- return () => {
- document.removeEventListener("click", closer);
- };
- }, []);
-
return (
{lhs}
@@ -59,31 +46,13 @@ export function TopBar({
- {menuExpanded && (
-
- )}
diff --git a/packages/web/editor.tsx b/packages/web/editor.tsx
index 8dc80652..4cdb87f2 100644
--- a/packages/web/editor.tsx
+++ b/packages/web/editor.tsx
@@ -127,11 +127,10 @@ export class Editor {
// Command hook
this.commandHook = new CommandHook();
this.commandHook.on({
- commandsUpdated: (commandMap, shortcutItems) => {
+ commandsUpdated: (commandMap) => {
this.viewDispatch({
type: "update-commands",
commands: commandMap,
- shortcutItems: shortcutItems,
});
},
});
@@ -660,7 +659,6 @@ export class Editor {
placeholder={viewState.filterBoxPlaceHolder}
options={viewState.filterBoxOptions}
allowNew={false}
- // icon={faPersonRunning}
helpText={viewState.filterBoxHelpText}
onSelect={viewState.filterBoxOnSelect}
/>
@@ -669,19 +667,12 @@ export class Editor {
pageName={viewState.currentPage}
notifications={viewState.notifications}
unsavedChanges={viewState.unsavedChanges}
- shortcutItems={[
- {
- label: "Run command",
- orderId: 0,
- run: () => {
- this.viewDispatch({ type: "show-palette" });
- },
- },
- ...viewState.shortcutItems,
- ]}
onClick={() => {
dispatch({ type: "start-navigate" });
}}
+ onActionClick={() => {
+ dispatch({ type: "show-palette" });
+ }}
rhs={
!!viewState.showRHS && (
diff --git a/packages/web/hooks/command.ts b/packages/web/hooks/command.ts
index 2f2ace20..718649c8 100644
--- a/packages/web/hooks/command.ts
+++ b/packages/web/hooks/command.ts
@@ -1,7 +1,6 @@
import { Hook, Manifest } from "@plugos/plugos/types";
import { System } from "@plugos/plugos/system";
import { EventEmitter } from "@plugos/plugos/event";
-import { ShortcutItem } from "../types";
export type CommandDef = {
name: string;
@@ -11,13 +10,6 @@ export type CommandDef = {
// Bind to keyboard shortcut
key?: string;
mac?: string;
-
- // Shortcuts in UI
- shortcut?: ShortcutDef;
-};
-
-export type ShortcutDef = {
- label: string;
};
export type AppCommand = {
@@ -30,10 +22,7 @@ export type CommandHookT = {
};
export type CommandHookEvents = {
- commandsUpdated(
- commandMap: Map,
- appButtons: ShortcutItem[]
- ): void;
+ commandsUpdated(commandMap: Map): void;
};
export class CommandHook
@@ -41,11 +30,9 @@ export class CommandHook
implements Hook
{
editorCommands = new Map();
- shortcutItems: ShortcutItem[] = [];
buildAllCommands(system: System) {
this.editorCommands.clear();
- this.shortcutItems = [];
for (let plug of system.loadedPlugs.values()) {
for (const [name, functionDef] of Object.entries(
plug.manifest!.functions
@@ -60,17 +47,9 @@ export class CommandHook
return plug.invoke(name, []);
},
});
- if (cmd.shortcut) {
- this.shortcutItems.push({
- label: cmd.shortcut.label,
- run: () => {
- return plug.invoke(name, []);
- },
- });
- }
}
}
- this.emit("commandsUpdated", this.editorCommands, this.shortcutItems);
+ this.emit("commandsUpdated", this.editorCommands);
}
apply(system: System): void {
diff --git a/packages/web/reducer.ts b/packages/web/reducer.ts
index 7bd52d72..81827742 100644
--- a/packages/web/reducer.ts
+++ b/packages/web/reducer.ts
@@ -76,7 +76,6 @@ export default function reducer(
return {
...state,
commands: action.commands,
- shortcutItems: action.shortcutItems,
};
case "show-notification":
return {
diff --git a/packages/web/styles/main.scss b/packages/web/styles/main.scss
index c7228a3c..c7567702 100644
--- a/packages/web/styles/main.scss
+++ b/packages/web/styles/main.scss
@@ -76,19 +76,19 @@ body {
display: flex;
flex-direction: row;
- // .status {
- // position: absolute;
- // font-family: "iA-Mono";
- // bottom: 45px;
- // left: 5px;
- // right: 5px;
- // background-color: rgb(187, 221, 247);
- // border: rgb(41, 41, 41) 1px solid;
- // border-radius: 5px;
- // padding: 3px;
- // font-size: 15px;
- // z-index: 100;
- // }
+ .status {
+ position: absolute;
+ font-family: "iA-Mono";
+ bottom: 45px;
+ left: 5px;
+ right: 5px;
+ background-color: rgb(187, 221, 247);
+ border: rgb(41, 41, 41) 1px solid;
+ border-radius: 5px;
+ padding: 3px;
+ font-size: 15px;
+ z-index: 100;
+ }
.current-page {
font-family: var(--ui-font);
@@ -97,15 +97,11 @@ body {
overflow: hidden;
white-space: nowrap;
- // margin-right: 40px;
+ text-align: left;
display: block;
+ text-overflow: ellipsis;
}
- // .icon {
- // padding-left: 5px;
- // padding-right: 10px;
- // }
-
.saved {
color: #111;
}
@@ -115,10 +111,8 @@ body {
}
}
.actions {
- // float: right;
text-align: right;
width: 40px;
- // margin-top: -35px;
ul {
list-style: none;
diff --git a/packages/web/types.ts b/packages/web/types.ts
index 6cd513cf..4f039673 100644
--- a/packages/web/types.ts
+++ b/packages/web/types.ts
@@ -9,12 +9,6 @@ export type Notification = {
date: Date;
};
-export type ShortcutItem = {
- label: string;
- orderId?: number;
- run: () => void;
-};
-
export type AppViewState = {
currentPage?: string;
perm: "ro" | "rw";
@@ -34,7 +28,6 @@ export type AppViewState = {
allPages: Set;
commands: Map;
notifications: Notification[];
- shortcutItems: ShortcutItem[];
recentCommands: Map;
showFilterBox: boolean;
@@ -60,7 +53,6 @@ export const initialViewState: AppViewState = {
commands: new Map(),
recentCommands: new Map(),
notifications: [],
- shortcutItems: [],
showFilterBox: false,
filterBoxHelpText: "",
filterBoxLabel: "",
@@ -79,7 +71,6 @@ export type Action =
| {
type: "update-commands";
commands: Map;
- shortcutItems: ShortcutItem[];
}
| { type: "show-palette"; context?: string }
| { type: "hide-palette" }