-
Notifications
You must be signed in to change notification settings - Fork 0
Development #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Development #1
Conversation
src/App.tsx
Outdated
| @@ -0,0 +1,58 @@ | |||
| import { createBrowserRouter, RouterProvider } from "react-router-dom"; | |||
| import DefaultLayout from "./layouts/DefaultLayout"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Tsconfig alias Import statements Missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/App.tsx
Outdated
| import Dashboard from "./pages/admin/dashboard"; | ||
| import { AuthProvider } from "./contexts/AuthContext"; | ||
|
|
||
| const router = createBrowserRouter([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Routing should be defined in separate file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/App.tsx
Outdated
| }, | ||
| ]); | ||
|
|
||
| function App() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Make all function name as per ES6 Standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/components/footer.tsx
Outdated
| @@ -0,0 +1,7 @@ | |||
| export default function Footer() { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Define function type like : ReactElement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/components/header.tsx
Outdated
| const { isAuthenticated, logout } = useAuth(); | ||
| const navigate = useNavigate(); | ||
|
|
||
| const [menuOpen, SetMenuOpen] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh State should be define with type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/components/header.tsx
Outdated
| }; | ||
|
|
||
| useEffect(() => { | ||
| function handleResize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Function should be define outside of the useEffect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/contexts/AuthContext.tsx
Outdated
| logout: () => void; | ||
| }; | ||
|
|
||
| const AuthContext = createContext<AuthContextType | undefined>(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Context type define initial value as a null instead of undefined and always prefer default value null instead of undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/pages/admin/dashboard.tsx
Outdated
| headers["Authorization"] = `Bearer ${token}`; | ||
| } | ||
|
|
||
| const res = await fetch("https://jsonplaceholder.typicode.com/posts", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Define api end point domain in environment file and api end points like post, create define in constant file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/pages/admin/dashboard.tsx
Outdated
| } | ||
|
|
||
| const data: Post[] = await res.json(); | ||
| if (mounted) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Unwanted used of mounted variable remove it and adjust your logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/pages/admin/dashboard.tsx
Outdated
| }, [token]); | ||
|
|
||
| // Validation rules | ||
| const titleRegex = /^[A-Za-z\s]+$/; // letters and spaces only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Validation rules should be define in separate file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/pages/admin/dashboard.tsx
Outdated
| return Object.keys(errors).length === 0; | ||
| } | ||
|
|
||
| function showToast(message: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Create a common hook to show and hide the toaster message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/pages/admin/dashboard.tsx
Outdated
| setTitle(""); | ||
| setBody(""); | ||
| setFormErrors({}); | ||
| setEditingId(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BVPritesh Create a separate function to reset the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
No description provided.