From a2ea0b00319da1381aef38dbcfa1bc84a2618a06 Mon Sep 17 00:00:00 2001 From: Rudra Date: Wed, 16 Oct 2024 17:51:15 +0530 Subject: [PATCH] ws dropdown --- .../OrganizationManager/CustomSelect.jsx | 24 ++--------- .../_components/OrganizationManager/List.jsx | 41 +++++++++++-------- frontend/src/_ui/Icon/solidIcons/NewTab.jsx | 21 ++++++++++ frontend/src/_ui/Icon/solidIcons/index.js | 3 ++ 4 files changed, 53 insertions(+), 36 deletions(-) create mode 100644 frontend/src/_ui/Icon/solidIcons/NewTab.jsx diff --git a/frontend/src/_components/OrganizationManager/CustomSelect.jsx b/frontend/src/_components/OrganizationManager/CustomSelect.jsx index e070d1e97c..52930f08c7 100644 --- a/frontend/src/_components/OrganizationManager/CustomSelect.jsx +++ b/frontend/src/_components/OrganizationManager/CustomSelect.jsx @@ -26,14 +26,13 @@ const Menu = (props) => {
Workspaces ({props.options.length})
{admin && ( -
- {/* */} +
@@ -43,21 +42,6 @@ const Menu = (props) => {
{props.children}
- -
-
- -
- -
- -
- {t('header.organization.addNewWorkSpace', 'Add new workspace')} -
); diff --git a/frontend/src/_components/OrganizationManager/List.jsx b/frontend/src/_components/OrganizationManager/List.jsx index 25e3a52d85..f8e3799e5e 100644 --- a/frontend/src/_components/OrganizationManager/List.jsx +++ b/frontend/src/_components/OrganizationManager/List.jsx @@ -14,7 +14,7 @@ import { EditOrganization } from './EditOrganization'; otherwise this component will intiate everytime we switch between pages */ export const OrganizationList = function () { - const { current_organization_id } = authenticationService.currentSessionValue; + const { current_organization_id, admin } = authenticationService.currentSessionValue; const { fetchOrganizations, organizationList, isGettingOrganizations } = useCurrentSessionStore( (state) => ({ organizationList: state.organizations, @@ -34,8 +34,7 @@ export const OrganizationList = function () { const organization = organizationList.find((org) => org.id === id); if (![id, organization.slug].includes(getWorkspaceIdOrSlugFromURL())) { const newPath = appendWorkspaceId(organization.slug || id, location.pathname, true); - window.history.replaceState(null, null, newPath); - window.location.reload(); + window.open(newPath, '_blank'); } }; @@ -48,7 +47,7 @@ export const OrganizationList = function () {
{org.id === current_organization_id ? (
- +
) : (
- {org.id === current_organization_id ? ( -
setShowEditOrg(true)}> - -
+ {org.id === current_organization_id && admin ? ( + +
setShowEditOrg(true)} + > + +
+
) : ( -
console.log('Dummy onClick')} - > - -
+ org.id !== current_organization_id && ( + +
switchOrganization(org.id)} + > + +
+
+ ) )}
), @@ -94,7 +103,7 @@ export const OrganizationList = function () { isLoading={isGettingOrganizations} options={options} value={current_organization_id} - onChange={(id) => switchOrganization(id)} + // onChange={(id) => switchOrganization(id)} className={`tj-org-select ${darkMode && 'dark-theme'}`} /> diff --git a/frontend/src/_ui/Icon/solidIcons/NewTab.jsx b/frontend/src/_ui/Icon/solidIcons/NewTab.jsx new file mode 100644 index 0000000000..f4e3e7bb92 --- /dev/null +++ b/frontend/src/_ui/Icon/solidIcons/NewTab.jsx @@ -0,0 +1,21 @@ +import React from 'react'; + +const NewTab = ({ fill = '#6A727C', width = '25', className = '', viewBox = '0 0 25 25' }) => ( + + + +); + +export default NewTab; diff --git a/frontend/src/_ui/Icon/solidIcons/index.js b/frontend/src/_ui/Icon/solidIcons/index.js index 7e6874ca09..4971327a21 100644 --- a/frontend/src/_ui/Icon/solidIcons/index.js +++ b/frontend/src/_ui/Icon/solidIcons/index.js @@ -123,6 +123,7 @@ import AddRectangle from './AddRectangle.jsx'; import Lock from './Lock.jsx'; import Mail from './Mail.jsx'; import Logs from './Logs.jsx'; +import NewTab from './NewTab.jsx'; import Marketplace from './Marketplace.jsx'; import Minimize from './Minimize.jsx'; import Maximize from './Maximize.jsx'; @@ -354,6 +355,8 @@ const Icon = (props) => { return ; case 'notificationunread': return ; + case 'newtab': + return ; case 'options': return ; case 'open':