updated living space

This commit is contained in:
2025-11-27 20:22:40 +03:00
parent 3aebb79d36
commit eaca36573e
57 changed files with 2434 additions and 147 deletions

View File

@@ -10,11 +10,11 @@ import { dateToLocaleString } from "@/lib/utils"
import { Pencil, Trash } from "lucide-react"
import { IconHandClick } from "@tabler/icons-react"
export function DraggableRow({ row }: { row: Row<z.infer<typeof schema>> }) {
export function DraggableRow({ row, selectedID }: { row: Row<z.infer<typeof schema>>; selectedID: string }) {
const { transform, transition, setNodeRef, isDragging } = useSortable({ id: row.original._id })
return (
<TableRow data-state={row.getIsSelected() && "selected"} data-dragging={isDragging} ref={setNodeRef}
className="relative z-0 data-[dragging=true]:z-10 data-[dragging=true]:opacity-80"
className={`${row.original._id === selectedID ? "bg-blue-700/50 hover:bg-blue-700/50" : ""} relative z-0 data-[dragging=true]:z-10 data-[dragging=true]:opacity-80`}
style={{ transform: CSS.Transform.toString(transform), transition: transition }}
>
{row.getVisibleCells().map((cell) => (

View File

@@ -171,10 +171,6 @@ export function LivingSpaceBuildDataTable({
})}
</DropdownMenuContent>
</DropdownMenu>
{/* <Button variant="outline" size="sm" onClick={() => { router.push(`/build-sites/add`) }}>
<IconPlus />
<span className="hidden lg:inline">Add Build Sites</span>
</Button> */}
</div>
</div>
<TabsContent value="outline" className="relative flex flex-col gap-4 overflow-auto px-4 lg:px-6">
@@ -196,7 +192,7 @@ export function LivingSpaceBuildDataTable({
</TableHeader>
<TableBody className="**:data-[slot=table-cell]:first:w-8">
{table.getRowModel().rows?.length ? (<SortableContext items={dataIds} strategy={verticalListSortingStrategy} >
{table.getRowModel().rows.map((row) => <DraggableRow key={row.id} row={row} />)}
{table.getRowModel().rows.map((row) => <DraggableRow selectedID={buildId} key={row.id} row={row} />)}
</SortableContext>) : (
<TableRow><TableCell colSpan={columns.length} className="h-24 text-center">No results.</TableCell></TableRow>
)}