persist block settings toolbar expanded and adjust padding to match lump width
This commit is contained in:
parent
15b4576a1b
commit
ee139138d1
5 changed files with 23 additions and 10 deletions
|
|
@ -20,8 +20,10 @@ interface StepContainerProps {
|
|||
}
|
||||
|
||||
const ContentDiv = styled.div<{ fontSize?: number }>`
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
padding: 4px;
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
|
||||
background-color: ${vscBackground};
|
||||
font-size: ${getFontSize()}px;
|
||||
overflow: hidden;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ import {
|
|||
Squares2X2Icon,
|
||||
WrenchScrewdriverIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useState } from "react";
|
||||
import { vscBadgeBackground, vscBadgeForeground } from "../..";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import { toggleBlockSettingsToolbar } from "../../../redux/slices/uiSlice";
|
||||
import { fontSize } from "../../../util";
|
||||
import AssistantSelect from "../../modelSelection/platform/AssistantSelect";
|
||||
import HoverItem from "../InputToolbar/bottom/HoverItem";
|
||||
|
|
@ -85,13 +86,15 @@ interface BlockSettingsTopToolbarProps {
|
|||
}
|
||||
|
||||
export function BlockSettingsTopToolbar(props: BlockSettingsTopToolbarProps) {
|
||||
const [isExpanded, setIsExpanded] = useState(true);
|
||||
|
||||
const isExpanded = useAppSelector(
|
||||
(state) => state.ui.isBlockSettingsToolbarExpanded,
|
||||
);
|
||||
const dispatch = useAppDispatch();
|
||||
const handleEllipsisClick = () => {
|
||||
if (isExpanded) {
|
||||
props.setSelectedSection(null);
|
||||
}
|
||||
setIsExpanded(!isExpanded);
|
||||
dispatch(toggleBlockSettingsToolbar());
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { useContext } from "react";
|
||||
import styled from "styled-components";
|
||||
import { lightGray } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import {
|
||||
|
|
@ -18,8 +17,8 @@ const Container = styled.div`
|
|||
|
||||
const StopButton = styled.div`
|
||||
font-size: ${getFontSize() - 3}px;
|
||||
color: ${lightGray};
|
||||
padding: 4px;
|
||||
padding: 2px;
|
||||
padding-right: 4px;
|
||||
cursor: pointer;
|
||||
`;
|
||||
|
||||
|
|
@ -38,6 +37,7 @@ export function LumpToolbar(props: TopToolbarProps) {
|
|||
return (
|
||||
<Container>
|
||||
<StopButton
|
||||
className="text-gray-400"
|
||||
onClick={() => {
|
||||
ideMessenger.post("tts/kill", undefined);
|
||||
}}
|
||||
|
|
@ -52,6 +52,7 @@ export function LumpToolbar(props: TopToolbarProps) {
|
|||
return (
|
||||
<Container>
|
||||
<StopButton
|
||||
className="text-gray-400"
|
||||
onClick={() => {
|
||||
dispatch(setInactive());
|
||||
dispatch(clearLastEmptyResponse());
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ export function Chat() {
|
|||
</div>
|
||||
))}
|
||||
</StepsDiv>
|
||||
<div className={`relative mt-1`}>
|
||||
<div className={"relative"}>
|
||||
{toolCallState?.status === "generated" && <ToolCallButtons />}
|
||||
|
||||
{isInEditMode && history.length === 0 && <CodeToEditCard />}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ type UIState = {
|
|||
toolSettings: { [toolName: string]: ToolSetting };
|
||||
toolGroupSettings: { [toolGroupName: string]: ToolGroupSetting };
|
||||
ttsActive: boolean;
|
||||
isBlockSettingsToolbarExpanded: boolean;
|
||||
};
|
||||
|
||||
export const DEFAULT_TOOL_SETTING: ToolSetting = "allowedWithPermission";
|
||||
|
|
@ -55,6 +56,7 @@ export const uiSlice = createSlice({
|
|||
toolGroupSettings: {
|
||||
BUILT_IN_GROUP_NAME: "include",
|
||||
},
|
||||
isBlockSettingsToolbarExpanded: true,
|
||||
} as UIState,
|
||||
reducers: {
|
||||
setOnboardingCard: (
|
||||
|
|
@ -122,6 +124,10 @@ export const uiSlice = createSlice({
|
|||
setTTSActive: (state, { payload }: PayloadAction<boolean>) => {
|
||||
state.ttsActive = payload;
|
||||
},
|
||||
toggleBlockSettingsToolbar: (state) => {
|
||||
state.isBlockSettingsToolbarExpanded =
|
||||
!state.isBlockSettingsToolbarExpanded;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -136,6 +142,7 @@ export const {
|
|||
toggleToolGroupSetting,
|
||||
addTool,
|
||||
setTTSActive,
|
||||
toggleBlockSettingsToolbar,
|
||||
} = uiSlice.actions;
|
||||
|
||||
export default uiSlice.reducer;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue