diff --git a/packages/sanity/src/tasks/plugin/TasksStudioNavbar.tsx b/packages/sanity/src/tasks/plugin/TasksStudioNavbar.tsx index 0edb18ed874..ad61e1d26f2 100644 --- a/packages/sanity/src/tasks/plugin/TasksStudioNavbar.tsx +++ b/packages/sanity/src/tasks/plugin/TasksStudioNavbar.tsx @@ -1,5 +1,5 @@ import {PanelRightIcon, TaskIcon} from '@sanity/icons' -import {useCallback, useMemo} from 'react' +import {useMemo} from 'react' import {type NavbarProps, useTranslation} from 'sanity' import {tasksLocaleNamespace} from '../i18n' @@ -9,19 +9,10 @@ const EMPTY_ARRAY: [] = [] function TasksStudioNavbarInner(props: NavbarProps) { const { - handleCloseTasks, handleOpenTasks, state: {isOpen}, } = useTasksNavigation() - const handleAction = useCallback(() => { - if (isOpen) { - handleCloseTasks() - } else { - handleOpenTasks() - } - }, [handleCloseTasks, handleOpenTasks, isOpen]) - const {t} = useTranslation(tasksLocaleNamespace) const actions = useMemo((): NavbarProps['__internal_actions'] => { @@ -31,7 +22,7 @@ function TasksStudioNavbarInner(props: NavbarProps) { icon: PanelRightIcon, location: 'topbar', name: 'tasks-topbar', - onAction: handleAction, + onAction: handleOpenTasks, selected: isOpen, title: t('actions.open.text'), }, @@ -39,12 +30,12 @@ function TasksStudioNavbarInner(props: NavbarProps) { icon: TaskIcon, location: 'sidebar', name: 'tasks-sidebar', - onAction: handleAction, + onAction: handleOpenTasks, selected: isOpen, title: t('actions.open.text'), }, ] - }, [handleAction, isOpen, props?.__internal_actions, t]) + }, [handleOpenTasks, isOpen, props?.__internal_actions, t]) return props.renderDefault({ ...props, diff --git a/packages/sanity/src/tasks/src/tasks/components/activity/TasksActivityCommentInput.tsx b/packages/sanity/src/tasks/src/tasks/components/activity/TasksActivityCommentInput.tsx index 993dcdc2d45..8fb57349e58 100644 --- a/packages/sanity/src/tasks/src/tasks/components/activity/TasksActivityCommentInput.tsx +++ b/packages/sanity/src/tasks/src/tasks/components/activity/TasksActivityCommentInput.tsx @@ -64,7 +64,7 @@ export function TasksActivityCommentInput(props: TasksCommentActivityInputProps) return ( - + { + // Make sure we have valid subscriber IDs + return subscriberIdsProp?.filter(Boolean) || EMPTY_ARRAY + }, [subscriberIdsProp]) return ( - {subscriberIds && - subscriberIds.map((subscriberId) => ( - - - - ))} + {subscriberIds.map((subscriberId) => ( + + + + ))} ) diff --git a/packages/sanity/src/tasks/src/tasks/components/form/fields/assignee/AssigneeEditFormField.tsx b/packages/sanity/src/tasks/src/tasks/components/form/fields/assignee/AssigneeEditFormField.tsx index 280d838943b..d09085aefb4 100644 --- a/packages/sanity/src/tasks/src/tasks/components/form/fields/assignee/AssigneeEditFormField.tsx +++ b/packages/sanity/src/tasks/src/tasks/components/form/fields/assignee/AssigneeEditFormField.tsx @@ -20,11 +20,13 @@ const StyledButton = styled(Button)` padding: 3px 6px; ` -export function AssigneeEditFormField(props: { +interface AssigneeEditFormFieldProps { value: string | undefined path: Path onChange: (patch: FormPatch | PatchEvent | FormPatch[]) => void -}) { +} + +export function AssigneeEditFormField(props: AssigneeEditFormFieldProps) { const {value, onChange, path} = props const subscribers = useFormValue(['subscribers']) as string[] | undefined const {mentionOptions} = useMentionUser() @@ -33,10 +35,11 @@ export function AssigneeEditFormField(props: { [mentionOptions.data, value], ) const {t} = useTranslation(tasksLocaleNamespace) + const onSelect = useCallback( (userId: string) => { onChange(set(userId, path)) - if (subscribers && !subscribers.includes(userId)) { + if (subscribers && !subscribers.includes(userId) && userId) { onChange(set([...subscribers, userId], ['subscribers'])) } }, diff --git a/packages/sanity/src/tasks/src/tasks/components/list/TasksListItem.tsx b/packages/sanity/src/tasks/src/tasks/components/list/TasksListItem.tsx index 62e7246b6ef..adbb8c4bfdb 100644 --- a/packages/sanity/src/tasks/src/tasks/components/list/TasksListItem.tsx +++ b/packages/sanity/src/tasks/src/tasks/components/list/TasksListItem.tsx @@ -27,11 +27,6 @@ interface TasksListItemProps const TitleButton = styled(UIButton)` width: 100%; max-width: 100%; - - &:hover { - text-decoration: underline; - background-color: transparent; - } ` const TaskDetailsRoot = styled(Flex)` @@ -83,15 +78,8 @@ function TaskDueDate({dueBy}: {dueBy: string}) { ) } -export function TasksListItem({ - assignedTo, - title, - dueBy, - target, - onSelect, - documentId, - status, -}: TasksListItemProps) { +export function TasksListItem(props: TasksListItemProps) { + const {assignedTo, title, dueBy, target, onSelect, documentId, status} = props const targetDocument = useMemo(() => getTargetDocumentMeta(target), [target]) return ( @@ -103,7 +91,7 @@ export function TasksListItem({ - + {title || 'Untitled'}