From aab4efbb000fc0ad0e160c2927cb427b21c67fbc Mon Sep 17 00:00:00 2001 From: gibbyb Date: Tue, 24 Sep 2024 11:04:34 -0500 Subject: [PATCH] Fix long statuses. Not perfect but good for now --- src/components/ui/Tech_Table.tsx | 7 +++-- src/components/ui/scroll-area.tsx | 48 +++++++++++++++++++++++++++++++ src/server/functions.ts | 42 --------------------------- src/styles/globals.css | 14 ++------- 4 files changed, 56 insertions(+), 55 deletions(-) create mode 100644 src/components/ui/scroll-area.tsx diff --git a/src/components/ui/Tech_Table.tsx b/src/components/ui/Tech_Table.tsx index a453804..2ac7e15 100644 --- a/src/components/ui/Tech_Table.tsx +++ b/src/components/ui/Tech_Table.tsx @@ -4,6 +4,7 @@ import { useSession } from "next-auth/react"; import Loading from "~/components/ui/Loading"; import { useTVMode } from "~/components/context/TVModeContext"; import { Drawer, DrawerTrigger } from "~/components/ui/shadcn/drawer"; +import { ScrollArea } from "~/components/ui/shadcn/scroll-area"; import History_Drawer from "~/components/ui/History_Drawer"; @@ -211,11 +212,13 @@ export default function Tech_Table({ employees }: { employees: Employee[] }) { {employee.name} + border-[#3e4446] wrapword max-h-0"> {selectedUserId !== -1 && ( diff --git a/src/components/ui/scroll-area.tsx b/src/components/ui/scroll-area.tsx new file mode 100644 index 0000000..f66ab4f --- /dev/null +++ b/src/components/ui/scroll-area.tsx @@ -0,0 +1,48 @@ +"use client" + +import * as React from "react" +import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area" + +import { cn } from "~/lib/utils" + +const ScrollArea = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + {children} + + + + +)) +ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName + +const ScrollBar = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, orientation = "vertical", ...props }, ref) => ( + + + +)) +ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName + +export { ScrollArea, ScrollBar } diff --git a/src/server/functions.ts b/src/server/functions.ts index a1ca34e..c64f960 100644 --- a/src/server/functions.ts +++ b/src/server/functions.ts @@ -128,45 +128,3 @@ export const get_history = async (user_id: number, page: number, perPage: number } }; }; - -//export const getHistory = - //async (page: number, perPage: number): Promise => { - //const offset = (page - 1) * perPage; - //const historyQuery = sql` - //SELECT u.name, h.status, h.updatedAt - //FROM history h - //JOIN users u ON h.user_id = u.id - //ORDER BY h.id DESC - //LIMIT ${perPage} OFFSET ${offset} - //`; - //const countQuery = sql` - //SELECT COUNT(*) AS total_count - //FROM history - //`; - //const [historyResults, countResults] = await Promise.all([ - //db.execute(historyQuery), - //db.execute(countQuery), - //]); - //// Safely cast results - //const historyRows = historyResults[0] as unknown as - //{ name: string, status: string, updatedAt: Date }[]; - //const countRow = countResults[0] as unknown as { total_count: number }[]; - //const totalCount = countRow[0]?.total_count ?? 0; - //const totalPages = Math.ceil(totalCount / perPage); - //// Format and map results - //const formattedResults: HistoryEntry[] = historyRows.map(row => ({ - //name: row.name, - //status: row.status, - //updatedAt: new Date(row.updatedAt), - //})); - //return { - //data: formattedResults, - //meta: { - //current_page: page, - //per_page: perPage, - //total_pages: totalPages, - //total_count: totalCount, - //} - //}; -//}; - diff --git a/src/styles/globals.css b/src/styles/globals.css index 00da67e..db1480f 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -128,20 +128,12 @@ .techtable-fullscreen { width: 100%; - height: 100%; + /*height: 100%;*/ + height: 80vh; + } .tablefill { height: 10vh; } -.wrapword { - white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ - white-space: -webkit-pre-wrap; /* Chrome & Safari */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: pre-wrap; /* CSS3 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ - word-break: break-all; - white-space: normal; -}