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: Update AddNodesSider component to use Switch instead of Tag for… #1971

Merged
merged 1 commit into from
Sep 4, 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
13 changes: 9 additions & 4 deletions web/components/flow/add-nodes-sider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { IFlowNode } from '@/types/flow';
import { FLOW_NODES_KEY } from '@/utils';
import { CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
import type { CollapseProps } from 'antd';
import { Badge, Collapse, Input, Layout, Space, Tag } from 'antd';
import { Badge, Collapse, Input, Layout, Space, Switch } from 'antd';
import classnames from 'classnames';
import React, { useContext, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import StaticNodes from './static-nodes';
Expand Down Expand Up @@ -199,9 +200,13 @@ const AddNodesSider: React.FC = () => {
{t('add_node')}
</p>

<Tag color={isAllNodesVisible ? 'green' : 'blue'} onClick={onModeChange} className='mr-0'>
{isAllNodesVisible ? t('All_Nodes') : t('Higher_Order_Nodes')}
</Tag>
<Switch
checkedChildren='高阶'
unCheckedChildren='全部'
onClick={onModeChange}
className={classnames('w-20', { 'bg-zinc-400': isAllNodesVisible })}
defaultChecked
/>
</div>

<Search placeholder='Search node' onSearch={searchNode} allowClear />
Expand Down
4 changes: 2 additions & 2 deletions web/locales/en/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export const FlowEn = {
Please_Add_Nodes_First: 'Please add nodes first',
Add_Global_Variable_of_Flow: 'Add global variable of flow',
Add_Parameter: 'Add Parameter',
Higher_Order_Nodes: 'Higher Order Nodes',
All_Nodes: 'All Nodes',
Higher_Order_Nodes: 'Higher Order',
All_Nodes: 'All',
};
4 changes: 2 additions & 2 deletions web/locales/zh/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export const FlowZn = {
Please_Add_Nodes_First: '请先添加节点',
Add_Global_Variable_of_Flow: '添加 Flow 全局变量',
Add_Parameter: '添加参数',
Higher_Order_Nodes: '高阶节点',
All_Nodes: '所有节点',
Higher_Order_Nodes: '高阶',
All_Nodes: '所有',
};
12 changes: 6 additions & 6 deletions web/pages/mobile/chat/components/InputContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ClearOutlined, LoadingOutlined, PauseCircleOutlined, RedoOutlined, Send
import { EventStreamContentType, fetchEventSource } from '@microsoft/fetch-event-source';
import { useRequest } from 'ahooks';
import { Button, Input, Popover, Spin, Tag } from 'antd';
import cls from 'classnames';
import classnames from 'classnames';
import { useSearchParams } from 'next/navigation';
import React, { useContext, useEffect, useMemo, useState } from 'react';
import { MobileChatContext } from '../';
Expand Down Expand Up @@ -245,7 +245,7 @@ const InputContainer: React.FC = () => {
<div className='flex items-center justify-between text-lg font-bold'>
<Popover content='暂停回复' trigger={['hover']}>
<PauseCircleOutlined
className={cls('p-2 cursor-pointer', {
className={classnames('p-2 cursor-pointer', {
'text-[#0c75fc]': canAbort,
'text-gray-400': !canAbort,
})}
Expand All @@ -254,7 +254,7 @@ const InputContainer: React.FC = () => {
</Popover>
<Popover content='再来一次' trigger={['hover']}>
<RedoOutlined
className={cls('p-2 cursor-pointer', {
className={classnames('p-2 cursor-pointer', {
'text-gray-400': !history.length || !canNewChat,
})}
onClick={redo}
Expand All @@ -265,7 +265,7 @@ const InputContainer: React.FC = () => {
) : (
<Popover content='清除历史' trigger={['hover']}>
<ClearOutlined
className={cls('p-2 cursor-pointer', {
className={classnames('p-2 cursor-pointer', {
'text-gray-400': !history.length || !canNewChat,
})}
onClick={clearHistory}
Expand All @@ -276,7 +276,7 @@ const InputContainer: React.FC = () => {
</div>
{/* 输入框 */}
<div
className={cls(
className={classnames(
'flex py-2 px-3 items-center justify-between bg-white dark:bg-[#242733] dark:border-[#6f7f95] rounded-xl border',
{
'border-[#0c75fc] dark:border-[rgba(12,117,252,0.8)]': isFocus,
Expand Down Expand Up @@ -323,7 +323,7 @@ const InputContainer: React.FC = () => {

<Button
type='primary'
className={cls('flex items-center justify-center rounded-lg bg-button-gradient border-0 ml-2', {
className={classnames('flex items-center justify-center rounded-lg bg-button-gradient border-0 ml-2', {
'opacity-40 cursor-not-allowed': !userInput.trim() || !canNewChat,
})}
onClick={onSubmit}
Expand Down
Loading