) {
const urlInputFocused = globalStore.get(this.urlInputFocused);
if (e.type === "mouseover" && !urlInputFocused) {
@@ -227,7 +260,7 @@ export class WebViewModel implements ViewModel {
* @param url The URL that has been navigated to.
*/
handleNavigate(url: string) {
- services.ObjectService.UpdateObjectMeta(WOS.makeORef("block", this.blockId), { url });
+ ObjectService.UpdateObjectMeta(WOS.makeORef("block", this.blockId), { url });
globalStore.set(this.url, url);
}
@@ -349,7 +382,10 @@ export class WebViewModel implements ViewModel {
click: async () => {
const url = this.getUrl();
if (url != null && url != "") {
- RpcApi.SetConfigCommand(WindowRpcClient, { "web:defaulturl": url });
+ await RpcApi.SetMetaCommand(WindowRpcClient, {
+ oref: WOS.makeORef("block", this.blockId),
+ meta: { pinnedurl: url },
+ });
}
},
},
@@ -383,11 +419,10 @@ interface WebViewProps {
}
const WebView = memo(({ model }: WebViewProps) => {
- const blockData = jotai.useAtomValue(model.blockAtom);
- const defaultUrlAtom = getSettingsKeyAtom("web:defaulturl");
- const defaultUrl = jotai.useAtomValue(defaultUrlAtom);
+ const blockData = useAtomValue(model.blockAtom);
+ const defaultUrl = useAtomValue(model.homepageUrl);
const defaultSearchAtom = getSettingsKeyAtom("web:defaultsearch");
- const defaultSearch = jotai.useAtomValue(defaultSearchAtom);
+ const defaultSearch = useAtomValue(defaultSearchAtom);
let metaUrl = blockData?.meta?.url || defaultUrl;
metaUrl = model.ensureUrlScheme(metaUrl, defaultSearch);
const metaUrlRef = React.useRef(metaUrl);
diff --git a/frontend/app/workspace/workspace.tsx b/frontend/app/workspace/workspace.tsx
index bf392ce30..343e9d602 100644
--- a/frontend/app/workspace/workspace.tsx
+++ b/frontend/app/workspace/workspace.tsx
@@ -1,16 +1,15 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
+import { ErrorBoundary } from "@/app/element/errorboundary";
+import { CenteredDiv } from "@/app/element/quickelems";
import { ModalsRenderer } from "@/app/modals/modalsrenderer";
import { TabBar } from "@/app/tab/tabbar";
import { TabContent } from "@/app/tab/tabcontent";
import { atoms, createBlock } from "@/store/global";
-import * as util from "@/util/util";
-import * as jotai from "jotai";
-import * as React from "react";
-import { CenteredDiv } from "../element/quickelems";
-
-import { ErrorBoundary } from "@/app/element/errorboundary";
+import { isBlank, makeIconClass } from "@/util/util";
+import { useAtomValue } from "jotai";
+import { memo } from "react";
import "./workspace.less";
const iconRegex = /^[a-z0-9-]+$/;
@@ -33,9 +32,8 @@ function sortByDisplayOrder(wmap: { [key: string]: WidgetConfigType }): WidgetCo
return wlist;
}
-const Widgets = React.memo(() => {
- const fullConfig = jotai.useAtomValue(atoms.fullConfigAtom);
- const newWidgetModalVisible = React.useState(false);
+const Widgets = memo(() => {
+ const fullConfig = useAtomValue(atoms.fullConfigAtom);
const helpWidget: WidgetConfigType = {
icon: "circle-question",
label: "help",
@@ -80,7 +78,7 @@ async function handleWidgetSelect(blockDef: BlockDef) {
createBlock(blockDef);
}
-const Widget = React.memo(({ widget }: { widget: WidgetConfigType }) => {
+const Widget = memo(({ widget }: { widget: WidgetConfigType }) => {
return (
{
title={widget.description || widget.label}
>
-
+
- {!util.isBlank(widget.label) ?
{widget.label}
: null}
+ {!isBlank(widget.label) ?
{widget.label}
: null}
);
});
-const WorkspaceElem = React.memo(() => {
- const windowData = jotai.useAtomValue(atoms.waveWindow);
+const WorkspaceElem = memo(() => {
+ const windowData = useAtomValue(atoms.waveWindow);
const activeTabId = windowData?.activetabid;
- const ws = jotai.useAtomValue(atoms.workspace);
+ const ws = useAtomValue(atoms.workspace);
return (
diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts
index 04126bae7..98fb35a28 100644
--- a/frontend/types/gotypes.d.ts
+++ b/frontend/types/gotypes.d.ts
@@ -266,6 +266,7 @@ declare global {
controller?: string;
file?: string;
url?: string;
+ pinnedurl?: string;
connection?: string;
edit?: boolean;
history?: string[];
diff --git a/pkg/waveobj/metaconsts.go b/pkg/waveobj/metaconsts.go
index df21805e5..02a738d7f 100644
--- a/pkg/waveobj/metaconsts.go
+++ b/pkg/waveobj/metaconsts.go
@@ -14,6 +14,8 @@ const (
MetaKey_Url = "url"
+ MetaKey_PinnedUrl = "pinnedurl"
+
MetaKey_Connection = "connection"
MetaKey_Edit = "edit"
diff --git a/pkg/waveobj/wtypemeta.go b/pkg/waveobj/wtypemeta.go
index de6a444ec..0fce994cd 100644
--- a/pkg/waveobj/wtypemeta.go
+++ b/pkg/waveobj/wtypemeta.go
@@ -16,6 +16,7 @@ type MetaTSType struct {
Controller string `json:"controller,omitempty"`
File string `json:"file,omitempty"`
Url string `json:"url,omitempty"`
+ PinnedUrl string `json:"pinnedurl,omitempty"`
Connection string `json:"connection,omitempty"`
Edit bool `json:"edit,omitempty"`
History []string `json:"history,omitempty"`