-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/admin/login #14
Open
sagaradhi19
wants to merge
45
commits into
main
Choose a base branch
from
feat/admin/login
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/admin/login #14
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
36304da
chore:added dependencies
1c4d6b4
modified: app.tsx and main.tsx
8ddcbde
added: driver type data (#1)
Someone-rahul 455fe0d
Master (#2)
Someone-rahul 7edf98c
Master (#3)
Someone-rahul f131f31
feat:user registration with custom json for testing
Someone-rahul 4a6edd4
fixed:registration and added a login feature
2c249d3
Feat/admin/passenger (#6)
Someone-rahul b4d873a
feat: added client side pages and components
SagarAdhikari19 0ce3a8b
admin-dashboard-updated
SagarAdhikari19 ef671b6
jsondb_updated
SagarAdhikari19 4180ce0
table created
SagarAdhikari19 2809820
added some changes in admin side UI
e57defa
feat:added a repository context to access all repos objects
0530bbd
Merge branch 'main' of github.com:truenary/pl7-web-app
92007ec
feat:managed driver info
c51eeb8
some changes added
7bb85a9
added a map feature from sagar
1df1e1c
refactor: removed passenger info
18d9bc1
Merge branch 'main' of github.com:truenary/pl7-web-app
baf43dd
fixed:bug in dashboard_map
2af06a1
fixed:bugs at passenger info
75491cc
refactor:added a generic api and repositories
6b9a9ca
refactor: deleted other repo and apis
5fff332
refactor: completed
37bdaca
fixed: comments
a06bba3
chore: added pagination logic
ff8b12e
feat: pagination added in driver and passenger table
fcdea22
feat: added ride history
SagarAdhikari19 37cf564
feat : Blog feature added
SagarAdhikari19 6e2148e
feat :commentfixed : lodash implemented
SagarAdhikari19 175ef01
Fixed : comment
SagarAdhikari19 a2c5361
Merge branch 'main' of github.com:truenary/pl7-web-app
79cf3df
Merge branch 'main' of github.com:truenary/pl7-web-app
SagarAdhikari19 e8953b2
fix:merge confilts fixed
SagarAdhikari19 6b8f325
updated api
436258f
Merge branch 'main' of https://github.com/sagaradhi19/autoapp_testing
SagarAdhikari19 6b23fc1
fixed :design
SagarAdhikari19 00bdfc5
Enhanced About Us section: new design, refined content
SagarAdhikari19 d3a407d
fixed :footer
SagarAdhikari19 7986a16
passenger list fetch
SagarAdhikari19 2f6f5a9
fixed : error with passengertable
SagarAdhikari19 a99694f
fixed : login
SagarAdhikari19 2b31829
fixed : login-task Completed
SagarAdhikari19 97849ec
fixed : comments
SagarAdhikari19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import{ create} from 'zustand'; | ||
interface PaginationState { | ||
currentPage: number; | ||
setCurrentPage: (page: number) => void; | ||
} | ||
|
||
export const usePaginationStore = create<PaginationState>((set) => ({ | ||
currentPage: 1, | ||
setCurrentPage: (page) => set({ currentPage: page }), | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useEffect, useState } from 'react'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't these throwing errors? "useEffect" and "useState" are hooks and can't be used here. Just return the response data received. |
||
import { OnlineDriver } from '@/types/data'; | ||
import _ from 'lodash'; | ||
import { Repository } from '@/repositories/Repository'; | ||
|
||
export function useOnlineDrivers(repo: Repository): OnlineDriver[] | null { | ||
const [onlineDrivers, setOnlineDrivers] = useState<OnlineDriver[] | null>(null); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
try { | ||
const data = await repo.getAllOnlineDriver(); | ||
if (_.isArray(data)) { | ||
setOnlineDrivers(data); | ||
} else { | ||
console.error('Data is not in the expected format:', data); | ||
setOnlineDrivers(null); | ||
} | ||
} catch (error) { | ||
console.error('Error fetching data:', error); | ||
setOnlineDrivers(null); | ||
} | ||
}; | ||
|
||
fetchData(); | ||
}, [repo]); | ||
|
||
return onlineDrivers; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { useRepository } from '@/hooks/CustomHook'; | ||
import { BlogPostFormData } from '@/types/data'; | ||
import React from 'react'; | ||
import { SubmitHandler, useForm } from 'react-hook-form'; | ||
import toast from 'react-hot-toast'; | ||
import BlogSection from './BlogSection'; | ||
|
||
const BlogAdmin: React.FC = () => { | ||
const { register, handleSubmit, formState: { errors } } = useForm<BlogPostFormData>(); | ||
const repository = useRepository(); | ||
|
||
const onSubmit: SubmitHandler<BlogPostFormData> = async (data ) => { | ||
const formData = new FormData(); | ||
formData.append('title', data.title); | ||
formData.append('content', data.content); | ||
if (data.photo) { | ||
formData.append('blogImage', data.photo[0]); | ||
} | ||
if (data.video) { | ||
formData.append('blogVideo', data.video[0]); | ||
} | ||
|
||
try { | ||
const response = await repository.repo.createBlogPost(formData); | ||
if (response) { | ||
toast.success('Blog post submitted successfully!'); | ||
console.log(data) | ||
} else { | ||
toast.error('Failed to submit blog post!'); | ||
console.log(data) | ||
} | ||
} catch (error) { | ||
console.error('Error submitting blog post:', error); | ||
console.log(data) | ||
toast.error('An error occurred while submitting blog post!'); | ||
} | ||
}; | ||
return ( | ||
<> | ||
<div className="container mx-auto p-4 "> | ||
<h1 className="text-3xl font-bold mb-4">Blog Section</h1> | ||
<form onSubmit={handleSubmit(onSubmit)}> | ||
<div className="mb-4"> | ||
<label htmlFor="title" className="block text-sm font-medium text-gray-700 mb-1"> | ||
Title | ||
</label> | ||
<input | ||
type="text" | ||
id="title" | ||
{...register('title', { required: true })} | ||
className="w-full mx-2 my-2 border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50 h-14" | ||
/> | ||
{errors.title && <span className="text-red-500">Title is required</span>} | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="content" className="block text-sm font-medium text-gray-700 mb-1"> | ||
Content | ||
</label> | ||
<textarea | ||
id="content" | ||
{...register('content', { required: true })} | ||
className="w-full border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50" | ||
rows={8} | ||
></textarea> | ||
{errors.content && <span className="text-red-500">Content is required</span>} | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="photo" className="block text-sm font-medium text-gray-700 mb-1"> | ||
Photo | ||
</label> | ||
<input | ||
type="file" | ||
id="blogImage" | ||
{...register('photo')} | ||
className="w-full border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="video" className="block text-sm font-medium text-gray-700 mb-1"> | ||
Video | ||
</label> | ||
<input | ||
type="file" | ||
id="blogVideo" | ||
{...register('video')} | ||
className="w-full border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50" | ||
accept="video/*" | ||
/> | ||
</div> | ||
<div className="flex justify-center"> | ||
<button | ||
type="submit" | ||
className="inline-block bg-indigo-500 text-white py-2 px-6 rounded-md hover:bg-indigo-600 focus:outline-none focus:ring focus:ring-indigo-200" | ||
> | ||
Publish | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
<BlogSection /> | ||
</> | ||
); | ||
}; | ||
|
||
export default BlogAdmin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React from 'react' | ||
|
||
function BlogSection() { | ||
return ( | ||
<> | ||
|
||
|
||
<div className='grid grid-cols-3 gap-4 my-32'> | ||
<div className="container mx-auto p-4 "> | ||
<h1 className="text-3xl font-bold mb-4">Blog Section</h1> | ||
<div className="max-w-sm bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700"> | ||
<a href="#"> | ||
<img className="rounded-t-lg" src="/docs/images/blog/image-1.jpg" alt="" /> | ||
</a> | ||
<div className="p-5"> | ||
<a href="#"> | ||
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5> | ||
</a> | ||
<p className="mb-3 font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p> | ||
<a href="#" className="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"> | ||
Read more | ||
<svg className="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10"> | ||
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M1 5h12m0 0L9 1m4 4L9 9"/> | ||
</svg> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
<div className="container mx-auto p-4"> | ||
<h1 className="text-3xl font-bold mb-4">Blog Section</h1> | ||
<div className="max-w-sm bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700"> | ||
<a href="#"> | ||
<img className="rounded-t-lg" src="/docs/images/blog/image-1.jpg" alt="" /> | ||
</a> | ||
<div className="p-5"> | ||
<a href="#"> | ||
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5> | ||
</a> | ||
<p className="mb-3 font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p> | ||
<a href="#" className="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"> | ||
Read more | ||
<svg className="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10"> | ||
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M1 5h12m0 0L9 1m4 4L9 9"/> | ||
</svg> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
<div className="container mx-auto p-4"> | ||
<h1 className="text-3xl font-bold mb-4">Blog Section</h1> | ||
<div className="max-w-sm bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700"> | ||
<a href="#"> | ||
<img className="rounded-t-lg" src="/docs/images/blog/image-1.jpg" alt="" /> | ||
</a> | ||
<div className="p-5"> | ||
<a href="#"> | ||
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5> | ||
</a> | ||
<p className="mb-3 font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p> | ||
<a href="#" className="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"> | ||
Read more | ||
<svg className="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10"> | ||
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M1 5h12m0 0L9 1m4 4L9 9"/> | ||
</svg> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div className="container mx-auto p-4"> | ||
<h1 className="text-3xl font-bold mb-4">Blog Section</h1> | ||
<div className="max-w-sm bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700"> | ||
<a href="#"> | ||
<img className="rounded-t-lg" src="/docs/images/blog/image-1.jpg" alt="" /> | ||
</a> | ||
<div className="p-5"> | ||
<a href="#"> | ||
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5> | ||
</a> | ||
<p className="mb-3 font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p> | ||
<a href="#" className="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"> | ||
Read more | ||
<svg className="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10"> | ||
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M1 5h12m0 0L9 1m4 4L9 9"/> | ||
</svg> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default BlogSection |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove these commented imports.