feat: add one-click nudge system with popover, throttling, and email notifications (Story 3.2)

Add NudgeController with 1-hour throttling per declaration, NudgePopover component
on declarations index and dashboard, shadcn-vue popover primitives, and per-declaration
nudge tracking. Owners/managers can nudge assigned workers with one click.
Includes 10 feature tests covering authorization, throttling, and cache invalidation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 11:26:22 +01:00
parent 1ab3cfc445
commit c7ecbd0ee7
15 changed files with 808 additions and 6 deletions

View File

@@ -62,6 +62,7 @@ const breadcrumbs: BreadcrumbItem[] = [
const hasWorkspace = computed(() => !!props.workspaceName);
const showFeed = ref(false);
const nudgingIds = ref(new Set<number>());
const isWorkerEmpty = computed(
() =>
@@ -347,7 +348,21 @@ function navigateToDeclaration(declaration: DashboardDeclaration): void {
Voir
</DropdownMenuItem>
<DropdownMenuItem
disabled
v-if="canNudge"
:disabled="nudgingIds.has(declaration.id)"
@click.stop="
if (!nudgingIds.has(declaration.id)) {
nudgingIds.add(declaration.id);
router.post(
declaration.nudgeUrl,
{},
{
preserveScroll: true,
onFinish: () => nudgingIds.delete(declaration.id),
},
);
}
"
>
<Send
class="mr-2 h-4 w-4"

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { Head, Link, router } from '@inertiajs/vue3';
import { FolderOpen } from 'lucide-vue-next';
import NudgePopover from '@/components/declarations/NudgePopover.vue';
import Heading from '@/components/Heading.vue';
import Pagination from '@/components/Pagination.vue';
import { Button } from '@/components/ui/button';
@@ -11,11 +12,13 @@ type Declaration = {
title: string;
type: string;
client_name: string;
assignee_name: string | null;
status: string;
due_date: string | null;
showUrl: string;
editUrl: string;
destroyUrl: string;
nudgeUrl: string | null;
};
type PaginatedData<T> = {
@@ -40,6 +43,7 @@ type Props = {
canCreate: boolean;
canEdit: boolean;
canDelete: boolean;
canNudge: boolean;
};
const props = defineProps<Props>();
@@ -167,7 +171,16 @@ const statusLabels: Record<string, string> = {
<td class="px-4 py-3 text-muted-foreground">
{{ declaration.due_date || '—' }}
</td>
<td class="space-x-2 px-4 py-3 text-right">
<td
class="flex items-center gap-2 px-4 py-3 text-right"
>
<NudgePopover
v-if="props.canNudge"
:assignee-name="
declaration.assignee_name
"
:nudge-url="declaration.nudgeUrl"
/>
<Button
variant="outline"
size="sm"