-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.js
More file actions
296 lines (282 loc) · 10.3 KB
/
Copy pathplugin.js
File metadata and controls
296 lines (282 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
import {
Badge,
Button,
cn,
Codicon,
EmptyState,
haptic,
host,
ROUTES_AREA,
SIDEBAR_NAV_AREA,
} from '@hermes/plugin-sdk';
import { useEffect, useMemo, useState } from 'react';
import { jsx, jsxs } from 'react/jsx-runtime';
const ID = 'hermes-new-features';
let storage;
const FEATURE_GROUPS = [
{
release: 'Prerelease',
note: 'Preview capabilities worth exploring before their first stable release.',
features: [
{
id: 'desktop-plugin-sdk',
icon: 'extensions',
name: 'Desktop plugin SDK',
description: 'Build native panes, commands, routes, and status items without rebuilding Hermes.',
},
{
id: 'desktop-plugin-storage',
icon: 'database',
name: 'Plugin-local storage',
description: 'Keep preferences and exploration progress local to each desktop installation.',
},
],
},
{
release: '2026.1',
note: 'Stable capabilities available in Hermes today.',
features: [
{
id: 'persistent-memory',
icon: 'heart',
name: 'Persistent memory',
description: 'Carry high-signal preferences and environment facts between sessions.',
},
{
id: 'desktop-plugins',
icon: 'milestone',
name: 'Desktop plugins',
description: 'Extend the desktop app with theme-native UI that reloads in place.',
},
],
},
];
const FILTERS = [
{ id: 'all', label: 'All' },
{ id: 'unexplored', label: 'To explore' },
{ id: 'explored', label: 'Explored' },
];
function FeatureCard({ feature, release, explored, onExplore }) {
return jsxs('article', {
className: cn(
'group flex min-h-48 flex-col rounded-lg border p-4 transition-colors',
explored
? 'border-(--ui-stroke-secondary) bg-(--ui-bg-secondary) opacity-65 hover:bg-(--ui-bg-tertiary) hover:opacity-100'
: 'border-(--ui-stroke-strong) bg-(--ui-bg-tertiary)'
),
children: [
jsxs('div', {
className: 'flex items-start justify-between gap-3',
children: [
jsx('div', {
className: cn(
'flex size-8 shrink-0 items-center justify-center rounded-md border',
explored
? 'border-(--ui-stroke-secondary) text-(--ui-text-tertiary)'
: 'border-(--ui-stroke-secondary) bg-(--ui-accent-muted) text-(--ui-accent)'
),
children: jsx(Codicon, { name: feature.icon, size: '0.9rem' }),
}),
jsx(Badge, {
variant: 'outline',
className: 'shrink-0 bg-(--ui-accent) text-(--ui-accent-foreground)',
children: release,
}),
],
}),
jsx('h2', {
className: 'mt-4 text-sm font-medium tracking-[-0.01em] text-(--ui-text-primary)',
children: feature.name,
}),
jsx('p', {
className: 'mt-1.5 line-clamp-3 text-xs leading-relaxed text-(--ui-text-tertiary)',
children: feature.description,
}),
jsxs('div', {
className: 'mt-auto flex items-center justify-between gap-3 pt-4',
children: [
jsxs('span', {
className: 'inline-flex items-center gap-1.5 text-[0.6875rem] text-(--ui-text-quaternary)',
children: [
jsx('span', {
className: cn('size-1.5 rounded-full', explored ? 'bg-(--ui-text-quaternary)' : 'bg-(--ui-accent)'),
}),
explored ? 'Explored' : 'New to you',
],
}),
jsx(Button, {
type: 'button',
variant: explored ? 'ghost' : 'secondary',
size: 'sm',
onClick: () => {
haptic('tap');
onExplore(feature.id);
},
children: explored ? 'Review' : 'Explore',
}),
],
}),
],
});
}
function ReleaseSection({ group, explored, filter, onExplore }) {
const features = group.features.filter((feature) => {
const isExplored = Boolean(explored[feature.id]);
return filter === 'all' || (filter === 'explored' ? isExplored : !isExplored);
});
if (!features.length) return null;
return jsxs('section', {
className: 'space-y-3',
children: [
jsxs('div', {
className: 'flex items-start justify-between gap-4',
children: [
jsxs('div', {
children: [
jsxs('div', {
className: 'flex items-center gap-2',
children: [
jsx('h1', { className: 'text-sm font-medium', children: group.release }),
group.release === 'Prerelease'
? jsx(Badge, { variant: 'outline', className: 'text-[0.625rem] text-(--ui-accent)', children: 'Preview' })
: null,
],
}),
jsx('p', { className: 'mt-1 text-xs text-(--ui-text-tertiary)', children: group.note }),
],
}),
jsx('span', { className: 'pt-0.5 text-xs tabular-nums text-(--ui-text-quaternary)', children: `${features.length} features` }),
],
}),
jsx('div', {
className: 'grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3',
children: features.map((feature) => jsx(FeatureCard, {
feature,
release: group.release,
explored: Boolean(explored[feature.id]),
onExplore,
}, feature.id)),
}),
],
});
}
function NewFeaturesPage() {
const [explored, setExplored] = useState({});
const [filter, setFilter] = useState('all');
const allFeatures = useMemo(() => FEATURE_GROUPS.flatMap((group) => group.features), []);
const exploredCount = allFeatures.filter((feature) => explored[feature.id]).length;
useEffect(() => {
let active = true;
Promise.resolve(storage.get('explored-features')).then((saved) => {
if (active && saved && typeof saved === 'object') setExplored(saved);
});
return () => { active = false; };
}, []);
const updateExplored = (next) => {
setExplored(next);
Promise.resolve(storage.set('explored-features', next));
};
const markExplored = (featureId) => {
updateExplored({ ...explored, [featureId]: true });
};
const resetExploration = () => {
updateExplored({});
setFilter('all');
};
return jsxs('main', {
className: 'flex h-full min-h-0 flex-col',
children: [
jsxs('header', {
className: 'border-b border-(--ui-stroke-secondary) bg-(--ui-bg-tertiary) px-6 py-5',
children: [
jsxs('div', {
className: 'flex items-start justify-between gap-5',
children: [
jsxs('div', {
children: [
jsxs('div', {
className: 'flex items-center gap-2.5',
children: [
jsx('div', {
className: 'flex size-8 items-center justify-center rounded-md bg-(--ui-accent-muted) text-(--ui-accent)',
children: jsx(Codicon, { name: 'sparkle', size: '1rem' }),
}),
jsx('h1', { className: 'text-base font-medium tracking-[-0.015em]', children: 'What’s new' }),
],
}),
jsx('p', { className: 'mt-2 text-sm text-(--ui-text-secondary)', children: 'A curated field guide to the Hermes features worth trying next.' }),
],
}),
jsxs('div', {
className: 'shrink-0 text-right',
children: [
jsx('div', { className: 'text-2xl font-semibold tabular-nums tracking-[-0.03em]', children: `${exploredCount}/${allFeatures.length}` }),
jsx('div', { className: 'mt-0.5 text-[0.6875rem] text-(--ui-text-tertiary)', children: 'explored' }),
],
}),
],
}),
jsxs('div', {
className: 'mt-5 flex items-center justify-between gap-4',
children: [
jsx('div', {
className: 'flex items-center gap-1 rounded-lg border border-(--ui-stroke-secondary) bg-(--ui-bg-secondary) p-1',
children: FILTERS.map((item) => jsx('button', {
type: 'button',
onClick: () => setFilter(item.id),
className: cn(
'rounded-md px-2.5 py-1 text-xs transition-colors',
filter === item.id
? 'bg-(--ui-bg-quaternary) text-(--ui-text-primary)'
: 'text-(--ui-text-tertiary) hover:text-(--ui-text-primary)'
),
children: item.label,
}, item.id)),
}),
exploredCount
? jsx(Button, { variant: 'ghost', size: 'sm', onClick: resetExploration, children: 'Reset progress' })
: null,
],
}),
],
}),
jsx('div', {
className: 'flex-1 overflow-y-auto px-6 py-6',
children: FEATURE_GROUPS.some((group) => group.features.some((feature) => filter === 'all' || (filter === 'explored' ? explored[feature.id] : !explored[feature.id])))
? jsx('div', {
className: 'mx-auto flex max-w-6xl flex-col gap-8',
children: FEATURE_GROUPS.map((group) => jsx(ReleaseSection, { group, explored, filter, onExplore: markExplored }, group.release)),
})
: jsx(EmptyState, {
title: filter === 'explored' ? 'Nothing explored yet' : 'You’re all caught up',
description: filter === 'explored' ? 'Explore a feature card to begin building your history.' : 'Every feature in this guide has been explored.',
}),
}),
],
});
}
export default {
id: ID,
name: 'Hermes New Features',
description: 'A release-organized, theme-native field guide to notable Hermes features.',
defaultEnabled: true,
register(ctx) {
storage = ctx.storage;
ctx.registerMany([
{
id: 'page',
area: ROUTES_AREA,
data: { path: '/hermes-new-features' },
title: 'What’s new',
render: () => jsx(NewFeaturesPage, {}),
},
{
id: 'nav',
area: SIDEBAR_NAV_AREA,
order: 60,
data: { path: '/hermes-new-features', label: 'What’s new', codicon: 'sparkle' },
},
]);
host.logs('info', 'Hermes New Features plugin registered');
},
};