- Replace ESLint with Biome for linting and formatting - Configure Biome with tabs, double quotes, and organized imports - Move all SQL/Drizzle queries from page.tsx files to data.ts files - Create new data.ts files for: ajustes, dashboard, relatorios/categorias - Update existing data.ts files: extrato, fatura (add lancamentos queries) - Remove all drizzle-orm imports from page.tsx files - Update README.md with new tooling info Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
859 B
TypeScript
48 lines
859 B
TypeScript
"use client";
|
|
|
|
import { useSortable } from "@dnd-kit/sortable";
|
|
import { CSS } from "@dnd-kit/utilities";
|
|
import type { ReactNode } from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
type SortableWidgetProps = {
|
|
id: string;
|
|
children: ReactNode;
|
|
isEditing: boolean;
|
|
};
|
|
|
|
export function SortableWidget({
|
|
id,
|
|
children,
|
|
isEditing,
|
|
}: SortableWidgetProps) {
|
|
const {
|
|
attributes,
|
|
listeners,
|
|
setNodeRef,
|
|
transform,
|
|
transition,
|
|
isDragging,
|
|
} = useSortable({ id, disabled: !isEditing });
|
|
|
|
const style = {
|
|
transform: CSS.Transform.toString(transform),
|
|
transition,
|
|
};
|
|
|
|
return (
|
|
<div
|
|
ref={setNodeRef}
|
|
style={style}
|
|
className={cn(
|
|
"relative",
|
|
isDragging && "z-50 opacity-90",
|
|
isEditing && "cursor-grab active:cursor-grabbing",
|
|
)}
|
|
{...(isEditing ? { ...attributes, ...listeners } : {})}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|