mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-31 11:01:36 +08:00
style: format code and apply clippy lint fixes
This commit is contained in:
@@ -40,7 +40,7 @@ export function SessionItem({
|
||||
"w-full text-left rounded-lg px-3 py-2.5 transition-all group",
|
||||
isSelected
|
||||
? "bg-primary/10 border border-primary/30"
|
||||
: "hover:bg-muted/60 border border-transparent"
|
||||
: "hover:bg-muted/60 border border-transparent",
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
@@ -62,7 +62,7 @@ export function SessionItem({
|
||||
<ChevronRight
|
||||
className={cn(
|
||||
"size-4 text-muted-foreground/50 shrink-0 transition-transform",
|
||||
isSelected && "text-primary rotate-90"
|
||||
isSelected && "text-primary rotate-90",
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -76,7 +76,7 @@ export function SessionManagerPage() {
|
||||
const messagesEndRef = useRef<HTMLDivElement | null>(null);
|
||||
const messageRefs = useRef<Map<number, HTMLDivElement>>(new Map());
|
||||
const [activeMessageIndex, setActiveMessageIndex] = useState<number | null>(
|
||||
null
|
||||
null,
|
||||
);
|
||||
const [tocDialogOpen, setTocDialogOpen] = useState(false);
|
||||
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
||||
@@ -91,7 +91,7 @@ export function SessionManagerPage() {
|
||||
|
||||
useEffect(() => {
|
||||
const storedTarget = window.localStorage.getItem(
|
||||
TERMINAL_TARGET_KEY
|
||||
TERMINAL_TARGET_KEY,
|
||||
) as TerminalTarget | null;
|
||||
if (storedTarget) {
|
||||
setTerminalTarget(storedTarget);
|
||||
@@ -123,7 +123,7 @@ export function SessionManagerPage() {
|
||||
}
|
||||
const exists = selectedKey
|
||||
? filteredSessions.some(
|
||||
(session) => getSessionKey(session) === selectedKey
|
||||
(session) => getSessionKey(session) === selectedKey,
|
||||
)
|
||||
: false;
|
||||
if (!exists) {
|
||||
@@ -135,7 +135,7 @@ export function SessionManagerPage() {
|
||||
if (!selectedKey) return null;
|
||||
return (
|
||||
filteredSessions.find(
|
||||
(session) => getSessionKey(session) === selectedKey
|
||||
(session) => getSessionKey(session) === selectedKey,
|
||||
) || null
|
||||
);
|
||||
}, [filteredSessions, selectedKey]);
|
||||
@@ -143,7 +143,7 @@ export function SessionManagerPage() {
|
||||
const { data: messages = [], isLoading: isLoadingMessages } =
|
||||
useSessionMessagesQuery(
|
||||
selectedSession?.providerId,
|
||||
selectedSession?.sourcePath
|
||||
selectedSession?.sourcePath,
|
||||
);
|
||||
|
||||
// 提取用户消息用于目录
|
||||
@@ -187,7 +187,7 @@ export function SessionManagerPage() {
|
||||
} catch (error) {
|
||||
toast.error(
|
||||
extractErrorMessage(error) ||
|
||||
t("common.error", { defaultValue: "Copy failed" })
|
||||
t("common.error", { defaultValue: "Copy failed" }),
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -198,7 +198,7 @@ export function SessionManagerPage() {
|
||||
if (!isMac()) {
|
||||
await handleCopy(
|
||||
selectedSession.resumeCommand,
|
||||
t("sessionManager.resumeCommandCopied")
|
||||
t("sessionManager.resumeCommandCopied"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ export function SessionManagerPage() {
|
||||
setIsSearchOpen(true);
|
||||
setTimeout(
|
||||
() => searchInputRef.current?.focus(),
|
||||
0
|
||||
0,
|
||||
);
|
||||
}}
|
||||
>
|
||||
@@ -428,7 +428,7 @@ export function SessionManagerPage() {
|
||||
<span className="shrink-0">
|
||||
<ProviderIcon
|
||||
icon={getProviderIconName(
|
||||
selectedSession.providerId
|
||||
selectedSession.providerId,
|
||||
)}
|
||||
name={selectedSession.providerId}
|
||||
size={20}
|
||||
@@ -451,7 +451,7 @@ export function SessionManagerPage() {
|
||||
<span>
|
||||
{formatTimestamp(
|
||||
selectedSession.lastActiveAt ??
|
||||
selectedSession.createdAt
|
||||
selectedSession.createdAt,
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
@@ -463,7 +463,7 @@ export function SessionManagerPage() {
|
||||
onClick={() =>
|
||||
void handleCopy(
|
||||
selectedSession.projectDir!,
|
||||
t("sessionManager.projectDirCopied")
|
||||
t("sessionManager.projectDirCopied"),
|
||||
)
|
||||
}
|
||||
className="flex items-center gap-1 hover:text-foreground transition-colors"
|
||||
@@ -590,7 +590,7 @@ export function SessionManagerPage() {
|
||||
onClick={() =>
|
||||
void handleCopy(
|
||||
selectedSession.resumeCommand!,
|
||||
t("sessionManager.resumeCommandCopied")
|
||||
t("sessionManager.resumeCommandCopied"),
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -652,7 +652,7 @@ export function SessionManagerPage() {
|
||||
content,
|
||||
t("sessionManager.messageCopied", {
|
||||
defaultValue: "已复制消息内容",
|
||||
})
|
||||
}),
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -37,7 +37,7 @@ export function SessionMessageItem({
|
||||
: message.role.toLowerCase() === "assistant"
|
||||
? "bg-blue-500/5 border-blue-500/20 mr-8"
|
||||
: "bg-muted/40 border-border/60",
|
||||
isActive && "ring-2 ring-primary ring-offset-2"
|
||||
isActive && "ring-2 ring-primary ring-offset-2",
|
||||
)}
|
||||
>
|
||||
<Tooltip>
|
||||
|
||||
@@ -46,7 +46,7 @@ export function SessionTocSidebar({
|
||||
className={cn(
|
||||
"w-full text-left px-2 py-1.5 rounded text-xs transition-colors",
|
||||
"hover:bg-muted/80 text-muted-foreground hover:text-foreground",
|
||||
"flex items-start gap-2"
|
||||
"flex items-start gap-2",
|
||||
)}
|
||||
>
|
||||
<span className="shrink-0 w-4 h-4 rounded-full bg-primary/10 text-primary text-[10px] flex items-center justify-center font-medium">
|
||||
@@ -115,7 +115,7 @@ export function SessionTocDialog({
|
||||
"w-full text-left px-3 py-2.5 rounded-lg text-sm transition-all",
|
||||
"hover:bg-primary/10 text-foreground",
|
||||
"flex items-start gap-3",
|
||||
"focus:outline-none focus:ring-2 focus:ring-primary focus:ring-inset"
|
||||
"focus:outline-none focus:ring-2 focus:ring-primary focus:ring-inset",
|
||||
)}
|
||||
>
|
||||
<span className="shrink-0 w-6 h-6 rounded-full bg-primary text-primary-foreground text-xs flex items-center justify-center font-semibold">
|
||||
|
||||
@@ -34,7 +34,7 @@ export const formatRelativeTime = (value?: number) => {
|
||||
|
||||
export const getProviderLabel = (
|
||||
providerId: string,
|
||||
t: (key: string) => string
|
||||
t: (key: string) => string,
|
||||
) => {
|
||||
const key = `apps.${providerId}`;
|
||||
const translated = t(key);
|
||||
|
||||
Reference in New Issue
Block a user