Skip to content

Commit

Permalink
fix eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
FoggyMtnDrifter committed May 4, 2024
1 parent 5b544be commit 9e74f14
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 13 additions & 10 deletions app/[locale]/download/components/CloudImage/Table/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ interface DataTableProps<TData, TValue> {
}

const fuzzyFilter: FilterFn<any> = (row, columnId, value, addMeta) => {
// Rank the item
const itemRank = rankItem(row.getValue(columnId), value);

// Store the itemRank info
addMeta({
itemRank,
});
Expand Down Expand Up @@ -82,12 +80,17 @@ export function DataTable<TData, TValue>({
});

React.useEffect(() => {
if (table.getState().columnFilters[0]?.id === "fullName") {
if (table.getState().sorting[0]?.id !== "fullName") {
table.setSorting([{ id: "fullName", desc: false }]);
}
const columnFilters = table.getState().columnFilters[0];
const sorting = table.getState().sorting[0];

if (columnFilters?.id === "fullName" && sorting?.id !== "fullName") {
table.setSorting([{ id: "fullName", desc: false }]);
}
}, [table.getState().columnFilters[0]?.id]);
}, [table]);

const noResultsText = "No results.";
const previousText = "Previous";
const nextText = "Next";

return (
<div>
Expand Down Expand Up @@ -142,7 +145,7 @@ export function DataTable<TData, TValue>({
colSpan={columns.length}
className="h-24 text-center"
>
No results.
{noResultsText}
</TableCell>
</TableRow>
)}
Expand All @@ -155,15 +158,15 @@ export function DataTable<TData, TValue>({
onClick={() => table.previousPage()}
disabled={!table.getCanPreviousPage()}
>
Previous
{previousText}
</Button>
<Button
variant="outline"
size="sm"
onClick={() => table.nextPage()}
disabled={!table.getCanNextPage()}
>
Next
{nextText}
</Button>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const DialogOverlay = React.forwardRef<
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;

const closeButtonText = "Close";

const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
Expand All @@ -46,7 +48,7 @@ const DialogContent = React.forwardRef<
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<Cross2Icon className="h-4 w-4" />
<span className="sr-only">Close</span>
<span className="sr-only">{closeButtonText}</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
Expand Down

0 comments on commit 9e74f14

Please sign in to comment.