code cleanup

This commit is contained in:
Jan Prochazka 2021-12-30 17:08:04 +01:00
parent 0d7accc990
commit 064a5f5564

View File

@ -272,12 +272,6 @@
function dragDropTabs(draggingTabs, targetTabs) {
if (draggingTabs.find(x => targetTabs.find(y => x.tabid == y.tabid))) return;
// if (getTabDbKey(draggingTab) != getTabDbKey(targetTab)) {
// // dragDropDbKey(getTabDbKey(draggingTab), getTabDbKey(targetTab));
// return;
// }
// const dbKey = getTabDbKey(draggingTab);
const items = sortTabs($openedTabs.filter(x => x.closedTime == null));
const dstIndexes = targetTabs.map(targetTab => _.findIndex(items, x => x.tabid == targetTab.tabid));
const dstIndexFirst = _.min(dstIndexes) as number;
@ -314,39 +308,6 @@
);
}
// function dragDropDbKey(draggingDbKey, targetDbKey) {
// if (!draggingDbKey) return;
// if (targetDbKey == draggingDbKey) return;
// const groupOrderFiltered = _.pickBy($tabDatabaseGroupOrder, (v, k) =>
// $openedTabs.filter(x => x.closedTime == null).find(x => getTabDbKey(x) == k)
// );
// const items = _.sortBy(_.keys(groupOrderFiltered), x => groupOrderFiltered[x]);
// const dstIndex = _.indexOf(items, targetDbKey);
// const srcIndex = _.indexOf(items, draggingDbKey);
// if (srcIndex < 0 || dstIndex < 0) {
// console.warn('Drag tab group index not found');
// return;
// }
// const newItems =
// dstIndex < srcIndex
// ? [...items.slice(0, dstIndex), draggingDbKey, ...items.slice(dstIndex).filter(x => x != draggingDbKey)]
// : [
// ...items.slice(0, dstIndex + 1).filter(x => x != draggingDbKey),
// draggingDbKey,
// ...items.slice(dstIndex + 1),
// ];
// const newGroupOrder = {};
// for (const key in groupOrderFiltered) {
// const index = newItems.indexOf(key);
// newGroupOrder[key] = index >= 0 ? index + 1 : groupOrderFiltered[key];
// }
// tabDatabaseGroupOrder.set(newGroupOrder);
// }
</script>
{#each groupedTabs as tabGroup}