Compare commits

...

2 Commits

Author SHA1 Message Date
pablodanswer
08b26c3227 update folder logic 2024-12-14 17:00:22 -08:00
pablodanswer
2cc72255d2 cloud settings -> billing 2024-12-14 17:00:22 -08:00
11 changed files with 23 additions and 23 deletions

View File

@@ -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,
@@ -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>(
@@ -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" });
}
@@ -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",

View File

@@ -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;
@@ -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>

View File

@@ -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,
@@ -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",
},
]
: []),

View File

@@ -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";
@@ -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 />

View File

@@ -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
@@ -153,7 +152,8 @@ export default function FunctionalHeader({
h-full
${documentSidebarToggled ? "w-[400px]" : "w-[0px]"}
`}
/>
/>
</div>
{page != "assistants" && (
<div

View File

@@ -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

View File

@@ -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";

View File

@@ -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;
@@ -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;

View File

@@ -14,7 +14,7 @@ export const config = {
"/admin/standard-answer/:path*",
// Cloud only
"/admin/cloud-settings/:path*",
"/admin/billing/:path*",
],
};