Skip to content

Commit 91da0d3

Browse files
pieman1313KokoMilev
authored andcommitted
chore(apollo-vertex): replace unmaintained @uidotdev/usehooks lib
1 parent 0a4b12c commit 91da0d3

11 files changed

Lines changed: 42 additions & 49 deletions

apps/apollo-vertex/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"@tanstack/react-query": "^5.90.21",
6161
"@tanstack/react-router": "^1.132.31",
6262
"@tanstack/react-table": "^8.21.3",
63-
"@uidotdev/usehooks": "^2.4.1",
6463
"@vercel/analytics": "^1.5.0",
6564
"class-variance-authority": "^0.7.1",
6665
"clsx": "^2.1.1",

apps/apollo-vertex/registry.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@
874874
"@tanstack/react-router",
875875
"pkce-challenge",
876876
"sonner",
877-
"@uidotdev/usehooks"
877+
"@mantine/hooks@^9.0.0"
878878
],
879879
"registryDependencies": [
880880
"button",
@@ -987,7 +987,7 @@
987987
"type": "registry:hook",
988988
"title": "useDataTable",
989989
"description": "A generic data table hook that manages sorting, filtering, pagination, column visibility, and column order with localStorage persistence.",
990-
"dependencies": ["@tanstack/react-table", "@uidotdev/usehooks"],
990+
"dependencies": ["@tanstack/react-table", "@mantine/hooks@^9.0.0"],
991991
"files": [
992992
{
993993
"path": "registry/use-data-table/types.ts",

apps/apollo-vertex/registry/shell/shell-company.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useLocalStorage } from "@uidotdev/usehooks";
1+
import { useLocalStorage } from "@mantine/hooks";
22
import { AnimatePresence, motion } from "framer-motion";
33
import { PanelLeft } from "lucide-react";
44
import { useState } from "react";
@@ -86,10 +86,10 @@ export const Company = ({
8686
companyLogo,
8787
}: CompanyProps) => {
8888
const { t } = useTranslation();
89-
const [isCollapsed, setIsCollapsed] = useLocalStorage(
90-
SIDEBAR_COLLAPSED_KEY,
91-
false,
92-
);
89+
const [isCollapsed, setIsCollapsed] = useLocalStorage<boolean>({
90+
key: SIDEBAR_COLLAPSED_KEY,
91+
defaultValue: false,
92+
});
9393
const iconElement = (
9494
<motion.div
9595
className="w-8 h-8 rounded-[4px] bg-primary-700 dark:bg-primary-400 flex items-center justify-center shrink-0"

apps/apollo-vertex/registry/shell/shell-nav-item.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Link, useLocation } from "@tanstack/react-router";
2-
import { useLocalStorage } from "@uidotdev/usehooks";
2+
import { useLocalStorage } from "@mantine/hooks";
33
import { AnimatePresence, motion } from "framer-motion";
44
import type { LucideIcon } from "lucide-react";
55
import {
@@ -25,7 +25,10 @@ interface NavItemProps {
2525
}
2626

2727
export const NavItem = ({ to, icon: Icon, label }: NavItemProps) => {
28-
const [isCollapsed] = useLocalStorage(SIDEBAR_COLLAPSED_KEY, false);
28+
const [isCollapsed] = useLocalStorage<boolean>({
29+
key: SIDEBAR_COLLAPSED_KEY,
30+
defaultValue: false,
31+
});
2932
const { pathname } = useLocation();
3033
const isActive = pathname === to || pathname.startsWith(`${to}/`);
3134

apps/apollo-vertex/registry/shell/shell-sidebar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useLocalStorage } from "@uidotdev/usehooks";
1+
import { useLocalStorage } from "@mantine/hooks";
22
import { motion } from "framer-motion";
33
import { cn } from "@/lib/utils";
44
import type { CompanyLogo, ShellNavItem } from "./shell";
@@ -25,7 +25,10 @@ export const Sidebar = ({
2525
companyLogo,
2626
navItems,
2727
}: SidebarProps) => {
28-
const [isCollapsed] = useLocalStorage(SIDEBAR_COLLAPSED_KEY, false);
28+
const [isCollapsed] = useLocalStorage<boolean>({
29+
key: SIDEBAR_COLLAPSED_KEY,
30+
defaultValue: false,
31+
});
2932

3033
const sidebarWidth = isCollapsed ? "w-16" : "w-[280px]";
3134

apps/apollo-vertex/registry/shell/shell-theme-toggle.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useLocalStorage } from "@uidotdev/usehooks";
1+
import { useLocalStorage } from "@mantine/hooks";
22
import { Moon, Sun } from "lucide-react";
33
import { useTranslation } from "react-i18next";
44
import { Button } from "@/components/ui/button";
@@ -13,7 +13,10 @@ import { useTheme } from "./shell-theme-provider";
1313

1414
export function ThemeToggle() {
1515
const { t } = useTranslation();
16-
const [isCollapsed] = useLocalStorage(SIDEBAR_COLLAPSED_KEY, false);
16+
const [isCollapsed] = useLocalStorage<boolean>({
17+
key: SIDEBAR_COLLAPSED_KEY,
18+
defaultValue: false,
19+
});
1720
const { setTheme } = useTheme();
1821

1922
return (

apps/apollo-vertex/registry/use-data-table/useEntityDataTable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useSolution } from "@uipath/vs-core";
1010
import { useState } from "react";
1111

1212
import { ENTITY_TABLE_STORAGE_PREFIX } from "@/lib/constants";
13-
import { useLocalStorage } from "@uidotdev/usehooks";
13+
import { useLocalStorage } from "@mantine/hooks";
1414

1515
import type {
1616
ColumnDefWithAccessorKey,
@@ -93,10 +93,10 @@ export function useEntityDataTable<
9393
[],
9494
);
9595
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
96-
const [globalFilter, setGlobalFilter] = useLocalStorage(
97-
`${ENTITY_TABLE_STORAGE_PREFIX}global-filter-${storageKey}`,
98-
"",
99-
);
96+
const [globalFilter, setGlobalFilter] = useLocalStorage({
97+
key: `${ENTITY_TABLE_STORAGE_PREFIX}global-filter-${storageKey}`,
98+
defaultValue: "",
99+
});
100100
const [pagination, setPagination] = useState<PaginationState>({
101101
pageIndex: 0,
102102
pageSize: 10,

apps/apollo-vertex/registry/use-data-table/usePersistedColumnOrder.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import type { OnChangeFn } from "@tanstack/react-table";
44

55
import { ENTITY_TABLE_STORAGE_PREFIX } from "@/lib/constants";
6-
import { useLocalStorage } from "@uidotdev/usehooks";
6+
import { useLocalStorage } from "@mantine/hooks";
77

88
export interface UsePersistedColumnOrderOptions {
99
storageKey: string;
@@ -14,10 +14,10 @@ export function usePersistedColumnOrder({
1414
storageKey,
1515
defaultColumnOrder,
1616
}: UsePersistedColumnOrderOptions) {
17-
const [columnOrder, setColumnOrder] = useLocalStorage<string[]>(
18-
`${ENTITY_TABLE_STORAGE_PREFIX}order-${storageKey}`,
19-
defaultColumnOrder,
20-
);
17+
const [columnOrder, setColumnOrder] = useLocalStorage<string[]>({
18+
key: `${ENTITY_TABLE_STORAGE_PREFIX}order-${storageKey}`,
19+
defaultValue: defaultColumnOrder,
20+
});
2121

2222
const onColumnOrderChange: OnChangeFn<string[]> = (updaterOrValue) => {
2323
const newOrder =

apps/apollo-vertex/registry/use-data-table/usePersistedColumns.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useLocalStorage } from "@uidotdev/usehooks";
3+
import { useLocalStorage } from "@mantine/hooks";
44
import { ENTITY_TABLE_COLUMNS_STORAGE_PREFIX } from "@/lib/constants";
55

66
export interface UsePersistedColumnsProps {
@@ -16,10 +16,10 @@ export function usePersistedColumns({
1616
}: UsePersistedColumnsProps): [string[], (columns: string[]) => void] {
1717
const fullKey = `${ENTITY_TABLE_COLUMNS_STORAGE_PREFIX}${storageKey}`;
1818

19-
const [rawColumns, setRawColumns] = useLocalStorage<string[]>(
20-
fullKey,
21-
defaultColumns,
22-
);
19+
const [rawColumns, setRawColumns] = useLocalStorage<string[]>({
20+
key: fullKey,
21+
defaultValue: defaultColumns,
22+
});
2323

2424
const visibleColumns = availableColumns
2525
? rawColumns.filter((key) => availableColumns.includes(key))

apps/apollo-vertex/registry/use-data-table/usePersistedSorting.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import type { OnChangeFn, SortingState } from "@tanstack/react-table";
44

55
import { ENTITY_TABLE_STORAGE_PREFIX } from "@/lib/constants";
6-
import { useLocalStorage } from "@uidotdev/usehooks";
6+
import { useLocalStorage } from "@mantine/hooks";
77

88
export interface UsePersistedSortingOptions {
99
storageKey: string;
@@ -12,10 +12,10 @@ export interface UsePersistedSortingOptions {
1212
export function usePersistedSorting({
1313
storageKey,
1414
}: UsePersistedSortingOptions) {
15-
const [sorting, setSorting] = useLocalStorage<SortingState>(
16-
`${ENTITY_TABLE_STORAGE_PREFIX}sorting-${storageKey}`,
17-
[],
18-
);
15+
const [sorting, setSorting] = useLocalStorage<SortingState>({
16+
key: `${ENTITY_TABLE_STORAGE_PREFIX}sorting-${storageKey}`,
17+
defaultValue: [],
18+
});
1919

2020
const onSortingChange: OnChangeFn<SortingState> = (updaterOrValue) => {
2121
const newSorting =

0 commit comments

Comments
 (0)