From b62ce11e2337c9d16f47454077694c22aae6110f Mon Sep 17 00:00:00 2001 From: xue jiahao Date: Mon, 16 Mar 2026 17:27:09 +0800 Subject: [PATCH] add store and UI fix --- .../src/components/AppDetail/AppDetail.tsx | 20 +-- .../src/components/AppList/AppList.tsx | 77 -------- .../src/components/AppList/AppListItem.tsx | 169 +++++++++--------- src/renderer/src/stores/appStore.ts | 1 + src/renderer/src/stores/index.ts | 5 +- src/renderer/src/stores/sessionStore.ts | 54 ++++++ 6 files changed, 146 insertions(+), 180 deletions(-) create mode 100644 src/renderer/src/stores/sessionStore.ts diff --git a/src/renderer/src/components/AppDetail/AppDetail.tsx b/src/renderer/src/components/AppDetail/AppDetail.tsx index a9447ea..8433fed 100644 --- a/src/renderer/src/components/AppDetail/AppDetail.tsx +++ b/src/renderer/src/components/AppDetail/AppDetail.tsx @@ -17,8 +17,7 @@ import { ArrowLeft, } from "lucide-react"; import { createStyles } from "antd-style"; -import { useAppStore } from "@renderer/stores"; -import { useDomainStore } from "@renderer/stores"; +import { useAppStore, useDomainStore, useSessionStore } from "@renderer/stores"; import { CodeViewer } from "../CodeViewer"; import { FileConfigResponse, isFileResource } from "@shared/types/kintone"; import { getDisplayName, getFileKey } from "@shared/utils/fileDisplay"; @@ -51,6 +50,7 @@ const useStyles = createStyles(({ token, css }) => ({ flex: 1; overflow: auto; padding: ${token.paddingMD}px; + padding-top: ${token.paddingXS}px; `, loading: css` display: flex; @@ -129,8 +129,9 @@ const useStyles = createStyles(({ token, css }) => ({ `, // Back button - no border, left aligned with text backButton: css` - padding: 0; - margin-bottom: ${token.marginMD}px; + padding: ${token.marginSM}px 0; + padding-left: ${token.marginXS}px; + margin-bottom: ${token.marginXS}px; display: flex; align-items: center; justify-content: flex-start; @@ -152,14 +153,7 @@ const AppDetail: React.FC = () => { const { currentDomain } = useDomainStore(); const { currentApp, selectedAppId, loading, setCurrentApp, setLoading } = useAppStore(); - - // View mode: 'list' shows file sections, 'code' shows code viewer - const [viewMode, setViewMode] = React.useState<"list" | "code">("list"); - const [selectedFile, setSelectedFile] = React.useState<{ - type: "js" | "css"; - fileKey: string; - name: string; - } | null>(null); + const { viewMode, selectedFile, setViewMode, setSelectedFile } = useSessionStore(); // Download state: track which file is being downloaded const [downloadingKey, setDownloadingKey] = React.useState( @@ -463,7 +457,7 @@ const AppDetail: React.FC = () => {

{currentApp.name}

- {currentApp.appId} + ID: {currentApp.appId}