diff --git a/app/person/dashboard/components/Icon.tsx b/app/person/dashboard/components/Icon.tsx deleted file mode 100644 index f3bf826..0000000 --- a/app/person/dashboard/components/Icon.tsx +++ /dev/null @@ -1,282 +0,0 @@ -"use client" - -export const DataIcon = () => ( - - - - - - - - - - - - - - -) - -export const HourIcon = () => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -) - -export const ReviewIcon = () => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -) diff --git a/components/label/hooks/useAuth.ts b/components/label/hooks/useAuth.ts deleted file mode 100644 index 16febc5..0000000 --- a/components/label/hooks/useAuth.ts +++ /dev/null @@ -1,115 +0,0 @@ -"use client" - -import { usePermissionStore } from "@/components/label/store/auth" -import { usePathname } from "next/navigation" - -interface PermissionItem { - [x: string]: [boolean, null, string] -} - -type PermissionMap = { - [x: string]: PermissionItem -} - -const mappingList: { [x: string]: [string, string] } = { - "/person/dashboard": ["task", "view"], - "/person/report": ["daily_work", "self_view"], - "/person/workload": ["workload", "self_view"], -} - -export const headerBarCheckItems = (data: PermissionMap) => { - const projectTitle = [ - ["daily_work", "self_view"], - ["label_schema", "view"], - ["project", "view"], - ["task", "view"], - ] as const - - let projectVisible = false - projectTitle.forEach(([prop, subProp]) => { - if (data[prop] && data[prop][subProp] && data[prop][subProp][0]) { - projectVisible = true - } - }) - - const staffTitle = [ - ["daily_work", "team_view"], - ["user", "view"], - ["user", "group_view"], - ] as const - - let staffVisible = false - staffTitle.forEach(([prop, subProp]) => { - if (data[prop] && data[prop][subProp] && data[prop][subProp][0]) { - staffVisible = true - } - }) - - return [projectVisible, staffVisible] -} - -const useAuth = () => { - const pathname = usePathname() - const detailInfo = usePermissionStore((s) => s.detailInfo) - const permission = detailInfo?.permissions as PermissionMap | undefined - const roleName: string[] = detailInfo?.role_name ?? [] - - return { - hasPermission: () => { - if ( - [ - "/", - "/login", - "/management", - "/management/person/dashboard", - "/management/team", - ].includes(pathname) - ) { - return true - } - - if (!permission) return false - if (mappingList[pathname]) { - const [prop, subProp] = mappingList[pathname] - return ( - !!permission[prop] && - !!permission[prop][subProp] && - !!permission[prop][subProp][0] - ) - } - return false - }, - // path 跳转是否可见 - canNv: (path: string, type = "view") => { - if (!permission) return false - if (mappingList[path]) { - const [prop] = mappingList[path] - return ( - !!permission[prop] && - !!permission[prop][type] && - !!permission[prop][type][0] - ) - } - return false - }, - // 当前页面是否可见某个操作 - isShow: (type = "view") => { - if (!permission) return false - if (mappingList[pathname]) { - const [prop] = mappingList[pathname] - return ( - !!permission[prop] && - !!permission[prop][type] && - !!permission[prop][type][0] - ) - } - return false - }, - checkRole: (name: string) => { - if (!name) return false - return roleName.includes(name) - }, - } -} - -export default useAuth diff --git a/components/layout/components/icons/custom.tsx b/components/layout/components/icons/custom.tsx deleted file mode 100644 index a1850c6..0000000 --- a/components/layout/components/icons/custom.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { SVGProps } from "react" - -export function SystemIcon(props: SVGProps) { - return ( - - - - - ) -} - -export const PersonalMenuIcon = (props: SVGProps) => ( - - - -) - -export const TaskMenuIcon = (props: SVGProps) => ( - - - - - - - - - - -) - -export const AuthMenuIcon = (props: SVGProps) => ( - - - - - - - - - - - -) diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx deleted file mode 100644 index 517ad6a..0000000 --- a/components/tree-select/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export { VirtualTreeSelect as default, VirtualTreeSelect } from "./tree"