@dxos/plugin-status-bar 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33
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.
- package/dist/lib/browser/index.mjs +67 -50
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +24 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +67 -49
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +26 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/StatusBarPlugin.d.ts +2 -1
- package/dist/types/src/StatusBarPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/{StatusBar.d.ts → StatusBar/StatusBar.d.ts} +9 -7
- package/dist/types/src/components/StatusBar/StatusBar.d.ts.map +1 -0
- package/dist/types/src/components/StatusBar/StatusBar.stories.d.ts +15 -0
- package/dist/types/src/components/StatusBar/StatusBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/StatusBar/index.d.ts +2 -0
- package/dist/types/src/components/StatusBar/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts +4 -0
- package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts.map +1 -0
- package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts +7 -0
- package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts.map +1 -0
- package/dist/types/src/containers/StatusBarActions/index.d.ts +2 -0
- package/dist/types/src/containers/StatusBarActions/index.d.ts.map +1 -0
- package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts +4 -0
- package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts.map +1 -0
- package/dist/types/src/containers/StatusBarPanel/index.d.ts +2 -0
- package/dist/types/src/containers/StatusBarPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts +4 -0
- package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts.map +1 -0
- package/dist/types/src/containers/VersionNumber/index.d.ts +2 -0
- package/dist/types/src/containers/VersionNumber/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +11 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -30
- package/src/StatusBarPlugin.ts +10 -17
- package/src/capabilities/index.ts +2 -2
- package/src/capabilities/react-surface.tsx +25 -26
- package/src/components/StatusBar/StatusBar.stories.tsx +45 -0
- package/src/components/{StatusBar.tsx → StatusBar/StatusBar.tsx} +43 -21
- package/src/components/StatusBar/index.ts +5 -0
- package/src/components/index.ts +0 -2
- package/src/containers/StatusBarActions/StatusBarActions.stories.tsx +62 -0
- package/src/containers/StatusBarActions/StatusBarActions.tsx +70 -0
- package/src/containers/StatusBarActions/index.ts +5 -0
- package/src/containers/StatusBarPanel/StatusBarPanel.tsx +21 -0
- package/src/containers/StatusBarPanel/index.ts +5 -0
- package/src/containers/VersionNumber/VersionNumber.tsx +97 -0
- package/src/containers/VersionNumber/index.ts +5 -0
- package/src/containers/index.ts +9 -0
- package/src/meta.ts +8 -6
- package/src/translations.ts +11 -11
- package/dist/lib/browser/chunk-32FBOE6I.mjs +0 -249
- package/dist/lib/browser/chunk-32FBOE6I.mjs.map +0 -7
- package/dist/lib/browser/react-surface-P7CEMQU3.mjs +0 -38
- package/dist/lib/browser/react-surface-P7CEMQU3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IQXGCBGU.mjs +0 -251
- package/dist/lib/node-esm/chunk-IQXGCBGU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-U7DLJKU6.mjs +0 -39
- package/dist/lib/node-esm/react-surface-U7DLJKU6.mjs.map +0 -7
- package/dist/types/src/components/StatusBar.d.ts.map +0 -1
- package/dist/types/src/components/StatusBar.stories.d.ts +0 -9
- package/dist/types/src/components/StatusBar.stories.d.ts.map +0 -1
- package/dist/types/src/components/StatusBarPanel.d.ts +0 -4
- package/dist/types/src/components/StatusBarPanel.d.ts.map +0 -1
- package/dist/types/src/components/VersionNumber.d.ts +0 -3
- package/dist/types/src/components/VersionNumber.d.ts.map +0 -1
- package/src/components/StatusBar.stories.tsx +0 -48
- package/src/components/StatusBarPanel.tsx +0 -75
- package/src/components/VersionNumber.tsx +0 -84
package/package.json
CHANGED
|
@@ -1,61 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-status-bar",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.fcc0d83b33",
|
|
4
4
|
"description": "Status bar plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
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
|
+
"#translations": "./src/translations.ts"
|
|
21
|
+
},
|
|
11
22
|
"exports": {
|
|
12
23
|
".": {
|
|
24
|
+
"source": "./src/index.ts",
|
|
13
25
|
"types": "./dist/types/src/index.d.ts",
|
|
14
26
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
27
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./translations": {
|
|
30
|
+
"source": "./src/translations.ts",
|
|
31
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
32
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
33
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
16
34
|
}
|
|
17
35
|
},
|
|
18
36
|
"types": "dist/types/src/index.d.ts",
|
|
19
|
-
"typesVersions": {
|
|
20
|
-
"*": {}
|
|
21
|
-
},
|
|
22
37
|
"files": [
|
|
23
38
|
"dist",
|
|
24
39
|
"src"
|
|
25
40
|
],
|
|
26
41
|
"dependencies": {
|
|
27
|
-
"@fluentui/react-tabster": "
|
|
28
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
29
|
-
"@preact/signals-core": "^1.9.0",
|
|
42
|
+
"@fluentui/react-tabster": "9.26.11",
|
|
30
43
|
"@radix-ui/react-slot": "1.1.2",
|
|
31
|
-
"date-fns": "^3.
|
|
32
|
-
"effect": "3.
|
|
44
|
+
"date-fns": "^3.6.0",
|
|
45
|
+
"effect": "3.20.0",
|
|
33
46
|
"react-resize-detector": "^11.0.1",
|
|
34
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/react-
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/schema": "0.8.4-main.
|
|
47
|
+
"@dxos/app-framework": "0.8.4-main.fcc0d83b33",
|
|
48
|
+
"@dxos/app-toolkit": "0.8.4-main.fcc0d83b33",
|
|
49
|
+
"@dxos/echo": "0.8.4-main.fcc0d83b33",
|
|
50
|
+
"@dxos/operation": "0.8.4-main.fcc0d83b33",
|
|
51
|
+
"@dxos/react-client": "0.8.4-main.fcc0d83b33",
|
|
52
|
+
"@dxos/react-ui-form": "0.8.4-main.fcc0d83b33",
|
|
53
|
+
"@dxos/plugin-observability": "0.8.4-main.fcc0d83b33",
|
|
54
|
+
"@dxos/schema": "0.8.4-main.fcc0d83b33",
|
|
55
|
+
"@dxos/async": "0.8.4-main.fcc0d83b33",
|
|
56
|
+
"@dxos/util": "0.8.4-main.fcc0d83b33"
|
|
42
57
|
},
|
|
43
58
|
"devDependencies": {
|
|
44
|
-
"@types/react": "~
|
|
45
|
-
"@types/react-dom": "~
|
|
46
|
-
"react": "~
|
|
47
|
-
"react-dom": "~
|
|
48
|
-
"vite": "
|
|
49
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
59
|
+
"@types/react": "~19.2.7",
|
|
60
|
+
"@types/react-dom": "~19.2.3",
|
|
61
|
+
"react": "~19.2.3",
|
|
62
|
+
"react-dom": "~19.2.3",
|
|
63
|
+
"vite": "^8.0.10",
|
|
64
|
+
"@dxos/react-ui": "0.8.4-main.fcc0d83b33",
|
|
65
|
+
"@dxos/storybook-utils": "0.8.4-main.fcc0d83b33",
|
|
66
|
+
"@dxos/ui-theme": "0.8.4-main.fcc0d83b33"
|
|
52
67
|
},
|
|
53
68
|
"peerDependencies": {
|
|
54
|
-
"effect": "
|
|
55
|
-
"react": "~
|
|
56
|
-
"react-dom": "~
|
|
57
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
58
|
-
"@dxos/
|
|
69
|
+
"effect": "3.20.0",
|
|
70
|
+
"react": "~19.2.3",
|
|
71
|
+
"react-dom": "~19.2.3",
|
|
72
|
+
"@dxos/react-ui": "0.8.4-main.fcc0d83b33",
|
|
73
|
+
"@dxos/ui-theme": "0.8.4-main.fcc0d83b33"
|
|
59
74
|
},
|
|
60
75
|
"publishConfig": {
|
|
61
76
|
"access": "public"
|
package/src/StatusBarPlugin.ts
CHANGED
|
@@ -2,22 +2,15 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
|
-
import { ReactSurface } from '
|
|
8
|
-
import { meta } from '
|
|
9
|
-
import { translations } from '
|
|
8
|
+
import { ReactSurface } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
10
11
|
|
|
11
|
-
export const StatusBarPlugin = ()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
activate: () => contributes(Capabilities.Translations, translations),
|
|
17
|
-
}),
|
|
18
|
-
defineModule({
|
|
19
|
-
id: `${meta.id}/module/react-surface`,
|
|
20
|
-
activatesOn: Events.SetupReactSurface,
|
|
21
|
-
activate: ReactSurface,
|
|
22
|
-
}),
|
|
23
|
-
]);
|
|
12
|
+
export const StatusBarPlugin = Plugin.define(meta).pipe(
|
|
13
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
14
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
15
|
+
Plugin.make,
|
|
16
|
+
);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
7
|
+
export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
|
|
@@ -2,33 +2,32 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import { Capabilities,
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
10
|
|
|
9
|
-
import { StatusBarActions, StatusBarPanel, VersionNumber } from '
|
|
10
|
-
import { meta } from '../meta';
|
|
11
|
+
import { StatusBarActions, StatusBarPanel, VersionNumber } from '#containers';
|
|
11
12
|
|
|
12
|
-
export default () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}),
|
|
34
|
-
]);
|
|
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 = {};
|
|
@@ -3,10 +3,30 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Slot } from '@radix-ui/react-slot';
|
|
6
|
-
import React, { type ComponentPropsWithRef,
|
|
6
|
+
import React, { type ComponentPropsWithRef, type PropsWithChildren, type ReactNode, forwardRef } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
-
import { mx } from '@dxos/
|
|
9
|
+
import { mx } from '@dxos/ui-theme';
|
|
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
|
+
//
|
|
10
30
|
|
|
11
31
|
type StatusBarTextProps = ThemedClassName<{ children: ReactNode }>;
|
|
12
32
|
|
|
@@ -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 px-2 rounded-
|
|
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-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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 px-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,
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
|
|
13
|
+
import { StatusBarActions } from './StatusBarActions';
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof StatusBarActions> = {
|
|
16
|
+
title: 'plugins/plugin-status-bar/containers/StatusBarActions',
|
|
17
|
+
component: StatusBarActions,
|
|
18
|
+
decorators: [
|
|
19
|
+
withTheme(),
|
|
20
|
+
withLayout({
|
|
21
|
+
layout: 'centered',
|
|
22
|
+
classNames: 'w-[calc(var(--dx-complementary-sidebar-size)_-_var(--dx-rail-content))]',
|
|
23
|
+
}),
|
|
24
|
+
withClientProvider({
|
|
25
|
+
config: new Config({
|
|
26
|
+
version: 1,
|
|
27
|
+
runtime: {
|
|
28
|
+
client: {
|
|
29
|
+
storage: {
|
|
30
|
+
persistent: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
app: {
|
|
34
|
+
build: {
|
|
35
|
+
version: '0.8.3-beta.b78990fdd5',
|
|
36
|
+
timestamp: '2024-06-01T12:00:00.000Z',
|
|
37
|
+
commitHash: 'b78990fdd5',
|
|
38
|
+
},
|
|
39
|
+
env: {
|
|
40
|
+
DX_ENVIRONMENT: 'development',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
services: {
|
|
44
|
+
edge: {
|
|
45
|
+
url: 'https://edge-dev.dxos.org',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
parameters: {
|
|
53
|
+
layout: 'centered',
|
|
54
|
+
translations,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
|
|
60
|
+
type Story = StoryObj<typeof meta>;
|
|
61
|
+
|
|
62
|
+
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,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,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,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'));
|