Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

style: update todo list style

canisminor19904f71117bac13
diff --git a/package.json b/package.json
index bc351bf4b55..a3e67084f8c 100644
--- a/package.json
+++ b/package.json
@@ -203,7 +203,7 @@
"@lobehub/icons": "^4.0.0",
"@lobehub/market-sdk": "^0.24.0",
"@lobehub/tts": "^4.0.0",
- "@lobehub/ui": "^4.1.9",
+ "@lobehub/ui": "^4.2.1",
"@modelcontextprotocol/sdk": "^1.25.1",
"@neondatabase/serverless": "^1.0.2",
"@next/third-parties": "^16.1.0",
diff --git a/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx b/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx
index ddca0dfa819..432bdcdf794 100644
--- a/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx
+++ b/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx
@@ -1,26 +1,17 @@
'use client';
import { BuiltinInterventionProps } from '@lobechat/types';
-import { Flexbox } from '@lobehub/ui';
-import { createStyles } from 'antd-style';
+import { Block } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import { memo, useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
import type { CreateTodosParams, TodoItem } from '../../types';
import { SortableTodoList } from '../components';
-const useStyles = createStyles(({ css, token }) => ({
- container: css`
- padding-block: 12px;
- padding-inline: 4px;
- border-radius: ${token.borderRadius}px;
- background: ${token.colorFillQuaternary};
- `,
-}));
-
const AddTodoIntervention = memo<BuiltinInterventionProps<CreateTodosParams>>(
({ args, onArgsChange, registerBeforeApprove }) => {
- const { styles } = useStyles();
+ const { t } = useTranslation('tool');
// Handle both formats:
// - Initial AI input: { adds: string[] } (from AI)
@@ -38,14 +29,14 @@ const AddTodoIntervention = memo<BuiltinInterventionProps<CreateTodosParams>>(
);
return (
- <Flexbox className={styles.container}>
+ <Block variant={'outlined'}>
<SortableTodoList
defaultItems={defaultItems}
onSave={handleSave}
- placeholder="Add a todo item..."
+ placeholder={t('lobe-gtd.addTodo.placeholder')}
registerBeforeApprove={registerBeforeApprove}
/>
- </Flexbox>
+ </Block>
);
},
isEqual,
diff --git a/packages/builtin-tool-gtd/src/client/Intervention/ClearTodos.tsx b/packages/builtin-tool-gtd/src/client/Intervention/ClearTodos.tsx
index 203edfaf705..38ed06c05de 100644
--- a/packages/builtin-tool-gtd/src/client/Intervention/ClearTodos.tsx
+++ b/packages/builtin-tool-gtd/src/client/Intervention/ClearTodos.tsx
@@ -6,6 +6,7 @@ import { Radio, RadioChangeEvent } from 'antd';
import { createStyles } from 'antd-style';
import { Trash2 } from 'lucide-react';
import { memo, useCallback, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import type { ClearTodosParams } from '../../types';
@@ -38,6 +39,7 @@ const useStyles = createStyles(({ css, token }) => ({
const ClearTodosIntervention = memo<BuiltinInterventionProps<ClearTodosParams>>(
({ args, onArgsChange }) => {
const { styles } = useStyles();
+ const { t } = useTranslation('tool');
const [mode, setMode] = useState<ClearTodosParams['mode']>(args?.mode || 'completed');
const handleModeChange = useCallback(
@@ -53,18 +55,20 @@ const ClearTodosIntervention = memo<BuiltinInterventionProps<ClearTodosParams>>(
<Flexbox gap={12}>
<Flexbox align="center" className={styles.header} gap={8} horizontal>
<Trash2 size={16} />
- <span style={{ fontSize: 14, fontWeight: 500 }}>Clear Todo Items</span>
+ <span style={{ fontSize: 14, fontWeight: 500 }}>{t('lobe-gtd.clearTodos.header')}</span>
</Flexbox>
<Flexbox className={styles.container} gap={8}>
- <span className={styles.label}>Choose what to clear:</span>
+ <span className={styles.label}>{t('lobe-gtd.clearTodos.label')}</span>
<Radio.Group onChange={handleModeChange} value={mode}>
<Flexbox gap={8}>
<Radio value="completed">
- <span className={styles.normalText}>Clear completed items only</span>
+ <span className={styles.normalText}>
+ {t('lobe-gtd.clearTodos.option.completed')}
+ </span>
</Radio>
<Radio value="all">
- <span className={styles.dangerText}>Clear all items (including pending)</span>
+ <span className={styles.dangerText}>{t('lobe-gtd.clearTodos.option.all')}</span>
</Radio>
</Flexbox>
</Radio.Group>
diff --git a/packages/builtin-tool-gtd/src/client/Intervention/CreatePlan.tsx b/packages/builtin-tool-gtd/src/client/Intervention/CreatePlan.tsx
index 63cf0137ece..91405e0d9f3 100644
--- a/packages/builtin-tool-gtd/src/client/Intervention/CreatePlan.tsx
+++ b/packages/builtin-tool-gtd/src/client/Intervention/CreatePlan.tsx
@@ -1,30 +1,16 @@
'use client';
import { BuiltinInterventionProps } from '@lobechat/types';
-import { Flexbox, Input, TextArea } from '@lobehub/ui';
-import { createStyles } from 'antd-style';
+import { Flexbox, Input, Text, TextArea } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import { memo, useCallback, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import type { CreatePlanParams } from '../../types';
-const useStyles = createStyles(({ css, token }) => ({
- container: css`
- padding: 12px;
- border-radius: ${token.borderRadius}px;
- background: ${token.colorFillQuaternary};
- `,
- label: css`
- margin-block-end: 4px;
- font-size: 12px;
- font-weight: 500;
- color: ${token.colorTextSecondary};
- `,
-}));
-
const CreatePlanIntervention = memo<BuiltinInterventionProps<CreatePlanParams>>(
({ args, onArgsChange, registerBeforeApprove }) => {
- const { styles } = useStyles();
+ const { t } = useTranslation('tool');
const [goal, setGoal] = useState(args?.goal || '');
const [description, setDescription] = useState(args?.description || '');
@@ -81,29 +67,29 @@ const CreatePlanIntervention = memo<BuiltinInterventionProps<CreatePlanParams>>(
);
return (
- <Flexbox className={styles.container} gap={12}>
- <Flexbox>
- <div className={styles.label}>Goal</div>
+ <Flexbox gap={12}>
+ <Flexbox gap={8}>
+ <Text>{t('lobe-gtd.createPlan.goal.label')}</Text>
<Input
onChange={(e) => handleGoalChange(e.target.value)}
- placeholder="What do you want to achieve?"
+ placeholder={t('lobe-gtd.createPlan.goal.placeholder')}
value={goal}
/>
</Flexbox>
- <Flexbox>
- <div className={styles.label}>Description</div>
+ <Flexbox gap={8}>
+ <Text>{t('lobe-gtd.createPlan.description.label')}</Text>
<Input
onChange={(e) => handleDescriptionChange(e.target.value)}
- placeholder="Brief summary of the plan"
+ placeholder={t('lobe-gtd.createPlan.description.placeholder')}
value={description}
/>
</Flexbox>
- <Flexbox>
- <div className={styles.label}>Context (optional)</div>
+ <Flexbox gap={8}>
+ <Text>{t('lobe-gtd.createPlan.context.label')}</Text>
<TextArea
autoSize={{ minRows: 10 }}
onChange={(e) => handleContextChange(e.target.value)}
- placeholder="Background, constraints, considerations..."
+ placeholder={t('lobe-gtd.createPlan.context.placeholder')}
value={context}
/>
</Flexbox>
diff --git a/packages/builtin-tool-gtd/src/client/Render/PlanCard.tsx b/packages/builtin-tool-gtd/src/client/Render/PlanCard.tsx
index dbcebb92e4e..8d685469ec3 100644
--- a/packages/builtin-tool-gtd/src/client/Render/PlanCard.tsx
+++ b/packages/builtin-tool-gtd/src/client/Render/PlanCard.tsx
@@ -1,62 +1,18 @@
'use client';
-import { Flexbox, Tag, Text } from '@lobehub/ui';
-import { createStyles } from 'antd-style';
-import { ClipboardList } from 'lucide-react';
+import { Block, Flexbox, Icon, Text } from '@lobehub/ui';
+import { ListChecksIcon } from 'lucide-react';
import { memo } from 'react';
import { useChatStore } from '@/store/chat';
import type { Plan } from '../../types';
-const useStyles = createStyles(({ token, css }) => {
- return {
- container: css`
- cursor: pointer;
-
- overflow: hidden;
-
- width: 100%;
- padding-block: 12px;
- padding-inline: 12px;
- border: 1px solid ${token.colorBorderSecondary};
- border-radius: 8px;
-
- background: ${token.colorBgElevated};
-
- &:hover {
- background: ${token.colorFillSecondary};
- }
- `,
- description: css`
- font-size: 12px;
- line-height: 1.5;
- color: ${token.colorTextSecondary};
- `,
- icon: css`
- color: ${token.colorPrimary};
- `,
- title: css`
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
-
- font-weight: 500;
- color: ${token.colorText};
- `,
- typeTag: css`
- font-size: 11px;
- `,
- };
-});
-
interface PlanCardProps {
plan: Plan;
}
const PlanCard = memo<PlanCardProps>(({ plan }) => {
- const { styles } = useStyles();
const openDocument = useChatStore((s) => s.openDocument);
const handleClick = () => {
@@ -64,20 +20,26 @@ const PlanCard = memo<PlanCardProps>(({ plan }) => {
};
return (
- <Flexbox className={styles.container} gap={8} onClick={handleClick}>
- <Flexbox align={'center'} gap={8} horizontal>
- <ClipboardList className={styles.icon} size={16} />
- <div className={styles.title}>{plan.goal}</div>
- <Tag className={styles.typeTag} size={'small'}>
- plan
- </Tag>
+ <Block
+ clickable
+ gap={8}
+ onClick={handleClick}
+ padding={12}
+ style={{ overflow: 'hidden' }}
+ variant={'outlined'}
+ >
+ <Flexbox align={'center'} gap={8} horizontal style={{ overflow: 'hidden' }}>
+ <Icon icon={ListChecksIcon} size={18} />
+ <Text ellipsis fontSize={16} weight={500}>
+ {plan.goal}
+ </Text>
</Flexbox>
{plan.description && (
- <Text className={styles.description} ellipsis={{ rows: 2 }}>
+ <Text ellipsis={{ rows: 2 }} fontSize={14} type={'secondary'}>
{plan.description}
</Text>
)}
- </Flexbox>
+ </Block>
);
});
diff --git a/packages/builtin-tool-gtd/src/client/Render/TodoList.tsx b/packages/builtin-tool-gtd/src/client/Render/TodoList.tsx
index 5c9c6a0cc76..cd761989a56 100644
--- a/packages/builtin-tool-gtd/src/client/Render/TodoList.tsx
+++ b/packages/builtin-tool-gtd/src/client/Render/TodoList.tsx
@@ -1,9 +1,8 @@
'use client';
import { BuiltinRenderProps } from '@lobechat/types';
-import { Flexbox } from '@lobehub/ui';
+import { Block, Checkbox } from '@lobehub/ui';
import { createStyles } from 'antd-style';
-import { CheckCircle2, Circle } from 'lucide-react';
import { memo } from 'react';
import type { TodoItem, TodoList as TodoListType } from '../../types';
@@ -14,40 +13,16 @@ export interface TodoListRenderState {
// Styles matching TodoItemRow in SortableTodoList
const useStyles = createStyles(({ css, token }) => ({
- checkbox: css`
- flex-shrink: 0;
- color: ${token.colorTextQuaternary};
- `,
- checkboxChecked: css`
- color: ${token.colorSuccess};
- `,
- // Outer container - matches AddTodoIntervention container style
- container: css`
- padding-block: 12px;
- padding-inline: 4px;
- border-radius: ${token.borderRadius}px;
- background: ${token.colorFillQuaternary};
- `,
- // Placeholder to match DragHandle width
- dragHandlePlaceholder: css`
- flex-shrink: 0;
- width: 16px;
- height: 24px;
- `,
- // Item row - matches TodoItemRow itemRow style
itemRow: css`
- padding-block: 2px;
- border-block-end: 1px solid ${token.colorBorderSecondary};
+ width: 100%;
+ padding-block: 10px;
+ padding-inline: 12px;
+ border-block-end: 1px dashed ${token.colorBorderSecondary};
&:last-child {
border-block-end: none;
}
`,
- text: css`
- flex: 1;
- font-size: 14px;
- line-height: 32px;
- `,
textChecked: css`
color: ${token.colorTextQuaternary};
text-decoration: line-through;
@@ -63,16 +38,21 @@ interface ReadOnlyTodoItemProps {
* Read-only todo item row, matching the style of TodoItemRow in SortableTodoList
*/
const ReadOnlyTodoItem = memo<ReadOnlyTodoItemProps>(({ text, completed }) => {
- const { styles, cx } = useStyles();
-
- const CheckIcon = completed ? CheckCircle2 : Circle;
+ const { styles, theme } = useStyles();
return (
- <Flexbox align="center" className={styles.itemRow} gap={8} horizontal width="100%">
- <div className={styles.dragHandlePlaceholder} />
- <CheckIcon className={cx(styles.checkbox, completed && styles.checkboxChecked)} size={16} />
- <span className={cx(styles.text, completed && styles.textChecked)}>{text}</span>
- </Flexbox>
+ <Checkbox
+ backgroundColor={theme.colorSuccess}
+ checked={completed}
+ classNames={{ text: completed ? styles.textChecked : undefined, wrapper: styles.itemRow }}
+ shape={'circle'}
+ style={{ borderWidth: 1.5, cursor: 'default' }}
+ textProps={{
+ type: completed ? 'secondary' : undefined,
+ }}
+ >
+ {text}
+ </Checkbox>
);
});
@@ -87,21 +67,17 @@ interface TodoListUIProps {
* Displays todo items in a style matching the editable SortableTodoList
*/
const TodoListUI = memo<TodoListUIProps>(({ items }) => {
- const { styles } = useStyles();
-
if (items.length === 0) {
return null;
}
return (
// Outer container with background - matches AddTodoIntervention
- <Flexbox className={styles.container}>
- <Flexbox width="100%">
- {items.map((item, index) => (
- <ReadOnlyTodoItem completed={item.completed} key={index} text={item.text} />
- ))}
- </Flexbox>
- </Flexbox>
+ <Block variant={'outlined'} width="100%">
+ {items.map((item, index) => (
+ <ReadOnlyTodoItem completed={item.completed} key={index} text={item.text} />
+ ))}
+ </Block>
);
});
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/AddItemRow.tsx b/packages/builtin-tool-gtd/src/client/components/SortableTodoList/AddItemRow.tsx
index 6c65504b45a..eb82f196d71 100644
--- a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/AddItemRow.tsx
+++ b/packages/builtin-tool-gtd/src/client/components/SortableTodoList/AddItemRow.tsx
@@ -1,26 +1,21 @@
'use client';
-import { ActionIcon , Flexbox } from '@lobehub/ui';
-import { Input, InputRef } from 'antd';
+import { ActionIcon, Checkbox, Flexbox, Input } from '@lobehub/ui';
+import { InputRef } from 'antd';
import { createStyles } from 'antd-style';
-import { Circle, Plus } from 'lucide-react';
+import { Plus } from 'lucide-react';
import { ChangeEvent, KeyboardEvent, memo, useCallback, useEffect, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
import { ADD_ITEM_ID, useTodoListStore } from './store';
-const useStyles = createStyles(({ css, token }) => ({
+const useStyles = createStyles(({ css }) => ({
addRow: css`
- padding-block: 6px;
+ padding-block: 10px;
+ padding-inline: 12px;
`,
- circle: css`
- flex-shrink: 0;
- color: ${token.colorTextQuaternary};
- `,
- // Placeholder to match DragHandle width (28px from SortableList.DragHandle small size)
dragHandlePlaceholder: css`
- flex-shrink: 0;
- width: 16px;
- height: 24px;
+ width: 8px;
`,
}));
@@ -30,85 +25,85 @@ interface AddItemRowProps {
showDragHandle?: boolean;
}
-const AddItemRow = memo<AddItemRowProps>(
- ({ placeholder = 'Add a todo item...', showDragHandle = true, className }) => {
- const { styles, cx } = useStyles();
- const inputRef = useRef<InputRef>(null);
+const AddItemRow = memo<AddItemRowProps>(({ placeholder, showDragHandle = true, className }) => {
+ const { styles, cx } = useStyles();
+ const { t } = useTranslation('tool');
+ const inputRef = useRef<InputRef>(null);
+ const defaultPlaceholder = placeholder || t('lobe-gtd.addTodo.placeholder');
- const newItemText = useTodoListStore((s) => s.newItemText);
- const focusedId = useTodoListStore((s) => s.focusedId);
- const cursorPosition = useTodoListStore((s) => s.cursorPosition);
- const setNewItemText = useTodoListStore((s) => s.setNewItemText);
- const addItem = useTodoListStore((s) => s.addItem);
- const focusPrevItem = useTodoListStore((s) => s.focusPrevItem);
- const setFocusedId = useTodoListStore((s) => s.setFocusedId);
+ const newItemText = useTodoListStore((s) => s.newItemText);
+ const focusedId = useTodoListStore((s) => s.focusedId);
+ const cursorPosition = useTodoListStore((s) => s.cursorPosition);
+ const setNewItemText = useTodoListStore((s) => s.setNewItemText);
+ const addItem = useTodoListStore((s) => s.addItem);
+ const focusPrevItem = useTodoListStore((s) => s.focusPrevItem);
+ const setFocusedId = useTodoListStore((s) => s.setFocusedId);
- // Focus input when focusedId changes to this input and restore cursor position
- const prevFocusedIdRef = useRef<string | null>(null);
- useEffect(() => {
- // Only restore cursor when focus changes TO this input (not on every cursorPosition change)
- if (focusedId === ADD_ITEM_ID && prevFocusedIdRef.current !== ADD_ITEM_ID) {
- const input = inputRef.current?.input;
- if (input) {
- input.focus();
- // Clamp cursor position to text length
- const pos = Math.min(cursorPosition, newItemText.length);
- input.setSelectionRange(pos, pos);
- }
+ // Focus input when focusedId changes to this input and restore cursor position
+ const prevFocusedIdRef = useRef<string | null>(null);
+ useEffect(() => {
+ // Only restore cursor when focus changes TO this input (not on every cursorPosition change)
+ if (focusedId === ADD_ITEM_ID && prevFocusedIdRef.current !== ADD_ITEM_ID) {
+ const input = inputRef.current?.input;
+ if (input) {
+ input.focus();
+ // Clamp cursor position to text length
+ const pos = Math.min(cursorPosition, newItemText.length);
+ input.setSelectionRange(pos, pos);
}
- prevFocusedIdRef.current = focusedId;
- }, [focusedId, cursorPosition, newItemText.length]);
+ }
+ prevFocusedIdRef.current = focusedId;
+ }, [focusedId, cursorPosition, newItemText.length]);
- const handleChange = useCallback(
- (e: ChangeEvent<HTMLInputElement>) => {
- setNewItemText(e.target.value);
- },
- [setNewItemText],
- );
+ const handleChange = useCallback(
+ (e: ChangeEvent<HTMLInputElement>) => {
+ setNewItemText(e.target.value);
+ },
+ [setNewItemText],
+ );
- const handleKeyDown = useCallback(
- (e: KeyboardEvent<HTMLInputElement>) => {
- const input = e.currentTarget;
- const cursorPos = input.selectionStart ?? 0;
+ const handleKeyDown = useCallback(
+ (e: KeyboardEvent<HTMLInputElement>) => {
+ const input = e.currentTarget;
+ const cursorPos = input.selectionStart ?? 0;
- if (e.key === 'Enter') {
- e.preventDefault();
- addItem();
- } else if (e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)) {
- e.preventDefault();
- focusPrevItem(ADD_ITEM_ID, cursorPos);
- } else if (e.key === 'Tab' && !e.shiftKey) {
- // Prevent default tab behavior to keep focus in the todo list
- e.preventDefault();
- }
- },
- [addItem, focusPrevItem],
- );
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ addItem();
+ } else if (e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)) {
+ e.preventDefault();
+ focusPrevItem(ADD_ITEM_ID, cursorPos);
+ } else if (e.key === 'Tab' && !e.shiftKey) {
+ // Prevent default tab behavior to keep focus in the todo list
+ e.preventDefault();
+ }
+ },
+ [addItem, focusPrevItem],
+ );
- const handleFocus = useCallback(() => {
- setFocusedId(ADD_ITEM_ID);
- }, [setFocusedId]);
+ const handleFocus = useCallback(() => {
+ setFocusedId(ADD_ITEM_ID);
+ }, [setFocusedId]);
- return (
- <Flexbox align="center" className={cx(styles.addRow, className)} gap={4} horizontal>
- {showDragHandle && <div className={styles.dragHandlePlaceholder} />}
- <Circle className={styles.circle} size={16} />
- <Input
- onChange={handleChange}
- onFocus={handleFocus}
- onKeyDown={handleKeyDown}
- placeholder={placeholder}
- ref={inputRef}
- size="small"
- style={{ flex: 1 }}
- value={newItemText}
- variant="borderless"
- />
- <ActionIcon icon={Plus} onClick={addItem} size="small" tabIndex={-1} />
- </Flexbox>
- );
- },
-);
+ return (
+ <Flexbox align="center" className={cx(styles.addRow, className)} gap={4} horizontal>
+ {showDragHandle && <div className={styles.dragHandlePlaceholder} />}
+ <Checkbox checked={false} shape={'circle'} style={{ borderWidth: 1.5, cursor: 'default' }} />
+ <Input
+ onChange={handleChange}
+ onFocus={handleFocus}
+ onKeyDown={handleKeyDown}
+ placeholder={defaultPlaceholder}
+ ref={inputRef}
+ size="small"
+ style={{ flex: 1 }}
+ value={newItemText}
+ variant="borderless"
+ />
+ <ActionIcon icon={Plus} onClick={addItem} size="small" tabIndex={-1} />
+ </Flexbox>
+ );
+});
AddItemRow.displayName = 'AddItemRow';
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx b/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx
index 46f09aa0061..4d3ecdaf6af 100644
--- a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx
+++ b/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx
@@ -1,31 +1,15 @@
'use client';
-import { ActionIcon, SortableList , Flexbox } from '@lobehub/ui';
+import { ActionIcon, Checkbox, Flexbox, SortableList } from '@lobehub/ui';
import { Input, InputRef } from 'antd';
import { createStyles } from 'antd-style';
-import { CheckCircle2, Circle, Trash2 } from 'lucide-react';
+import { Trash2 } from 'lucide-react';
import { ChangeEvent, KeyboardEvent, memo, useCallback, useEffect, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
import { useTodoListStore } from './store';
const useStyles = createStyles(({ css, token }) => ({
- checkbox: css`
- cursor: pointer;
- flex-shrink: 0;
- color: ${token.colorTextQuaternary};
- transition: color 0.2s;
-
- &:hover {
- color: ${token.colorPrimary};
- }
- `,
- checkboxChecked: css`
- color: ${token.colorSuccess};
-
- &:hover {
- color: ${token.colorSuccessHover};
- }
- `,
deleteIcon: css`
flex-shrink: 0;
opacity: 0;
@@ -38,12 +22,10 @@ const useStyles = createStyles(({ css, token }) => ({
transition: opacity 0.2s;
`,
itemRow: css`
- padding-block: 2px;
- border-block-end: 1px solid ${token.colorBorderSecondary};
-
- &:last-child {
- border-block-end: none;
- }
+ width: 100%;
+ padding-block: 10px;
+ padding-inline: 4px 12px;
+ border-block-end: 1px dashed ${token.colorBorderSecondary};
&:hover {
.drag-handle,
@@ -63,9 +45,11 @@ interface TodoItemRowProps {
placeholder?: string;
}
-const TodoItemRow = memo<TodoItemRowProps>(({ id, placeholder = 'Enter todo item...' }) => {
- const { styles, cx } = useStyles();
+const TodoItemRow = memo<TodoItemRowProps>(({ id, placeholder }) => {
+ const { styles, cx, theme } = useStyles();
+ const { t } = useTranslation('tool');
const inputRef = useRef<InputRef>(null);
+ const defaultPlaceholder = placeholder || t('lobe-gtd.todoItem.placeholder');
// Find item by stable id
const item = useTodoListStore((s) => s.items.find((item) => item.id === id));
@@ -137,22 +121,22 @@ const TodoItemRow = memo<TodoItemRowProps>(({ id, placeholder = 'Enter todo item
toggleItem(id);
}, [id, toggleItem]);
- const CheckIcon = completed ? CheckCircle2 : Circle;
-
return (
<Flexbox align="center" className={styles.itemRow} gap={4} horizontal width="100%">
<SortableList.DragHandle className={cx(styles.dragHandle, 'drag-handle')} size="small" />
- <CheckIcon
- className={cx(styles.checkbox, completed && styles.checkboxChecked)}
- onClick={handleToggle}
- size={16}
+ <Checkbox
+ backgroundColor={theme.colorSuccess}
+ checked={completed}
+ onChange={handleToggle}
+ shape={'circle'}
+ style={{ borderWidth: 1.5 }}
/>
<Input
className={cx(completed && styles.textChecked)}
onChange={handleChange}
onFocus={handleFocus}
onKeyDown={handleKeyDown}
- placeholder={placeholder}
+ placeholder={defaultPlaceholder}
ref={inputRef}
size="small"
style={{ flex: 1 }}
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoList.tsx b/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoList.tsx
index 56d1e00b410..393dcffe732 100644
--- a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoList.tsx
+++ b/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoList.tsx
@@ -1,26 +1,17 @@
'use client';
-import { SortableList , Flexbox } from '@lobehub/ui';
-import { createStyles } from 'antd-style';
+import { SortableList } from '@lobehub/ui';
import { memo, useCallback } from 'react';
import AddItemRow from './AddItemRow';
import SortableItem from './SortableItem';
import { TodoListItem, useTodoListStore } from './store';
-const useStyles = createStyles(({ css }) => ({
- container: css`
- width: 100%;
- `,
-}));
-
interface TodoListProps {
placeholder?: string;
}
const TodoList = memo<TodoListProps>(({ placeholder }) => {
- const { styles } = useStyles();
-
const items = useTodoListStore((s) => s.items);
const sortItems = useTodoListStore((s) => s.sortItems);
@@ -40,11 +31,7 @@ const TodoList = memo<TodoListProps>(({ placeholder }) => {
// Empty state
if (items.length === 0) {
- return (
- <Flexbox className={styles.container} gap={0}>
- <AddItemRow placeholder={placeholder} showDragHandle={false} />
- </Flexbox>
- );
+ return <AddItemRow placeholder={placeholder} showDragHandle={false} />;
}
// Use items length as key to force remount when items change structure
@@ -52,8 +39,9 @@ const TodoList = memo<TodoListProps>(({ placeholder }) => {
const listKey = items.map((i) => i.id).join('-');
return (
- <Flexbox paddingBlock={8} paddingInline={4} width={'100%'}>
+ <>
<SortableList
+ gap={0}
items={items}
key={listKey}
onChange={handleSortEnd}
@@ -61,7 +49,7 @@ const TodoList = memo<TodoListProps>(({ placeholder }) => {
style={{ marginBottom: 0 }}
/>
<AddItemRow placeholder={placeholder} />
- </Flexbox>
+ </>
);
});
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/index.tsx b/packages/builtin-tool-gtd/src/client/components/SortableTodoList/index.tsx
index 9f940ef617c..89b843d143a 100644
--- a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/index.tsx
+++ b/packages/builtin-tool-gtd/src/client/components/SortableTodoList/index.tsx
@@ -34,7 +34,7 @@ export interface SortableTodoListProps {
}
const SortableTodoList = memo<SortableTodoListProps>(
- ({ defaultItems = [], placeholder = 'Enter todo item...', onSave, registerBeforeApprove }) => {
+ ({ defaultItems = [], placeholder, onSave, registerBeforeApprove }) => {
// Create store instance once with onSave callback
const store = useMemo(() => createTodoListStore(defaultItems, onSave), []);
diff --git a/src/locales/default/tool.ts b/src/locales/default/tool.ts
index 250521ae1f1..65fd01db328 100644
--- a/src/locales/default/tool.ts
+++ b/src/locales/default/tool.ts
@@ -1,132 +1,149 @@
export default {
- "agentGroupManagement.executeTask.agent": "Execute Agent",
- "agentGroupManagement.executeTask.cancelled": "Cancelled",
- "agentGroupManagement.executeTask.completed": "Task Completed",
- "agentGroupManagement.executeTask.cost": "Cost",
- "agentGroupManagement.executeTask.failed": "Task Failed",
- "agentGroupManagement.executeTask.interrupted": "Interrupted",
- "agentGroupManagement.executeTask.intervention.taskPlaceholder": "Please provide a detailed description of the task for the Agent to perform...",
- "agentGroupManagement.executeTask.intervention.timeout": "Maximum execution time",
- "agentGroupManagement.executeTask.intervention.timeoutUnit": "minutes",
- "agentGroupManagement.executeTask.intervention.unknownAgent": "Unknown Agent",
- "agentGroupManagement.executeTask.processing": "Processing...",
- "agentGroupManagement.executeTask.steps": "Execution Steps",
- "agentGroupManagement.executeTask.task": "Task Content",
- "agentGroupManagement.executeTask.thread": "Thread ID",
- "agentGroupManagement.executeTask.timeout": "Execution Timed Out",
- "agentGroupManagement.executeTask.tokens": "Token Usage",
- "codeInterpreter-legacy.error": "Execution Error",
- "codeInterpreter-legacy.executing": "Executing...",
- "codeInterpreter-legacy.files": "Files:",
- "codeInterpreter-legacy.output": "Output:",
- "codeInterpreter-legacy.returnValue": "Return Value:",
- "codeInterpreter.error": "Execution Error",
- "codeInterpreter.executing": "Executing...",
- "codeInterpreter.files": "Files:",
- "codeInterpreter.output": "Output:",
- "codeInterpreter.returnValue": "Return Value:",
- "dalle.autoGenerate": "Auto Generate",
- "dalle.downloading": "The image links generated by DALL·E3 are only valid for 1 hour, caching the images locally...",
- "dalle.generate": "Generate",
- "dalle.generating": "Generating...",
- "dalle.images": "Images:",
- "dalle.prompt": "Prompt",
- "lobe-gtd.actions.add": "Add",
- "lobe-gtd.actions.clearCompleted": "Clear Completed",
- "lobe-gtd.actions.placeholder": "Enter a to-do item...",
- "lobe-gtd.clearTodos.cleared": "{{count}} item(s) cleared",
- "lobe-gtd.clearTodos.clearedCompleted": "{{count}} completed item(s) cleared",
- "lobe-gtd.clearTodos.clearedCompleted_one": "{{count}} completed item cleared",
- "lobe-gtd.clearTodos.clearedCompleted_other": "{{count}} completed items cleared",
- "lobe-gtd.clearTodos.cleared_one": "{{count}} item cleared",
- "lobe-gtd.clearTodos.cleared_other": "{{count}} items cleared",
- "lobe-gtd.clearTodos.noItems": "No items to clear",
- "lobe-gtd.clearTodos.remaining": "{{count}} item(s) remaining",
- "lobe-gtd.clearTodos.remaining_one": "{{count}} item remaining",
- "lobe-gtd.clearTodos.remaining_other": "{{count}} items remaining",
- "lobe-gtd.completeTodos.completed": "{{count}} item(s) completed",
- "lobe-gtd.completeTodos.completed_one": "{{count}} item completed",
- "lobe-gtd.completeTodos.completed_other": "{{count}} items completed",
- "lobe-gtd.createTodos.created": "{{count}} to-do item(s) created",
- "lobe-gtd.createTodos.created_one": "{{count}} to-do item created",
- "lobe-gtd.createTodos.created_other": "{{count}} to-do items created",
- "lobe-gtd.createTodos.total": "Total: {{count}} item(s)",
- "lobe-gtd.createTodos.total_one": "Total: {{count}} item",
- "lobe-gtd.createTodos.total_other": "Total: {{count}} items",
- "lobe-gtd.removeTodos.removed": "{{count}} item(s) removed",
- "lobe-gtd.removeTodos.removed_one": "{{count}} item removed",
- "lobe-gtd.removeTodos.removed_other": "{{count}} items removed",
- "lobe-gtd.status.done": "{{count}} completed",
- "lobe-gtd.status.pending": "{{count}} pending",
- "lobe-gtd.todoList.empty": "To-do list is empty",
- "lobe-gtd.todoList.items": "{{count}} item(s)",
- "lobe-gtd.todoList.items_one": "{{count}} item",
- "lobe-gtd.todoList.items_other": "{{count}} items",
- "lobe-gtd.todoList.title": "To-Do List",
- "lobe-gtd.updateTodos.updated": "To-do list updated",
- "lobe-knowledge-base.readKnowledge.meta.chars": "Character Count",
- "lobe-knowledge-base.readKnowledge.meta.lines": "Line Count",
- "localFiles.editFile.newString": "Replace with",
- "localFiles.editFile.oldString": "Find",
- "localFiles.editFile.replaceAll": "Replace all occurrences",
- "localFiles.editFile.replaceFirst": "Replace first occurrence only",
- "localFiles.file": "File",
- "localFiles.folder": "Folder",
- "localFiles.moveFiles.itemsMoved": "{{count}} item(s) moved:",
- "localFiles.moveFiles.itemsMoved_one": "{{count}} item moved:",
- "localFiles.moveFiles.itemsMoved_other": "{{count}} items moved:",
- "localFiles.moveFiles.itemsToMove": "{{count}} item(s) to move:",
- "localFiles.moveFiles.itemsToMove_one": "{{count}} item to move:",
- "localFiles.moveFiles.itemsToMove_other": "{{count}} items to move:",
- "localFiles.open": "Open",
- "localFiles.openFile": "Open File",
- "localFiles.openFolder": "Open Folder",
- "localFiles.read.more": "View More",
- "localFiles.readFile": "Read File",
- "localFiles.readFileError": "Failed to read file, please check if the file path is correct",
- "localFiles.readFiles": "Read Files",
- "localFiles.readFilesError": "Failed to read files, please check if the file path is correct",
- "localFiles.writeFile.characters": "characters",
- "localFiles.writeFile.preview": "Content Preview",
- "localFiles.writeFile.truncated": "truncated",
- "search.createNewSearch": "Create a new search record",
- "search.emptyResult": "No results found, please modify your keywords and try again",
- "search.genAiMessage": "Create Agent Message",
- "search.includedTooltip": "The current search results will be included in the context of the conversation",
- "search.keywords": "Keywords:",
- "search.scoreTooltip": "Relevance score; a higher score indicates a closer match to the query keywords",
- "search.searchBar.button": "Search",
- "search.searchBar.placeholder": "Keywords",
- "search.searchBar.tooltip": "This will refresh the search results and create a new summary message",
- "search.searchCategory.placeholder": "Search Category",
- "search.searchCategory.title": "Search Category:",
- "search.searchCategory.value.files": "Files",
- "search.searchCategory.value.general": "General",
- "search.searchCategory.value.images": "Images",
- "search.searchCategory.value.it": "Information Technology",
- "search.searchCategory.value.map": "Maps",
- "search.searchCategory.value.music": "Music",
- "search.searchCategory.value.news": "News",
- "search.searchCategory.value.science": "Science",
- "search.searchCategory.value.social_media": "Social Media",
- "search.searchCategory.value.videos": "Videos",
- "search.searchEngine.placeholder": "Search Engine",
- "search.searchEngine.title": "Search Engine:",
- "search.searchResult": "Number of searches:",
- "search.searchTimeRange.title": "Time Range:",
- "search.searchTimeRange.value.anytime": "Anytime",
- "search.searchTimeRange.value.day": "Within a day",
- "search.searchTimeRange.value.month": "Within a month",
- "search.searchTimeRange.value.week": "Within a week",
- "search.searchTimeRange.value.year": "Within a year",
- "search.summary": "Summary",
- "search.summaryTooltip": "Summarize the current content",
- "search.viewMoreResults": "View {{results}} more results",
- "updateArgs.duplicateKeyError": "Field key must be unique",
- "updateArgs.form.add": "Add an Item",
- "updateArgs.form.key": "Field Key",
- "updateArgs.form.value": "Field Value",
- "updateArgs.formValidationFailed": "Form validation failed, please check the parameter format",
- "updateArgs.keyRequired": "Field key cannot be empty",
- "updateArgs.stringifyError": "Unable to serialize parameters, please check the parameter format"
-}
+ 'agentGroupManagement.executeTask.agent': 'Execute Agent',
+ 'agentGroupManagement.executeTask.cancelled': 'Cancelled',
+ 'agentGroupManagement.executeTask.completed': 'Task Completed',
+ 'agentGroupManagement.executeTask.cost': 'Cost',
+ 'agentGroupManagement.executeTask.failed': 'Task Failed',
+ 'agentGroupManagement.executeTask.interrupted': 'Interrupted',
+ 'agentGroupManagement.executeTask.intervention.taskPlaceholder':
+ 'Please provide a detailed description of the task for the Agent to perform...',
+ 'agentGroupManagement.executeTask.intervention.timeout': 'Maximum execution time',
+ 'agentGroupManagement.executeTask.intervention.timeoutUnit': 'minutes',
+ 'agentGroupManagement.executeTask.intervention.unknownAgent': 'Unknown Agent',
+ 'agentGroupManagement.executeTask.processing': 'Processing...',
+ 'agentGroupManagement.executeTask.steps': 'Execution Steps',
+ 'agentGroupManagement.executeTask.task': 'Task Content',
+ 'agentGroupManagement.executeTask.thread': 'Thread ID',
+ 'agentGroupManagement.executeTask.timeout': 'Execution Timed Out',
+ 'agentGroupManagement.executeTask.tokens': 'Token Usage',
+ 'codeInterpreter-legacy.error': 'Execution Error',
+ 'codeInterpreter-legacy.executing': 'Executing...',
+ 'codeInterpreter-legacy.files': 'Files:',
+ 'codeInterpreter-legacy.output': 'Output:',
+ 'codeInterpreter-legacy.returnValue': 'Return Value:',
+ 'codeInterpreter.error': 'Execution Error',
+ 'codeInterpreter.executing': 'Executing...',
+ 'codeInterpreter.files': 'Files:',
+ 'codeInterpreter.output': 'Output:',
+ 'codeInterpreter.returnValue': 'Return Value:',
+ 'dalle.autoGenerate': 'Auto Generate',
+ 'dalle.downloading':
+ 'The image links generated by DALL·E3 are only valid for 1 hour, caching the images locally...',
+ 'dalle.generate': 'Generate',
+ 'dalle.generating': 'Generating...',
+ 'dalle.images': 'Images:',
+ 'dalle.prompt': 'Prompt',
+ 'lobe-gtd.actions.add': 'Add',
+ 'lobe-gtd.actions.clearCompleted': 'Clear Completed',
+ 'lobe-gtd.actions.placeholder': 'Enter a to-do item...',
+ 'lobe-gtd.addTodo.placeholder': 'Add a todo item...',
+ 'lobe-gtd.clearTodos.cleared': '{{count}} item(s) cleared',
+ 'lobe-gtd.clearTodos.clearedCompleted': '{{count}} completed item(s) cleared',
+ 'lobe-gtd.clearTodos.clearedCompleted_one': '{{count}} completed item cleared',
+ 'lobe-gtd.clearTodos.clearedCompleted_other': '{{count}} completed items cleared',
+ 'lobe-gtd.clearTodos.cleared_one': '{{count}} item cleared',
+ 'lobe-gtd.clearTodos.cleared_other': '{{count}} items cleared',
+ 'lobe-gtd.clearTodos.header': 'Clear Todo Items',
+ 'lobe-gtd.clearTodos.label': 'Choose what to clear:',
+ 'lobe-gtd.clearTodos.noItems': 'No items to clear',
+ 'lobe-gtd.clearTodos.option.all': 'Clear all items (including pending)',
+ 'lobe-gtd.clearTodos.option.completed': 'Clear completed items only',
+ 'lobe-gtd.clearTodos.remaining': '{{count}} item(s) remaining',
+ 'lobe-gtd.clearTodos.remaining_one': '{{count}} item remaining',
+ 'lobe-gtd.clearTodos.remaining_other': '{{count}} items remaining',
+ 'lobe-gtd.completeTodos.completed': '{{count}} item(s) completed',
+ 'lobe-gtd.completeTodos.completed_one': '{{count}} item completed',
+ 'lobe-gtd.completeTodos.completed_other': '{{count}} items completed',
+ 'lobe-gtd.createPlan.context.label': 'Context (optional)',
+ 'lobe-gtd.createPlan.context.placeholder': 'Background, constraints, considerations...',
+ 'lobe-gtd.createPlan.description.label': 'Description',
+ 'lobe-gtd.createPlan.description.placeholder': 'Brief summary of the plan',
+ 'lobe-gtd.createPlan.goal.label': 'Goal',
+ 'lobe-gtd.createPlan.goal.placeholder': 'What do you want to achieve?',
+ 'lobe-gtd.createTodos.created': '{{count}} to-do item(s) created',
+ 'lobe-gtd.createTodos.created_one': '{{count}} to-do item created',
+ 'lobe-gtd.createTodos.created_other': '{{count}} to-do items created',
+ 'lobe-gtd.createTodos.total': 'Total: {{count}} item(s)',
+ 'lobe-gtd.createTodos.total_one': 'Total: {{count}} item',
+ 'lobe-gtd.createTodos.total_other': 'Total: {{count}} items',
+ 'lobe-gtd.removeTodos.removed': '{{count}} item(s) removed',
+ 'lobe-gtd.removeTodos.removed_one': '{{count}} item removed',
+ 'lobe-gtd.removeTodos.removed_other': '{{count}} items removed',
+ 'lobe-gtd.status.done': '{{count}} completed',
+ 'lobe-gtd.status.pending': '{{count}} pending',
+ 'lobe-gtd.todoItem.placeholder': 'Enter todo item...',
+ 'lobe-gtd.todoList.empty': 'To-do list is empty',
+ 'lobe-gtd.todoList.items': '{{count}} item(s)',
+ 'lobe-gtd.todoList.items_one': '{{count}} item',
+ 'lobe-gtd.todoList.items_other': '{{count}} items',
+ 'lobe-gtd.todoList.title': 'To-Do List',
+ 'lobe-gtd.updateTodos.updated': 'To-do list updated',
+ 'lobe-knowledge-base.readKnowledge.meta.chars': 'Character Count',
+ 'lobe-knowledge-base.readKnowledge.meta.lines': 'Line Count',
+ 'localFiles.editFile.newString': 'Replace with',
+ 'localFiles.editFile.oldString': 'Find',
+ 'localFiles.editFile.replaceAll': 'Replace all occurrences',
+ 'localFiles.editFile.replaceFirst': 'Replace first occurrence only',
+ 'localFiles.file': 'File',
+ 'localFiles.folder': 'Folder',
+ 'localFiles.moveFiles.itemsMoved': '{{count}} item(s) moved:',
+ 'localFiles.moveFiles.itemsMoved_one': '{{count}} item moved:',
+ 'localFiles.moveFiles.itemsMoved_other': '{{count}} items moved:',
+ 'localFiles.moveFiles.itemsToMove': '{{count}} item(s) to move:',
+ 'localFiles.moveFiles.itemsToMove_one': '{{count}} item to move:',
+ 'localFiles.moveFiles.itemsToMove_other': '{{count}} items to move:',
+ 'localFiles.open': 'Open',
+ 'localFiles.openFile': 'Open File',
+ 'localFiles.openFolder': 'Open Folder',
+ 'localFiles.read.more': 'View More',
+ 'localFiles.readFile': 'Read File',
+ 'localFiles.readFileError': 'Failed to read file, please check if the file path is correct',
+ 'localFiles.readFiles': 'Read Files',
+ 'localFiles.readFilesError': 'Failed to read files, please check if the file path is correct',
+ 'localFiles.writeFile.characters': 'characters',
+ 'localFiles.writeFile.preview': 'Content Preview',
+ 'localFiles.writeFile.truncated': 'truncated',
+ 'search.createNewSearch': 'Create a new search record',
+ 'search.emptyResult': 'No results found, please modify your keywords and try again',
+ 'search.genAiMessage': 'Create Agent Message',
+ 'search.includedTooltip':
+ 'The current search results will be included in the context of the conversation',
+ 'search.keywords': 'Keywords:',
+ 'search.scoreTooltip':
+ 'Relevance score; a higher score indicates a closer match to the query keywords',
+ 'search.searchBar.button': 'Search',
+ 'search.searchBar.placeholder': 'Keywords',
+ 'search.searchBar.tooltip':
+ 'This will refresh the search results and create a new summary message',
+ 'search.searchCategory.placeholder': 'Search Category',
+ 'search.searchCategory.title': 'Search Category:',
+ 'search.searchCategory.value.files': 'Files',
+ 'search.searchCategory.value.general': 'General',
+ 'search.searchCategory.value.images': 'Images',
+ 'search.searchCategory.value.it': 'Information Technology',
+ 'search.searchCategory.value.map': 'Maps',
+ 'search.searchCategory.value.music': 'Music',
+ 'search.searchCategory.value.news': 'News',
+ 'search.searchCategory.value.science': 'Science',
+ 'search.searchCategory.value.social_media': 'Social Media',
+ 'search.searchCategory.value.videos': 'Videos',
+ 'search.searchEngine.placeholder': 'Search Engine',
+ 'search.searchEngine.title': 'Search Engine:',
+ 'search.searchResult': 'Number of searches:',
+ 'search.searchTimeRange.title': 'Time Range:',
+ 'search.searchTimeRange.value.anytime': 'Anytime',
+ 'search.searchTimeRange.value.day': 'Within a day',
+ 'search.searchTimeRange.value.month': 'Within a month',
+ 'search.searchTimeRange.value.week': 'Within a week',
+ 'search.searchTimeRange.value.year': 'Within a year',
+ 'search.summary': 'Summary',
+ 'search.summaryTooltip': 'Summarize the current content',
+ 'search.viewMoreResults': 'View {{results}} more results',
+ 'updateArgs.duplicateKeyError': 'Field key must be unique',
+ 'updateArgs.form.add': 'Add an Item',
+ 'updateArgs.form.key': 'Field Key',
+ 'updateArgs.form.value': 'Field Value',
+ 'updateArgs.formValidationFailed': 'Form validation failed, please check the parameter format',
+ 'updateArgs.keyRequired': 'Field key cannot be empty',
+ 'updateArgs.stringifyError': 'Unable to serialize parameters, please check the parameter format',
+};