Skip to content

Commit

Permalink
Restrict the local files tab to the list view sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Dec 28, 2024
1 parent 1fbfbfc commit 7e5e96a
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,22 @@ export function addLocalFilesTab(tab: {
function patchArguments(args: any[]) {
let [type, props, ...children] = args;
const newProps = { ...props };
if ('tabs' in newProps) {
const hasLocalFilesTab = newProps.tabs.find(
(tab) => tab.name === 'local-files'
);
if (!hasLocalFilesTab) {
newProps.tabs.unshift(tab);
}
newProps.defaultTabId = 'local-files';
if (!('tabs' in newProps)) {
return [type, newProps, ...children];
}
const hasListViewTab = newProps.tabs.find(
(tab) => tab.name === 'list-view'
);
if (!hasListViewTab) {
return [type, newProps, ...children];
}
const hasLocalFilesTab = newProps.tabs.find(
(tab) => tab.name === 'local-files'
);
if (!hasLocalFilesTab) {
newProps.tabs.unshift(tab);
}
newProps.defaultTabId = 'local-files';
return [type, newProps, ...children];
}

Expand Down

0 comments on commit 7e5e96a

Please sign in to comment.