From 0659c27b7c6e699da4c14e61e9b00f4802712296 Mon Sep 17 00:00:00 2001 From: Pedro Bonamin <46196328+pedrobonamin@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:57:20 +0200 Subject: [PATCH] chore(corel): add eslintrc change, remove progress icon and update types (#7050) --- .eslintrc.cjs | 10 +++ .../components/BundleIcon/BundleIcon.tsx | 47 ------------ .../components/BundlesTable/BundleHeader.tsx | 2 - .../components/BundlesTable/BundleRow.tsx | 4 +- .../components/progressIcon/ProgressIcon.tsx | 76 ------------------- .../sanity/src/core/releases/constants.ts | 2 - .../sanity/src/core/releases/plugin/index.ts | 5 +- .../src/core/releases/tool/BundleDetail.tsx | 2 - .../core/releases/tool/BundlesOverview.tsx | 2 - .../sanity/src/core/store/bundles/types.ts | 2 +- .../sanity/src/core/tasks/plugin/index.tsx | 2 +- 11 files changed, 16 insertions(+), 138 deletions(-) delete mode 100644 packages/sanity/src/core/releases/components/BundleIcon/BundleIcon.tsx delete mode 100644 packages/sanity/src/core/releases/components/progressIcon/ProgressIcon.tsx delete mode 100644 packages/sanity/src/core/releases/constants.ts diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 95f9c94b17d..bb06ebc51de 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -161,6 +161,16 @@ const config = { }, }, + // Ignore i18n in releases files. TODO: Remove this before moving releases to GA. + { + files: ['**/*/core/releases/**/*'], + rules: { + 'i18next/no-literal-string': 'off', + '@sanity/i18n/no-attribute-string-literals': 'off', + '@sanity/i18n/no-attribute-template-literals': 'off', + }, + }, + // Files to disable i18n literals, { files: ['./**/*/__workshop__/**/*', './dev/**/*', './examples/**/*', '**/*/debug/**/*'], diff --git a/packages/sanity/src/core/releases/components/BundleIcon/BundleIcon.tsx b/packages/sanity/src/core/releases/components/BundleIcon/BundleIcon.tsx deleted file mode 100644 index 9920b91acb3..00000000000 --- a/packages/sanity/src/core/releases/components/BundleIcon/BundleIcon.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import {ChevronDownIcon, Icon} from '@sanity/icons' -// eslint-disable-next-line camelcase -import {Box, Flex, Text} from '@sanity/ui' -import {type CSSProperties} from 'react' - -import {type SanityVersionIcon} from '../../../versions/types' - -export function BundleIcon( - props: Partial & {openButton?: boolean; padding?: number; title?: string}, -): JSX.Element { - const {tone, icon, openButton, padding = 3, title} = props - - return ( - - {icon && ( - - - - - - )} - {title && ( - - {title} - - )} - {openButton && ( - - - - - - )} - - ) -} diff --git a/packages/sanity/src/core/releases/components/BundlesTable/BundleHeader.tsx b/packages/sanity/src/core/releases/components/BundlesTable/BundleHeader.tsx index 6a89455d4ad..b4c01941bb2 100644 --- a/packages/sanity/src/core/releases/components/BundlesTable/BundleHeader.tsx +++ b/packages/sanity/src/core/releases/components/BundlesTable/BundleHeader.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @sanity/i18n/no-attribute-string-literals */ -/* eslint-disable i18next/no-literal-string */ import {SearchIcon} from '@sanity/icons' import {Button, Card, Flex, Stack, TextInput} from '@sanity/ui' diff --git a/packages/sanity/src/core/releases/components/BundlesTable/BundleRow.tsx b/packages/sanity/src/core/releases/components/BundlesTable/BundleRow.tsx index 4388bef2ee2..fd5fc96e6b2 100644 --- a/packages/sanity/src/core/releases/components/BundlesTable/BundleRow.tsx +++ b/packages/sanity/src/core/releases/components/BundlesTable/BundleRow.tsx @@ -2,8 +2,8 @@ import {Box, Card, Flex, Stack, Text} from '@sanity/ui' import {useRouter} from 'sanity/router' import {type BundleDocument} from '../../../store/bundles/types' +import {VersionBadge} from '../../../versions/components/VersionBadge' import {shortRelativeDate} from '../../utils/shortRelativeDate' -import {BundleIcon} from '../BundleIcon/BundleIcon' import {BundleMenuButton} from '../BundleMenuButton/BundleMenuButton' type Props = { @@ -26,7 +26,7 @@ export function BundleRow({bundle}: Props) { > - + diff --git a/packages/sanity/src/core/releases/components/progressIcon/ProgressIcon.tsx b/packages/sanity/src/core/releases/components/progressIcon/ProgressIcon.tsx deleted file mode 100644 index c91408c77e1..00000000000 --- a/packages/sanity/src/core/releases/components/progressIcon/ProgressIcon.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import {type ForwardedRef, forwardRef, type SVGProps} from 'react' - -function partialCircle(cx: number, cy: number, r: number, start: number, end: number) { - const length = end - start - if (length === 0) return [] - - const fromX = r * Math.cos(start) + cx - const fromY = r * Math.sin(start) + cy - const toX = r * Math.cos(end) + cx - const toY = r * Math.sin(end) + cy - const large = Math.abs(length) <= Math.PI ? '0' : '1' - const sweep = length < 0 ? '0' : '1' - - return [ - ['M', fromX, fromY], - ['A', r, r, 0, large, sweep, toX, toY], - ] -} - -const degreesToRadians = (degrees: number) => (degrees * Math.PI) / 180 - -type Props = {progress: number} & SVGProps - -/** - * @internal - */ -export const ProgressIcon = forwardRef(function ProgressCircleIcon( - props: Props, - ref: ForwardedRef, -) { - const {progress, ...rest} = props - - return ( - - vs.join(' ')) - .join(' ')} L 12.5 12.5 Z`} - fill="currentColor" - stroke="currentColor" - strokeWidth={1.2} - strokeLinejoin="round" - /> - - - ) -}) - -/** - * @internal - */ -export const ProgressHalfIcon = forwardRef(function ProgressHalfCircleIcon( - props: Omit, - ref: ForwardedRef, -) { - return -}) diff --git a/packages/sanity/src/core/releases/constants.ts b/packages/sanity/src/core/releases/constants.ts deleted file mode 100644 index 59cc7d9a660..00000000000 --- a/packages/sanity/src/core/releases/constants.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const TOOL_NAME = 'releases' -export const TOOL_TITLE = 'Releases' diff --git a/packages/sanity/src/core/releases/plugin/index.ts b/packages/sanity/src/core/releases/plugin/index.ts index 76181b54746..7b44b2fa345 100644 --- a/packages/sanity/src/core/releases/plugin/index.ts +++ b/packages/sanity/src/core/releases/plugin/index.ts @@ -1,7 +1,6 @@ import {route} from 'sanity/router' import {definePlugin} from '../../config' -import {TOOL_NAME, TOOL_TITLE} from '../constants' import {ReleasesTool} from '../tool/ReleasesTool' /** @@ -17,8 +16,8 @@ export const releases = definePlugin({ tools: [ { - name: TOOL_NAME, - title: TOOL_TITLE, + name: 'releases', + title: 'Releases', component: ReleasesTool, router: route.create('/', [route.create('/:bundleId')]), }, diff --git a/packages/sanity/src/core/releases/tool/BundleDetail.tsx b/packages/sanity/src/core/releases/tool/BundleDetail.tsx index 686500e323b..17702da421b 100644 --- a/packages/sanity/src/core/releases/tool/BundleDetail.tsx +++ b/packages/sanity/src/core/releases/tool/BundleDetail.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @sanity/i18n/no-attribute-string-literals */ -/* eslint-disable i18next/no-literal-string */ import {ArrowLeftIcon, PublishIcon, StarIcon} from '@sanity/icons' import {Box, Button, Card, Flex, Text} from '@sanity/ui' import {useMemo, useState} from 'react' diff --git a/packages/sanity/src/core/releases/tool/BundlesOverview.tsx b/packages/sanity/src/core/releases/tool/BundlesOverview.tsx index 50006aed4e5..1db4907c970 100644 --- a/packages/sanity/src/core/releases/tool/BundlesOverview.tsx +++ b/packages/sanity/src/core/releases/tool/BundlesOverview.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @sanity/i18n/no-attribute-string-literals */ -/* eslint-disable i18next/no-literal-string */ import {AddIcon} from '@sanity/icons' import {Box, Button, type ButtonMode, Card, Container, Flex, Heading, Stack, Text} from '@sanity/ui' import {isBefore} from 'date-fns' diff --git a/packages/sanity/src/core/store/bundles/types.ts b/packages/sanity/src/core/store/bundles/types.ts index 9ef7859f48e..3389aa3c2a1 100644 --- a/packages/sanity/src/core/store/bundles/types.ts +++ b/packages/sanity/src/core/store/bundles/types.ts @@ -10,5 +10,5 @@ export interface BundleDocument extends SanityDocument { tone?: ButtonTone icon?: IconSymbol authorId: string - publishedAt?: Date + publishedAt?: string } diff --git a/packages/sanity/src/core/tasks/plugin/index.tsx b/packages/sanity/src/core/tasks/plugin/index.tsx index e97231e70aa..52a46e27b02 100644 --- a/packages/sanity/src/core/tasks/plugin/index.tsx +++ b/packages/sanity/src/core/tasks/plugin/index.tsx @@ -18,7 +18,7 @@ export const TASKS_NAME = 'sanity/tasks' * @beta */ export const tasks = definePlugin({ - name: 'sanity/tasks', + name: TASKS_NAME, // eslint-disable-next-line camelcase __internal_tasks: { footerAction: ,