feat: p2 batch 28-31 reminders lists comments bang stats
Calendar events support multiple reminder offsets with presets and per-user defaults. Lists index adds inline task entry and list property editing. Generic entity comments on list detail. New bangs.stats dashboard widget. Closes Gitea #28, #29, #30, #31. Migrations 0022 and 0023.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useTransition } from "react";
|
||||
import { ReminderPicker } from "@/components/reminder-picker";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { setDefaultEventReminderOffsets } from "@/app/settings/reminder-actions";
|
||||
|
||||
export function DefaultEventRemindersSetting({ initialOffsets }: { initialOffsets: number[] }) {
|
||||
const [saved, setSaved] = useState(initialOffsets);
|
||||
const [offsets, setOffsets] = useState(initialOffsets);
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
const dirty =
|
||||
offsets.length !== saved.length || offsets.some((value, index) => value !== saved[index]);
|
||||
|
||||
function handleSave() {
|
||||
startTransition(async () => {
|
||||
await setDefaultEventReminderOffsets(offsets);
|
||||
setSaved(offsets);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<p className="muted text-[13px]">
|
||||
Applied when you create a new calendar event. You can still customize reminders per event.
|
||||
</p>
|
||||
<ReminderPicker offsets={offsets} onChange={setOffsets} disabled={isPending} />
|
||||
<Button type="button" size="sm" disabled={!dirty || isPending} onClick={handleSave}>
|
||||
{isPending ? "Saving…" : "Save defaults"}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user