Skip to content

Commit 56a8e41

Browse files
authored
Merge pull request #14 from ArjinAlbay/claude/github-monitoring-dashboard-01Mev23WUcwXi26vGmvizn8z
Add 'Add to Kanban' quick action for Quick Wins issues
2 parents 1628493 + 499c626 commit 56a8e41

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

src/components/quick-wins/QuickWinsTable.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useState, useMemo } from "react";
3+
import { useState, useMemo, useCallback } from "react";
44
import {
55
useReactTable,
66
getCoreRowModel,
@@ -45,6 +45,7 @@ import {
4545

4646
import { createColumns } from "./columns";
4747
import type { GitHubIssue } from "@/types/quickWins";
48+
import { useKanbanStore } from "@/stores/kanban";
4849

4950
interface QuickWinsTableProps {
5051
data: GitHubIssue[];
@@ -70,7 +71,21 @@ export function QuickWinsTable({
7071

7172
const [languageFilter, setLanguageFilter] = useState<string>("all");
7273

73-
const columns = useMemo(() => createColumns(), []);
74+
const addTask = useKanbanStore((state) => state.addTask);
75+
76+
const handleAddToKanban = useCallback((issue: GitHubIssue) => {
77+
addTask({
78+
title: issue.title,
79+
description: `From ${issue.repository}`,
80+
type: "github-issue",
81+
priority: issue.priority,
82+
githubUrl: issue.url,
83+
labels: issue.labels.map((label) => label.name),
84+
columnId: "todo",
85+
});
86+
}, [addTask]);
87+
88+
const columns = useMemo(() => createColumns({ onAddToKanban: handleAddToKanban }), [handleAddToKanban]);
7489

7590
const filteredData = useMemo(() => {
7691
let filtered = data;

src/components/quick-wins/columns.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import { ColumnDef } from "@tanstack/react-table";
22
import { Badge } from "@/components/ui/badge";
33
import { Button } from "@/components/ui/button";
44
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
5-
import { ExternalLink, Calendar } from "lucide-react";
5+
import { ExternalLink, Calendar, ListPlus } from "lucide-react";
66
import type { GitHubIssue } from "@/types/quickWins";
77

8-
export const createColumns = (): ColumnDef<GitHubIssue>[] => [
8+
interface CreateColumnsOptions {
9+
onAddToKanban?: (issue: GitHubIssue) => void;
10+
}
11+
12+
export const createColumns = (options?: CreateColumnsOptions): ColumnDef<GitHubIssue>[] => [
913
{
1014
accessorKey: "title",
1115
header: ({ column }) => (
@@ -157,4 +161,24 @@ export const createColumns = (): ColumnDef<GitHubIssue>[] => [
157161
},
158162
enableSorting: false,
159163
},
164+
{
165+
id: "actions",
166+
header: "Actions",
167+
cell: ({ row }) => {
168+
const issue = row.original;
169+
return (
170+
<Button
171+
size="sm"
172+
variant="outline"
173+
onClick={() => options?.onAddToKanban?.(issue)}
174+
disabled={!options?.onAddToKanban}
175+
className="gap-1"
176+
>
177+
<ListPlus className="w-4 h-4" />
178+
Add to Kanban
179+
</Button>
180+
);
181+
},
182+
enableSorting: false,
183+
},
160184
];

0 commit comments

Comments
 (0)