Skip to content

Commit 6b36817

Browse files
refactor(cleanup): remove unused variables and improve naming consistency
1 parent ea2556b commit 6b36817

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

src/app/dashboard/datasets/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import { useRouter } from 'next/navigation';
1717
import { UserNav } from '@/components/layout/user-nav';
1818

19-
const DatasetItem = ({ file, onDelete }: { file: DatasetFile, onDelete: (fileName: string) => void }) => {
19+
const DatasetItem = ({ file, onDelete }: { file: DatasetFile, onDelete: (_name: string) => void }) => {
2020
const router = useRouter();
2121

2222
const handleViewAnalysis = () => {

src/components/pages/dashboard/project-card.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ import { formatDistanceToNow } from 'date-fns';
4545

4646
type ProjectCardProps = {
4747
project: Project;
48-
onArchive: (_projectId: string) => void;
49-
onDelete: (_projectId: string) => void;
50-
onRestore: (_projectId: string) => void;
51-
onRename: (_projectId: string, _newName: string) => void;
48+
onArchive: (_id: string) => void;
49+
onDelete: (_id: string) => void;
50+
onRestore: (_id: string) => void;
51+
onRename: (_id: string, _newName: string) => void;
5252
};
5353

5454
const statusInfo: { [key: string]: { style: string; icon: React.ReactNode } } = {

src/components/pages/dashboard/project-list-item.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ import { formatDistanceToNow } from 'date-fns';
4242

4343
type ProjectListItemProps = {
4444
project: Project;
45-
onArchive: (_projectId: string) => void;
46-
onDelete: (_projectId: string) => void;
47-
onRestore: (_projectId: string) => void;
48-
onRename: (_projectId: string, _newName: string) => void;
45+
onArchive: (_id: string) => void;
46+
onDelete: (_id: string) => void;
47+
onRestore: (_id: string) => void;
48+
onRename: (_id: string, _newName: string) => void;
4949
};
5050

5151
const statusInfo: { [key: string]: { style: string; icon: React.ReactNode } } = {
@@ -72,7 +72,7 @@ const statusInfo: { [key: string]: { style: string; icon: React.ReactNode } } =
7272
};
7373

7474

75-
export function ProjectListItem({ project, onArchive, onDelete, onRestore, onRename }: ProjectListItemProps) {
75+
export function ProjectListItem({ project, onArchive, onDelete, onRestore: _onRestore, onRename }: ProjectListItemProps) {
7676
const router = useRouter();
7777
const [isRenameDialogOpen, setIsRenameDialogOpen] = useState(false);
7878
const [newName, setNewName] = useState(project.name);

src/components/ui/carousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type CarouselProps = {
1818
opts?: CarouselOptions
1919
plugins?: CarouselPlugin
2020
orientation?: "horizontal" | "vertical"
21-
setApi?: (api: CarouselApi) => void
21+
setApi?: (_api: any) => void
2222
}
2323

2424
type CarouselContextProps = {

src/components/ui/sidebar.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ const SIDEBAR_WIDTH_MOBILE = "18rem"
2626
const SIDEBAR_WIDTH_ICON = "3rem"
2727
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
2828

29-
type SidebarContext = {
29+
type SidebarContextType = {
3030
state: "expanded" | "collapsed"
31-
setOpen: (open: boolean) => void
31+
setOpen: (_open: boolean) => void
3232
openMobile: boolean
33-
setOpenMobile: (open: boolean) => void
33+
setOpenMobile: (_open: boolean) => void
3434
isMobile: boolean
3535
toggleSidebar: () => void
3636
}
3737

38-
const SidebarContext = React.createContext<SidebarContext | null>(null)
38+
const SidebarContext = React.createContext<SidebarContextType | null>(null)
3939

4040
function useSidebar() {
4141
const context = React.useContext(SidebarContext)
@@ -51,7 +51,7 @@ const SidebarProvider = React.forwardRef<
5151
React.ComponentProps<"div"> & {
5252
defaultOpen?: boolean
5353
open?: boolean
54-
onOpenChange?: (open: boolean) => void
54+
onOpenChange?: (_open: boolean) => void
5555
}
5656
>(
5757
(
@@ -74,7 +74,7 @@ const SidebarProvider = React.forwardRef<
7474
const [_open, _setOpen] = React.useState(defaultOpen)
7575
const open = openProp ?? _open
7676
const setOpen = React.useCallback(
77-
(value: boolean | ((value: boolean) => boolean)) => {
77+
(value: boolean | ((_value: boolean) => boolean)) => {
7878
const openState = typeof value === "function" ? value(open) : value
7979
if (setOpenProp) {
8080
setOpenProp(openState)
@@ -115,7 +115,7 @@ const SidebarProvider = React.forwardRef<
115115
// This makes it easier to style the sidebar with Tailwind classes.
116116
const state = open ? "expanded" : "collapsed"
117117

118-
const contextValue = React.useMemo<SidebarContext>(
118+
const contextValue = React.useMemo<SidebarContextType>(
119119
() => ({
120120
state,
121121
setOpen,

src/hooks/use-toast.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const addToRemoveQueue = (toastId: string) => {
6666
const timeout = setTimeout(() => {
6767
toastTimeouts.delete(toastId)
6868
dispatch({
69-
type: "REMOVE_TOAST",
69+
type: actionTypes.REMOVE_TOAST,
7070
toastId: toastId,
7171
})
7272
}, TOAST_REMOVE_DELAY)
@@ -76,21 +76,21 @@ const addToRemoveQueue = (toastId: string) => {
7676

7777
export const reducer = (state: State, action: Action): State => {
7878
switch (action.type) {
79-
case "ADD_TOAST":
79+
case actionTypes.ADD_TOAST:
8080
return {
8181
...state,
8282
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
8383
}
8484

85-
case "UPDATE_TOAST":
85+
case actionTypes.UPDATE_TOAST:
8686
return {
8787
...state,
8888
toasts: state.toasts.map((t) =>
8989
t.id === action.toast.id ? { ...t, ...action.toast } : t
9090
),
9191
}
9292

93-
case "DISMISS_TOAST": {
93+
case actionTypes.DISMISS_TOAST: {
9494
const { toastId } = action
9595

9696
// ! Side effects ! - This could be extracted into a dismissToast() action,
@@ -115,7 +115,7 @@ export const reducer = (state: State, action: Action): State => {
115115
),
116116
}
117117
}
118-
case "REMOVE_TOAST":
118+
case actionTypes.REMOVE_TOAST:
119119
if (action.toastId === undefined) {
120120
return {
121121
...state,
@@ -129,7 +129,7 @@ export const reducer = (state: State, action: Action): State => {
129129
}
130130
}
131131

132-
const listeners: Array<(state: State) => void> = []
132+
const listeners: Array<(_state: State) => void> = []
133133

134134
let memoryState: State = { toasts: [] }
135135

@@ -147,13 +147,13 @@ function toast({ ...props }: Toast) {
147147

148148
const update = (props: ToasterToast) =>
149149
dispatch({
150-
type: "UPDATE_TOAST",
150+
type: actionTypes.UPDATE_TOAST,
151151
toast: { ...props, id },
152152
})
153-
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
153+
const dismiss = () => dispatch({ type: actionTypes.DISMISS_TOAST, toastId: id })
154154

155155
dispatch({
156-
type: "ADD_TOAST",
156+
type: actionTypes.ADD_TOAST,
157157
toast: {
158158
...props,
159159
id,
@@ -187,7 +187,7 @@ function useToast() {
187187
return {
188188
...state,
189189
toast,
190-
dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
190+
dismiss: (toastId?: string) => dispatch({ type: actionTypes.DISMISS_TOAST, toastId }),
191191
}
192192
}
193193

0 commit comments

Comments
 (0)