Merge pull request #2493 from continuedev/tomasz/full-screen-ui
Full screen UI improvements
This commit is contained in:
commit
a212612f66
9 changed files with 289 additions and 247 deletions
|
|
@ -1,8 +1,4 @@
|
|||
import {
|
||||
ArrowLeftIcon,
|
||||
PencilSquareIcon,
|
||||
TrashIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { PencilSquareIcon, TrashIcon } from "@heroicons/react/24/outline";
|
||||
import { SessionInfo } from "core";
|
||||
import MiniSearch from "minisearch";
|
||||
import React, { Fragment, useEffect, useState } from "react";
|
||||
|
|
@ -12,15 +8,12 @@ import styled from "styled-components";
|
|||
import {
|
||||
defaultBorderRadius,
|
||||
Input,
|
||||
lightGray,
|
||||
vscBackground,
|
||||
vscBadgeBackground,
|
||||
vscForeground,
|
||||
vscInputBackground,
|
||||
} from "../components";
|
||||
import ButtonWithTooltip from "../components/ButtonWithTooltip";
|
||||
} from ".";
|
||||
import ButtonWithTooltip from "./ButtonWithTooltip";
|
||||
import useHistory from "../hooks/useHistory";
|
||||
import { useNavigationListener } from "../hooks/useNavigationListener";
|
||||
import { getFontSize } from "../util";
|
||||
|
||||
const SearchBarContainer = styled.div`
|
||||
|
|
@ -71,7 +64,7 @@ const SectionHeader = styled.tr`
|
|||
user-select: none;
|
||||
padding: 4px;
|
||||
background-color: ${vscInputBackground};
|
||||
width: 100%;
|
||||
width: calc(100% - 8px);
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
|
|
@ -81,15 +74,6 @@ const SectionHeader = styled.tr`
|
|||
height: 1.5em;
|
||||
`;
|
||||
|
||||
const TdDiv = styled.div`
|
||||
cursor: pointer;
|
||||
flex-grow: 1;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
`;
|
||||
|
||||
function TableRow({
|
||||
session,
|
||||
date,
|
||||
|
|
@ -132,17 +116,18 @@ function TableRow({
|
|||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
>
|
||||
<div className="flex justify-between items-center w-full">
|
||||
<TdDiv
|
||||
onClick={async () => {
|
||||
// Save current session
|
||||
saveSession();
|
||||
await loadSession(session.sessionId);
|
||||
navigate("/");
|
||||
}}
|
||||
>
|
||||
<div className="text-md w-100">
|
||||
{editing ? (
|
||||
<div
|
||||
className="flex max-w-full box-border px-4 py-2"
|
||||
onClick={async () => {
|
||||
// Save current session
|
||||
saveSession();
|
||||
await loadSession(session.sessionId);
|
||||
navigate("/");
|
||||
}}
|
||||
>
|
||||
<div className="cursor-pointer flex-1">
|
||||
{editing ? (
|
||||
<div className="text-md">
|
||||
<Input
|
||||
type="text"
|
||||
style={{ width: "100%" }}
|
||||
|
|
@ -152,15 +137,17 @@ function TableRow({
|
|||
onKeyUp={(e) => handleKeyUp(e)}
|
||||
onBlur={() => setEditing(false)}
|
||||
/>
|
||||
) : (
|
||||
JSON.stringify(session.title).slice(1, -1)
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<span className="truncate max-w-60 block">
|
||||
{JSON.stringify(session.title).slice(1, -1)}
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div style={{ color: "#9ca3af" }}>
|
||||
{lastPartOfPath(session.workspaceDirectory || "")}
|
||||
<div className="flex" style={{ color: "#9ca3af" }}>
|
||||
<span>{lastPartOfPath(session.workspaceDirectory || "")}</span>
|
||||
{!hovered && (
|
||||
<span className="inline-block float-right">
|
||||
<span className="inline-block ml-auto">
|
||||
{date.toLocaleString("en-US", {
|
||||
year: "2-digit",
|
||||
month: "2-digit",
|
||||
|
|
@ -172,31 +159,29 @@ function TableRow({
|
|||
</span>
|
||||
)}
|
||||
</div>
|
||||
</TdDiv>
|
||||
</div>
|
||||
|
||||
{hovered && (
|
||||
<ButtonWithTooltip
|
||||
className="mr-2"
|
||||
text="Edit"
|
||||
onClick={async () => {
|
||||
setEditing(true);
|
||||
}}
|
||||
>
|
||||
<PencilSquareIcon width="1.3em" height="1.3em" />
|
||||
</ButtonWithTooltip>
|
||||
)}
|
||||
|
||||
{hovered && (
|
||||
<ButtonWithTooltip
|
||||
className="mr-2"
|
||||
text="Delete"
|
||||
onClick={async () => {
|
||||
deleteSession(session.sessionId);
|
||||
onDelete(session.sessionId);
|
||||
}}
|
||||
>
|
||||
<TrashIcon width="1.3em" height="1.3em" />
|
||||
</ButtonWithTooltip>
|
||||
<div className="ml-auto pl-2 gap-x-2 flex">
|
||||
<ButtonWithTooltip
|
||||
text="Edit"
|
||||
onClick={async (e) => {
|
||||
e.stopPropagation();
|
||||
setEditing(true);
|
||||
}}
|
||||
>
|
||||
<PencilSquareIcon width="1.3em" height="1.3em" />
|
||||
</ButtonWithTooltip>
|
||||
<ButtonWithTooltip
|
||||
text="Delete"
|
||||
onClick={async () => {
|
||||
deleteSession(session.sessionId);
|
||||
onDelete(session.sessionId);
|
||||
}}
|
||||
>
|
||||
<TrashIcon width="1.3em" height="1.3em" />
|
||||
</ButtonWithTooltip>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -208,10 +193,7 @@ function lastPartOfPath(path: string): string {
|
|||
return path.split(sep).pop() || path;
|
||||
}
|
||||
|
||||
function History() {
|
||||
useNavigationListener();
|
||||
const navigate = useNavigate();
|
||||
|
||||
export function History() {
|
||||
const [sessions, setSessions] = useState<SessionInfo[]>([]);
|
||||
const [filteredAndSortedSessions, setFilteredAndSortedSessions] = useState<
|
||||
SessionInfo[]
|
||||
|
|
@ -227,11 +209,8 @@ function History() {
|
|||
|
||||
const searchInputRef = React.useRef<HTMLInputElement>(null);
|
||||
|
||||
const stickyHistoryHeaderRef = React.useRef<HTMLDivElement>(null);
|
||||
const [headerHeight, setHeaderHeight] = useState(0);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const { getHistory } = useHistory(dispatch);
|
||||
const { getHistory, lastSessionId } = useHistory(dispatch);
|
||||
|
||||
const [minisearch, setMinisearch] = useState<
|
||||
MiniSearch<{ title: string; sessionId: string }>
|
||||
|
|
@ -256,7 +235,7 @@ function History() {
|
|||
);
|
||||
};
|
||||
fetchSessions();
|
||||
}, []);
|
||||
}, [lastSessionId]);
|
||||
|
||||
useEffect(() => {
|
||||
// When searchTerm is empty only show sessions from the current workspace
|
||||
|
|
@ -297,138 +276,90 @@ function History() {
|
|||
);
|
||||
}, [sessions, searchTerm, minisearch]);
|
||||
|
||||
useEffect(() => {
|
||||
setHeaderHeight(stickyHistoryHeaderRef.current?.clientHeight || 100);
|
||||
}, [stickyHistoryHeaderRef.current]);
|
||||
|
||||
const yesterday = new Date(Date.now() - 1000 * 60 * 60 * 24);
|
||||
const lastWeek = new Date(Date.now() - 1000 * 60 * 60 * 24 * 7);
|
||||
const lastMonth = new Date(Date.now() - 1000 * 60 * 60 * 24 * 30);
|
||||
const earlier = new Date(0);
|
||||
|
||||
return (
|
||||
<div className="overflow-y-scroll" style={{ fontSize: getFontSize() }}>
|
||||
<div
|
||||
ref={stickyHistoryHeaderRef}
|
||||
className="sticky top-0"
|
||||
style={{ backgroundColor: vscBackground }}
|
||||
>
|
||||
<div
|
||||
className="items-center flex m-0 p-0"
|
||||
<div style={{ fontSize: getFontSize() }}>
|
||||
<SearchBarContainer className="space-x-2">
|
||||
<SearchBar
|
||||
className="flex-1 w-full"
|
||||
ref={searchInputRef}
|
||||
placeholder="Search past sessions"
|
||||
type="text"
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
/>
|
||||
<span
|
||||
className="block text-center px-2 py-1.5 rounded-md w-12 mx-1 my-2 select-none cursor-pointer"
|
||||
style={{
|
||||
borderBottom: `0.5px solid ${lightGray}`,
|
||||
fontSize: "11px",
|
||||
backgroundColor:
|
||||
searchTerm !== "" ? vscInputBackground : vscBadgeBackground,
|
||||
}}
|
||||
onClick={() => {
|
||||
if (searchInputRef.current.value === "") {
|
||||
searchInputRef.current.value = "*";
|
||||
setSearchTerm("*");
|
||||
} else {
|
||||
searchInputRef.current.value = "";
|
||||
setSearchTerm("");
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ArrowLeftIcon
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
onClick={() => navigate("/")}
|
||||
className="inline-block ml-4 cursor-pointer"
|
||||
/>
|
||||
<h3 className="text-lg font-bold m-2 inline-block">History</h3>
|
||||
{searchTerm === "" ? "Show All" : "Clear"}
|
||||
</span>
|
||||
</SearchBarContainer>
|
||||
|
||||
{filteredAndSortedSessions.length === 0 && (
|
||||
<div className="text-center m-4">
|
||||
No past sessions found. To start a new session, either click the "+"
|
||||
button or use the keyboard shortcut: <b>Option + Command + N</b>
|
||||
</div>
|
||||
{/* {workspacePaths && workspacePaths.length > 0 && (
|
||||
<CheckDiv
|
||||
checked={filteringByWorkspace}
|
||||
onClick={() => setFilteringByWorkspace((prev) => !prev)}
|
||||
title={`Show only sessions from ${lastPartOfPath(
|
||||
workspacePaths[workspacePaths.length - 1]
|
||||
)}/`}
|
||||
/>
|
||||
)} */}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<SearchBarContainer className="space-x-2">
|
||||
<SearchBar
|
||||
className="flex-1 w-full"
|
||||
ref={searchInputRef}
|
||||
placeholder="Search past sessions"
|
||||
type="text"
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
/>
|
||||
<span
|
||||
className="block text-center px-2 py-1.5 rounded-md w-12 mx-1 my-2 select-none cursor-pointer"
|
||||
style={{
|
||||
fontSize: "11px",
|
||||
backgroundColor:
|
||||
searchTerm !== "" ? vscInputBackground : vscBadgeBackground,
|
||||
}}
|
||||
onClick={() => {
|
||||
if (searchInputRef.current.value === "") {
|
||||
searchInputRef.current.value = "*";
|
||||
setSearchTerm("*");
|
||||
} else {
|
||||
searchInputRef.current.value = "";
|
||||
setSearchTerm("");
|
||||
}
|
||||
}}
|
||||
>
|
||||
{searchTerm === "" ? "Show All" : "Clear"}
|
||||
</span>
|
||||
</SearchBarContainer>
|
||||
|
||||
{filteredAndSortedSessions.length === 0 && (
|
||||
<div className="text-center m-4">
|
||||
No past sessions found. To start a new session, either click the "+"
|
||||
button or use the keyboard shortcut: <b>Option + Command + N</b>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<table className="w-full border-spacing-0 border-collapse">
|
||||
<tbody>
|
||||
{filteredAndSortedSessions.map((session, index) => {
|
||||
const prevDate =
|
||||
index > 0
|
||||
? parseDate(filteredAndSortedSessions[index - 1].dateCreated)
|
||||
: earlier;
|
||||
const date = parseDate(session.dateCreated);
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
{index === 0 && date > yesterday && (
|
||||
<SectionHeader style={{ top: `${headerHeight - 1}px` }}>
|
||||
Today
|
||||
</SectionHeader>
|
||||
)}
|
||||
{date < yesterday &&
|
||||
date > lastWeek &&
|
||||
prevDate > yesterday && (
|
||||
<SectionHeader style={{ top: `${headerHeight - 1}px` }}>
|
||||
This Week
|
||||
</SectionHeader>
|
||||
)}
|
||||
{date < lastWeek &&
|
||||
date > lastMonth &&
|
||||
prevDate > lastWeek && (
|
||||
<SectionHeader style={{ top: `${headerHeight - 1}px` }}>
|
||||
This Month
|
||||
</SectionHeader>
|
||||
)}
|
||||
{date < lastMonth && prevDate > lastMonth && (
|
||||
<SectionHeader style={{ top: `${headerHeight - 1}px` }}>
|
||||
Older
|
||||
</SectionHeader>
|
||||
<table className="w-full border-spacing-0 border-collapse">
|
||||
<tbody>
|
||||
{filteredAndSortedSessions.map((session, index) => {
|
||||
const prevDate =
|
||||
index > 0
|
||||
? parseDate(filteredAndSortedSessions[index - 1].dateCreated)
|
||||
: earlier;
|
||||
const date = parseDate(session.dateCreated);
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
{index === 0 && date > yesterday && (
|
||||
<SectionHeader>Today</SectionHeader>
|
||||
)}
|
||||
{date < yesterday &&
|
||||
date > lastWeek &&
|
||||
prevDate > yesterday && (
|
||||
<SectionHeader>This Week</SectionHeader>
|
||||
)}
|
||||
{date < lastWeek && date > lastMonth && prevDate > lastWeek && (
|
||||
<SectionHeader>This Month</SectionHeader>
|
||||
)}
|
||||
{date < lastMonth && prevDate > lastMonth && (
|
||||
<SectionHeader>Older</SectionHeader>
|
||||
)}
|
||||
|
||||
<Tr key={index}>
|
||||
<TableRow
|
||||
session={session}
|
||||
date={date}
|
||||
onDelete={() => deleteSessionInUI(session.sessionId)}
|
||||
></TableRow>
|
||||
</Tr>
|
||||
</Fragment>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<i className="text-sm ml-4">
|
||||
All session data is saved in ~/.continue/sessions
|
||||
</i>
|
||||
</div>
|
||||
<Tr key={index}>
|
||||
<TableRow
|
||||
session={session}
|
||||
date={date}
|
||||
onDelete={() => deleteSessionInUI(session.sessionId)}
|
||||
></TableRow>
|
||||
</Tr>
|
||||
</Fragment>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<i className="text-sm ml-4">
|
||||
All session data is saved in ~/.continue/sessions
|
||||
</i>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default History;
|
||||
|
|
@ -13,6 +13,7 @@ import Footer from "./Footer";
|
|||
import { updateApplyState, setShowDialog } from "../redux/slices/uiStateSlice";
|
||||
import TextDialog from "./dialogs";
|
||||
import { useOnboardingCard, isNewUserOnboarding } from "./OnboardingCard";
|
||||
import { LastSessionProvider } from "../context/LastSessionContext";
|
||||
|
||||
const LayoutTopDiv = styled(CustomScrollbarDiv)`
|
||||
height: 100%;
|
||||
|
|
@ -174,39 +175,42 @@ const Layout = () => {
|
|||
}, [location]);
|
||||
|
||||
return (
|
||||
<LayoutTopDiv>
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
<LastSessionProvider>
|
||||
<LayoutTopDiv>
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
|
||||
<GridDiv>
|
||||
<PostHogPageView />
|
||||
<Outlet />
|
||||
<ModelDropdownPortalDiv id="model-select-top-div"></ModelDropdownPortalDiv>
|
||||
<ProfileDropdownPortalDiv id="profile-select-top-div"></ProfileDropdownPortalDiv>
|
||||
<Footer />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div
|
||||
style={{ fontSize: `${getFontSize() - 4}px` }}
|
||||
id="tooltip-portal-div"
|
||||
/>
|
||||
</LayoutTopDiv>
|
||||
<GridDiv>
|
||||
<PostHogPageView />
|
||||
<Outlet />
|
||||
|
||||
<ModelDropdownPortalDiv id="model-select-top-div"></ModelDropdownPortalDiv>
|
||||
<ProfileDropdownPortalDiv id="profile-select-top-div"></ProfileDropdownPortalDiv>
|
||||
<Footer />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div
|
||||
style={{ fontSize: `${getFontSize() - 4}px` }}
|
||||
id="tooltip-portal-div"
|
||||
/>
|
||||
</LayoutTopDiv>
|
||||
</LastSessionProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
23
gui/src/context/LastSessionContext.tsx
Normal file
23
gui/src/context/LastSessionContext.tsx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import React, { createContext, useState } from "react";
|
||||
|
||||
export const LastSessionContext = createContext<{
|
||||
lastSessionId: string | undefined;
|
||||
setLastSessionId: (id: string | undefined) => void;
|
||||
}>({
|
||||
lastSessionId: undefined,
|
||||
setLastSessionId: () => {},
|
||||
});
|
||||
|
||||
export const LastSessionProvider: React.FC<{
|
||||
children: React.ReactNode;
|
||||
}> = ({ children }) => {
|
||||
const [lastSessionId, setLastSessionId] = useState<string | undefined>();
|
||||
|
||||
return (
|
||||
<LastSessionContext.Provider value={{ lastSessionId, setLastSessionId }}>
|
||||
{children}
|
||||
</LastSessionContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export const useLastSessionContext = () => React.useContext(LastSessionContext);
|
||||
|
|
@ -3,13 +3,14 @@ import { PersistedSessionInfo, SessionInfo } from "core";
|
|||
|
||||
import { llmCanGenerateInParallel } from "core/llm/autodetect";
|
||||
import { stripImages } from "core/llm/images";
|
||||
import { useContext } from "react";
|
||||
import { useCallback, useContext, useEffect } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { defaultModelSelector } from "../redux/selectors/modelSelectors";
|
||||
import { newSession } from "../redux/slices/stateSlice";
|
||||
import { RootState } from "../redux/store";
|
||||
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
|
||||
import { useLastSessionContext } from "../context/LastSessionContext";
|
||||
|
||||
function truncateText(text: string, maxLength: number) {
|
||||
if (text.length > maxLength) {
|
||||
|
|
@ -25,6 +26,12 @@ function useHistory(dispatch: Dispatch) {
|
|||
(store: RootState) => store.state.config.disableSessionTitles,
|
||||
);
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { lastSessionId, setLastSessionId } = useLastSessionContext();
|
||||
|
||||
const updateLastSessionId = useCallback((sessionId: string) => {
|
||||
setLastSessionId(sessionId);
|
||||
setLocalStorage("lastSessionId", sessionId);
|
||||
}, []);
|
||||
|
||||
async function getHistory(
|
||||
offset?: number,
|
||||
|
|
@ -85,7 +92,7 @@ function useHistory(dispatch: Dispatch) {
|
|||
sessionId: stateCopy.sessionId,
|
||||
workspaceDirectory: window.workspacePaths?.[0] || "",
|
||||
};
|
||||
setLocalStorage("lastSessionId", stateCopy.sessionId);
|
||||
updateLastSessionId(stateCopy.sessionId);
|
||||
return await ideMessenger.request("history/save", sessionInfo);
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +113,7 @@ function useHistory(dispatch: Dispatch) {
|
|||
}
|
||||
|
||||
async function loadSession(id: string): Promise<PersistedSessionInfo> {
|
||||
setLocalStorage("lastSessionId", state.sessionId);
|
||||
updateLastSessionId(state.sessionId);
|
||||
const result = await ideMessenger.request("history/load", { id });
|
||||
if (result.status === "error") {
|
||||
throw new Error(result.error);
|
||||
|
|
@ -136,6 +143,7 @@ function useHistory(dispatch: Dispatch) {
|
|||
getLastSessionId,
|
||||
updateSession,
|
||||
getSession,
|
||||
lastSessionId,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,43 +24,43 @@ import {
|
|||
lightGray,
|
||||
vscBackground,
|
||||
vscForeground,
|
||||
} from "../components";
|
||||
import { ChatScrollAnchor } from "../components/ChatScrollAnchor";
|
||||
import StepContainer from "../components/gui/StepContainer";
|
||||
import TimelineItem from "../components/gui/TimelineItem";
|
||||
import ContinueInputBox from "../components/mainInput/ContinueInputBox";
|
||||
import { defaultInputModifiers } from "../components/mainInput/inputModifiers";
|
||||
import { TutorialCard } from "../components/mainInput/TutorialCard";
|
||||
} from "../../components";
|
||||
import { ChatScrollAnchor } from "../../components/ChatScrollAnchor";
|
||||
import StepContainer from "../../components/gui/StepContainer";
|
||||
import TimelineItem from "../../components/gui/TimelineItem";
|
||||
import ContinueInputBox from "../../components/mainInput/ContinueInputBox";
|
||||
import { defaultInputModifiers } from "../../components/mainInput/inputModifiers";
|
||||
import { TutorialCard } from "../../components/mainInput/TutorialCard";
|
||||
import {
|
||||
OnboardingCard,
|
||||
useOnboardingCard,
|
||||
} from "../components/OnboardingCard";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import useChatHandler from "../hooks/useChatHandler";
|
||||
import useHistory from "../hooks/useHistory";
|
||||
import { useTutorialCard } from "../hooks/useTutorialCard";
|
||||
import { useWebviewListener } from "../hooks/useWebviewListener";
|
||||
import { defaultModelSelector } from "../redux/selectors/modelSelectors";
|
||||
} from "../../components/OnboardingCard";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import useChatHandler from "../../hooks/useChatHandler";
|
||||
import useHistory from "../../hooks/useHistory";
|
||||
import { useTutorialCard } from "../../hooks/useTutorialCard";
|
||||
import { useWebviewListener } from "../../hooks/useWebviewListener";
|
||||
import { defaultModelSelector } from "../../redux/selectors/modelSelectors";
|
||||
import {
|
||||
clearLastResponse,
|
||||
deleteMessage,
|
||||
newSession,
|
||||
setInactive,
|
||||
} from "../redux/slices/stateSlice";
|
||||
} from "../../redux/slices/stateSlice";
|
||||
import {
|
||||
setDialogEntryOn,
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../redux/slices/uiStateSlice";
|
||||
import { RootState } from "../redux/store";
|
||||
} from "../../redux/slices/uiStateSlice";
|
||||
import { RootState } from "../../redux/store";
|
||||
import {
|
||||
getFontSize,
|
||||
getMetaKeyLabel,
|
||||
isJetBrains,
|
||||
isMetaEquivalentKeyPressed,
|
||||
} from "../util";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial";
|
||||
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
|
||||
} from "../../util";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS } from "../../util/freeTrial";
|
||||
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
|
||||
|
||||
const TopGuiDiv = styled.div<{
|
||||
showScrollbar?: boolean;
|
||||
|
|
@ -144,7 +144,7 @@ function fallbackRender({ error, resetErrorBoundary }: any) {
|
|||
);
|
||||
}
|
||||
|
||||
function GUI() {
|
||||
export function Chat() {
|
||||
const posthog = usePostHog();
|
||||
const dispatch = useDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
|
@ -528,5 +528,3 @@ function GUI() {
|
|||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default GUI;
|
||||
22
gui/src/pages/gui/index.tsx
Normal file
22
gui/src/pages/gui/index.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Chat } from "./Chat";
|
||||
import { History } from "../../components/History";
|
||||
import styled from "styled-components";
|
||||
import { vscSidebarBorder } from "../../components";
|
||||
|
||||
export const Aside = styled.aside`
|
||||
border-right: 1px solid ${vscSidebarBorder};
|
||||
`;
|
||||
|
||||
export default function GUI() {
|
||||
return (
|
||||
<div className="flex overflow-scroll">
|
||||
<Aside className="overflow-y-auto w-96 hidden 4xl:block">
|
||||
<History />
|
||||
</Aside>
|
||||
|
||||
<main className="overflow-y-auto flex-1 flex flex-col">
|
||||
<Chat />
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
41
gui/src/pages/history/HistoryHeader.tsx
Normal file
41
gui/src/pages/history/HistoryHeader.tsx
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { useNavigate } from "react-router-dom";
|
||||
import { lightGray, vscBackground } from "../../components";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
||||
import { getFontSize } from "../../util";
|
||||
|
||||
export const HistoryHeader = () => {
|
||||
useNavigationListener();
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<div
|
||||
className="sticky top-0"
|
||||
style={{ backgroundColor: vscBackground, fontSize: getFontSize() }}
|
||||
>
|
||||
<div
|
||||
className="items-center flex m-0 p-0"
|
||||
style={{
|
||||
borderBottom: `0.5px solid ${lightGray}`,
|
||||
}}
|
||||
>
|
||||
<ArrowLeftIcon
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
onClick={() => navigate("/")}
|
||||
className="inline-block ml-4 cursor-pointer"
|
||||
/>
|
||||
<h3 className="text-lg font-bold m-2 inline-block">History</h3>
|
||||
</div>
|
||||
{/* {workspacePaths && workspacePaths.length > 0 && (
|
||||
<CheckDiv
|
||||
checked={filteringByWorkspace}
|
||||
onClick={() => setFilteringByWorkspace((prev) => !prev)}
|
||||
title={`Show only sessions from ${lastPartOfPath(
|
||||
workspacePaths[workspacePaths.length - 1]
|
||||
)}/`}
|
||||
/>
|
||||
)} */}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
12
gui/src/pages/history/index.tsx
Normal file
12
gui/src/pages/history/index.tsx
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { History } from "../../components/History";
|
||||
import { getFontSize } from "../../util";
|
||||
import { HistoryHeader } from "./HistoryHeader";
|
||||
|
||||
export default function HistoryPage() {
|
||||
return (
|
||||
<div className="overflow-y-scroll" style={{ fontSize: getFontSize() }}>
|
||||
<HistoryHeader />
|
||||
<History />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -10,12 +10,15 @@ module.exports = {
|
|||
theme: {
|
||||
// Note that these breakpoints are primarily optimized for the input toolbar
|
||||
screens: {
|
||||
xxs: "170px", // Smallest width for Primary Sidebar in VS Code
|
||||
"2xs": "170px", // Smallest width for Primary Sidebar in VS Code
|
||||
xs: "250px", // Avg default sidebar width in VS Code
|
||||
sm: "330px",
|
||||
md: "460px",
|
||||
lg: "590px",
|
||||
xl: "720px",
|
||||
"2xl": "860px",
|
||||
"3xl": "1000px",
|
||||
"4xl": "1180px",
|
||||
},
|
||||
extend: {
|
||||
animation: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue