From 1f47f6dfc995d40d264faa8f6707cde4dd2e69a8 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Sat, 8 Jun 2024 14:18:29 +0100 Subject: [PATCH] Update all pages to use PageHeader --- packages/create/templates/plugin-js/web/plugin.jsx | 4 ++-- packages/create/templates/plugin-ts/web/plugin.tsx | 4 ++-- packages/web_ui/src/components/PluginViewPage.tsx | 3 ++- packages/web_ui/src/components/PluginsPage.tsx | 3 ++- plugins/inventory_sync/web/index.tsx | 4 ++-- plugins/subspace_storage/web/index.tsx | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/create/templates/plugin-js/web/plugin.jsx b/packages/create/templates/plugin-js/web/plugin.jsx index 2f94158a..87c59767 100644 --- a/packages/create/templates/plugin-js/web/plugin.jsx +++ b/packages/create/templates/plugin-js/web/plugin.jsx @@ -10,7 +10,7 @@ import React, { // } from "antd"; import { - BaseWebPlugin, PageLayout, Control, ControlContext, notifyErrorHandler, + BaseWebPlugin, PageLayout, PageHeader, Control, ControlContext, notifyErrorHandler, } from "@clusterio/web_ui"; //%if multi_context // Subscribing requires multi context @@ -34,7 +34,7 @@ function MyTemplatePage() { //%endif return -

__plugin_name__

+ //%if controller // Subscribing requires web content and the controller Synced: {String(synced)} Data: {JSON.stringify([...subscribableData.values()])} //%endif diff --git a/packages/create/templates/plugin-ts/web/plugin.tsx b/packages/create/templates/plugin-ts/web/plugin.tsx index 06a7542a..e54e0a7c 100644 --- a/packages/create/templates/plugin-ts/web/plugin.tsx +++ b/packages/create/templates/plugin-ts/web/plugin.tsx @@ -10,7 +10,7 @@ import React, { // } from "antd"; import { - BaseWebPlugin, PageLayout, Control, ControlContext, notifyErrorHandler, + BaseWebPlugin, PageLayout, PageHeader, Control, ControlContext, notifyErrorHandler, } from "@clusterio/web_ui"; //%if multi_context // Subscribing requires multi context @@ -34,7 +34,7 @@ function MyTemplatePage() { //%endif return -

__plugin_name__

+ //%if controller // Subscribing requires web content and the controller Synced: {String(synced)} Data: {JSON.stringify([...subscribableData.values()])} //%endif diff --git a/packages/web_ui/src/components/PluginViewPage.tsx b/packages/web_ui/src/components/PluginViewPage.tsx index 8b9281fd..58eba31a 100644 --- a/packages/web_ui/src/components/PluginViewPage.tsx +++ b/packages/web_ui/src/components/PluginViewPage.tsx @@ -6,6 +6,7 @@ import type { PluginWebApi } from "@clusterio/lib"; import ControlContext from "./ControlContext"; import PageLayout from "./PageLayout"; +import PageHeader from "./PageHeader"; import notify from "../util/notify"; export default function PluginViewPage() { @@ -39,7 +40,7 @@ export default function PluginViewPage() { let pluginMeta = pluginList.find(p => p.name === pluginName); if (!pluginMeta) { return -

Plugin not found

+

Plugin with name {pluginName} was not found on the controller.

; } diff --git a/packages/web_ui/src/components/PluginsPage.tsx b/packages/web_ui/src/components/PluginsPage.tsx index f12b3d00..9d721852 100644 --- a/packages/web_ui/src/components/PluginsPage.tsx +++ b/packages/web_ui/src/components/PluginsPage.tsx @@ -9,6 +9,7 @@ import type { PluginWebApi } from "@clusterio/lib"; import notify from "../util/notify"; import ControlContext from "./ControlContext"; import PageLayout from "./PageLayout"; +import PageHeader from "./PageHeader"; const strcmp = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }).compare; @@ -47,7 +48,7 @@ export default function PluginsPage() { } return -

Plugins

+ -

Inventory sync

+ {statsData && <>

Database size: {Math.round(statsData.databaseSize / 1000)}kB

Database entries: {statsData.databaseEntries}

diff --git a/plugins/subspace_storage/web/index.tsx b/plugins/subspace_storage/web/index.tsx index 345795f2..2d1b458a 100644 --- a/plugins/subspace_storage/web/index.tsx +++ b/plugins/subspace_storage/web/index.tsx @@ -3,7 +3,7 @@ import { Input, Table, Typography } from "antd"; import * as lib from "@clusterio/lib"; import { - BaseWebPlugin, PageLayout, Control, ControlContext, + BaseWebPlugin, PageLayout, PageHeader, Control, ControlContext, notifyErrorHandler, useItemMetadata, useLocale, } from "@clusterio/web_ui"; import { GetStorageRequest, Item, SetStorageSubscriptionRequest, UpdateStorageEvent } from "../messages"; @@ -60,7 +60,7 @@ function StoragePage() { let numberFormat = new Intl.NumberFormat("en-US"); return -

Storage

+