Compare commits
	
		
			No commits in common. "8c4b9d27f242a89cde09550b81c41362adf9142a" and "540413173cb50c037b08f912e2d35f947c1b8908" have entirely different histories.
		
	
	
		
			8c4b9d27f2
			...
			540413173c
		
	
		|  | @ -13,14 +13,6 @@ export async function getStoriesWithGenres() { | ||||||
| 
 | 
 | ||||||
| 	) | 	) | ||||||
| } | } | ||||||
| export async function getStoriesWithGenresAndSubs() { |  | ||||||
| 	return prisma.story.findMany({ |  | ||||||
| 		include: { |  | ||||||
| 			genres: true, |  | ||||||
| 			subs: true |  | ||||||
| 		} |  | ||||||
| 	}) |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| export async function getPubs() { | export async function getPubs() { | ||||||
| 	return prisma.pub.findMany() | 	return prisma.pub.findMany() | ||||||
|  |  | ||||||
|  | @ -18,13 +18,11 @@ import { PubsWithGenres } from "./page" | ||||||
| import { DialogClose } from "@radix-ui/react-dialog" | import { DialogClose } from "@radix-ui/react-dialog" | ||||||
| import { actions } from "app/ui/tables/actions" | import { actions } from "app/ui/tables/actions" | ||||||
| import { TextInputCell } from "app/ui/inputs/textInput" | import { TextInputCell } from "app/ui/inputs/textInput" | ||||||
| import { selectCol } from "app/ui/tables/selectColumn" |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| const columnHelper = createColumnHelper<PubsWithGenres>() | const columnHelper = createColumnHelper<PubsWithGenres>() | ||||||
| 
 | 
 | ||||||
| export const columns: ColumnDef<PubsWithGenres>[] = [ | export const columns: ColumnDef<PubsWithGenres>[] = [ | ||||||
|   selectCol, |  | ||||||
|   { |   { | ||||||
|     accessorKey: "title", |     accessorKey: "title", | ||||||
|     header: ({ column }) => { |     header: ({ column }) => { | ||||||
|  |  | ||||||
|  | @ -26,9 +26,6 @@ export const TextInputCell = (props: CellContext<any, any>) => { | ||||||
|     initialValue = value |     initialValue = value | ||||||
|     handleClose() |     handleClose() | ||||||
|   } |   } | ||||||
|   function handleOpen() { |  | ||||||
|     setIsActive(true) |  | ||||||
|   } |  | ||||||
|   function handleClose() { |   function handleClose() { | ||||||
|     setValue(initialValue) |     setValue(initialValue) | ||||||
|     setIsActive(false) |     setIsActive(false) | ||||||
|  | @ -43,12 +40,6 @@ export const TextInputCell = (props: CellContext<any, any>) => { | ||||||
|   return (<div |   return (<div | ||||||
|     onDoubleClick={() => setIsActive(prev => !prev)} |     onDoubleClick={() => setIsActive(prev => !prev)} | ||||||
|     className="w-full h-fit flex items-center justify-center" |     className="w-full h-fit flex items-center justify-center" | ||||||
|     tabIndex={0} |  | ||||||
|     onKeyDown={e => { |  | ||||||
|       if (e.code === "Enter" && !isActive) { |  | ||||||
|         setIsActive(true) |  | ||||||
|       } |  | ||||||
|     }} |  | ||||||
|   > |   > | ||||||
|     {isActive ? |     {isActive ? | ||||||
|       <Input |       <Input | ||||||
|  |  | ||||||
|  | @ -22,9 +22,21 @@ export default function FormContextMenu({ table, row }: ComponentProps<"div"> & | ||||||
|           </> |           </> | ||||||
|           : "" |           : "" | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         { |         { | ||||||
|           selectedRows.length > 0 ? |           selectedRows.length <= 1 ? | ||||||
|  |             <ContextMenuSub> | ||||||
|  |               <ContextMenuSubTrigger>Edit</ContextMenuSubTrigger> | ||||||
|  |               <ContextMenuSubContent> | ||||||
|  |                 {Object.keys(row.original).map(e => { | ||||||
|  |                   if (e !== "id") { | ||||||
|  |                     return <ContextMenuItem>{letterCase(e)}</ContextMenuItem> | ||||||
|  |                   } | ||||||
|  |                 })} | ||||||
|  |               </ContextMenuSubContent> | ||||||
|  |             </ContextMenuSub> : "" | ||||||
|  |         } | ||||||
|  |         { | ||||||
|  |           selectedRows ? | ||||||
|             <ContextMenuItem onClick={() => { table.resetRowSelection() }}>Deselect</ContextMenuItem> |             <ContextMenuItem onClick={() => { table.resetRowSelection() }}>Deselect</ContextMenuItem> | ||||||
|             : "" |             : "" | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -22,9 +22,7 @@ export const selectCol = { | ||||||
|         <Checkbox |         <Checkbox | ||||||
|           checked={props.row.getIsSelected()} |           checked={props.row.getIsSelected()} | ||||||
|           onCheckedChange={props.row.toggleSelected} |           onCheckedChange={props.row.toggleSelected} | ||||||
|           aria-label="select/deselect row" |           aria-label="select/deselect row" /> | ||||||
|         /> |  | ||||||
| 
 |  | ||||||
|       </div> |       </div> | ||||||
|     ) |     ) | ||||||
|   } |   } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue