@meith/plugin-calendar 0.24.0 → 0.25.1
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 +2 -2
- package/src/definition.tsx +1 -1
- package/src/messages/en.json +1 -0
- package/src/ui/page.tsx +32 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meith/plugin-calendar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.1",
|
|
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,7 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@meith/plugin-kit": "^0.
|
|
23
|
+
"@meith/plugin-kit": "^0.25.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "^19.2.0"
|
package/src/definition.tsx
CHANGED
|
@@ -18,7 +18,7 @@ export const calendarPlugin = definePlugin({
|
|
|
18
18
|
key: 'calendar',
|
|
19
19
|
name: en['calendar.definition.name'],
|
|
20
20
|
nameKey: 'calendar.definition.name',
|
|
21
|
-
version: '0.
|
|
21
|
+
version: '0.25.1',
|
|
22
22
|
description: en['calendar.definition.description'],
|
|
23
23
|
descriptionKey: 'calendar.definition.description',
|
|
24
24
|
apiVersion: '0',
|
package/src/messages/en.json
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"calendar.page.past": "Past",
|
|
27
27
|
"calendar.page.title": "Calendar",
|
|
28
28
|
"calendar.page.upcoming": "Upcoming",
|
|
29
|
+
"calendar.page.views": "Calendar views",
|
|
29
30
|
"calendar.setting.anyMember.description": "When off, only the organisers named under Admin → Plugins → Calendar may add events.",
|
|
30
31
|
"calendar.setting.anyMember.label": "Any member may add an event",
|
|
31
32
|
"calendar.thread.card": "This thread discusses an event."
|
package/src/ui/page.tsx
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
PLUGIN_CARD,
|
|
3
|
+
PLUGIN_NOTE,
|
|
4
|
+
PLUGIN_TAB_LIST,
|
|
5
|
+
type PluginPageContext,
|
|
6
|
+
pluginTabClass,
|
|
7
|
+
} from '@meith/plugin-kit'
|
|
2
8
|
|
|
3
9
|
import { mayAdd, resolveCalendarConfig } from '../access'
|
|
4
10
|
import {
|
|
@@ -96,7 +102,7 @@ function Agenda({
|
|
|
96
102
|
return (
|
|
97
103
|
<div className="flex flex-col gap-6">
|
|
98
104
|
{groupByMonth(events, locale).map((month) => (
|
|
99
|
-
<section key={month.key} className=
|
|
105
|
+
<section key={month.key} className={PLUGIN_CARD}>
|
|
100
106
|
<h2 className="text-muted-foreground text-xs font-semibold tracking-widest">
|
|
101
107
|
{month.label}
|
|
102
108
|
</h2>
|
|
@@ -113,11 +119,7 @@ function Agenda({
|
|
|
113
119
|
|
|
114
120
|
function AddForm({ context }: { context: PluginPageContext }) {
|
|
115
121
|
return (
|
|
116
|
-
<form
|
|
117
|
-
method="post"
|
|
118
|
-
action="/api/plugins/calendar/events"
|
|
119
|
-
className="bg-card flex flex-col gap-3 rounded-md border p-4"
|
|
120
|
-
>
|
|
122
|
+
<form method="post" action="/api/plugins/calendar/events" className={PLUGIN_CARD}>
|
|
121
123
|
<h2 className="font-semibold">{translated(context, 'calendar.event.add')}</h2>
|
|
122
124
|
|
|
123
125
|
<div className="grid gap-3 sm:grid-cols-2">
|
|
@@ -187,23 +189,31 @@ export async function CalendarPage(context: PluginPageContext) {
|
|
|
187
189
|
|
|
188
190
|
return (
|
|
189
191
|
<div className="flex flex-col gap-6">
|
|
190
|
-
<nav
|
|
191
|
-
<
|
|
192
|
-
className=
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
192
|
+
<nav aria-label={translated(context, 'calendar.page.views')}>
|
|
193
|
+
<ul className={PLUGIN_TAB_LIST}>
|
|
194
|
+
<li className="shrink-0">
|
|
195
|
+
<a
|
|
196
|
+
href="/plugins/calendar"
|
|
197
|
+
{...(showingPast ? {} : { 'aria-current': 'page' as const })}
|
|
198
|
+
className={pluginTabClass(!showingPast)}
|
|
199
|
+
>
|
|
200
|
+
{translated(context, 'calendar.page.upcoming')}
|
|
201
|
+
</a>
|
|
202
|
+
</li>
|
|
203
|
+
<li className="shrink-0">
|
|
204
|
+
<a
|
|
205
|
+
href="/plugins/calendar?show=past"
|
|
206
|
+
{...(showingPast ? { 'aria-current': 'page' as const } : {})}
|
|
207
|
+
className={pluginTabClass(showingPast)}
|
|
208
|
+
>
|
|
209
|
+
{translated(context, 'calendar.page.past')}
|
|
210
|
+
</a>
|
|
211
|
+
</li>
|
|
212
|
+
</ul>
|
|
203
213
|
</nav>
|
|
204
214
|
|
|
205
215
|
{events.length === 0 ? (
|
|
206
|
-
<p className=
|
|
216
|
+
<p className={PLUGIN_NOTE}>
|
|
207
217
|
{translated(context, showingPast ? 'calendar.page.emptyPast' : 'calendar.page.empty')}
|
|
208
218
|
</p>
|
|
209
219
|
) : (
|
|
@@ -212,9 +222,7 @@ export async function CalendarPage(context: PluginPageContext) {
|
|
|
212
222
|
|
|
213
223
|
{!showingPast && verdict === 'allowed' && <AddForm context={context} />}
|
|
214
224
|
{!showingPast && verdict === 'not-an-organiser' && (
|
|
215
|
-
<p className=
|
|
216
|
-
{translated(context, 'calendar.error.notAnOrganiser')}
|
|
217
|
-
</p>
|
|
225
|
+
<p className={PLUGIN_NOTE}>{translated(context, 'calendar.error.notAnOrganiser')}</p>
|
|
218
226
|
)}
|
|
219
227
|
</div>
|
|
220
228
|
)
|