mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Improve truncation of long chat titles
This commit is contained in:
3 files changed
+31
-33
No files matched your search
@@ -58,7 +58,7 @@ const ProjectItem: React.FC<ProjectItemProps> = ({ project, isSelected, onSelect
|
||||
{/* Star indicator - only shown when favorited */}
|
||||
{isFavorite && (
|
||||
<div className="flex-shrink-0 relative -mr-2 pointer-events-none">
|
||||
<div className="h-6 w-6 flex items-center justify-center">
|
||||
<div className="flex items-center justify-center">
|
||||
<Star className="h-4 w-4 text-yellow-500 fill-current" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
});
|
||||
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const { fs: browserFS } = useFS();
|
||||
const { fs } = useFS();
|
||||
const { user, metadata } = useCurrentUser();
|
||||
const { models } = useProviderModels();
|
||||
|
||||
@@ -87,14 +87,14 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
const cwd = `/projects/${projectId}`;
|
||||
const customTools = useMemo(() => {
|
||||
const baseTools = {
|
||||
git_commit: new GitCommitTool(browserFS, cwd),
|
||||
text_editor_view: new TextEditorViewTool(browserFS, cwd),
|
||||
text_editor_write: new TextEditorWriteTool(browserFS, cwd),
|
||||
text_editor_str_replace: new TextEditorStrReplaceTool(browserFS, cwd),
|
||||
npm_add_package: new NpmAddPackageTool(browserFS, cwd),
|
||||
npm_remove_package: new NpmRemovePackageTool(browserFS, cwd),
|
||||
build_project: new BuildProjectTool(browserFS, cwd),
|
||||
typecheck: new TypecheckTool(browserFS, cwd),
|
||||
git_commit: new GitCommitTool(fs, cwd),
|
||||
text_editor_view: new TextEditorViewTool(fs, cwd),
|
||||
text_editor_write: new TextEditorWriteTool(fs, cwd),
|
||||
text_editor_str_replace: new TextEditorStrReplaceTool(fs, cwd),
|
||||
npm_add_package: new NpmAddPackageTool(fs, cwd),
|
||||
npm_remove_package: new NpmRemovePackageTool(fs, cwd),
|
||||
build_project: new BuildProjectTool(fs, cwd),
|
||||
typecheck: new TypecheckTool(fs, cwd),
|
||||
nostr_read_nip: new NostrReadNipTool(),
|
||||
nostr_fetch_event: new NostrFetchEventTool(),
|
||||
nostr_read_kind: new NostrReadKindTool(),
|
||||
@@ -102,19 +102,19 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
nostr_read_protocol: new NostrReadProtocolTool(),
|
||||
nostr_read_nips_index: new NostrReadNipsIndexTool(),
|
||||
nostr_generate_kind: new NostrGenerateKindTool(),
|
||||
shell: new ShellTool(browserFS, cwd),
|
||||
shell: new ShellTool(fs, cwd),
|
||||
};
|
||||
|
||||
// Add deploy tool only if user is logged in
|
||||
if (user && user.signer) {
|
||||
return {
|
||||
...baseTools,
|
||||
deploy_project: new DeployProjectTool(browserFS, cwd, user.signer, projectId),
|
||||
deploy_project: new DeployProjectTool(fs, cwd, user.signer, projectId),
|
||||
};
|
||||
}
|
||||
|
||||
return baseTools;
|
||||
}, [browserFS, cwd, user, projectId]);
|
||||
}, [fs, cwd, user, projectId]);
|
||||
|
||||
// Convert tools to OpenAI format
|
||||
const tools = useMemo(() => {
|
||||
@@ -147,7 +147,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
useEffect(() => {
|
||||
makeSystemPrompt({
|
||||
cwd,
|
||||
fs: browserFS,
|
||||
fs,
|
||||
mode: "agent",
|
||||
name: "Shakespeare",
|
||||
profession: "software extraordinaire",
|
||||
@@ -155,7 +155,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
user,
|
||||
metadata,
|
||||
}).then(setSystemPrompt)
|
||||
}, [browserFS, cwd, tools, user, metadata]);
|
||||
}, [fs, cwd, tools, user, metadata]);
|
||||
|
||||
const {
|
||||
messages,
|
||||
|
||||
+16
-18
@@ -187,8 +187,8 @@ export function ProjectView() {
|
||||
if (isMobile) {
|
||||
return (
|
||||
<div className="h-dvh flex flex-col bg-background">
|
||||
<header className="border-b bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur supports-[backdrop-filter]:bg-gradient-to-r supports-[backdrop-filter]:from-primary/10 supports-[backdrop-filter]:via-accent/5 supports-[backdrop-filter]:to-primary/10 px-4 py-3 flex items-center justify-between">
|
||||
<div className="flex items-center space-x-2">
|
||||
<header className="overflow-hidden border-b bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur supports-[backdrop-filter]:bg-gradient-to-r supports-[backdrop-filter]:from-primary/10 supports-[backdrop-filter]:via-accent/5 supports-[backdrop-filter]:to-primary/10 px-4 py-3 flex items-center justify-between">
|
||||
<div className="flex items-center space-x-2 overflow-hidden">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
@@ -196,11 +196,11 @@ export function ProjectView() {
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
</Button>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex min-w-0 flex-1">
|
||||
{project ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="p-0 h-auto text-sm font-semibold truncate hover:bg-transparent hover:text-primary"
|
||||
className="block p-0 h-auto text-sm font-semibold truncate hover:bg-transparent hover:text-primary"
|
||||
onClick={() => setIsProjectInfoOpen(true)}
|
||||
>
|
||||
{project.name}
|
||||
@@ -399,20 +399,18 @@ export function ProjectView() {
|
||||
</div>
|
||||
|
||||
{/* Center - Project title */}
|
||||
<div className="flex-1 min-w-0 ml-2 px-4">
|
||||
<div className="flex items-center justify-center md:justify-start">
|
||||
{project ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="p-0 h-auto font-semibold text-lg truncate hover:bg-transparent hover:text-primary"
|
||||
onClick={() => setIsProjectInfoOpen(true)}
|
||||
>
|
||||
{project.name}
|
||||
</Button>
|
||||
) : (
|
||||
<Skeleton className="h-6 w-40" />
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-1 min-w-0 px-4 truncate">
|
||||
{project ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="block p-0 h-auto font-semibold text-lg truncate hover:bg-transparent hover:text-primary"
|
||||
onClick={() => setIsProjectInfoOpen(true)}
|
||||
>
|
||||
{project.name}
|
||||
</Button>
|
||||
) : (
|
||||
<Skeleton className="h-6 w-40" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Right side - Star and Actions Menu */}
|
||||
|
||||
Reference in new issue
Block a user