From cac92558ebc123154e65bbd31f835036c43e323a Mon Sep 17 00:00:00 2001 From: Robin Pyon Date: Wed, 10 Jan 2024 00:19:13 +0000 Subject: [PATCH] fix: update reverse trial button styles, add tooltips to nav button and localize --- .../sanity/src/core/i18n/bundles/studio.ts | 6 +++ .../navbar/free-trial/FreeTrialButton.tsx | 44 +++++++------------ .../navbar/navDrawer/ManageMenu.tsx | 3 ++ 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/packages/sanity/src/core/i18n/bundles/studio.ts b/packages/sanity/src/core/i18n/bundles/studio.ts index afb43fdd36e..d9e1dc10a6e 100644 --- a/packages/sanity/src/core/i18n/bundles/studio.ts +++ b/packages/sanity/src/core/i18n/bundles/studio.ts @@ -411,6 +411,12 @@ export const studioLocaleStrings = defineLocalesResources('studio', { 'form.validation.summary.warnings-count_one': '{{count}} warning', 'form.validation.summary.warnings-count_other': '{{count}} warnings', + /** Tooltip for free trial navbar button indicating remaining days */ + 'free-trial.tooltip.days-count_one': '{{count}} day left in trial', + 'free-trial.tooltip.days-count_other': '{{count}} days left in trial', + /** Tooltip for free trial navbar button, once trial has ended */ + 'free-trial.tooltip.trial-finished': 'Upgrade your project', + /** * Label for "contact sales" call to action * These are titles for fallback links in the event the help & resources endpoint isn't able to be fetched diff --git a/packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx b/packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx index 9fd6d2bbc01..c8fccc8ecae 100644 --- a/packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx +++ b/packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx @@ -1,23 +1,12 @@ import styled from 'styled-components' -import { - // eslint-disable-next-line no-restricted-imports - Button as UIButton, // Button with necessary custom styles. - Text, - Card, -} from '@sanity/ui' +import {Card, Text} from '@sanity/ui' import {BoltIcon} from '@sanity/icons' import {purple, yellow} from '@sanity/color' import {useTranslation} from 'react-i18next' import {forwardRef} from 'react' import {Button} from '../../../../../ui-components' -const StyledButton = styled(UIButton)` - padding: 2px; - margin: -2px; - position: relative; -` - const CenteredStroke = styled.div` position: absolute; top: 50%; @@ -34,7 +23,7 @@ const SvgFilledOutline = ({daysLeft, totalDays}: OutlineProps) => { const progress = totalDays - daysLeft const percentage = Math.round((progress / totalDays) * 100) - const radius = 12.5 + const radius = 10 const strokeDasharray = 2 * Math.PI * radius const strokeDashOffset = strokeDasharray * ((100 - percentage) / 100) const strokeWidth = 1.2 @@ -82,25 +71,24 @@ export const FreeTrialButtonTopbar = forwardRef(function FreeTrialButtonTopbar( {toggleShowContent, daysLeft, totalDays}: FreeTrialButtonProps, ref: React.Ref, ) { - if (!daysLeft) { - return ( - ) }) diff --git a/packages/sanity/src/core/studio/components/navbar/navDrawer/ManageMenu.tsx b/packages/sanity/src/core/studio/components/navbar/navDrawer/ManageMenu.tsx index 16625323bc2..d71a338dfae 100644 --- a/packages/sanity/src/core/studio/components/navbar/navDrawer/ManageMenu.tsx +++ b/packages/sanity/src/core/studio/components/navbar/navDrawer/ManageMenu.tsx @@ -17,6 +17,9 @@ export function ManageMenu() { + + +