-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f4a9fa
commit ee2fadc
Showing
33 changed files
with
727 additions
and
378 deletions.
There are no files selected for viewing
12 changes: 7 additions & 5 deletions
12
admin-client/app/(with-dashboard-layout)/categories/page.js
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import Categories from "@/views/categories"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "Categories", | ||
}; | ||
} | ||
|
||
export default function InternalPage() { | ||
return ( | ||
<div className="bg-content-bg px-5 py-3 rounded-xl border border-bc"> | ||
<Categories /> | ||
</div> | ||
); | ||
return <Categories />; | ||
} |
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
admin-client/app/(with-dashboard-layout)/orders/details/[id]/page.js
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import OrderDetails from "@/views/order-details"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "Order Details", | ||
}; | ||
} | ||
|
||
export default function InternalOrderDetailsPage() { | ||
return <OrderDetails />; | ||
} |
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import OrderListContent from "./page-content"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "Orders", | ||
}; | ||
} | ||
|
||
export default function InternalOrderListPage() { | ||
return <OrderListContent />; | ||
} |
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import Dashboard from "@/views/dashboard"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "Dashboard", | ||
}; | ||
} | ||
|
||
export default function DashboardPage() { | ||
return <Dashboard />; | ||
} |
7 changes: 7 additions & 0 deletions
7
admin-client/app/(with-dashboard-layout)/products/edit/[id]/page.js
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 |
---|---|---|
@@ -1,4 +1,11 @@ | ||
import EditProduct from "@/views/edit-product"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "Edit Product", | ||
}; | ||
} | ||
|
||
export default function InternalPage() { | ||
return <EditProduct />; | ||
} |
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
12 changes: 7 additions & 5 deletions
12
admin-client/app/(with-dashboard-layout)/users/create/page.js
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import AddUser from "@/views/add-user"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "Add User", | ||
}; | ||
} | ||
|
||
export default function page() { | ||
return ( | ||
<div className="bg-content-bg px-5 py-3 rounded-xl border border-bc"> | ||
<AddUser /> | ||
</div> | ||
); | ||
return <AddUser />; | ||
} |
6 changes: 6 additions & 0 deletions
6
admin-client/app/(with-dashboard-layout)/users/details/[id]/page.js
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import UserDetails from "@/views/user-details"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "User Details", | ||
}; | ||
} | ||
|
||
export default function InternalUserDetailsPage() { | ||
return <UserDetails />; | ||
} |
6 changes: 6 additions & 0 deletions
6
admin-client/app/(with-dashboard-layout)/users/edit/[id]/page.js
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import EditUser from "@/views/edit-user"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "Edit User", | ||
}; | ||
} | ||
|
||
export default function InternalPage() { | ||
return <EditUser />; | ||
} |
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import UserListView from "@/views/user-list"; | ||
|
||
export function generateMetadata() { | ||
return { | ||
title: "Users", | ||
}; | ||
} | ||
|
||
export default function InternalPage() { | ||
return <UserListView />; | ||
} |
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
function Loading() { | ||
return <span className="loading loading-infinity loading-lg"></span>; | ||
return ( | ||
<div className="h-screen w-screen flex items-center justify-center"> | ||
<span className="loading loading-infinity loading-lg"></span> | ||
</div> | ||
); | ||
} | ||
|
||
export default Loading; |
7 changes: 7 additions & 0 deletions
7
admin-client/components/confirm-dialog/confirm-dialog-context.js
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,7 @@ | ||
"use client"; | ||
|
||
import { createContext } from "react"; | ||
|
||
export const ConfirmDialogActionsContext = createContext({ | ||
confirmDialog: () => Promise.reject(false), | ||
}); |
95 changes: 95 additions & 0 deletions
95
admin-client/components/confirm-dialog/confirm-dialog-provider.jsx
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,95 @@ | ||
"use client"; | ||
import { useCallback, useMemo, useRef, useState } from "react"; | ||
|
||
const { ConfirmDialogActionsContext } = require("./confirm-dialog-context"); | ||
|
||
function ConfirmDialogProvider({ children }) { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const resolveRef = useRef(); | ||
|
||
const defaultConfirmDialogInfo = useMemo( | ||
() => ({ | ||
title: "title", | ||
message: "message", | ||
successButtonText: "Yes", | ||
cancelButtonText: "No", | ||
}), | ||
[] | ||
); | ||
|
||
const [confirmDialogInfo, setConfirmDialogInfo] = useState( | ||
defaultConfirmDialogInfo | ||
); | ||
|
||
const handleClose = () => { | ||
setIsOpen(false); | ||
}; | ||
|
||
const onCancel = () => { | ||
setIsOpen(false); | ||
resolveRef.current?.(false); | ||
}; | ||
|
||
const onSuccess = () => { | ||
setIsOpen(false); | ||
resolveRef.current?.(true); | ||
}; | ||
|
||
const confirmDialog = useCallback( | ||
(options) => { | ||
return new Promise((resolve) => { | ||
setConfirmDialogInfo({ | ||
...defaultConfirmDialogInfo, | ||
...options, | ||
}); | ||
setIsOpen(true); | ||
resolveRef.current = resolve; | ||
}); | ||
}, | ||
[defaultConfirmDialogInfo] | ||
); | ||
|
||
const contextActions = useMemo( | ||
() => ({ | ||
confirmDialog, | ||
}), | ||
[confirmDialog] | ||
); | ||
return ( | ||
<> | ||
<ConfirmDialogActionsContext.Provider value={contextActions}> | ||
{children} | ||
</ConfirmDialogActionsContext.Provider> | ||
|
||
{isOpen && ( | ||
<dialog id="my_modal" className="modal" open> | ||
<div className="modal-box"> | ||
<h3 className="font-bold text-lg">{confirmDialogInfo.title}</h3> | ||
<p className="py-4">{confirmDialogInfo.message}</p> | ||
<div className="modal-action"> | ||
<button className="btn" onClick={onCancel}> | ||
{confirmDialogInfo.cancelButtonText} | ||
</button> | ||
<button className="btn btn-primary" onClick={onSuccess}> | ||
{confirmDialogInfo.successButtonText} | ||
</button> | ||
</div> | ||
</div> | ||
<form | ||
method="dialog" | ||
className="modal-backdrop" | ||
onClick={(e) => { | ||
e.stopPropagation(); | ||
onCancel(); | ||
}} | ||
> | ||
<button>close</button> | ||
</form> | ||
</dialog> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default ConfirmDialogProvider; |
10 changes: 10 additions & 0 deletions
10
admin-client/components/confirm-dialog/use-confirm-dialog.js
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 @@ | ||
"use client"; | ||
|
||
import { useContext } from "react"; | ||
import { ConfirmDialogActionsContext } from "./confirm-dialog-context"; | ||
|
||
const useConfirmDialog = () => { | ||
return useContext(ConfirmDialogActionsContext); | ||
}; | ||
|
||
export default useConfirmDialog; |
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
Oops, something went wrong.