1
0
mirror of https://github.com/XFox111/TabsAsideExtension.git synced 2026-04-22 07:58:01 +03:00

fix: copilot fixes

This commit is contained in:
2025-12-21 16:49:27 +03:00
parent 9fbc152a91
commit 41123bd8db
3 changed files with 29 additions and 20 deletions
@@ -19,7 +19,7 @@ export default function convertBookmarks(bookmarks: Bookmark[]): [CollectionItem
untitled.items.push(getTab(bookmark, graphics));
count++;
}
else if (bookmark.type === "folder" && bookmark.children)
else if (bookmark.type === "folder")
{
const collection: CollectionItem = getCollection(bookmark, graphics);
items.push(collection);
@@ -34,6 +34,9 @@ export default function convertBookmarks(bookmarks: Bookmark[]): [CollectionItem
}
}
if (untitled.items.length > 0)
items.unshift(untitled);
return [items, graphics, count];
}
@@ -60,13 +63,14 @@ function getCollection(bookmark: Bookmark, graphics: GraphicsStorage): Collectio
type: "collection"
};
for (const child of bookmark.children!)
{
if (child.type === "bookmark")
collection.items.push(getTab(child, graphics));
else if (child.type === "folder" && child.children)
collection.items.push(getGroup(child, graphics));
}
if (bookmark.children)
for (const child of bookmark.children)
{
if (child.type === "bookmark")
collection.items.push(getTab(child, graphics));
else if (child.type === "folder" && child.children)
collection.items.push(getGroup(child, graphics));
}
return collection;
}
@@ -81,13 +85,14 @@ function getGroup(bookmark: Bookmark, graphics: GraphicsStorage): GroupItem
color: getRandomColor()
};
for (const child of bookmark.children!)
{
if (child.type === "bookmark")
group.items.push(getTab(child, graphics));
else if (child.type === "folder")
group.items.push(...getGroup(child, graphics).items);
}
if (bookmark.children)
for (const child of bookmark.children)
{
if (child.type === "bookmark")
group.items.push(getTab(child, graphics));
else if (child.type === "folder")
group.items.push(...getGroup(child, graphics).items);
}
return group;
}