Skip to content

Revert "[Permissions] Force open title input for role label when empty" #12817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
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 @@ -68,7 +68,7 @@ export const SettingsRoleSettings = ({
label: value,
});
}}
placeholder={t`Untitled Role`}
placeholder={t`Role name`}
disabled={!isEditable}
/>
</StyledInputsContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { SettingsRoleAssignment } from '@/settings/roles/role-assignment/compone
import { SettingsRolePermissions } from '@/settings/roles/role-permissions/components/SettingsRolePermissions';
import { SettingsRoleSettings } from '@/settings/roles/role-settings/components/SettingsRoleSettings';
import { SettingsRoleLabelContainer } from '@/settings/roles/role/components/SettingsRoleLabelContainer';
import { SettingsRoleLabelContainerEffect } from '@/settings/roles/role/components/SettingsRoleLabelContainerEffect';
import { SETTINGS_ROLE_DETAIL_TABS } from '@/settings/roles/role/constants/SettingsRoleDetailTabs';
import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState';
import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settingsPersistedRoleFamilyState';
Expand All @@ -20,7 +19,6 @@ import { TabList } from '@/ui/layout/tab-list/components/TabList';
import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { getOperationName } from '@apollo/client/utilities';
import styled from '@emotion/styled';
import { t } from '@lingui/core/macro';
import { useRecoilState, useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared/utils';
Expand Down Expand Up @@ -54,10 +52,6 @@ const ROLE_BASIC_KEYS: Array<keyof Role> = [
'canDestroyAllObjectRecords',
];

const StyledUntitledRole = styled.span`
color: ${({ theme }) => theme.font.color.tertiary};
`;

export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => {
const activeTabId = useRecoilComponentValueV2(
activeTabIdComponentState,
Expand Down Expand Up @@ -281,12 +275,7 @@ export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => {

return (
<SubMenuTopBarContainer
title={
<>
<SettingsRoleLabelContainer roleId={roleId} />
<SettingsRoleLabelContainerEffect roleId={roleId} />
</>
}
title={<SettingsRoleLabelContainer roleId={roleId} />}
links={[
{
children: 'Workspace',
Expand All @@ -297,19 +286,14 @@ export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => {
href: getSettingsPath(SettingsPath.Roles),
},
{
children:
isDefined(settingsDraftRole.label) &&
settingsDraftRole.label !== '' ? (
settingsDraftRole.label
) : (
<StyledUntitledRole>{t`Untitled Role`}</StyledUntitledRole>
),
children: settingsDraftRole.label,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: No fallback display when label is empty. Consider showing 'Untitled Role' or similar placeholder.

},
]}
actionButton={
isRoleEditable && isDirty ? (
isRoleEditable &&
isDirty && (
<SaveAndCancelButtons onSave={handleSave} onCancel={handleCancel} />
) : null
)
}
>
<SettingsPageContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ export const SettingsRoleLabelContainer = ({
settingsDraftRoleFamilyState(roleId),
);

const titleInputInstanceId = `settings-role-label-${roleId}`;

const handleChange = (newValue: string) => {
setSettingsDraftRole({
...settingsDraftRole,
Expand All @@ -45,9 +43,8 @@ export const SettingsRoleLabelContainer = ({
sizeVariant="md"
value={settingsDraftRole.label}
onChange={handleChange}
placeholder={t`Untitled Role`}
placeholder={t`Role name`}
hotkeyScope={ROLE_LABEL_EDIT_HOTKEY_SCOPE}
instanceId={titleInputInstanceId}
/>
</StyledHeaderTitle>
);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { useRef, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';

import { useRegisterInputEvents } from '@/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents';
import { titleInputComponentState } from '@/ui/input/states/titleInputComponentState';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
import styled from '@emotion/styled';
import { OverflowingTextWithTooltip } from 'twenty-ui/display';

Expand All @@ -27,7 +25,6 @@ type InputProps = {

export type TitleInputProps = {
disabled?: boolean;
instanceId: string;
} & InputProps;

const StyledDiv = styled.div<{
Expand Down Expand Up @@ -145,18 +142,14 @@ export const TitleInput = ({
onClickOutside,
onTab,
onShiftTab,
instanceId,
}: TitleInputProps) => {
const [isTitleInputOpen, setIsTitleInputOpen] = useRecoilComponentStateV2(
titleInputComponentState,
instanceId,
);
const [isOpened, setIsOpened] = useState(false);

const { setHotkeyScopeAndMemorizePreviousScope } = usePreviousHotkeyScope();

return (
<>
{isTitleInputOpen ? (
{isOpened ? (
<Input
sizeVariant={sizeVariant}
value={value}
Expand All @@ -168,15 +161,15 @@ export const TitleInput = ({
onClickOutside={onClickOutside}
onTab={onTab}
onShiftTab={onShiftTab}
setIsOpened={setIsTitleInputOpen}
setIsOpened={setIsOpened}
/>
) : (
<StyledDiv
sizeVariant={sizeVariant}
disabled={disabled}
onClick={() => {
if (!disabled) {
setIsTitleInputOpen(true);
setIsOpened(true);
setHotkeyScopeAndMemorizePreviousScope({
scope: hotkeyScope,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const meta: Meta<typeof TitleInput> = {
placeholder: 'Enter title',
hotkeyScope: 'titleInput',
sizeVariant: 'md',
instanceId: 'title-input-story',
},
argTypes: {
hotkeyScope: { control: false },
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export const WorkflowStepHeader = ({
onClickOutside={saveTitle}
onTab={saveTitle}
onShiftTab={saveTitle}
instanceId="workflow-step-title"
/>
</StyledHeaderTitle>
<StyledHeaderType>{headerType}</StyledHeaderType>
Expand Down