addd
This commit is contained in:
parent
622bd193c4
commit
f8659b90ca
|
@ -10,16 +10,19 @@ import { useAuth } from "@web/src/providers/auth-provider";
|
|||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { UserMenu } from "@web/src/app/main/layout/UserMenu/UserMenu";
|
||||
import { CourseDetailContext } from "../CourseDetailContext";
|
||||
import { Department, RolePerms } from "@nice/common";
|
||||
|
||||
const { Header } = Layout;
|
||||
|
||||
export function CourseDetailHeader() {
|
||||
const [searchValue, setSearchValue] = useState("");
|
||||
const { id } = useParams();
|
||||
const { isAuthenticated, user, hasSomePermissions } = useAuth();
|
||||
const { isAuthenticated, user, hasSomePermissions, hasEveryPermissions } =
|
||||
useAuth();
|
||||
const navigate = useNavigate();
|
||||
const { course } = useContext(CourseDetailContext);
|
||||
|
||||
hasSomePermissions(RolePerms.MANAGE_ANY_POST, RolePerms.MANAGE_DOM_POST);
|
||||
hasEveryPermissions(RolePerms.MANAGE_ANY_POST, RolePerms.MANAGE_DOM_POST);
|
||||
return (
|
||||
<Header className="select-none flex items-center justify-center bg-white shadow-md border-b border-gray-100 fixed w-full z-30">
|
||||
<div className="w-full flex items-center justify-between h-full">
|
||||
|
@ -65,18 +68,7 @@ export function CourseDetailHeader() {
|
|||
</>
|
||||
)}
|
||||
{isAuthenticated ? (
|
||||
<Dropdown
|
||||
overlay={<UserMenu />}
|
||||
trigger={["click"]}
|
||||
placement="bottomRight">
|
||||
<Avatar
|
||||
size="large"
|
||||
className="cursor-pointer hover:scale-105 transition-all bg-gradient-to-r from-blue-500 to-blue-600 text-white font-semibold">
|
||||
{(user?.showname ||
|
||||
user?.username ||
|
||||
"")[0]?.toUpperCase()}
|
||||
</Avatar>
|
||||
</Dropdown>
|
||||
<UserMenu />
|
||||
) : (
|
||||
<Button
|
||||
onClick={() => navigate("/login")}
|
||||
|
|
|
@ -18,8 +18,9 @@ const courseStatusVariant: Record<CourseStatus, string> = {
|
|||
export default function CourseEditorHeader() {
|
||||
const navigate = useNavigate();
|
||||
const { user, hasSomePermissions } = useAuth();
|
||||
|
||||
const { onSubmit, course, form } = useCourseEditor();
|
||||
|
||||
|
||||
const handleSave = () => {
|
||||
try {
|
||||
form.validateFields().then((values) => {
|
||||
|
|
Loading…
Reference in New Issue