chore: format all frontend files (#430)

This commit is contained in:
tecvan
2025-07-31 23:15:48 +08:00
committed by GitHub
parent 8b078ff013
commit 6995cec404
8787 changed files with 11975 additions and 10924 deletions

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @type { import('storybook-react-rspack').StorybookConfig } */
const config = {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @type { import('@storybook/react').Preview } */
const preview = {
parameters: {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mitt from 'mitt';
import {
renderHook,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { it, expect } from 'vitest';
import { getFileExtensionAndName } from '../../src/utils/file-name';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { getImageDisplayAttribute } from '../../src/utils/image/get-image-display-attribute';
// Test Suite

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type PropsWithChildren } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { cva, type VariantProps } from 'class-variance-authority';
const audioStaticToastVariants = cva(['px-24px', 'py-10px', 'rounded-[99px]'], {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from 'classnames';
import { Space } from '@coze-arch/coze-design';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface AudioWaveProps {
size: 'small' | 'medium' | 'large';
type: 'default' | 'primary' | 'warning';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type AudioWaveProps } from './type';
export const getBarHeights = (

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { forwardRef, useEffect, useRef, useState } from 'react';
import { useThrottleFn } from 'ahooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ReactNode, type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ReactNode, type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ReactNode, type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
forwardRef,
useImperativeHandle,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
useState,
type KeyboardEvent,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from 'classnames';
import { Divider, Typography } from '@coze-arch/coze-design';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './chat-input';
export * from './chat-upload';
export * from './on-boarding';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
type CSSProperties,
useState,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { cva, type VariantProps } from 'class-variance-authority';
export const botInfoNameVariants = cva(

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface IThinkingPlaceholderProps {
className?: string;
theme?: 'primary' | 'whiteness' | 'none' | 'grey';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { cva, type VariantProps } from 'class-variance-authority';
const thinkingPlaceholderVariants = cva(

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const MODE_CONFIG = {
pc: {
size: {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useRef } from 'react';
import { useSize } from 'ahooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useState, useEffect } from 'react';
import { isEmpty } from 'lodash-es';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface GradientPosition {
left?: number;
right?: number;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MODE_CONFIG } from './const';
// Enter the transparency factor and color to return a new color

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { forwardRef } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ReactNode, type FC } from 'react';
import {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ComponentPropsWithRef, type FC } from 'react';
import { MdBoxLazy } from '@coze-arch/bot-md-box-adapter/lazy';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { PropsWithChildren } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './content-box';
export * from './tooltips';
export * from './message-box';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type PropsWithChildren, type FC } from 'react';
export const DefaultAvatarWrap: FC<PropsWithChildren> = ({ children }) => (
<>{children}</>

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useRef, useEffect, type ComponentType } from 'react';
import { type FallbackProps } from '@coze-arch/logger';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import { Layout } from '@coze-common/chat-uikit-shared';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
type PropsWithChildren,
type FC,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ReactNode } from 'react';
import {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { exhaustiveCheckSimple } from '@coze-common/chat-area-utils';
import { type MessageBoxInnerVariantProps } from '../../../variants/message-box-inner-variants';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { cva, type VariantProps } from 'class-variance-authority';
export const messageBoxContainerVariants = cva(['flex', 'flex-row', 'my-0'], {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from 'classnames';
import { formatMessageBoxContentTime } from '../../../utils/date-time';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from 'classnames';
import { IconCozLongArrowUp } from '@coze-arch/coze-design/icons';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type CSSProperties } from 'react';
export interface ToNewestTipProps {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import { Tooltip, type TooltipProps } from '@coze-arch/coze-design';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import cs from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FileTypeEnum } from '@coze-common/chat-core/shared/const';
import EXCELSuccess from '../../../../../assets/file/xlsx-success.svg';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
type IFileAttributeKeys,
type IFileCardTooltipsCopyWritingConfig,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { cva, type VariantProps } from 'class-variance-authority';
const fileCardVariants = cva(

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ErrorBoundary } from 'react-error-boundary';
import { type FC } from 'react';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './file-content';
export * from './image-content';
export * from './plain-text-content';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import { type FileMixItem } from '@coze-common/chat-core';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import { type ImageMixItem } from '@coze-common/chat-core';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ReactNode } from 'react';
import {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ReactNode, type FC } from 'react';
import { type TextMixItem } from '@coze-common/chat-core';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import { type MessageMentionListFields } from '@coze-common/chat-core/src/message/types';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import { typeSafeJsonParse } from '@coze-common/chat-area-utils';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
type ISimpleFunctionContentCopywriting,
type IBaseContentProps,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useEffect, useState, type FC } from 'react';
import { isEmpty } from 'lodash-es';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useState, type FC, useEffect } from 'react';
import { type IImageMessageContentProps } from '../image-content';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from 'classnames';
import { Image } from '@coze-arch/coze-design';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { cva, type VariantProps } from 'class-variance-authority';
const suggestionItemVariants = cva(
[

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { SuggestionItem } from './components/suggestion-item';
export { SuggestionItem };

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type MouseEvent, type FC, useRef } from 'react';
import {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './chat';
export * from './common';
export * from './contents';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable react-hooks/rules-of-hooks */
import {
type CSSProperties,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { type FC, useEffect, useRef } from 'react';
import { isObject, isString, omit } from 'lodash-es';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const safeParseUrl = (url: string) => {
try {
return new URL(url);

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type MessageType } from '@coze-common/chat-core';
export const MESSAGE_TYPE_VALID_IN_TEXT_LIST: Omit<MessageType[], ''> = [

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const NO_MESSAGE_ID_MARK = 'NO_MESSAGE_ID';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const MESSAGE_BOX_CONTAINER_MARGIN_X_PC = 24;
export const MESSAGE_BOX_CONTAINER_MARGIN_X_MOBILE = 10;
export const MESSAGE_BOX_AVATAR_SIZE = 32;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createContext, type ComponentType, type ReactNode } from 'react';
import { type SendButtonProps } from '@coze-common/chat-uikit-shared';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useContext } from 'react';
import {

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { LocalCacheContext, useLocalCache } from './local-cache-context';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createContext, useContext } from 'react';
import {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createContext, useContext } from 'react';
import {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createContext, useContext } from 'react';
import { type IEventCallbacks } from '@coze-common/chat-uikit-shared';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types='@coze-arch/bot-typings' />
declare module '*.svg';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type RefObject, useEffect, useRef } from 'react';
import { useLatest, useKeyPress } from 'ahooks';

View File

@@ -13,4 +13,3 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useEffect, type RefObject } from 'react';
import { useDebounceFn } from 'ahooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useState } from 'react';
import type { LocalCacheKey, StoreStruct } from '../utils/local-cache/type';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './components';
export * from './utils';
export { FullWidthAligner } from './components/common/full-width-aligner';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const convertBytes = (bytes: number, decimals = 2) => {
if (!bytes) {
return '0 Byte';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import dayjs from 'dayjs';
export const formatMessageBoxContentTime = (contentTime: number): string => {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const defaultEnable = (value?: boolean) => {
if (typeof value === 'undefined') {
return true;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const getFileExtensionAndName = (fileName: string) => {
const dotIndex = fileName.lastIndexOf('.');
if (dotIndex < 0) {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const getImageDisplayAttribute = (
width: number,
height: number,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './convert-bytes';
export * from './default-enable';
export * from './is-file';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Is it under the Webkit kernel browser of the Apple platform?
* Note: This judgment condition is not equal to under Apple devices, because some Apple devices (such as Mac) can run non-native Webkit engine browsers, such as Chromium (Blink)

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type IFileContent } from '@coze-common/chat-uikit-shared';
export const isFile = (

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
type IFunctionCallContent,
type IMessage,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type IImageContent } from '@coze-common/chat-uikit-shared';
// eslint-disable-next-line @typescript-eslint/no-explicit-any

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ISuggestionContent } from '@coze-common/chat-uikit-shared';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const isSuggestion = (value: any): value is ISuggestionContent =>

Some files were not shown because too many files have changed in this diff Show More