Fix TypeScript build errors
- Remove unused variables (allFolders, getFolderDepth, hasChildren, legacyCategories) - Fix Lucide icon title prop by wrapping in span elements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,10 +38,7 @@ export function AddToFolderMenu({ treeId, onFolderCreated }: AddToFolderMenuProp
|
|||||||
const loadFoldersAndAssignments = async () => {
|
const loadFoldersAndAssignments = async () => {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
try {
|
try {
|
||||||
const [foldersData, allFolders] = await Promise.all([
|
const foldersData = await foldersApi.list()
|
||||||
foldersApi.list(),
|
|
||||||
Promise.resolve([]), // Will load tree's folder assignments below
|
|
||||||
])
|
|
||||||
setFolders(foldersData)
|
setFolders(foldersData)
|
||||||
|
|
||||||
// Check which folders contain this tree
|
// Check which folders contain this tree
|
||||||
|
|||||||
@@ -46,18 +46,6 @@ function buildFolderTree(folders: FolderListItem[]): FolderTreeItem[] {
|
|||||||
return rootFolders
|
return rootFolders
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate folder depth (for limiting nesting)
|
|
||||||
function getFolderDepth(folders: FolderListItem[], folderId: string): number {
|
|
||||||
const folder = folders.find((f) => f.id === folderId)
|
|
||||||
if (!folder || !folder.parent_id) return 1
|
|
||||||
return 1 + getFolderDepth(folders, folder.parent_id)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if folder has children
|
|
||||||
function hasChildren(folders: FolderListItem[], folderId: string): boolean {
|
|
||||||
return folders.some((f) => f.parent_id === folderId)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all descendant IDs (for cascade delete warning)
|
// Get all descendant IDs (for cascade delete warning)
|
||||||
function getDescendantIds(folders: FolderListItem[], folderId: string): string[] {
|
function getDescendantIds(folders: FolderListItem[], folderId: string): string[] {
|
||||||
const children = folders.filter((f) => f.parent_id === folderId)
|
const children = folders.filter((f) => f.parent_id === folderId)
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ export function TreeMetadataForm() {
|
|||||||
} = useTreeEditorStore()
|
} = useTreeEditorStore()
|
||||||
|
|
||||||
const [categories, setCategories] = useState<CategoryListItem[]>([])
|
const [categories, setCategories] = useState<CategoryListItem[]>([])
|
||||||
const [legacyCategories, setLegacyCategories] = useState<string[]>([])
|
|
||||||
const [customCategory, setCustomCategory] = useState(false)
|
const [customCategory, setCustomCategory] = useState(false)
|
||||||
|
|
||||||
// Load categories
|
// Load categories
|
||||||
|
|||||||
@@ -274,9 +274,13 @@ export function TreeLibraryPage() {
|
|||||||
<h3 className="font-semibold text-card-foreground">{tree.name}</h3>
|
<h3 className="font-semibold text-card-foreground">{tree.name}</h3>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{tree.is_public ? (
|
{tree.is_public ? (
|
||||||
<Globe className="h-4 w-4 text-muted-foreground" title="Public tree" />
|
<span title="Public tree">
|
||||||
|
<Globe className="h-4 w-4 text-muted-foreground" />
|
||||||
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<Lock className="h-4 w-4 text-muted-foreground" title="Private tree" />
|
<span title="Private tree">
|
||||||
|
<Lock className="h-4 w-4 text-muted-foreground" />
|
||||||
|
</span>
|
||||||
)}
|
)}
|
||||||
{tree.category_info && (
|
{tree.category_info && (
|
||||||
<span className="rounded-full bg-secondary px-2 py-0.5 text-xs text-secondary-foreground">
|
<span className="rounded-full bg-secondary px-2 py-0.5 text-xs text-secondary-foreground">
|
||||||
|
|||||||
Reference in New Issue
Block a user