Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const FolderCard: React.FC<FolderItemComponentProps> = ({
'data-selection-id': dataSelectionId,
...props
}) => {
const { isTeamEditor } = useWorkspaceAuthorization();
const { hasEditorAccess } = useWorkspaceAuthorization();

return (
<InteractiveOverlay>
Expand All @@ -48,7 +48,7 @@ export const FolderCard: React.FC<FolderItemComponentProps> = ({
>
<Stack justify="space-between">
<Icon size={20} name="folder" color="#E3FF73" />
{!isNewFolder && isTeamEditor ? (
{!isNewFolder && hasEditorAccess ? (
<IconButton
css={{
marginRight: '-4px',
Expand Down
10 changes: 5 additions & 5 deletions packages/app/src/app/pages/Dashboard/Components/Folder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Folder = (folderItem: DashboardFolder) => {
const {
dashboard: { renameFolder },
} = useActions();
const { isTeamEditor } = useWorkspaceAuthorization();
const { hasEditorAccess } = useWorkspaceAuthorization();

const {
name = '',
Expand Down Expand Up @@ -95,7 +95,7 @@ export const Folder = (folderItem: DashboardFolder) => {

/* Drop target logic */

const accepts = isTeamEditor ? ['sandbox'] : [];
const accepts = hasEditorAccess ? ['sandbox'] : [];

const [{ isOver, canDrop }, dropRef] = useDrop({
accept: accepts,
Expand All @@ -114,7 +114,7 @@ export const Folder = (folderItem: DashboardFolder) => {

const [, dragRef, preview] = useDrag({
item: folderItem,
canDrag: isTeamEditor,
canDrag: hasEditorAccess,
end: (item, monitor) => {
const dropResult = monitor.getDropResult();

Expand All @@ -127,7 +127,7 @@ export const Folder = (folderItem: DashboardFolder) => {

const dragProps = {
ref: dragRef,
onDragStart: isTeamEditor ? (event => onDragStart(event, path, 'folder')) : undefined,
onDragStart: hasEditorAccess ? (event => onDragStart(event, path, 'folder')) : undefined,
};

React.useEffect(() => {
Expand Down Expand Up @@ -188,7 +188,7 @@ export const Folder = (folderItem: DashboardFolder) => {
onClick,
onDoubleClick,
// edit mode
editing: isRenaming && selected && isTeamEditor,
editing: isRenaming && selected && hasEditorAccess,
isNewFolder: false,
isDragging,
newName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const Header = ({
const location = useLocation();
const { modalOpened, dashboard: dashboardActions } = useActions();
const { dashboard } = useAppState();
const { isTeamEditor } = useWorkspaceAuthorization();
const { hasEditorAccess } = useWorkspaceAuthorization();

const repositoriesListPage =
location.pathname.includes('/repositories') &&
Expand Down Expand Up @@ -70,7 +70,7 @@ export const Header = ({
)}
</Stack>
<Stack gap={1} align="center">
{location.pathname.includes('/sandboxes') && isTeamEditor && (
{location.pathname.includes('/sandboxes') && hasEditorAccess && (
<Button onClick={createNewFolder} variant="ghost" autoWidth>
<Icon
name="folder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export const FolderMenu = ({ folder, setRenaming }: FolderMenuProps) => {
const {
dashboard: { deleteFolder },
} = useActions();
const { isTeamEditor } = useWorkspaceAuthorization();
const { hasEditorAccess } = useWorkspaceAuthorization();
const { visible, setVisibility, position } = React.useContext(Context);

if (!isTeamEditor) {
if (!hasEditorAccess) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const SandboxesPage = () => {
const items = useFilteredItems(currentPath, cleanParam, level);
const actions = useActions();
const { isFrozen } = useWorkspaceLimits();
const { isTeamEditor } = useWorkspaceAuthorization();
const { hasEditorAccess } = useWorkspaceAuthorization();
const {
dashboard: { allCollections },
activeTeam,
Expand Down Expand Up @@ -89,7 +89,7 @@ export const SandboxesPage = () => {
{isEmpty ? (
<EmptyPage.StyledWrapper>
<EmptyPage.StyledGrid>
{(isTeamEditor) && (
{hasEditorAccess && (
<ActionCard
icon="plus"
disabled={isFrozen}
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/app/pages/Dashboard/Sidebar/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export const ContextMenu: React.FC<ContextMenuProps> = ({
setNewFolderPath,
}) => {
const { deleteFolder } = useActions().dashboard;
const { isTeamEditor } = useWorkspaceAuthorization();
const { hasEditorAccess } = useWorkspaceAuthorization();

const history = useHistory();
const location = useLocation();

if (!visible || !folder || !isTeamEditor) {
if (!visible || !folder || !hasEditorAccess) {
return null;
};

Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/app/pages/Dashboard/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
const showRespositories = !state.environment.isOnPrem;

const { ubbBeta } = useWorkspaceFeatureFlags();
const { isPrimarySpace, isTeamAdmin, isTeamEditor } = useWorkspaceAuthorization();
const { isPrimarySpace, hasAdminAccess, hasEditorAccess } = useWorkspaceAuthorization();
const { isPro } = useWorkspaceSubscription();

const showTemplates = state.activeTeam
Expand Down Expand Up @@ -158,7 +158,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
path={dashboardUrls.getStarted(activeTeam)}
icon="documentation"
/>
{isTeamAdmin && (
{hasAdminAccess && (
<RowItem
name="Upgrade"
page="external"
Expand Down Expand Up @@ -225,7 +225,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
? [{ path: newFolderPath, name: '', parent: null }]
: []),
]}
canEdit={isTeamEditor}
canEdit={hasEditorAccess}
/>

{showTemplates ? (
Expand Down
Loading