️ Open in new window menu option (#183)

️ Open in new window menu option
This commit is contained in:
Montassar Ghanmy
2023-09-05 15:01:24 +01:00
committed by GitHub
parent 5fd29bb0d6
commit 362b2ee481
4 changed files with 16 additions and 0 deletions
+1
View File
@@ -313,6 +313,7 @@
"components.item_context_menu.today": "Today",
"components.item_context_menu.last_week": "Last week",
"components.item_context_menu.last_month": "Last month",
"components.item_context_menu.open_new_window": "Open in new window",
"scenes.app.shared_with_me.shared_with_me": "Shared with me",
"scenes.app.shared_with_me.file_type": "File type",
"scenes.app.shared_with_me.people": "People",
+1
View File
@@ -312,6 +312,7 @@
"components.item_context_menu.today": "Aujourd'hui",
"components.item_context_menu.last_week": "La semaine dernière",
"components.item_context_menu.last_month": "Le mois dernier",
"components.item_context_menu.open_new_window": "Open in new window",
"scenes.app.shared_with_me.shared_with_me": "Partagé avec moi",
"scenes.app.shared_with_me.file_type": "Type de fichier",
"scenes.app.shared_with_me.people": "Personnes",
+1
View File
@@ -312,6 +312,7 @@
"components.item_context_menu.today": "Сегодня",
"components.item_context_menu.last_week": "За неделю",
"components.item_context_menu.last_month": "За месяц",
"components.item_context_menu.open_new_window": "Открыть в новом окне",
"scenes.app.shared_with_me.shared_with_me": "Доступные мне",
"scenes.app.shared_with_me.file_type": "Тип файла",
"scenes.app.shared_with_me.people": "Люди",
@@ -19,6 +19,8 @@ import { ToasterService } from '@features/global/services/toaster-service';
import { copyToClipboard } from '@features/global/utils/CopyClipboard';
import { SharedWithMeFilterState } from '@features/drive/state/shared-with-me-filter';
import { getCurrentUserList } from '@features/users/hooks/use-user-list';
import RouterServices from '@features/router/services/router-service';
import useRouterCompany from '@features/router/hooks/use-router-company';
import _ from 'lodash';
import Languages from 'features/global/services/languages-service';
@@ -43,6 +45,8 @@ export const useOnBuildContextMenu = (children: DriveItem[], initialParentId?: s
const setPropertiesModalState = useSetRecoilState(PropertiesModalAtom);
const setUsersModalState = useSetRecoilState(UsersModalAtom);
const { open: preview } = useDrivePreview();
const company = useRouterCompany();
function getIdsFromArray(arr: DriveItem[]): string[] {
return arr.map((obj) => obj.id);
}
@@ -87,6 +91,15 @@ export const useOnBuildContextMenu = (children: DriveItem[], initialParentId?: s
}
},
{ type: 'separator' },
{
type: 'menu',
text: Languages.t('components.item_context_menu.open_new_window'),
onClick: () => {
const route = RouterServices.generateRouteFromState({ companyId: company, viewId: item.parent_id, itemId: item.id });
window.open(route, '_blank');
}
},
{ type: 'separator' },
{
type: 'menu',
text: Languages.t('components.item_context_menu.manage_access'),