diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/components/SelectAssignee.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/components/SelectAssignee.tsx index 39866f2940..ca43effbb2 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/components/SelectAssignee.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/components/SelectAssignee.tsx @@ -1,155 +1,152 @@ import { Avatar, AvatarImage, AvatarFallback } from "@comp/ui/avatar"; import { - Select, - SelectTrigger, - SelectContent, - SelectItem, + Select, + SelectTrigger, + SelectContent, + SelectItem, } from "@comp/ui/select"; import { UserIcon } from "lucide-react"; import { Member, User } from "@comp/db/types"; import { useState, useEffect } from "react"; interface SelectAssigneeProps { - assigneeId: string | null; - disabled?: boolean; - assignees: (Member & { user: User })[]; - onAssigneeChange: (value: string | null) => void; - withTitle?: boolean; + assigneeId: string | null; + disabled?: boolean; + assignees: (Member & { user: User })[]; + onAssigneeChange: (value: string | null) => void; + withTitle?: boolean; } export const SelectAssignee = ({ - assigneeId, - disabled, - assignees, - onAssigneeChange, - withTitle = true, + assigneeId, + disabled, + assignees, + onAssigneeChange, + withTitle = true, }: SelectAssigneeProps) => { - const [selectedAssignee, setSelectedAssignee] = useState< - (Member & { user: User }) | null - >(null); + const [selectedAssignee, setSelectedAssignee] = useState< + (Member & { user: User }) | null + >(null); - // Initialize selectedAssignee based on assigneeId prop - useEffect(() => { - if (assigneeId && assignees) { - const assignee = assignees.find((a) => a.id === assigneeId); - if (assignee) { - setSelectedAssignee(assignee); - } - } else { - setSelectedAssignee(null); - } - }, [assigneeId, assignees]); + // Initialize selectedAssignee based on assigneeId prop + useEffect(() => { + if (assigneeId && assignees) { + const assignee = assignees.find((a) => a.id === assigneeId); + if (assignee) { + setSelectedAssignee(assignee); + } + } else { + setSelectedAssignee(null); + } + }, [assigneeId, assignees]); - const handleAssigneeChange = (value: string) => { - const newAssigneeId = value === "none" ? null : value; - onAssigneeChange(newAssigneeId); + const handleAssigneeChange = (value: string) => { + const newAssigneeId = value === "none" ? null : value; + onAssigneeChange(newAssigneeId); - if (newAssigneeId && assignees) { - const assignee = assignees.find((a) => a.id === newAssigneeId); - if (assignee) { - setSelectedAssignee(assignee); - } else { - setSelectedAssignee(null); - } - } else { - setSelectedAssignee(null); - } - }; + if (newAssigneeId && assignees) { + const assignee = assignees.find((a) => a.id === newAssigneeId); + if (assignee) { + setSelectedAssignee(assignee); + } else { + setSelectedAssignee(null); + } + } else { + setSelectedAssignee(null); + } + }; - // Function to safely prepare image URLs - const getImageUrl = (image: string | null) => { - if (!image) return ""; + // Function to safely prepare image URLs + const getImageUrl = (image: string | null) => { + if (!image) return ""; - // If image is a relative URL, ensure it's properly formed - if (image.startsWith("/")) { - return image; - } + // If image is a relative URL, ensure it's properly formed + if (image.startsWith("/")) { + return image; + } - return image; - }; + return image; + }; - return ( -
- {withTitle && ( -
- -

- ASSIGNEE -

-
- )} - -
- ); + return ( +
+ {withTitle && ( +
+ Assignee +
+ )} + +
+ ); }; diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceDepartmentSection.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceDepartmentSection.tsx index d7f3b6ea30..52e7ef7e7f 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceDepartmentSection.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceDepartmentSection.tsx @@ -1,60 +1,57 @@ "use client"; import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, } from "@comp/ui/select"; import { Departments } from "@comp/db/types"; import { Building } from "lucide-react"; interface DepartmentSectionProps { - onDepartmentChange: (value: Departments) => void; - department: Departments; - disabled?: boolean; + onDepartmentChange: (value: Departments) => void; + department: Departments; + disabled?: boolean; } export function EvidenceDepartmentSection({ - onDepartmentChange, - department, - disabled = false, + onDepartmentChange, + department, + disabled = false, }: DepartmentSectionProps) { - const handleDepartmentChange = (value: Departments) => { - onDepartmentChange(value); - }; + const handleDepartmentChange = (value: Departments) => { + onDepartmentChange(value); + }; - // Filter out 'none' from the displayed options as we handle it separately - const departmentOptions = Object.values(Departments).filter( - (dept) => dept !== "none", - ); + // Filter out 'none' from the displayed options as we handle it separately + const departmentOptions = Object.values(Departments).filter( + (dept) => dept !== "none", + ); - return ( -
-
- -

- DEPARTMENT -

-
- -
- ); + return ( +
+
+ Department +
+ +
+ ); } diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceFrequencySection.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceFrequencySection.tsx index 08d94a8247..36d4abbc7c 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceFrequencySection.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceFrequencySection.tsx @@ -2,59 +2,58 @@ import type { Frequency } from "@comp/db/types"; import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, } from "@comp/ui/select"; import { RefreshCw } from "lucide-react"; interface FrequencySectionProps { - onFrequencyChange: (value: Frequency | null) => void; - frequency: Frequency | null; - disabled?: boolean; + onFrequencyChange: (value: Frequency | null) => void; + frequency: Frequency | null; + disabled?: boolean; } export function EvidenceFrequencySection({ - onFrequencyChange, - frequency, - disabled = false, + onFrequencyChange, + frequency, + disabled = false, }: FrequencySectionProps) { - const handleFrequencyChange = (value: string) => { - const newFrequency = value === "none" ? null : (value as Frequency); - onFrequencyChange(newFrequency); - }; + const handleFrequencyChange = (value: string) => { + const newFrequency = value === "none" ? null : (value as Frequency); + onFrequencyChange(newFrequency); + }; - const frequencyOptions = [ - { value: "monthly", label: "Monthly" }, - { value: "quarterly", label: "Quarterly" }, - { value: "yearly", label: "Yearly" }, - ]; + const frequencyOptions = [ + { value: "monthly", label: "Monthly" }, + { value: "quarterly", label: "Quarterly" }, + { value: "yearly", label: "Yearly" }, + ]; - return ( -
-
- -

FREQUENCY

-
- -
- ); + return ( +
+
+ Frequency +
+ +
+ ); } diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceNextReviewSection.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceNextReviewSection.tsx index a84e9cb160..1fc371f077 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceNextReviewSection.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceNextReviewSection.tsx @@ -1,33 +1,29 @@ -import { CalendarClock } from "lucide-react"; import { format } from "date-fns"; export const EvidenceNextReviewSection = ({ - reviewInfo, + reviewInfo, }: { - reviewInfo: { - daysUntil: number; - nextReviewDate: Date; - isUrgent: boolean; - } | null; + reviewInfo: { + daysUntil: number; + nextReviewDate: Date; + isUrgent: boolean; + } | null; }) => { - return ( -
-
- -

- NEXT REVIEW -

-
- {!reviewInfo ? ( -

ASAP

- ) : ( -
- {reviewInfo.daysUntil} days ( - {format(reviewInfo.nextReviewDate, "MM/dd/yyyy")}) -
- )} -
- ); + return ( +
+
+ Next Review +
+ {!reviewInfo ? ( +

ASAP

+ ) : ( +
+ {reviewInfo.daysUntil} days ( + {format(reviewInfo.nextReviewDate, "MM/dd/yyyy")}) +
+ )} +
+ ); }; diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceStatusSection.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceStatusSection.tsx index 841c0dc232..45a4f81efa 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceStatusSection.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceStatusSection.tsx @@ -1,74 +1,74 @@ import { cn } from "@comp/ui/cn"; import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, } from "@comp/ui/select"; import { FileCheck } from "lucide-react"; import { EvidenceStatus } from "@comp/db/types"; import { EVIDENCE_STATUS_HEX_COLORS } from "../../(overview)/constants/evidence-status"; +import { FormLabel } from "@comp/ui/form"; const statusOptions: { value: EvidenceStatus; label: string }[] = [ - { value: "draft", label: "Draft" }, - { value: "published", label: "Published" }, - { value: "not_relevant", label: "Not Relevant" }, + { value: "draft", label: "Draft" }, + { value: "published", label: "Published" }, + { value: "not_relevant", label: "Not Relevant" }, ]; export const EvidenceStatusSection = ({ - status, - handleStatusChange, - isSaving, + status, + handleStatusChange, + isSaving, }: { - status: EvidenceStatus; - handleStatusChange: (value: EvidenceStatus) => void; - isSaving: boolean; + status: EvidenceStatus; + handleStatusChange: (value: EvidenceStatus) => void; + isSaving: boolean; }) => { - return ( -
-
- -

STATUS

-
- -
- ); + return ( +
+
+ Status +
+ +
+ ); }; diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/components/policies-table-action-bar.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/components/policies-table-action-bar.tsx deleted file mode 100644 index e9737fd53e..0000000000 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/components/policies-table-action-bar.tsx +++ /dev/null @@ -1,52 +0,0 @@ -"use client"; - -import type { Table } from "@tanstack/react-table"; -import { X } from "lucide-react"; - -import { DataTableActionBar } from "@/components/data-table/data-table-action-bar"; -import { Button } from "@comp/ui/button"; -import { Separator } from "@comp/ui/separator"; -import { Tooltip, TooltipContent, TooltipTrigger } from "@comp/ui/tooltip"; -import { Policy } from "@comp/db/types"; - -interface PoliciesTableActionBarProps { - table: Table; -} - -export function PoliciesTableActionBar({ table }: PoliciesTableActionBarProps) { - const rows = table.getFilteredSelectedRowModel().rows; - - return ( - 0}> -
- - {rows.length} selected - - - - - - - -

Clear selection

- - - Esc - - -
-
-
-
- ); -} diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/page.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/page.tsx index 854515fc6f..e85faab6b5 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/page.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/page.tsx @@ -9,46 +9,46 @@ import { getPolicies } from "./data/queries"; import { searchParamsCache } from "./data/validations"; interface PolicyTableProps { - params: Promise<{ locale: string }>; - searchParams: Promise; + params: Promise<{ locale: string }>; + searchParams: Promise; } export default async function PoliciesPage({ - params, - ...props + params, + ...props }: PolicyTableProps) { - const { locale } = await params; - const searchParams = await props.searchParams; - const search = searchParamsCache.parse(searchParams); - const validFilters = getValidFilters(search.filters); - - setStaticParamsLocale(locale); - - const promises = Promise.all([ - getPolicies({ - ...search, - filters: validFilters, - }), - ]); - - return ( - - - - ); + const { locale } = await params; + const searchParams = await props.searchParams; + const search = searchParamsCache.parse(searchParams); + const validFilters = getValidFilters(search.filters); + + setStaticParamsLocale(locale); + + const promises = Promise.all([ + getPolicies({ + ...search, + filters: validFilters, + }), + ]); + + return ( + + + + ); } export async function generateMetadata({ - params, + params, }: { - params: Promise<{ locale: string }>; + params: Promise<{ locale: string }>; }): Promise { - const { locale } = await params; + const { locale } = await params; - setStaticParamsLocale(locale); - const t = await getI18n(); + setStaticParamsLocale(locale); + const t = await getI18n(); - return { - title: t("sidebar.policies"), - }; + return { + title: t("sidebar.policies"), + }; }