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

Major 3.0 (#118)

Co-authored-by: Maison da Silva <maisonmdsgreen@hotmail.com>
This commit is contained in:
2025-07-30 15:02:26 +03:00
committed by GitHub
parent d6996031b6
commit 2bd9337e63
200 changed files with 19452 additions and 3339 deletions
@@ -0,0 +1,38 @@
import { CollectionItem, GraphicsStorage, TabItem } from "@/models/CollectionModels";
import { LegacyCollection } from "../models/LegacyModels";
export default function migrateCollections(legacyCollections: LegacyCollection[]): [CollectionItem[], GraphicsStorage]
{
const collections: CollectionItem[] = [];
const graphics: GraphicsStorage = {};
for (let i = 0; i < legacyCollections.length; i++)
{
const legacyCollection: LegacyCollection = legacyCollections[i];
const items: TabItem[] = legacyCollection.links.map((url, index) =>
{
const title: string | undefined = legacyCollection.titles[index];
const icon: string | undefined = legacyCollection.icons?.[index];
const capture: string | undefined = legacyCollection.thumbnails?.[index];
if (!graphics[url])
graphics[url] = { icon, capture };
else
graphics[url] = { icon: graphics[url].icon ?? icon, capture: graphics[url].preview ?? capture };
return {
type: "tab",
url,
title
};
});
collections.push({
type: "collection",
timestamp: legacyCollection.timestamp,
items
});
}
return [collections, graphics];
}