@dxos/plugin-status-bar 0.8.4-main.9735255 → 0.8.4-main.9be5663bfe

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/lib/browser/index.mjs +77 -29
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +78 -29
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/StatusBarPlugin.d.ts.map +1 -1
  8. package/dist/types/src/capabilities/index.d.ts +2 -1
  9. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  10. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  11. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  12. package/dist/types/src/components/{StatusBar.d.ts → StatusBar/StatusBar.d.ts} +6 -4
  13. package/dist/types/src/components/StatusBar/StatusBar.d.ts.map +1 -0
  14. package/dist/types/src/components/{StatusBar.stories.d.ts → StatusBar/StatusBar.stories.d.ts} +3 -1
  15. package/dist/types/src/components/StatusBar/StatusBar.stories.d.ts.map +1 -0
  16. package/dist/types/src/components/StatusBar/index.d.ts +2 -0
  17. package/dist/types/src/components/StatusBar/index.d.ts.map +1 -0
  18. package/dist/types/src/components/index.d.ts +0 -2
  19. package/dist/types/src/components/index.d.ts.map +1 -1
  20. package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts +4 -0
  21. package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts.map +1 -0
  22. package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts +7 -0
  23. package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts.map +1 -0
  24. package/dist/types/src/containers/StatusBarActions/index.d.ts +2 -0
  25. package/dist/types/src/containers/StatusBarActions/index.d.ts.map +1 -0
  26. package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts +4 -0
  27. package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts.map +1 -0
  28. package/dist/types/src/containers/StatusBarPanel/index.d.ts +2 -0
  29. package/dist/types/src/containers/StatusBarPanel/index.d.ts.map +1 -0
  30. package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts +4 -0
  31. package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts.map +1 -0
  32. package/dist/types/src/containers/VersionNumber/index.d.ts +2 -0
  33. package/dist/types/src/containers/VersionNumber/index.d.ts.map +1 -0
  34. package/dist/types/src/containers/index.d.ts +5 -0
  35. package/dist/types/src/containers/index.d.ts.map +1 -0
  36. package/dist/types/src/translations.d.ts +11 -11
  37. package/dist/types/src/translations.d.ts.map +1 -1
  38. package/dist/types/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +26 -19
  40. package/src/StatusBarPlugin.ts +7 -5
  41. package/src/capabilities/index.ts +3 -1
  42. package/src/capabilities/react-surface.tsx +33 -0
  43. package/src/components/StatusBar/StatusBar.stories.tsx +45 -0
  44. package/src/components/{StatusBar.tsx → StatusBar/StatusBar.tsx} +41 -19
  45. package/src/components/StatusBar/index.ts +5 -0
  46. package/src/components/index.ts +0 -2
  47. package/src/containers/StatusBarActions/StatusBarActions.stories.tsx +61 -0
  48. package/src/containers/StatusBarActions/StatusBarActions.tsx +70 -0
  49. package/src/containers/StatusBarActions/index.ts +5 -0
  50. package/src/containers/StatusBarPanel/StatusBarPanel.tsx +21 -0
  51. package/src/containers/StatusBarPanel/index.ts +5 -0
  52. package/src/containers/VersionNumber/VersionNumber.tsx +97 -0
  53. package/src/containers/VersionNumber/index.ts +5 -0
  54. package/src/containers/index.ts +9 -0
  55. package/src/meta.ts +1 -1
  56. package/src/translations.ts +11 -11
  57. package/dist/lib/browser/chunk-G3E35NNM.mjs +0 -195
  58. package/dist/lib/browser/chunk-G3E35NNM.mjs.map +0 -7
  59. package/dist/lib/browser/react-surface-MYYYPTEW.mjs +0 -40
  60. package/dist/lib/browser/react-surface-MYYYPTEW.mjs.map +0 -7
  61. package/dist/lib/node-esm/chunk-RE6CUOP4.mjs +0 -197
  62. package/dist/lib/node-esm/chunk-RE6CUOP4.mjs.map +0 -7
  63. package/dist/lib/node-esm/react-surface-RNK64YYP.mjs +0 -41
  64. package/dist/lib/node-esm/react-surface-RNK64YYP.mjs.map +0 -7
  65. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  66. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  67. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  68. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  69. package/dist/types/src/components/StatusBar.d.ts.map +0 -1
  70. package/dist/types/src/components/StatusBar.stories.d.ts.map +0 -1
  71. package/dist/types/src/components/StatusBarPanel.d.ts +0 -4
  72. package/dist/types/src/components/StatusBarPanel.d.ts.map +0 -1
  73. package/dist/types/src/components/VersionNumber.d.ts +0 -3
  74. package/dist/types/src/components/VersionNumber.d.ts.map +0 -1
  75. package/src/capabilities/react-surface/index.ts +0 -7
  76. package/src/capabilities/react-surface/react-surface.tsx +0 -39
  77. package/src/components/StatusBar.stories.tsx +0 -45
  78. package/src/components/StatusBarPanel.tsx +0 -76
  79. package/src/components/VersionNumber.tsx +0 -85
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-status-bar",
3
- "version": "0.8.4-main.9735255",
3
+ "version": "0.8.4-main.9be5663bfe",
4
4
  "description": "Status bar plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -12,6 +12,12 @@
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": true,
14
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": "./src/capabilities/index.ts",
17
+ "#components": "./src/components/index.ts",
18
+ "#containers": "./src/containers/index.ts",
19
+ "#meta": "./src/meta.ts"
20
+ },
15
21
  "exports": {
16
22
  ".": {
17
23
  "source": "./src/index.ts",
@@ -31,35 +37,36 @@
31
37
  "dependencies": {
32
38
  "@fluentui/react-tabster": "9.26.11",
33
39
  "@radix-ui/react-slot": "1.1.2",
34
- "date-fns": "^3.3.1",
35
- "effect": "3.19.11",
40
+ "date-fns": "^3.6.0",
41
+ "effect": "3.20.0",
36
42
  "react-resize-detector": "^11.0.1",
37
- "@dxos/async": "0.8.4-main.9735255",
38
- "@dxos/echo": "0.8.4-main.9735255",
39
- "@dxos/operation": "0.8.4-main.9735255",
40
- "@dxos/app-framework": "0.8.4-main.9735255",
41
- "@dxos/plugin-observability": "0.8.4-main.9735255",
42
- "@dxos/react-client": "0.8.4-main.9735255",
43
- "@dxos/react-ui-form": "0.8.4-main.9735255",
44
- "@dxos/schema": "0.8.4-main.9735255",
45
- "@dxos/util": "0.8.4-main.9735255"
43
+ "@dxos/app-framework": "0.8.4-main.9be5663bfe",
44
+ "@dxos/app-toolkit": "0.8.4-main.9be5663bfe",
45
+ "@dxos/echo": "0.8.4-main.9be5663bfe",
46
+ "@dxos/operation": "0.8.4-main.9be5663bfe",
47
+ "@dxos/react-client": "0.8.4-main.9be5663bfe",
48
+ "@dxos/plugin-observability": "0.8.4-main.9be5663bfe",
49
+ "@dxos/react-ui-form": "0.8.4-main.9be5663bfe",
50
+ "@dxos/util": "0.8.4-main.9be5663bfe",
51
+ "@dxos/async": "0.8.4-main.9be5663bfe",
52
+ "@dxos/schema": "0.8.4-main.9be5663bfe"
46
53
  },
47
54
  "devDependencies": {
48
55
  "@types/react": "~19.2.7",
49
56
  "@types/react-dom": "~19.2.3",
50
57
  "react": "~19.2.3",
51
58
  "react-dom": "~19.2.3",
52
- "vite": "7.1.9",
53
- "@dxos/react-ui": "0.8.4-main.9735255",
54
- "@dxos/storybook-utils": "0.8.4-main.9735255",
55
- "@dxos/ui-theme": "0.8.4-main.9735255"
59
+ "vite": "^7.1.11",
60
+ "@dxos/react-ui": "0.8.4-main.9be5663bfe",
61
+ "@dxos/storybook-utils": "0.8.4-main.9be5663bfe",
62
+ "@dxos/ui-theme": "0.8.4-main.9be5663bfe"
56
63
  },
57
64
  "peerDependencies": {
58
- "effect": "3.19.11",
65
+ "effect": "3.20.0",
59
66
  "react": "~19.2.3",
60
67
  "react-dom": "~19.2.3",
61
- "@dxos/react-ui": "0.8.4-main.9735255",
62
- "@dxos/ui-theme": "0.8.4-main.9735255"
68
+ "@dxos/ui-theme": "0.8.4-main.9be5663bfe",
69
+ "@dxos/react-ui": "0.8.4-main.9be5663bfe"
63
70
  },
64
71
  "publishConfig": {
65
72
  "access": "public"
@@ -2,14 +2,16 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Common, Plugin } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
7
+
8
+ import { ReactSurface } from '#capabilities';
9
+ import { meta } from '#meta';
6
10
 
7
- import { ReactSurface } from './capabilities';
8
- import { meta } from './meta';
9
11
  import { translations } from './translations';
10
12
 
11
13
  export const StatusBarPlugin = Plugin.define(meta).pipe(
12
- Common.Plugin.addTranslationsModule({ translations }),
13
- Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
14
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
15
+ AppPlugin.addTranslationsModule({ translations }),
14
16
  Plugin.make,
15
17
  );
@@ -2,4 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './react-surface';
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React from 'react';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
10
+
11
+ import { StatusBarActions, StatusBarPanel, VersionNumber } from '#containers';
12
+
13
+ export default Capability.makeModule(() =>
14
+ Effect.succeed(
15
+ Capability.contributes(Capabilities.ReactSurface, [
16
+ Surface.create({
17
+ id: 'status-bar',
18
+ role: 'status-bar',
19
+ component: () => <StatusBarPanel />,
20
+ }),
21
+ Surface.create({
22
+ id: 'status-bar--r1-footer',
23
+ role: 'status-bar--r1-footer',
24
+ component: () => <StatusBarActions />,
25
+ }),
26
+ Surface.create({
27
+ id: 'version-info',
28
+ role: 'version-info',
29
+ component: () => <VersionNumber />,
30
+ }),
31
+ ]),
32
+ ),
33
+ );
@@ -0,0 +1,45 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React from 'react';
7
+
8
+ import { Icon, IconButton } from '@dxos/react-ui';
9
+ import { withTheme } from '@dxos/react-ui/testing';
10
+
11
+ import { StatusBar } from './index';
12
+
13
+ const DefaultStory = () => (
14
+ <StatusBar.EndContent>
15
+ <StatusBar.Button>
16
+ <Icon icon='ph--mailbox--regular' />
17
+ <StatusBar.Text>Quick feedback</StatusBar.Text>
18
+ </StatusBar.Button>
19
+ <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
20
+ <StatusBar.Button>
21
+ <Icon icon='ph--discord-logo--regular' />
22
+ <StatusBar.Text>Join us on Discord</StatusBar.Text>
23
+ </StatusBar.Button>
24
+ </a>
25
+ <StatusBar.Item>
26
+ <IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Online' />
27
+ </StatusBar.Item>
28
+ </StatusBar.EndContent>
29
+ );
30
+
31
+ const meta = {
32
+ title: 'plugins/plugin-status-bar/components/StatusBar',
33
+ component: StatusBar as any,
34
+ render: DefaultStory,
35
+ decorators: [withTheme()],
36
+ parameters: {
37
+ layout: 'centered',
38
+ },
39
+ } satisfies Meta<typeof StatusBar>;
40
+
41
+ export default meta;
42
+
43
+ type Story = StoryObj<typeof meta>;
44
+
45
+ export const Default: Story = {};
@@ -8,6 +8,26 @@ import React, { type ComponentPropsWithRef, type PropsWithChildren, type ReactNo
8
8
  import { type ThemedClassName } from '@dxos/react-ui';
9
9
  import { mx } from '@dxos/ui-theme';
10
10
 
11
+ //
12
+ // Item
13
+ //
14
+
15
+ type StatusBarItemProps = ThemedClassName<PropsWithChildren>;
16
+
17
+ const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
18
+ ({ classNames, children, ...props }, forwardedRef) => {
19
+ return (
20
+ <div {...props} role='status' className={mx('grid place-items-center', classNames)} ref={forwardedRef}>
21
+ {children}
22
+ </div>
23
+ );
24
+ },
25
+ );
26
+
27
+ //
28
+ // Text
29
+ //
30
+
11
31
  type StatusBarTextProps = ThemedClassName<{ children: ReactNode }>;
12
32
 
13
33
  const StatusBarText = forwardRef<HTMLSpanElement, StatusBarTextProps>(({ classNames, children }, forwardedRef) => (
@@ -16,14 +36,21 @@ const StatusBarText = forwardRef<HTMLSpanElement, StatusBarTextProps>(({ classNa
16
36
  </span>
17
37
  ));
18
38
 
39
+ //
40
+ // Button
41
+ //
42
+
19
43
  type StatusBarButtonProps = ThemedClassName<ComponentPropsWithRef<'button'> & { asChild?: boolean }>;
20
44
 
45
+ /**
46
+ * @deprecated
47
+ */
21
48
  const StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(
22
49
  ({ classNames, children, asChild, ...props }, forwardedRef) => {
23
50
  const classes = mx(
24
- 'flex items-center justify-center gap-2 p-1 pli-2 rounded-sm',
51
+ 'flex items-center justify-center gap-2 p-1 px-2 rounded-xs',
25
52
  'select-none cursor-pointer dx-focus-ring text-description text-xs',
26
- 'hover:bg-neutral-75 active:bg-neutral-150 dark:hover:bg-neutral-750 dark:active:bg-neutral-700',
53
+ 'hover:bg-neutral-100 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600',
27
54
  classNames,
28
55
  );
29
56
 
@@ -39,22 +66,9 @@ const StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(
39
66
  },
40
67
  );
41
68
 
42
- export default StatusBarButton;
43
-
44
- type StatusBarItemProps = ThemedClassName<ComponentPropsWithRef<'div'>>;
45
-
46
- const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
47
- ({ classNames, children, ...props }, forwardedRef) => (
48
- <div
49
- role='menuitem'
50
- className={mx('flex items-center justify-center gap-2 p-1 pli-2 rounded-sm select-none', classNames)}
51
- ref={forwardedRef}
52
- {...props}
53
- >
54
- {children}
55
- </div>
56
- ),
57
- );
69
+ //
70
+ // Content
71
+ //
58
72
 
59
73
  type StartContentProps = ThemedClassName<PropsWithChildren<{}>>;
60
74
 
@@ -64,6 +78,10 @@ const StartContent = forwardRef<HTMLDivElement, StartContentProps>(({ classNames
64
78
  </div>
65
79
  ));
66
80
 
81
+ //
82
+ // EndContent
83
+ //
84
+
67
85
  type EndContentProps = ThemedClassName<PropsWithChildren<{}>>;
68
86
 
69
87
  const EndContent = forwardRef<HTMLDivElement, EndContentProps>(({ classNames, children }, forwardedRef) => (
@@ -72,9 +90,13 @@ const EndContent = forwardRef<HTMLDivElement, EndContentProps>(({ classNames, ch
72
90
  </div>
73
91
  ));
74
92
 
93
+ //
94
+ // StatusBar
95
+ //
96
+
75
97
  export const StatusBar = {
76
- Text: StatusBarText,
77
98
  Item: StatusBarItem,
99
+ Text: StatusBarText,
78
100
  Button: StatusBarButton,
79
101
  StartContent,
80
102
  EndContent,
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './StatusBar';
@@ -3,5 +3,3 @@
3
3
  //
4
4
 
5
5
  export * from './StatusBar';
6
- export * from './StatusBarPanel';
7
- export * from './VersionNumber';
@@ -0,0 +1,61 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+
7
+ import { Config } from '@dxos/react-client';
8
+ import { withClientProvider } from '@dxos/react-client/testing';
9
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
10
+
11
+ import { translations } from '../../translations';
12
+ import { StatusBarActions } from './StatusBarActions';
13
+
14
+ const meta: Meta<typeof StatusBarActions> = {
15
+ title: 'plugins/plugin-status-bar/containers/StatusBarActions',
16
+ component: StatusBarActions,
17
+ decorators: [
18
+ withTheme(),
19
+ withLayout({
20
+ layout: 'centered',
21
+ classNames: 'w-[calc(var(--dx-complementary-sidebar-size)_-_var(--dx-rail-content))]',
22
+ }),
23
+ withClientProvider({
24
+ config: new Config({
25
+ version: 1,
26
+ runtime: {
27
+ client: {
28
+ storage: {
29
+ persistent: false,
30
+ },
31
+ },
32
+ app: {
33
+ build: {
34
+ version: '0.8.3-beta.b78990fdd5',
35
+ timestamp: '2024-06-01T12:00:00.000Z',
36
+ commitHash: 'b78990fdd5',
37
+ },
38
+ env: {
39
+ DX_ENVIRONMENT: 'development',
40
+ },
41
+ },
42
+ services: {
43
+ edge: {
44
+ url: 'https://edge-dev.dxos.org',
45
+ },
46
+ },
47
+ },
48
+ }),
49
+ }),
50
+ ],
51
+ parameters: {
52
+ layout: 'centered',
53
+ translations,
54
+ },
55
+ };
56
+
57
+ export default meta;
58
+
59
+ type Story = StoryObj<typeof meta>;
60
+
61
+ export const Default: Story = {};
@@ -0,0 +1,70 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { useState } from 'react';
6
+
7
+ import { useConfig } from '@dxos/react-client';
8
+ import { Icon, Popover, useTranslation } from '@dxos/react-ui';
9
+
10
+ import { StatusBar } from '#components';
11
+ import { meta } from '#meta';
12
+
13
+ import VersionNumber from '../VersionNumber';
14
+
15
+ export type StatusBarActionsProps = {};
16
+
17
+ export const StatusBarActions = (_props: StatusBarActionsProps) => {
18
+ const { t } = useTranslation(meta.id);
19
+ const [open, setOpen] = useState(false);
20
+
21
+ return (
22
+ <Popover.Root open={open} onOpenChange={setOpen}>
23
+ <div role='none' className='h-full flex items-center px-2 gap-2'>
24
+ <EnvironmentLabel />
25
+ <VersionNumber />
26
+ <div role='none' className='grow' />
27
+ <StatusBar.Button asChild>
28
+ <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
29
+ <Icon icon='ph--discord-logo--regular' />
30
+ <StatusBar.Text classNames='hidden sm:block'>{t('discord.label')}</StatusBar.Text>
31
+ </a>
32
+ </StatusBar.Button>
33
+ <StatusBar.Button asChild>
34
+ <a href='https://github.com/dxos/dxos' target='_blank' rel='noopener noreferrer'>
35
+ <Icon icon='ph--github-logo--regular' />
36
+ <StatusBar.Text classNames='hidden sm:block'>{t('github.label')}</StatusBar.Text>
37
+ </a>
38
+ </StatusBar.Button>
39
+ </div>
40
+ </Popover.Root>
41
+ );
42
+ };
43
+
44
+ const ENV_LABELS: Record<string, string> = {
45
+ 'edge-dev': 'Dev',
46
+ 'edge-main': 'Main',
47
+ 'edge-labs': 'Labs',
48
+ 'edge-production': 'Production',
49
+ };
50
+
51
+ const EnvironmentLabel = () => {
52
+ const config = useConfig();
53
+ const edgeUrl = config.values.runtime?.services?.edge?.url;
54
+ if (!edgeUrl) {
55
+ return null;
56
+ }
57
+ const part = new URL(edgeUrl).host.split('.')[0];
58
+ const edgeEnv = ENV_LABELS[part];
59
+ if (!edgeEnv) {
60
+ return null;
61
+ }
62
+
63
+ return (
64
+ <StatusBar.Item>
65
+ <StatusBar.Text classNames='text-xs text-subdued border border-separator rounded-full px-1'>
66
+ <span title={edgeEnv}>{edgeEnv[0]}</span>
67
+ </StatusBar.Text>
68
+ </StatusBar.Item>
69
+ );
70
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export { StatusBarActions as default } from './StatusBarActions';
@@ -0,0 +1,21 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Surface } from '@dxos/app-framework/ui';
8
+
9
+ import StatusBarActionsDefault from '../StatusBarActions';
10
+
11
+ export type StatusBarPanelProps = {};
12
+
13
+ export const StatusBarPanel = (_props: StatusBarPanelProps) => {
14
+ return (
15
+ <>
16
+ <StatusBarActionsDefault />
17
+ <span role='separator' className='grow' />
18
+ <Surface.Surface role='status' />
19
+ </>
20
+ );
21
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export { StatusBarPanel as default } from './StatusBarPanel';
@@ -0,0 +1,97 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { formatDistance } from 'date-fns/formatDistance';
6
+ import React from 'react';
7
+
8
+ import { useConfig } from '@dxos/react-client';
9
+ import { Icon, Link, Message, Popover, Trans, useTranslation } from '@dxos/react-ui';
10
+
11
+ import { StatusBar } from '#components';
12
+ import { meta } from '#meta';
13
+
14
+ export type VersionNumberProps = {};
15
+
16
+ const repo = 'https://github.com/dxos/dxos';
17
+
18
+ const VERSION_REGEX = /([\d.]+)/;
19
+
20
+ export const VersionNumber = (_props: VersionNumberProps) => {
21
+ const { t } = useTranslation(meta.id);
22
+ const config = useConfig();
23
+ const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
24
+ const [_, v] = version?.match(VERSION_REGEX) ?? [];
25
+
26
+ const releaseUrl =
27
+ config.values.runtime?.app?.env?.DX_ENVIRONMENT === 'production'
28
+ ? `${repo}/releases/tag/v${version}`
29
+ : `${repo}/commit/${commitHash}`;
30
+
31
+ const previewUrl = 'https://docs.dxos.org/composer#technology-preview';
32
+
33
+ return (
34
+ <Popover.Root>
35
+ <Popover.Trigger asChild>
36
+ <StatusBar.Button classNames='h-full text-xs'>{v}</StatusBar.Button>
37
+ </Popover.Trigger>
38
+ <Popover.Portal>
39
+ <Popover.Content side='top' role='message' classNames='z-[12] max-w-[min(calc(100vw-16px),40ch)]'>
40
+ <Message.Root valence='info' classNames='rounded-b-none p-4'>
41
+ <Message.Title>{t('warning.title')}</Message.Title>
42
+ <Message.Content>
43
+ {t('technology-preview.message')}
44
+ <br />
45
+ <Link href={previewUrl} target='_blank' rel='noreferrer' variant='neutral'>
46
+ {t('learn-more.label')}
47
+ <Icon icon='ph--arrow-square-out--bold' classNames='dx-icon-inline ms-1' />
48
+ </Link>
49
+ </Message.Content>
50
+ </Message.Root>
51
+ <div role='none' className='flex flex-col ps-9 pe-4 py-2 gap-1 space-b-2 text-base-surface-text'>
52
+ {timestamp && (
53
+ <div>
54
+ <p>
55
+ {t('released.message', {
56
+ released: formatDistance(new Date(timestamp), new Date(), { addSuffix: true }),
57
+ })}
58
+ </p>
59
+ <div>
60
+ <span className='dx-tag dx-tag--neutral -ml-1'>{version}</span>
61
+ </div>
62
+ </div>
63
+ )}
64
+ <div>
65
+ <p>
66
+ <Link href={releaseUrl} target='_blank' rel='noreferrer' variant='neutral'>
67
+ {t('see-release.label')}
68
+ <Icon icon='ph--arrow-square-out--bold' size={4} classNames='dx-icon-inline ms-1' />
69
+ </Link>
70
+ </p>
71
+ <p>
72
+ <Trans
73
+ {...{
74
+ t,
75
+ i18nKey: 'powered-by-dxos.message',
76
+ components: {
77
+ dxos: (
78
+ <Link
79
+ classNames='text-green-500'
80
+ href='https://dxos.org'
81
+ target='_blank'
82
+ rel='noreferrer'
83
+ variant='neutral'
84
+ />
85
+ ),
86
+ },
87
+ }}
88
+ />
89
+ </p>
90
+ </div>
91
+ </div>
92
+ <Popover.Arrow />
93
+ </Popover.Content>
94
+ </Popover.Portal>
95
+ </Popover.Root>
96
+ );
97
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export { VersionNumber as default } from './VersionNumber';
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type ComponentType, lazy } from 'react';
6
+
7
+ export const StatusBarActions: ComponentType<any> = lazy(() => import('./StatusBarActions'));
8
+ export const StatusBarPanel: ComponentType<any> = lazy(() => import('./StatusBarPanel'));
9
+ export const VersionNumber: ComponentType<any> = lazy(() => import('./VersionNumber'));
package/src/meta.ts CHANGED
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
6
6
  import { trim } from '@dxos/util';
7
7
 
8
8
  export const meta: Plugin.Meta = {
9
- id: 'dxos.org/plugin/status-bar',
9
+ id: 'org.dxos.plugin.status-bar',
10
10
  name: 'Status Bar',
11
11
  description: trim`
12
12
  Persistent bottom bar displaying workspace status information and quick actions.
@@ -4,22 +4,22 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- import { meta } from './meta';
7
+ import { meta } from '#meta';
8
8
 
9
9
  export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [meta.id]: {
13
- 'plugin name': 'Status Bar',
14
- 'warning title': 'WARNING',
15
- 'technology preview message': 'Composer is currently in beta.',
16
- 'learn more label': 'Learn more',
17
- 'released message': 'This version released {{released}}.',
18
- 'see release label': 'See release on GitHub',
19
- 'powered by dxos message': 'Powered by <dxos>DXOS</dxos>',
20
- 'discord label': 'Discord',
21
- 'github label': 'GitHub',
22
- 'feedback label': 'Feedback',
13
+ 'plugin.name': 'Status Bar',
14
+ 'warning.title': 'WARNING',
15
+ 'technology-preview.message': 'Composer is currently in beta.',
16
+ 'learn-more.label': 'Learn more',
17
+ 'released.message': 'This version was released {{released}}.',
18
+ 'see-release.label': 'See release on GitHub',
19
+ 'powered-by-dxos.message': 'Powered by <dxos>DXOS</dxos>',
20
+ 'discord.label': 'Discord',
21
+ 'github.label': 'GitHub',
22
+ 'feedback.label': 'Feedback',
23
23
  },
24
24
  },
25
25
  },