From b064d3385efac48bb7096d2ae460e978003b326b Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 20 Oct 2025 15:04:24 +0800 Subject: [PATCH] feat(settings): reorder Usage Analysis section and restore view details button --- .../components/layouts/TaskReportDropdown.tsx | 14 +++++-- .../renderer/src/modules/settings/tabs/ai.tsx | 7 +++- .../tabs/ai/usage/UsageAnalysisSection.tsx | 37 +++++++++---------- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/TaskReportDropdown.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/TaskReportDropdown.tsx index a6f968cf3..414c42e53 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/TaskReportDropdown.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/TaskReportDropdown.tsx @@ -1,4 +1,5 @@ import { ActionButton } from "@follow/components/ui/button/index.js" +import { nextFrame } from "@follow/utils" import type { AIChatSession } from "@follow-app/client-sdk" import type { ReactElement } from "react" import { useCallback, useMemo, useState } from "react" @@ -22,6 +23,7 @@ import { useDeleteAIChatSessionMutation, } from "~/modules/ai-chat-session/query" import { AITaskModal, useCanCreateNewAITask } from "~/modules/ai-task" +import { useSettingModal } from "~/modules/settings/modal/use-setting-modal-hack" import { AIPersistService } from "../../services" @@ -95,6 +97,7 @@ export const TaskReportDropdown = ({ triggerElement, asChild = true }: TaskRepor const { ask } = useDialog() const { t } = useTranslation("ai") const [loadingChatId, setLoadingChatId] = useState(null) + const showSettings = useSettingModal() // Only keep unread sessions for display const unreadSessions = useMemo( @@ -111,10 +114,13 @@ export const TaskReportDropdown = ({ triggerElement, asChild = true }: TaskRepor toast.error("Please remove an existing task before creating a new one.") return } - present({ - title: "New AI Task", - canClose: true, - content: () => , + showSettings("ai") + nextFrame(() => { + present({ + title: "New AI Task", + canClose: true, + content: () => , + }) }) } diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx index f10c104db..727df3f27 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx @@ -22,7 +22,6 @@ export const SettingAI = () => {
{ value: t("tasks.section.title"), }, TaskSchedulingSection, + + { + type: "title", + value: t("usage_analysis.title"), + }, + UsageAnalysisSection, AISecurityDisclosureSection, ]} /> diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/ai/usage/UsageAnalysisSection.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/ai/usage/UsageAnalysisSection.tsx index 8237e171f..ecdeb04bf 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/tabs/ai/usage/UsageAnalysisSection.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/ai/usage/UsageAnalysisSection.tsx @@ -32,26 +32,6 @@ export const UsageAnalysisSection = () => { -
-

{t("usage_analysis.title")}

- - -
-
@@ -75,6 +55,23 @@ export const UsageAnalysisSection = () => {
+
+ +