Skip to content

Commit

Permalink
refactor: ♻️ Remove uncessary types
Browse files Browse the repository at this point in the history
  • Loading branch information
singhAmandeep007 committed Nov 26, 2024
1 parent c3ae477 commit cd09659
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { Provider } from "react-redux";

Expand All @@ -12,7 +12,7 @@ import { Router } from "./Router";

export type TAppProps = Record<string, never>;

export const App: FC<PropsWithChildren<TAppProps>> = () => {
export const App: FC<TAppProps> = () => {
return (
<Provider store={setupStore()}>
<ThemeProvider>
Expand Down
4 changes: 2 additions & 2 deletions src/app/Router/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { RouterProvider, createBrowserRouter } from "react-router";

Expand Down Expand Up @@ -47,4 +47,4 @@ const router = createBrowserRouter(

export type TRouterProps = Record<string, never>;

export const Router: FC<PropsWithChildren<TRouterProps>> = () => <RouterProvider router={router} />;
export const Router: FC<TRouterProps> = () => <RouterProvider router={router} />;
4 changes: 2 additions & 2 deletions src/modules/theme/ThemeToggler.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { Moon, Sun } from "lucide-react";

Expand All @@ -9,7 +9,7 @@ import { useTheme } from "./context";

export type TThemeTogglerProps = Record<string, never>;

export const ThemeToggler: FC<PropsWithChildren<TThemeTogglerProps>> = () => {
export const ThemeToggler: FC<TThemeTogglerProps> = () => {
const { setTheme, theme } = useTheme();

return (
Expand Down
4 changes: 2 additions & 2 deletions src/views/Home/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";
import { useTranslation, Trans } from "react-i18next";

import { Typography } from "components";

export type THomeProps = Record<string, never>;

export const Home: FC<PropsWithChildren<THomeProps>> = () => {
export const Home: FC<THomeProps> = () => {
const { t } = useTranslation("homePage");

return (
Expand Down
4 changes: 2 additions & 2 deletions src/views/Layout/BaseLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";
import { Outlet } from "react-router";

import { Header } from "./Header";
Expand All @@ -7,7 +7,7 @@ import { Footer } from "./Footer";

export type TBaseLayoutProps = Record<string, never>;

export const BaseLayout: FC<PropsWithChildren<TBaseLayoutProps>> = () => {
export const BaseLayout: FC<TBaseLayoutProps> = () => {
return (
<div>
<Header />
Expand Down
4 changes: 2 additions & 2 deletions src/views/Layout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { useTranslation } from "react-i18next";

import { Typography } from "components";

export type TFooterProps = Record<string, never>;

export const Footer: FC<PropsWithChildren<TFooterProps>> = () => {
export const Footer: FC<TFooterProps> = () => {
const { t } = useTranslation("common");
return (
<footer
Expand Down
4 changes: 2 additions & 2 deletions src/views/Layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { Bell } from "lucide-react";

Expand All @@ -14,7 +14,7 @@ import { LangToggler } from "modules/i18n";

export type THeaderProps = Record<string, never>;

export const Header: FC<PropsWithChildren<THeaderProps>> = () => {
export const Header: FC<THeaderProps> = () => {
const { t } = useTranslation("common");

return (
Expand Down
4 changes: 2 additions & 2 deletions src/views/Reminders/ReminderGroupItem/ReminderGroupItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren, useMemo, useState } from "react";
import { FC, useMemo, useState } from "react";

import { ChevronDown, ChevronUp, Pencil, Trash } from "lucide-react";

Expand All @@ -24,7 +24,7 @@ export type TReminderGroupItemProps = {
reminderGroup?: TReminderGroup;
};

export const ReminderGroupItem: FC<PropsWithChildren<TReminderGroupItemProps>> = ({ reminderGroup }) => {
export const ReminderGroupItem: FC<TReminderGroupItemProps> = ({ reminderGroup }) => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [isUpdating, setIsUpdating] = useState(false);

Expand Down
4 changes: 2 additions & 2 deletions src/views/Reminders/ReminderGroupsList/ReminderGroupsList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren, useState } from "react";
import { FC, useState } from "react";

import { ReminderGroupItem } from "../ReminderGroupItem";
import { AddButton, AddUpdateItem } from "../components";
Expand All @@ -7,7 +7,7 @@ import { useReminderGroupsList } from "./useReminderGroupsList";

export type TReminderGroupsListProps = Record<string, never>;

export const ReminderGroupsList: FC<PropsWithChildren<TReminderGroupsListProps>> = () => {
export const ReminderGroupsList: FC<TReminderGroupsListProps> = () => {
const [isCreating, setIsCreating] = useState(false);

const { handleOnSave, reminderGroups } = useReminderGroupsList();
Expand Down
4 changes: 2 additions & 2 deletions src/views/Reminders/ReminderItem/Badges.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren, useMemo } from "react";
import { FC, useMemo } from "react";
import { format, intervalToDuration, differenceInMilliseconds } from "date-fns";

import { Badge } from "components";
Expand Down Expand Up @@ -34,7 +34,7 @@ function formatTimeSpent(milliseconds: number): string {
return format || "0m";
}

export const Badges: FC<PropsWithChildren<TBadgesProps>> = ({ reminder, listName }) => {
export const Badges: FC<TBadgesProps> = ({ reminder, listName }) => {
const isOverdue = reminder.dueDate && new Date(reminder.dueDate) < new Date();

const totalDurationMs = useMemo(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { TReminder } from "types";

Expand All @@ -8,7 +8,7 @@ export type TFocusSessionTrackerProps = {
reminder: TReminder;
};

export const FocusSessionTracker: FC<PropsWithChildren<TFocusSessionTrackerProps>> = ({ reminder }) => {
export const FocusSessionTracker: FC<TFocusSessionTrackerProps> = ({ reminder }) => {
return (
<FocusSessionWizardProvider reminder={reminder}>
<FocusSessionWizard />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { useFocusSessionWizardContext } from "./context";
import { Steps } from "./Steps";

export type TFocusSessionWizardProps = Record<string, never>;

export const FocusSessionWizard: FC<PropsWithChildren<TFocusSessionWizardProps>> = () => {
export const FocusSessionWizard: FC<TFocusSessionWizardProps> = () => {
const { step } = useFocusSessionWizardContext();

const Component = Steps[step];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { Play, Square } from "lucide-react";

Expand All @@ -24,7 +24,7 @@ const FormattedFocusedTime = ({ totalSeconds }: { totalSeconds: number }) => {

export type TFocusSessionProps = Record<string, never>;

export const FocusSession: FC<PropsWithChildren<TFocusSessionProps>> = () => {
export const FocusSession: FC<TFocusSessionProps> = () => {
const { isRunning, progress, onStart, onStop, elapsedDuration, reminder } = useFocusSession();

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { FC, PropsWithChildren, useRef } from "react";
import { FC, useRef } from "react";

import { DialogDescription, DialogHeader, DialogTitle, Button, ValueSetter } from "components";

import { useFocusSessionWizardContext } from "../context";

export type TFocusSessionDurationProps = Record<string, never>;

export const FocusSessionDuration: FC<PropsWithChildren<TFocusSessionDurationProps>> = () => {
export const FocusSessionDuration: FC<TFocusSessionDurationProps> = () => {
const hoursRef = useRef<number>(0);
const minutesRef = useRef<number>(1);

Expand Down
4 changes: 2 additions & 2 deletions src/views/Reminders/ReminderItem/ReminderItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren, useRef, useState } from "react";
import { FC, useRef, useState } from "react";

import { ChevronDown, ChevronUp, Pencil, Trash, Pin, CalendarClock, Timer } from "lucide-react";

Expand Down Expand Up @@ -51,7 +51,7 @@ const DIALOGS = {

type TDialog = (typeof DIALOGS)[keyof typeof DIALOGS] | null;

export const ReminderItem: FC<PropsWithChildren<TReminderItemProps>> = ({ reminder, listName }) => {
export const ReminderItem: FC<TReminderItemProps> = ({ reminder, listName }) => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [isUpdating, setIsUpdating] = useState(false);
const [dialog, setDialog] = useState<TDialog>(null);
Expand Down
4 changes: 2 additions & 2 deletions src/views/Reminders/Reminders.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import { FC } from "react";

import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
import { EllipsisVertical, EllipsisIcon } from "lucide-react";
Expand All @@ -13,7 +13,7 @@ import { ReminderGroupsList } from "./ReminderGroupsList";

export type TRemindersProps = Record<string, never>;

export const Reminders: FC<PropsWithChildren<TRemindersProps>> = () => {
export const Reminders: FC<TRemindersProps> = () => {
const { isBelowMd } = useBreakpoint<keyof typeof BREAKPOINTS>("md", BREAKPOINTS);

return (
Expand Down
4 changes: 2 additions & 2 deletions src/views/Reminders/RemindersList/RemindersList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren, useState } from "react";
import { FC, useState } from "react";

import { RefreshCcw } from "lucide-react";

Expand All @@ -12,7 +12,7 @@ import { useRemindersNotification } from "./useRemindersNotification";

export type TRemindersListProps = Record<string, never>;

export const RemindersList: FC<PropsWithChildren<TRemindersListProps>> = () => {
export const RemindersList: FC<TRemindersListProps> = () => {
const { reminders, refetchReminders, reminderGroup, handleOnSave } = useRemindersList();

useRemindersNotification({ reminders });
Expand Down
10 changes: 2 additions & 8 deletions src/views/Reminders/components/AddUpdateItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren, useCallback, useRef } from "react";
import { FC, useCallback, useRef } from "react";

import { Check, X } from "lucide-react";

Expand All @@ -18,13 +18,7 @@ export type TAddUpdateItemProps = {
};
};

export const AddUpdateItem: FC<PropsWithChildren<TAddUpdateItemProps>> = ({
className,
onCancel,
onSave,
defaultValue = "",
testIds,
}) => {
export const AddUpdateItem: FC<TAddUpdateItemProps> = ({ className, onCancel, onSave, defaultValue = "", testIds }) => {
const inputRef = useRef<HTMLInputElement>(null);

const handleOnSave = useCallback(() => {
Expand Down

0 comments on commit cd09659

Please sign in to comment.