mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-07-24 07:42:47 +00:00
feat: group merge, ZIP/reply/caption grouping, integrity audit
Group merge UI: - Add mergeGroups query and mergeGroupsAction server action - Add "Start Merge" / "Merge Here" buttons to group row actions - Two-step UX: click Start on source, click Merge Here on target ZIP path prefix grouping (Signal 7): - Compare PackageFile.path root folders across ungrouped packages - Auto-group if 2+ packages share the same dominant root folder Reply chain grouping (Signal 6): - Capture reply_to_message_id during channel scanning - Group archives that reply to the same root message - Add replyToMessageId field to Package schema Caption fuzzy match grouping (Signal 8): - Capture source caption during channel scanning - Normalize captions (strip extensions, extract significant words) - Group packages with matching normalized caption keys - Add sourceCaption field to Package schema Periodic integrity audit: - Check multipart packages for completeness (parts vs destMessageIds) - Detect orphaned indexes (destChannelId set but no destMessageId) - Runs after each ingestion cycle, deduplicates notifications Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,7 @@ import {
|
||||
removeFromGroupAction,
|
||||
sendAllInGroupAction,
|
||||
updateGroupPreviewAction,
|
||||
mergeGroupsAction,
|
||||
} from "../actions";
|
||||
|
||||
interface StlTableProps {
|
||||
@@ -102,6 +103,9 @@ export function StlTable({
|
||||
const previewInputRef = useRef<HTMLInputElement>(null);
|
||||
const [uploadGroupId, setUploadGroupId] = useState<string | null>(null);
|
||||
|
||||
// Group merge state
|
||||
const [mergeSourceId, setMergeSourceId] = useState<string | null>(null);
|
||||
|
||||
const toggleGroup = useCallback((groupId: string) => {
|
||||
setExpandedGroups((prev) => {
|
||||
const next = new Set(prev);
|
||||
@@ -340,6 +344,35 @@ export function StlTable({
|
||||
[uploadGroupId, router]
|
||||
);
|
||||
|
||||
const handleStartMerge = useCallback((groupId: string) => {
|
||||
setMergeSourceId((prev) => {
|
||||
if (prev === groupId) {
|
||||
toast.info("Merge cancelled");
|
||||
return null;
|
||||
}
|
||||
toast.info("Merge source selected — click the merge-here button on the target group");
|
||||
return groupId;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleMergeGroups = useCallback(
|
||||
(targetGroupId: string) => {
|
||||
if (!mergeSourceId) return;
|
||||
const sourceId = mergeSourceId;
|
||||
startTransition(async () => {
|
||||
const result = await mergeGroupsAction(targetGroupId, sourceId);
|
||||
if (result.success) {
|
||||
toast.success("Groups merged successfully");
|
||||
setMergeSourceId(null);
|
||||
router.refresh();
|
||||
} else {
|
||||
toast.error(result.error);
|
||||
}
|
||||
});
|
||||
},
|
||||
[mergeSourceId, router]
|
||||
);
|
||||
|
||||
const columns = getPackageColumns({
|
||||
onViewFiles: (pkg) => setViewPkg(pkg),
|
||||
searchTerm,
|
||||
@@ -381,6 +414,9 @@ export function StlTable({
|
||||
onGroupPreviewUpload: handleGroupPreviewUpload,
|
||||
selectedPackages,
|
||||
onToggleSelect: toggleSelect,
|
||||
mergeSourceId,
|
||||
onStartMerge: handleStartMerge,
|
||||
onCompleteMerge: handleMergeGroups,
|
||||
});
|
||||
|
||||
const { table } = useDataTable({ data: tableRows, columns, pageCount });
|
||||
|
||||
Reference in New Issue
Block a user