refactor: remove unused dead-code exports flagged by react-doctor
Low-risk subset only — each verified to have zero external references (tsc + eslint green); API clients, stores, icons and constants left untouched. - libs/util.ts: unexport `is` (still used internally by isNumber) - components/tree-select/libs/util.ts: drop unused recursive `findLabel` - app/person/workload/config.ts: drop unused `dimensionOpts` - components/login/libs/session-cache.ts: drop unused `getCachedSession` - components/setting/PageSurface.tsx: drop 3 unused layout components (SettingTableViewport, SettingSectionHeader, SettingFilterStack) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,14 +5,6 @@ export type DimensionType =
|
||||
| "order_by_project_name"
|
||||
| "order_by_project_type"
|
||||
|
||||
export const dimensionOpts = [
|
||||
{ label: "全部", value: "all" },
|
||||
{ label: "用户名", value: "order_by_user_name" },
|
||||
{ label: "用户组", value: "order_by_group_name" },
|
||||
{ label: "项目名称", value: "order_by_project_name" },
|
||||
{ label: "项目类型", value: "order_by_project_type" },
|
||||
]
|
||||
|
||||
export type MetricColumn = {
|
||||
key: string
|
||||
title: string
|
||||
|
||||
@@ -27,9 +27,6 @@ const getValidCachedSession = <T>(redisKey: string) => {
|
||||
return cacheEntry.data as T
|
||||
}
|
||||
|
||||
export const getCachedSession = <T>(redisKey: string) =>
|
||||
getValidCachedSession<T>(redisKey)
|
||||
|
||||
export const setCachedSession = <T>(redisKey: string, data: T) => {
|
||||
sessionCache.set(redisKey, {
|
||||
data,
|
||||
|
||||
@@ -386,12 +386,6 @@ export function SettingCustomPageSizeControl({
|
||||
)
|
||||
}
|
||||
|
||||
type SettingTableViewportProps = PropsWithChildren<{
|
||||
maxHeight: number | string
|
||||
className?: string
|
||||
style?: CSSProperties
|
||||
}>
|
||||
|
||||
export function SettingPage({
|
||||
className,
|
||||
...props
|
||||
@@ -428,21 +422,6 @@ export function SettingPanel({
|
||||
)
|
||||
}
|
||||
|
||||
export function SettingTableViewport({
|
||||
maxHeight,
|
||||
className,
|
||||
style,
|
||||
children,
|
||||
}: SettingTableViewportProps) {
|
||||
return (
|
||||
<div
|
||||
style={{ maxHeight, ...style }}
|
||||
className={mergeClassName(classes.tableViewport, className)}>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function SettingFilterPanel({
|
||||
className,
|
||||
...props
|
||||
@@ -467,43 +446,6 @@ export function SettingContentPanel({
|
||||
)
|
||||
}
|
||||
|
||||
type SettingSectionHeaderProps = GroupProps & {
|
||||
eyebrow?: string
|
||||
title: ReactNode
|
||||
description?: ReactNode
|
||||
actions?: ReactNode
|
||||
}
|
||||
|
||||
export function SettingSectionHeader({
|
||||
eyebrow,
|
||||
title,
|
||||
description,
|
||||
actions,
|
||||
className,
|
||||
...props
|
||||
}: SettingSectionHeaderProps) {
|
||||
return (
|
||||
<Group
|
||||
justify="space-between"
|
||||
align="flex-start"
|
||||
gap="sm"
|
||||
wrap="wrap"
|
||||
className={mergeClassName(classes.sectionHeader, className)}
|
||||
{...props}>
|
||||
<Stack gap={2}>
|
||||
{eyebrow ? (
|
||||
<Text className={classes.sectionEyebrow}>{eyebrow}</Text>
|
||||
) : null}
|
||||
<Text className={classes.sectionTitle}>{title}</Text>
|
||||
{description ? (
|
||||
<Text className={classes.sectionDescription}>{description}</Text>
|
||||
) : null}
|
||||
</Stack>
|
||||
{actions}
|
||||
</Group>
|
||||
)
|
||||
}
|
||||
|
||||
type SettingListHeaderProps = {
|
||||
title: ReactNode
|
||||
count?: ReactNode
|
||||
@@ -569,20 +511,6 @@ export function SettingFilterActions({
|
||||
)
|
||||
}
|
||||
|
||||
export function SettingFilterStack({
|
||||
className,
|
||||
gap = 12,
|
||||
...props
|
||||
}: PropsWithChildren<StackProps>) {
|
||||
return (
|
||||
<Stack
|
||||
gap={gap}
|
||||
className={mergeClassName(classes.filterStack, className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
type SettingInlineFilterFieldProps = {
|
||||
label: ReactNode
|
||||
children: ReactNode
|
||||
|
||||
@@ -75,24 +75,6 @@ export const buildTreeValueMap = (
|
||||
return acc
|
||||
}
|
||||
|
||||
export const findLabel = (
|
||||
nodes: TreeNodeData[],
|
||||
targetValue: string,
|
||||
pathArr: string[] = [] // 内部用,调用端无需传入
|
||||
): FindResult => {
|
||||
for (const node of nodes) {
|
||||
const curPath = [...pathArr, node.label as string] // 复制一份,避免污染上层
|
||||
if (node.value === targetValue) {
|
||||
return { path: curPath.join(TREE_PATH_SEPARATOR), node }
|
||||
}
|
||||
if (node.children) {
|
||||
const found = findLabel(node.children, targetValue, curPath)
|
||||
if (found.node) return found
|
||||
}
|
||||
}
|
||||
return { path: "", node: null }
|
||||
}
|
||||
|
||||
export const findNodesByValues = (
|
||||
valueMap: Record<string, TreeValueMeta>,
|
||||
targetValues: string[]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @description: 判断值是否为某个类型
|
||||
*/
|
||||
export function is(val: unknown, type: string) {
|
||||
function is(val: unknown, type: string) {
|
||||
return toString.call(val) === `[object ${type}]`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user