Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension: Better UX navigation headers #8358

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions front/extension/app/src/components/auth/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
return (
<div className="flex h-screen flex-col gap-2 p-4">
<div className="flex items-start justify-between">
<div className="flex items-center gap-2 pb-10">
<div className="flex items-center gap-2 pb-16">
<LogoHorizontalColorLogo className="h-4 w-16" />
<a href="https://dust.tt" target="_blank">
<ExternalLinkIcon color="#64748B" />
Expand All @@ -64,7 +64,7 @@ export const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
variant="outline"
label="Sign out"
onClick={handleLogout}
size="sm"
size="xs"
/>
</div>
<>
Expand Down
30 changes: 22 additions & 8 deletions front/extension/app/src/pages/ConversationPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { BarHeader, ChevronLeftIcon, Page } from "@dust-tt/sparkle";
import { usePublicConversation } from "@app/extension/app/src/components/conversation/usePublicConversation";
import { BarHeader, ExternalLinkIcon, IconButton } from "@dust-tt/sparkle";
import type { ProtectedRouteChildrenProps } from "@extension/components/auth/ProtectedRoute";
import { ConversationContainer } from "@extension/components/conversation/ConversationContainer";
import { Link, useNavigate, useParams } from "react-router-dom";
import { useNavigate, useParams } from "react-router-dom";

export const ConversationPage = ({
workspace,
Expand All @@ -10,6 +11,11 @@ export const ConversationPage = ({
const navigate = useNavigate();
const { conversationId } = useParams();

const { conversation } = usePublicConversation({
conversationId: conversationId ?? null,
workspaceId: workspace.sId,
});

if (!conversationId) {
navigate("/");
return;
Expand All @@ -18,15 +24,23 @@ export const ConversationPage = ({
return (
<>
<BarHeader
title="Home"
leftActions={
<Link to="/">
<ChevronLeftIcon />
</Link>
title={conversation?.title || "Conversation"}
rightActions={
<div>
<a
href={`${process.env.DUST_DOMAIN}/w/${workspace.sId}/assistant/${conversationId}`}
target="_blank"
>
<IconButton icon={ExternalLinkIcon} />
</a>
<BarHeader.ButtonBar
variant="close"
onClose={() => navigate("/")}
/>
</div>
}
/>
<div className="h-full w-full pt-4">
<Page.SectionHeader title="Conversation" />
<ConversationContainer
owner={workspace}
conversationId={conversationId}
Expand Down
27 changes: 17 additions & 10 deletions front/extension/app/src/pages/ConversationsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
BarHeader,
ChevronLeftIcon,
ExternalLinkIcon,
IconButton,
NavigationList,
NavigationListItem,
NavigationListLabel,
Page,
} from "@dust-tt/sparkle";
import type { ConversationWithoutContentType } from "@dust-tt/types";
import type { ProtectedRouteChildrenProps } from "@extension/components/auth/ProtectedRoute";
import { useConversations } from "@extension/components/conversation/useConversations";
import moment from "moment";
import { Link, useNavigate } from "react-router-dom";
import { useNavigate } from "react-router-dom";

type GroupLabel =
| "Today"
Expand Down Expand Up @@ -71,16 +71,23 @@ export const ConversationsPage = ({
return (
<>
<BarHeader
title="Home"
leftActions={
<Link to="/">
<ChevronLeftIcon />
</Link>
title="Conversations"
rightActions={
<div>
<a
href={`${process.env.DUST_DOMAIN}/w/${workspace.sId}`}
target="_blank"
>
<IconButton icon={ExternalLinkIcon} />
</a>
<BarHeader.ButtonBar
variant="close"
onClose={() => navigate("/")}
/>
</div>
}
/>
<div className="h-full w-full pt-4">
<Page.SectionHeader title="Conversations" />

{conversationsByDate &&
Object.keys(conversationsByDate).map((dateLabel) => (
<RenderConversations
Expand Down
Loading