@mutmutco/pi-plugin 4.5.180 → 4.5.181

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/pi-plugin",
3
- "version": "4.5.180",
3
+ "version": "4.5.181",
4
4
  "description": "MMI workflow skills and org gates delivery.",
5
5
  "author": {
6
6
  "name": "MMI Future",
@@ -5,7 +5,7 @@
5
5
  "type": "module",
6
6
  "description": "MM-Work module",
7
7
  "scripts": {
8
- "lint": "mmwork-check-ui src",
8
+ "lint": "mmwork-check-ui --rules=all src",
9
9
  "build": "vite build",
10
10
  "dev": "vite build --watch",
11
11
  "serve": "vite preview --port 5301",
@@ -2,7 +2,22 @@
2
2
  // It is built with mmworkModule() (vite.config.mjs), uses only the shared design system, and reaches Drive
3
3
  // through MM-Work's surface actions, never its own Google access.
4
4
  import { useEffect, useState } from 'react';
5
- import { Button, Card, Cluster, DataList, Page, Stack, Text } from '@mutmutco/mmwork-ds';
5
+ import {
6
+ Button,
7
+ Card,
8
+ Cluster,
9
+ Dashboard,
10
+ DashboardSection,
11
+ DataList,
12
+ DetailPage,
13
+ FormPage,
14
+ List,
15
+ ListPage,
16
+ ListRow,
17
+ SettingRow,
18
+ Stack,
19
+ Text,
20
+ } from '@mutmutco/mmwork-ds';
6
21
 
7
22
  export const manifest = { id: '{{REPO_SLUG}}', name: '{{REPO_NAME}}' };
8
23
 
@@ -11,7 +26,7 @@ export const manifest = { id: '{{REPO_SLUG}}', name: '{{REPO_NAME}}' };
11
26
  // { key: 'welcome', label: 'Welcome message', type: 'text', default: 'Hello', admin: true }
12
27
  // ] }] }`. MM-Work draws those choices; ctx.settings.get('compact') reads the effective value.
13
28
  // Declare `search: { title: 'Example module' }` and `sections: [{ label: 'Home', path: '/' },
14
- // { label: 'Details', path: '/details' }]` in the registry. Results are data, not rendered rows.
29
+ // { label: 'Items', path: '/items' }, { label: 'Details', path: '/details' }, { label: 'Settings', path: '/settings' }]` in the registry. Results are data, not rendered rows.
15
30
  export const search = {
16
31
  find: async (query, ctx, signal) => {
17
32
  if (signal.aborted) return { results: [] };
@@ -56,26 +71,95 @@ export default function ExampleModule({ ctx }) {
56
71
  .catch(() => setFailed(true));
57
72
  }, [ctx]);
58
73
 
74
+ const rows = [
75
+ { label: 'Workspace', value: ctx.workspace.name },
76
+ { label: 'Address in MM-Work', value: `${ctx.base}${ctx.path === '/' ? '' : ctx.path}` },
77
+ { label: 'Recent files (files.list)', value: failed ? 'Drive is not connected' : files === null ? 'Loading…' : String(files.length) },
78
+ { label: 'Review files job', value: ctx.can('files.review') ? 'Held' : 'Not held' },
79
+ ];
80
+
81
+ if (ctx.path === '/items') {
82
+ return (
83
+ <ListPage
84
+ title="Items"
85
+ description="Recent files from your connected Google Drive."
86
+ primary={{ label: 'Open details', onClick: () => ctx.navigate(`${ctx.base}/details`) }}
87
+ busy={!failed && files === null}
88
+ >
89
+ <List label="Items">
90
+ {(files ?? []).map((file, i) => (
91
+ <ListRow
92
+ key={file.id ?? i}
93
+ title={file.name}
94
+ meta="Recent files"
95
+ onClick={() => ctx.navigate(`${ctx.base}/details`)}
96
+ />
97
+ ))}
98
+ </List>
99
+ </ListPage>
100
+ );
101
+ }
102
+
103
+ if (ctx.path === '/details') {
104
+ return (
105
+ <DetailPage
106
+ title="Details"
107
+ description="One item inside the module."
108
+ back={{ label: 'Home', onClick: () => ctx.navigate(ctx.base) }}
109
+ aside={<DataList rows={rows} />}
110
+ asideLabel="About this item"
111
+ >
112
+ <Text as="p" variant="body" measure="body">
113
+ This detail view uses DetailPage with the module facts in its hideable aside column.
114
+ </Text>
115
+ </DetailPage>
116
+ );
117
+ }
118
+
119
+ if (ctx.path === '/settings') {
120
+ return (
121
+ <FormPage
122
+ title="Settings"
123
+ description="Display preferences for this module."
124
+ back={{ label: 'Home', onClick: () => ctx.navigate(ctx.base) }}
125
+ >
126
+ <DashboardSection title="Display" card>
127
+ <SettingRow
128
+ label="Compact view"
129
+ description="Show denser rows in this module."
130
+ value={ctx.settings?.get?.('compact') ? 'On' : 'Off'}
131
+ />
132
+ <SettingRow
133
+ label="Welcome message"
134
+ description="Greeting shown on the module home screen."
135
+ value={ctx.settings?.get?.('welcome') ?? 'Hello'}
136
+ />
137
+ </DashboardSection>
138
+ </FormPage>
139
+ );
140
+ }
141
+
59
142
  return (
60
- <Page title={`Hello, ${ctx.person.name ?? ctx.person.email}`} width="narrow">
143
+ <Dashboard
144
+ title={`Hello, ${ctx.person.name ?? ctx.person.email}`}
145
+ description="Module overview and workspace connection."
146
+ primary={{ label: 'Open details', onClick: () => ctx.navigate(`${ctx.base}/details`) }}
147
+ >
61
148
  <Stack gap="groups">
62
149
  <Text as="p" variant="lead" data-tour="example-intro">
63
150
  This screen comes from a module's own bundle. It uses MM-Work's React and design system, and reads Drive through MM-Work.
64
151
  </Text>
65
152
  <Card data-tour="example-overview" title="What the module sees" icon="info">
66
- <DataList rows={[
67
- { label: 'Workspace', value: ctx.workspace.name },
68
- { label: 'Address in MM-Work', value: `${ctx.base}${ctx.path === '/' ? '' : ctx.path}` },
69
- { label: 'Recent files (files.list)', value: failed ? 'Drive is not connected' : files === null ? 'Loading…' : String(files.length) },
70
- { label: 'Review files job', value: ctx.can('files.review') ? 'Held' : 'Not held' },
71
- ]} />
153
+ <DataList rows={rows} />
72
154
  </Card>
73
155
  <Cluster data-tour="example-actions">
156
+ <Button variant="secondary" onClick={() => ctx.navigate(`${ctx.base}/items`)}>Browse items</Button>
74
157
  <Button variant="secondary" onClick={() => ctx.navigate(`${ctx.base}/details`)}>Open a page inside the module</Button>
158
+ <Button variant="secondary" onClick={() => ctx.navigate(`${ctx.base}/settings`)}>Settings</Button>
75
159
  <Button variant="ghost" onClick={() => ctx.navigate('/files')}>Go to Files</Button>
76
160
  </Cluster>
77
161
  </Stack>
78
- </Page>
162
+ </Dashboard>
79
163
  );
80
164
  }
81
165