mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)
* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-2): 格式化 commands (79 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-5): 格式化 components其余 + hooks + tools (232 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md - README.md: 大幅重写,更详细版本历史和配置示例 - Run.ps1: 新增 Windows 启动脚本 - TODO.md: 新增包完成清单 - V6.md: 删除(架构重构规划已不适用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复以前的问题 * fix: 修复 login 面板的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,170 +1,108 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import * as React from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import { getDynamicConfig_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js';
|
||||
import { logEvent } from '../../services/analytics/index.js';
|
||||
import { getGlobalConfig, saveGlobalConfig } from '../../utils/config.js';
|
||||
import { Select } from '../CustomSelect/select.js';
|
||||
import { DesktopHandoff } from '../DesktopHandoff.js';
|
||||
import { PermissionDialog } from '../permissions/PermissionDialog.js';
|
||||
import * as React from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
import { getDynamicConfig_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js'
|
||||
import { logEvent } from '../../services/analytics/index.js'
|
||||
import { getGlobalConfig, saveGlobalConfig } from '../../utils/config.js'
|
||||
import { Select } from '../CustomSelect/select.js'
|
||||
import { DesktopHandoff } from '../DesktopHandoff.js'
|
||||
import { PermissionDialog } from '../permissions/PermissionDialog.js'
|
||||
|
||||
type DesktopUpsellConfig = {
|
||||
enable_shortcut_tip: boolean;
|
||||
enable_startup_dialog: boolean;
|
||||
};
|
||||
enable_shortcut_tip: boolean
|
||||
enable_startup_dialog: boolean
|
||||
}
|
||||
|
||||
const DESKTOP_UPSELL_DEFAULT: DesktopUpsellConfig = {
|
||||
enable_shortcut_tip: false,
|
||||
enable_startup_dialog: false
|
||||
};
|
||||
enable_startup_dialog: false,
|
||||
}
|
||||
|
||||
export function getDesktopUpsellConfig(): DesktopUpsellConfig {
|
||||
return getDynamicConfig_CACHED_MAY_BE_STALE('tengu_desktop_upsell', DESKTOP_UPSELL_DEFAULT);
|
||||
return getDynamicConfig_CACHED_MAY_BE_STALE(
|
||||
'tengu_desktop_upsell',
|
||||
DESKTOP_UPSELL_DEFAULT,
|
||||
)
|
||||
}
|
||||
|
||||
function isSupportedPlatform(): boolean {
|
||||
return process.platform === 'darwin' || process.platform === 'win32' && process.arch === 'x64';
|
||||
return (
|
||||
process.platform === 'darwin' ||
|
||||
(process.platform === 'win32' && process.arch === 'x64')
|
||||
)
|
||||
}
|
||||
|
||||
export function shouldShowDesktopUpsellStartup(): boolean {
|
||||
if (!isSupportedPlatform()) return false;
|
||||
if (!getDesktopUpsellConfig().enable_startup_dialog) return false;
|
||||
const config = getGlobalConfig();
|
||||
if (config.desktopUpsellDismissed) return false;
|
||||
if ((config.desktopUpsellSeenCount ?? 0) >= 3) return false;
|
||||
return true;
|
||||
if (!isSupportedPlatform()) return false
|
||||
if (!getDesktopUpsellConfig().enable_startup_dialog) return false
|
||||
const config = getGlobalConfig()
|
||||
if (config.desktopUpsellDismissed) return false
|
||||
if ((config.desktopUpsellSeenCount ?? 0) >= 3) return false
|
||||
return true
|
||||
}
|
||||
type DesktopUpsellSelection = 'try' | 'not-now' | 'never';
|
||||
|
||||
type DesktopUpsellSelection = 'try' | 'not-now' | 'never'
|
||||
|
||||
type Props = {
|
||||
onDone: () => void;
|
||||
};
|
||||
export function DesktopUpsellStartup(t0) {
|
||||
const $ = _c(14);
|
||||
const {
|
||||
onDone
|
||||
} = t0;
|
||||
const [showHandoff, setShowHandoff] = useState(false);
|
||||
let t1;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = [];
|
||||
$[0] = t1;
|
||||
} else {
|
||||
t1 = $[0];
|
||||
}
|
||||
useEffect(_temp, t1);
|
||||
onDone: () => void
|
||||
}
|
||||
|
||||
export function DesktopUpsellStartup({ onDone }: Props): React.ReactNode {
|
||||
const [showHandoff, setShowHandoff] = useState(false)
|
||||
|
||||
// Increment seen count on mount (guard in updater for StrictMode safety)
|
||||
useEffect(() => {
|
||||
const newCount = (getGlobalConfig().desktopUpsellSeenCount ?? 0) + 1
|
||||
saveGlobalConfig(prev => {
|
||||
if ((prev.desktopUpsellSeenCount ?? 0) >= newCount) return prev
|
||||
return { ...prev, desktopUpsellSeenCount: newCount }
|
||||
})
|
||||
logEvent('tengu_desktop_upsell_shown', { seen_count: newCount })
|
||||
}, [])
|
||||
|
||||
if (showHandoff) {
|
||||
let t2;
|
||||
if ($[1] !== onDone) {
|
||||
t2 = <DesktopHandoff onDone={() => onDone()} />;
|
||||
$[1] = onDone;
|
||||
$[2] = t2;
|
||||
} else {
|
||||
t2 = $[2];
|
||||
return <DesktopHandoff onDone={() => onDone()} />
|
||||
}
|
||||
|
||||
function handleSelect(value: DesktopUpsellSelection): void {
|
||||
switch (value) {
|
||||
case 'try':
|
||||
setShowHandoff(true)
|
||||
return
|
||||
case 'never':
|
||||
saveGlobalConfig(prev => {
|
||||
if (prev.desktopUpsellDismissed) return prev
|
||||
return { ...prev, desktopUpsellDismissed: true }
|
||||
})
|
||||
onDone()
|
||||
return
|
||||
case 'not-now':
|
||||
onDone()
|
||||
return
|
||||
}
|
||||
return t2;
|
||||
}
|
||||
let t2;
|
||||
if ($[3] !== onDone) {
|
||||
t2 = function handleSelect(value) {
|
||||
switch (value) {
|
||||
case "try":
|
||||
{
|
||||
setShowHandoff(true);
|
||||
return;
|
||||
}
|
||||
case "never":
|
||||
{
|
||||
saveGlobalConfig(_temp2);
|
||||
onDone();
|
||||
return;
|
||||
}
|
||||
case "not-now":
|
||||
{
|
||||
onDone();
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
$[3] = onDone;
|
||||
$[4] = t2;
|
||||
} else {
|
||||
t2 = $[4];
|
||||
}
|
||||
const handleSelect = t2;
|
||||
let t3;
|
||||
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t3 = {
|
||||
label: "Open in Claude Code Desktop",
|
||||
value: "try" as const
|
||||
};
|
||||
$[5] = t3;
|
||||
} else {
|
||||
t3 = $[5];
|
||||
}
|
||||
let t4;
|
||||
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t4 = {
|
||||
label: "Not now",
|
||||
value: "not-now" as const
|
||||
};
|
||||
$[6] = t4;
|
||||
} else {
|
||||
t4 = $[6];
|
||||
}
|
||||
let t5;
|
||||
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t5 = [t3, t4, {
|
||||
label: "Don't ask again",
|
||||
value: "never" as const
|
||||
}];
|
||||
$[7] = t5;
|
||||
} else {
|
||||
t5 = $[7];
|
||||
}
|
||||
const options = t5;
|
||||
let t6;
|
||||
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t6 = <Box marginBottom={1}><Text>Same Claude Code with visual diffs, live app preview, parallel sessions, and more.</Text></Box>;
|
||||
$[8] = t6;
|
||||
} else {
|
||||
t6 = $[8];
|
||||
}
|
||||
let t7;
|
||||
if ($[9] !== handleSelect) {
|
||||
t7 = () => handleSelect("not-now");
|
||||
$[9] = handleSelect;
|
||||
$[10] = t7;
|
||||
} else {
|
||||
t7 = $[10];
|
||||
}
|
||||
let t8;
|
||||
if ($[11] !== handleSelect || $[12] !== t7) {
|
||||
t8 = <PermissionDialog title="Try Claude Code Desktop"><Box flexDirection="column" paddingX={2} paddingY={1}>{t6}<Select options={options} onChange={handleSelect} onCancel={t7} /></Box></PermissionDialog>;
|
||||
$[11] = handleSelect;
|
||||
$[12] = t7;
|
||||
$[13] = t8;
|
||||
} else {
|
||||
t8 = $[13];
|
||||
}
|
||||
return t8;
|
||||
}
|
||||
function _temp2(prev_0) {
|
||||
if (prev_0.desktopUpsellDismissed) {
|
||||
return prev_0;
|
||||
}
|
||||
return {
|
||||
...prev_0,
|
||||
desktopUpsellDismissed: true
|
||||
};
|
||||
}
|
||||
function _temp() {
|
||||
const newCount = (getGlobalConfig().desktopUpsellSeenCount ?? 0) + 1;
|
||||
saveGlobalConfig(prev => {
|
||||
if ((prev.desktopUpsellSeenCount ?? 0) >= newCount) {
|
||||
return prev;
|
||||
}
|
||||
return {
|
||||
...prev,
|
||||
desktopUpsellSeenCount: newCount
|
||||
};
|
||||
});
|
||||
logEvent("tengu_desktop_upsell_shown", {
|
||||
seen_count: newCount
|
||||
});
|
||||
|
||||
const options = [
|
||||
{ label: 'Open in Claude Code Desktop', value: 'try' as const },
|
||||
{ label: 'Not now', value: 'not-now' as const },
|
||||
{ label: "Don't ask again", value: 'never' as const },
|
||||
]
|
||||
|
||||
return (
|
||||
<PermissionDialog title="Try Claude Code Desktop">
|
||||
<Box flexDirection="column" paddingX={2} paddingY={1}>
|
||||
<Box marginBottom={1}>
|
||||
<Text>
|
||||
Same Claude Code with visual diffs, live app preview, parallel
|
||||
sessions, and more.
|
||||
</Text>
|
||||
</Box>
|
||||
<Select
|
||||
options={options}
|
||||
onChange={handleSelect}
|
||||
onCancel={() => handleSelect('not-now')}
|
||||
/>
|
||||
</Box>
|
||||
</PermissionDialog>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user