Skip to content

Commit

Permalink
⭐️ Open in new window menu option (#183)
Browse files Browse the repository at this point in the history
⭐️ Open in new window menu option
  • Loading branch information
MontaGhanmy authored Sep 5, 2023
1 parent 5fd29bb commit 362b2ee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions tdrive/frontend/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions tdrive/frontend/public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions tdrive/frontend/public/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "Люди",
Expand Down
13 changes: 13 additions & 0 deletions tdrive/frontend/src/app/views/client/body/drive/context-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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);
}
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit 362b2ee

Please sign in to comment.