@meith/plugin-calendar 0.35.1 → 0.36.0

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": "@meith/plugin-calendar",
3
- "version": "0.35.1",
3
+ "version": "0.36.0",
4
4
  "description": "A shared calendar: events the community can see, linked to the threads that discuss them.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,7 +20,8 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@meith/plugin-kit": "^0.35.1"
23
+ "@meith/plugin-kit": "^0.36.0",
24
+ "@meith/ui": "^0.36.0"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "react": "^19.2.0"
@@ -20,7 +20,7 @@ export const calendarPlugin = definePlugin({
20
20
  key: 'calendar',
21
21
  name: en['calendar.definition.name'],
22
22
  nameKey: 'calendar.definition.name',
23
- version: '0.35.1',
23
+ version: '0.36.0',
24
24
  description: en['calendar.definition.description'],
25
25
  descriptionKey: 'calendar.definition.description',
26
26
  apiVersion: '0',
package/src/ui/admin.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { PluginAdminPageContext } from '@meith/plugin-kit'
2
+ import { buttonVariants, controlVariants, surfaceVariants } from '@meith/ui'
2
3
 
3
4
  import en from '../messages/en.json'
4
5
  import { organiserIds } from '../store'
@@ -18,7 +19,7 @@ export async function OrganisersPage(context: PluginAdminPageContext) {
18
19
  )
19
20
 
20
21
  return (
21
- <div className="flex flex-col gap-4 text-sm">
22
+ <div className={surfaceVariants({ padded: true, className: 'text-sm' })}>
22
23
  {named.length === 0 ? (
23
24
  <p className="text-muted-foreground">
24
25
  {translated(context, 'calendar.admin.organisers.empty')}
@@ -30,7 +31,10 @@ export async function OrganisersPage(context: PluginAdminPageContext) {
30
31
  <span>{organiser.username}</span>
31
32
  <form method="post" action="/admin/api/plugins/calendar/organisers/remove">
32
33
  <input type="hidden" name="user_id" value={organiser.userId} />
33
- <button type="submit" className="rounded border px-2 py-0.5 text-xs">
34
+ <button
35
+ type="submit"
36
+ className={buttonVariants({ variant: 'destructive', size: 'sm' })}
37
+ >
34
38
  {translated(context, 'calendar.admin.organisers.remove')}
35
39
  </button>
36
40
  </form>
@@ -42,13 +46,13 @@ export async function OrganisersPage(context: PluginAdminPageContext) {
42
46
  <form
43
47
  method="post"
44
48
  action="/admin/api/plugins/calendar/organisers/add"
45
- className="flex items-end gap-2"
49
+ className="flex flex-wrap items-end gap-3"
46
50
  >
47
51
  <label className="flex flex-col gap-1">
48
52
  {translated(context, 'calendar.admin.organisers.username')}
49
- <input name="username" required className="rounded border p-1" />
53
+ <input name="username" required className={controlVariants()} />
50
54
  </label>
51
- <button type="submit" className="rounded border px-3 py-1">
55
+ <button type="submit" className={buttonVariants({ variant: 'primary' })}>
52
56
  {translated(context, 'calendar.admin.organisers.add')}
53
57
  </button>
54
58
  </form>
package/src/ui/page.tsx CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  type PluginPageContext,
6
6
  pluginTabClass,
7
7
  } from '@meith/plugin-kit'
8
+ import { buttonVariants, controlVariants, textLinkVariants } from '@meith/ui'
8
9
 
9
10
  import { mayAdd, mayManage, resolveCalendarConfig } from '../access'
10
11
  import {
@@ -60,7 +61,7 @@ function EventRow({
60
61
  <DateBlock event={event} locale={locale} />
61
62
 
62
63
  <div className="flex min-w-0 flex-col gap-1">
63
- <p className="font-semibold leading-tight">{event.title}</p>
64
+ <p className="font-semibold leading-snug [overflow-wrap:anywhere]">{event.title}</p>
64
65
 
65
66
  <p className="text-muted-foreground text-sm">
66
67
  <time dateTime={event.startsAt.toISOString()}>
@@ -72,27 +73,27 @@ function EventRow({
72
73
  <div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-sm">
73
74
  <span className="text-muted-foreground">{relativeHint(event.startsAt, now, locale)}</span>
74
75
  {href !== null && (
75
- <a className="underline underline-offset-2" href={href}>
76
+ <a className={textLinkVariants()} href={href}>
76
77
  {translated(context, 'calendar.event.discuss')}
77
78
  </a>
78
79
  )}
79
80
  <a
80
- className="underline underline-offset-2"
81
+ className={textLinkVariants()}
81
82
  href={`/api/plugins/calendar/events/ics?id=${event.id}`}
82
83
  >
83
84
  {translated(context, 'calendar.event.download')}
84
85
  </a>
85
86
  {manageable && (
86
87
  <>
87
- <a
88
- className="underline underline-offset-2"
89
- href={`/plugins/calendar?edit=${event.id}`}
90
- >
88
+ <a className={textLinkVariants()} href={`/plugins/calendar?edit=${event.id}`}>
91
89
  {translated(context, 'calendar.event.edit')}
92
90
  </a>
93
91
  <form method="post" action="/api/plugins/calendar/events/delete">
94
92
  <input type="hidden" name="id" value={event.id} />
95
- <button type="submit" className="underline underline-offset-2">
93
+ <button
94
+ type="submit"
95
+ className={buttonVariants({ variant: 'destructive', size: 'sm' })}
96
+ >
96
97
  {translated(context, 'calendar.event.delete')}
97
98
  </button>
98
99
  </form>
@@ -173,53 +174,53 @@ function EventForm({
173
174
  {event !== null && <input type="hidden" name="id" value={event.id} />}
174
175
 
175
176
  <div className="grid gap-3 sm:grid-cols-2">
176
- <label className="flex flex-col gap-1 text-sm sm:col-span-2">
177
+ <label className="flex min-w-0 flex-col gap-2 text-sm sm:col-span-2">
177
178
  {translated(context, 'calendar.event.title')}
178
179
  <input
179
180
  name="title"
180
181
  required
181
182
  maxLength={120}
182
183
  defaultValue={event?.title ?? ''}
183
- className="rounded border p-1.5"
184
+ className={controlVariants()}
184
185
  />
185
186
  </label>
186
- <label className="flex flex-col gap-1 text-sm">
187
+ <label className="flex min-w-0 flex-col gap-2 text-sm">
187
188
  {translated(context, 'calendar.event.starts')}
188
189
  <input
189
190
  name="starts_at"
190
191
  type="datetime-local"
191
192
  required
192
193
  defaultValue={toDateTimeInput(event?.startsAt ?? null)}
193
- className="rounded border p-1.5"
194
+ className={controlVariants()}
194
195
  />
195
196
  </label>
196
- <label className="flex flex-col gap-1 text-sm">
197
+ <label className="flex min-w-0 flex-col gap-2 text-sm">
197
198
  {translated(context, 'calendar.event.until')}
198
199
  <input
199
200
  name="ends_at"
200
201
  type="datetime-local"
201
202
  defaultValue={toDateTimeInput(event?.endsAt ?? null)}
202
- className="rounded border p-1.5"
203
+ className={controlVariants()}
203
204
  />
204
205
  </label>
205
- <label className="flex flex-col gap-1 text-sm">
206
+ <label className="flex min-w-0 flex-col gap-2 text-sm">
206
207
  {translated(context, 'calendar.event.location')}
207
208
  <input
208
209
  name="location"
209
210
  maxLength={120}
210
211
  defaultValue={event?.location ?? ''}
211
- className="rounded border p-1.5"
212
+ className={controlVariants()}
212
213
  />
213
214
  </label>
214
- <label className="flex flex-col gap-1 text-sm">
215
+ <label className="flex min-w-0 flex-col gap-2 text-sm">
215
216
  {translated(context, 'calendar.event.thread')}
216
217
  <input
217
218
  name="thread"
218
219
  defaultValue={event?.threadId == null ? '' : String(event.threadId)}
219
- className="rounded border p-1.5"
220
+ className={controlVariants()}
220
221
  />
221
222
  </label>
222
- <label className="flex flex-col gap-1 text-sm">
223
+ <label className="flex min-w-0 flex-col gap-2 text-sm">
223
224
  {translated(context, 'calendar.event.link')}
224
225
  <input
225
226
  name="link"
@@ -227,19 +228,19 @@ function EventForm({
227
228
  maxLength={500}
228
229
  placeholder="https://"
229
230
  defaultValue={event?.linkUrl ?? ''}
230
- className="rounded border p-1.5"
231
+ className={controlVariants()}
231
232
  />
232
233
  <span className="text-muted-foreground text-xs">
233
234
  {translated(context, 'calendar.event.linkHint')}
234
235
  </span>
235
236
  </label>
236
- <label className="flex flex-col gap-1 text-sm">
237
+ <label className="flex min-w-0 flex-col gap-2 text-sm">
237
238
  {translated(context, 'calendar.event.linkText')}
238
239
  <input
239
240
  name="link_text"
240
241
  maxLength={40}
241
242
  defaultValue={event?.linkLabel ?? ''}
242
- className="rounded border p-1.5"
243
+ className={controlVariants()}
243
244
  />
244
245
  <span className="text-muted-foreground text-xs">
245
246
  {translated(context, 'calendar.event.linkTextHint')}
@@ -248,7 +249,7 @@ function EventForm({
248
249
  </div>
249
250
 
250
251
  <div className="flex items-center gap-3">
251
- <button type="submit" className="bg-muted rounded border px-3 py-1.5 text-sm">
252
+ <button type="submit" className={buttonVariants({ variant: 'primary' })}>
252
253
  {submit}
253
254
  </button>
254
255
  {event !== null && (
@@ -295,7 +296,7 @@ export async function CalendarPage(context: PluginPageContext) {
295
296
  return (
296
297
  <div className="flex flex-col gap-6">
297
298
  <nav aria-label={translated(context, 'calendar.page.views')}>
298
- <ul className={PLUGIN_TAB_LIST}>
299
+ <ul data-nav-tabs className={PLUGIN_TAB_LIST}>
299
300
  <li className="shrink-0">
300
301
  <a
301
302
  href="/plugins/calendar"