Skip to content
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

feat(tasks): add feedback link to tasks #6256

Merged
merged 2 commits into from
Apr 9, 2024
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
2 changes: 2 additions & 0 deletions packages/sanity/src/tasks/i18n/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ const tasksLocaleStrings = defineLocalesResources('tasks', {
'form.status.success': 'Task created',
/** The text displayed when no tasks are found */
'list.empty.text': 'No tasks',
/** The text displayed at the bottom of the tasks list inviting users provide feedback */
'list.feedback.text': 'Help us improve, <Link>share feedback on Tasks</Link> ',
/** The label for the copy link menu item */
'menuitem.copylink.text': 'Copy link to task',
/** The label for the delete task menu item */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {LaunchIcon} from '@sanity/icons'
import {Box, Text} from '@sanity/ui'
import {Translate, useTranslation} from 'sanity'
import {styled} from 'styled-components'

import {tasksLocaleNamespace} from '../../../../i18n'

const FEEDBACK_FORM_LINK = 'https://snty.link/tasks-feedback'

const Span = styled.span`
margin-right: 0.2em;
`

const Link = styled.a`
white-space: nowrap;
> [data-sanity-icon] {
--card-icon-color: var(--card-link-color);
}
`

function LinkComponent(props: {children?: React.ReactNode}) {
return (
<Link href={FEEDBACK_FORM_LINK} target="_blank" rel="noreferrer">
<Span>{props.children}</Span> <LaunchIcon />
</Link>
)
}

export function TasksListFeedbackFooter() {
const {t} = useTranslation(tasksLocaleNamespace)
return (
<Box padding={4}>
<Text muted size={1}>
<Translate i18nKey="list.feedback.text" t={t} components={{Link: LinkComponent}} />
</Text>
</Box>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {useTasks, useTasksEnabled, useTasksNavigation} from '../../context'
import {TasksFormBuilder} from '../form'
import {TasksList} from '../list/TasksList'
import {TasksUpsellPanel} from '../upsell/TasksUpsellPanel'
import {TasksListFeedbackFooter} from './TaskListFeedbackFooter'
import {TasksListTabs} from './TasksListTabs'
import {TasksSidebarHeader} from './TasksSidebarHeader'

Expand Down Expand Up @@ -96,6 +97,7 @@ export function TasksStudioSidebarInner() {
>
{content}
</ContentFlex>
{viewMode === 'list' && <TasksListFeedbackFooter />}
</RootCard>
)
}
Expand Down
Loading