mirror of
https://github.com/documenso/documenso.git
synced 2026-07-20 15:06:14 +10:00
chore: minor changes
This commit is contained in:
@@ -64,7 +64,7 @@ export function DataTableFacetedFilter<TData, TValue>({
|
||||
key={option.value}
|
||||
className={cn(
|
||||
'rounded-sm border-none px-2 py-0.5 font-normal',
|
||||
option.bgColor ? option.bgColor : 'variant-secondary',
|
||||
option.bgColor ? option.bgColor : 'bg-secondary',
|
||||
)}
|
||||
>
|
||||
{option.label}
|
||||
@@ -130,20 +130,6 @@ export function DataTableFacetedFilter<TData, TValue>({
|
||||
);
|
||||
})}
|
||||
</CommandGroup>
|
||||
{/* Option to clear filters, disabled for now since it makes the ui clanky. */}
|
||||
{/* {selectedValues.size > 0 && (
|
||||
<>
|
||||
<CommandSeparator />
|
||||
<CommandGroup>
|
||||
<CommandItem
|
||||
onSelect={() => column?.setFilterValue(undefined)}
|
||||
className="justify-center text-center"
|
||||
>
|
||||
Clear filters
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
</>
|
||||
)} */}
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
|
||||
@@ -44,8 +44,7 @@ export function DataTableSingleFilter<TData, TValue>({
|
||||
selectedValues,
|
||||
}: DataTableSingleFilterProps<TData, TValue>) {
|
||||
const filterValue = column?.getFilterValue() as string[] | undefined;
|
||||
const selectedValue =
|
||||
selectedValues?.[0] || (filterValue && filterValue.length > 0 ? filterValue[0] : undefined);
|
||||
const selectedValue = selectedValues?.[0] || (filterValue?.[0] ?? undefined);
|
||||
const selectedOption = options.find((option) => option.value === selectedValue);
|
||||
|
||||
const handleValueChange = (value: string) => {
|
||||
|
||||
@@ -29,7 +29,6 @@ import { DataTableToolbar } from './data-table-toolbar';
|
||||
interface DataTableProps<TData, TValue> {
|
||||
columns: ColumnDef<TData, TValue>[];
|
||||
data: TData[];
|
||||
columnVisibility?: VisibilityState;
|
||||
perPage?: number;
|
||||
currentPage?: number;
|
||||
totalPages?: number;
|
||||
@@ -126,7 +125,7 @@ export function DataTable<TData, TValue>({
|
||||
pagination: manualPagination ? pagination : undefined,
|
||||
},
|
||||
manualPagination,
|
||||
pageCount: totalPages,
|
||||
pageCount: manualPagination ? totalPages : undefined,
|
||||
initialState: {
|
||||
pagination: {
|
||||
pageSize: 10,
|
||||
|
||||
@@ -101,15 +101,15 @@ export function getDateRangeForPeriod(
|
||||
}
|
||||
|
||||
export function isDateInPeriod(date: Date, period: TimePeriod): boolean {
|
||||
const dateTime = DateTime.fromJSDate(date);
|
||||
|
||||
if (period === 'all-time') {
|
||||
return true;
|
||||
}
|
||||
|
||||
const dateTime = DateTime.fromJSDate(date);
|
||||
const range = getDateRangeForPeriod(period);
|
||||
|
||||
if (!range) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return dateTime >= range.start && dateTime <= range.end;
|
||||
|
||||
Reference in New Issue
Block a user