mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-24 13:15:40 +00:00
feat: update "Show in Folder" label based on platform in ManageWorkspace, Collection, CollectionItem, and WorkspaceHome components (#6623)
* feat: update "Show in Folder" label based on platform in ManageWorkspace, Collection, CollectionItem, and WorkspaceHome components * refactor: remove duplicate "Rename" item push in CollectionItem component
This commit is contained in:
@@ -14,6 +14,7 @@ import DeleteWorkspace from './DeleteWorkspace';
|
||||
import StyledWrapper from './StyledWrapper';
|
||||
import MenuDropdown from 'ui/MenuDropdown/index';
|
||||
import Button from 'ui/Button';
|
||||
import { getRevealInFolderLabel } from 'utils/common/platform';
|
||||
|
||||
const ManageWorkspace = () => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -133,7 +134,7 @@ const ManageWorkspace = () => {
|
||||
onClick={() => handleShowInFolder(workspace)}
|
||||
>
|
||||
<IconFolder size={14} strokeWidth={1.5} />
|
||||
<span>Show in folder</span>
|
||||
<span>{getRevealInFolderLabel()}</span>
|
||||
</button>
|
||||
)}
|
||||
{!isDefault && (
|
||||
|
||||
@@ -49,6 +49,7 @@ import { isTabForItemActive as isTabForItemActiveSelector, isTabForItemPresent a
|
||||
import { isEqual } from 'lodash';
|
||||
import { calculateDraggedItemNewPathname, getInitialExampleName, findParentItemInCollection } from 'utils/collections/index';
|
||||
import { sortByNameThenSequence } from 'utils/common/index';
|
||||
import { getRevealInFolderLabel } from 'utils/common/platform';
|
||||
import CreateExampleModal from 'components/ResponseExample/CreateExampleModal';
|
||||
import { openDevtoolsAndSwitchToTerminal } from 'utils/terminal';
|
||||
import ActionIcon from 'ui/ActionIcon';
|
||||
@@ -345,12 +346,6 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText })
|
||||
leftSection: IconEdit,
|
||||
label: 'Rename',
|
||||
onClick: () => setRenameItemModalOpen(true)
|
||||
},
|
||||
{
|
||||
id: 'show-in-folder',
|
||||
leftSection: IconFolder,
|
||||
label: 'Show in Folder',
|
||||
onClick: handleShowInFolder
|
||||
}
|
||||
);
|
||||
if (!isFolder && isItemARequest(item) && !(item.type === 'http-request' || item.type === 'graphql-request')) {
|
||||
@@ -382,6 +377,15 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText })
|
||||
});
|
||||
}
|
||||
|
||||
items.push(
|
||||
{
|
||||
id: 'show-in-folder',
|
||||
leftSection: IconFolder,
|
||||
label: getRevealInFolderLabel(),
|
||||
onClick: handleShowInFolder
|
||||
}
|
||||
);
|
||||
|
||||
items.push({ id: 'separator-1', type: 'divider' });
|
||||
|
||||
items.push({
|
||||
|
||||
@@ -44,6 +44,7 @@ import ShareCollection from 'components/ShareCollection/index';
|
||||
import GenerateDocumentation from './GenerateDocumentation';
|
||||
import { CollectionItemDragPreview } from './CollectionItem/CollectionItemDragPreview/index';
|
||||
import { sortByNameThenSequence } from 'utils/common/index';
|
||||
import { getRevealInFolderLabel } from 'utils/common/platform';
|
||||
import { openDevtoolsAndSwitchToTerminal } from 'utils/terminal';
|
||||
import ActionIcon from 'ui/ActionIcon';
|
||||
import MenuDropdown from 'ui/MenuDropdown';
|
||||
@@ -360,7 +361,7 @@ const Collection = ({ collection, searchText }) => {
|
||||
{
|
||||
id: 'show-in-folder',
|
||||
leftSection: IconFolder,
|
||||
label: 'Show in File Explorer',
|
||||
label: getRevealInFolderLabel(),
|
||||
onClick: handleShowInFolder
|
||||
},
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ import WorkspaceEnvironments from './WorkspaceEnvironments';
|
||||
import WorkspaceTabs from 'components/WorkspaceTabs';
|
||||
import StyledWrapper from './StyledWrapper';
|
||||
import Dropdown from 'components/Dropdown';
|
||||
import { getRevealInFolderLabel } from 'utils/common/platform';
|
||||
|
||||
const WorkspaceHome = () => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -225,7 +226,7 @@ const WorkspaceHome = () => {
|
||||
</div>
|
||||
<div className="dropdown-item" onClick={handleShowInFolder}>
|
||||
<IconFolder size={16} strokeWidth={1.5} />
|
||||
<span>Show in Folder</span>
|
||||
<span>{getRevealInFolderLabel()}</span>
|
||||
</div>
|
||||
<div className="dropdown-item" onClick={handleExportWorkspace}>
|
||||
<IconUpload size={16} strokeWidth={1.5} />
|
||||
|
||||
@@ -40,6 +40,12 @@ export const isLinuxOS = () => {
|
||||
return osFamily.includes('linux') || osFamily.includes('ubuntu') || osFamily.includes('debian') || osFamily.includes('fedora') || osFamily.includes('centos') || osFamily.includes('arch');
|
||||
};
|
||||
|
||||
export const getRevealInFolderLabel = () => {
|
||||
if (isMacOS()) return 'Reveal in Finder';
|
||||
if (isWindowsOS()) return 'Reveal in File Explorer';
|
||||
return 'Reveal in File Manager';
|
||||
};
|
||||
|
||||
export const getAppInstallDate = () => {
|
||||
let dateString = localStorage.getItem('bruno.installedOn');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user