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

Folder #3471

Closed
wants to merge 2 commits into from
Closed

Folder #3471

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
7 changes: 5 additions & 2 deletions web/src/app/chat/folders/FolderList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { CHAT_SESSION_ID_KEY } from "@/lib/drag/constants";
import Cookies from "js-cookie";
import { Popover } from "@/components/popover/Popover";
import { ChatSession } from "../interfaces";
import { useChatContext } from "@/components/context/ChatContext";
const FolderItem = ({
folder,
currentChatId,
Expand All @@ -40,6 +41,7 @@ const FolderItem = ({
showShareModal: ((chatSession: ChatSession) => void) | undefined;
showDeleteModal: ((chatSession: ChatSession) => void) | undefined;
}) => {
const { refreshChatSessions } = useChatContext();
const [isExpanded, setIsExpanded] = useState<boolean>(isInitiallyExpanded);
const [isEditing, setIsEditing] = useState<boolean>(initiallySelected);
const [editedFolderName, setEditedFolderName] = useState<string>(
Expand Down Expand Up @@ -93,7 +95,7 @@ const FolderItem = ({
if (!continueEditing) {
setIsEditing(false);
}
router.refresh(); // Refresh values to update the sidebar
router.refresh();
} catch (error) {
setPopup({ message: "Failed to save folder name", type: "error" });
}
Expand Down Expand Up @@ -154,7 +156,8 @@ const FolderItem = ({
const chatSessionId = event.dataTransfer.getData(CHAT_SESSION_ID_KEY);
try {
await addChatToFolder(folder.folder_id, chatSessionId);
router.refresh(); // Refresh to show the updated folder contents
await refreshChatSessions();
router.refresh();
} catch (error) {
setPopup({
message: "Failed to add chat session to folder",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AdminPageTitle } from "@/components/admin/Title";
import BillingInformationPage from "./BillingInformationPage";
import { FaCloud } from "react-icons/fa";
import { MdOutlineCreditCard } from "react-icons/md";

export interface BillingInformation {
seats: number;
Expand All @@ -14,8 +14,8 @@ export default function page() {
return (
<div className="container max-w-4xl">
<AdminPageTitle
title="Cloud Settings"
icon={<FaCloud size={32} className="my-auto" />}
title="Billing Information"
icon={<MdOutlineCreditCard size={32} className="my-auto" />}
/>
<BillingInformationPage />
</div>
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/admin/ClientLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { User } from "@/lib/types";
import { usePathname } from "next/navigation";
import { SettingsContext } from "../settings/SettingsProvider";
import { useContext } from "react";
import { Cloud } from "@phosphor-icons/react";
import { MdOutlineCreditCard } from "react-icons/md";

export function ClientLayout({
user,
Expand Down Expand Up @@ -386,14 +386,14 @@ export function ClientLayout({
{
name: (
<div className="flex">
<Cloud
<MdOutlineCreditCard
className="text-icon-settings-sidebar"
size={18}
/>
<div className="ml-1">Cloud Settings</div>
<div className="ml-1">Billing</div>
</div>
),
link: "/admin/cloud-settings",
link: "/admin/billing",
},
]
: []),
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/admin/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { redirect } from "next/navigation";
import { ClientLayout } from "./ClientLayout";
import {
SERVER_SIDE_ONLY__CLOUD_ENABLED,
NEXT_PUBLIC_CLOUD_ENABLED,
SERVER_SIDE_ONLY__PAID_ENTERPRISE_FEATURES_ENABLED,
} from "@/lib/constants";
import { AnnouncementBanner } from "../header/AnnouncementBanner";
Expand Down Expand Up @@ -45,7 +45,7 @@ export async function Layout({ children }: { children: React.ReactNode }) {
return (
<ClientLayout
enableEnterprise={SERVER_SIDE_ONLY__PAID_ENTERPRISE_FEATURES_ENABLED}
enableCloud={SERVER_SIDE_ONLY__CLOUD_ENABLED}
enableCloud={NEXT_PUBLIC_CLOUD_ENABLED}
user={user}
>
<AnnouncementBanner />
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/chat_search/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,9 @@ export default function FunctionalHeader({
<NewChatIcon size={20} />
</div>
</Link>
</div>
<div
style={{ transition: "width 0.30s ease-out" }}
className={`
<div
style={{ transition: "width 0.30s ease-out" }}
className={`
hidden
md:flex
mx-auto
Expand All @@ -153,7 +152,8 @@ export default function FunctionalHeader({
h-full
${documentSidebarToggled ? "w-[400px]" : "w-[0px]"}
`}
/>
/>
</div>

{page != "assistants" && (
<div
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/header/AnnouncementBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function AnnouncementBanner() {
Your trial is ending soon - submit your billing information to
continue using Onyx.{" "}
<Link
href="/admin/cloud-settings"
href="/admin/billing"
className="ml-2 underline cursor-pointer"
>
Update here
Expand Down
3 changes: 0 additions & 3 deletions web/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,4 @@ export const NEXT_PUBLIC_CLOUD_ENABLED =
export const REGISTRATION_URL =
process.env.INTERNAL_URL || "http://127.0.0.1:3001";

export const SERVER_SIDE_ONLY__CLOUD_ENABLED =
process.env.NEXT_PUBLIC_CLOUD_ENABLED?.toLowerCase() === "true";

export const TEST_ENV = process.env.TEST_ENV?.toLowerCase() === "true";
4 changes: 2 additions & 2 deletions web/src/lib/userSS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { cookies } from "next/headers";
import { User } from "./types";
import { buildUrl } from "./utilsSS";
import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies";
import { AuthType, SERVER_SIDE_ONLY__CLOUD_ENABLED } from "./constants";
import { AuthType, NEXT_PUBLIC_CLOUD_ENABLED } from "./constants";

export interface AuthTypeMetadata {
authType: AuthType;
Expand All @@ -22,7 +22,7 @@ export const getAuthTypeMetadataSS = async (): Promise<AuthTypeMetadata> => {
let authType: AuthType;

// Override fasapi users auth so we can use both
if (SERVER_SIDE_ONLY__CLOUD_ENABLED) {
if (NEXT_PUBLIC_CLOUD_ENABLED) {
authType = "cloud";
} else {
authType = data.auth_type as AuthType;
Expand Down
2 changes: 1 addition & 1 deletion web/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const config = {
"/admin/standard-answer/:path*",

// Cloud only
"/admin/cloud-settings/:path*",
"/admin/billing/:path*",
],
};

Expand Down
Loading