Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: make app tabs scrollable#19881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 9 commits intomainfrombq/fix-apps-overflowing
Sep 22, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionsite/src/components/Button/Button.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ import { cn } from "utils/cn";
const buttonVariants = cva(
`
inline-flex items-center justify-center gap-1 whitespace-nowrap font-sans
border-solid rounded-md transition-colors
border-solid rounded-md transition-colors shrink-0
text-sm font-medium cursor-pointer no-underline
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-content-link
disabled:pointer-events-none disabled:text-content-disabled
Expand Down
4 changes: 2 additions & 2 deletionssite/src/components/ScrollArea/ScrollArea.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,7 @@ export const ScrollArea = React.forwardRef<
));
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;

const ScrollBar = React.forwardRef<
exportconst ScrollBar = React.forwardRef<
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
>(({ className, orientation = "vertical", ...props }, ref) => (
Expand All@@ -41,6 +41,6 @@ const ScrollBar = React.forwardRef<
)}
{...props}
>
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-surface-quaternary" />
</ScrollAreaPrimitive.ScrollAreaScrollbar>
));
9 changes: 8 additions & 1 deletionsite/src/modules/apps/useAppLink.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,10 +20,17 @@ type UseAppLinkParams = {
agent: WorkspaceAgent;
};

type AppLink = {
href: string;
onClick: (e: React.MouseEvent) => void;
label: string;
hasToken: boolean;
};

export const useAppLink = (
app: WorkspaceApp,
{ agent, workspace }: UseAppLinkParams,
) => {
): AppLink => {
const label = app.display_name ?? app.slug;
const { proxy } = useProxy();
const { data: apiKeyResponse } = useQuery({
Expand Down
28 changes: 27 additions & 1 deletionsite/src/modules/tasks/tasks.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
import type { Workspace } from "api/typesGenerated";
import type {
Workspace,
WorkspaceAgent,
WorkspaceApp,
} from "api/typesGenerated";

export const AI_PROMPT_PARAMETER_NAME = "AI Prompt";

export type Task = {
workspace: Workspace;
prompt: string;
};

export type WorkspaceAppWithAgent = WorkspaceApp & {
agent: WorkspaceAgent;
};

export function getTaskApps(task: Task): WorkspaceAppWithAgent[] {
return (
task.workspace.latest_build.resources
.flatMap((r) => r.agents ?? [])
.flatMap((agent) =>
agent.apps.map((app) => ({
...app,
agent,
})),
)
// The Chat UI app will be displayed in the sidebar, so we don't want to
// show it as a tab.
.filter(
(app) => app.id !== task.workspace.latest_build.ai_task_sidebar_app_id,
)
);
}
52 changes: 19 additions & 33 deletionssite/src/pages/TaskPage/TaskAppIframe.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
import type { WorkspaceApp } from "api/typesGenerated";
import { Button } from "components/Button/Button";
import {
DropdownMenu,
Expand All@@ -7,55 +6,42 @@ import {
DropdownMenuTrigger,
} from "components/DropdownMenu/DropdownMenu";
import { Spinner } from "components/Spinner/Spinner";
import { useProxy } from "contexts/ProxyContext";
import { EllipsisVertical, ExternalLinkIcon, HouseIcon } from "lucide-react";
import { useAppLink } from "modules/apps/useAppLink";
import type { Task } from "modules/tasks/tasks";
import type { Task, WorkspaceAppWithAgent } from "modules/tasks/tasks";
import { type FC, useRef } from "react";
import { Link as RouterLink } from "react-router";
import { cn } from "utils/cn";
import { TaskWildcardWarning } from "./TaskWildcardWarning";

type TaskAppIFrameProps = {
task: Task;
app:WorkspaceApp;
app:WorkspaceAppWithAgent;
active: boolean;
pathname?: string;
};

export const TaskAppIFrame: FC<TaskAppIFrameProps> = ({
task,
app,
active,
pathname,
}) => {
const agent = task.workspace.latest_build.resources
.flatMap((r) => r.agents)
.filter((a) => !!a)
.find((a) => a.apps.some((a) => a.id === app.id));

if (!agent) {
throw new Error(`Agent for app ${app.id} not found in task workspace`);
}

const link = useAppLink(app, {
agent,
agent: app.agent,
workspace: task.workspace,
});

const appHref = (): string => {
try {
const url = new URL(link.href, location.href);
if (pathname) {
url.pathname = pathname;
}
return url.toString();
} catch (err) {
console.warn(`Failed to parse URL ${link.href} for app ${app.id}`, err);
return link.href;
}
};

const proxy = useProxy();
const frameRef = useRef<HTMLIFrameElement>(null);
const frameSrc = appHref();
const shouldDisplayWildcardWarning =
app.subdomain && !proxy.proxy?.preferredWildcardHostname;

if (shouldDisplayWildcardWarning) {
return (
<div className="h-full flex items-center justify-center pb-4">
<TaskWildcardWarning />
</div>
);
}

return (
<div className={cn([active ? "flex" : "hidden", "w-full h-full flex-col"])}>
Expand All@@ -67,7 +53,7 @@ export const TaskAppIFrame: FC<TaskAppIFrameProps> = ({
onClick={(e) => {
e.preventDefault();
if (frameRef.current?.contentWindow) {
frameRef.current.contentWindow.location.href =appHref();
frameRef.current.contentWindow.location.href =link.href;
}
}}
>
Expand All@@ -88,7 +74,7 @@ export const TaskAppIFrame: FC<TaskAppIFrameProps> = ({
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem asChild>
<RouterLink to={frameSrc} target="_blank">
<RouterLink to={link.href} target="_blank">
<ExternalLinkIcon />
Open app in new tab
</RouterLink>
Expand All@@ -103,7 +89,7 @@ export const TaskAppIFrame: FC<TaskAppIFrameProps> = ({
app.health === "unhealthy" ? (
<iframe
ref={frameRef}
src={frameSrc}
src={link.href}
title={link.label}
loading="eager"
className={"w-full h-full border-0"}
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp