cleanups for production

This commit is contained in:
Dhravya 2024-04-10 09:51:56 -07:00
parent d5544d0070
commit 75899ae5fd
6 changed files with 25 additions and 22 deletions

View file

@ -9,5 +9,5 @@ export const getEnv = () => {
// })
// return null
return 'development'
return 'production'
}

View file

@ -15,7 +15,7 @@ function MessagePoster({ jwt }: { jwt: string }) {
window.postMessage({ jwt }, '*');
}}
>
Send message
Extension Auth
</button>
);
}

View file

@ -4,13 +4,13 @@ import Sidebar from '@/components/Sidebar/index';
import { SessionProvider } from 'next-auth/react';
import { useState } from 'react';
export default function Content() {
export default function Content({ jwt }: { jwt: string }) {
const [selectedItem, setSelectedItem] = useState<string | null>(null);
return (
<SessionProvider>
<div className="flex w-screen">
<Sidebar selectChange={setSelectedItem} />
<Sidebar jwt={jwt} selectChange={setSelectedItem} />
<Main sidebarOpen={selectedItem !== null} />
</div>
</SessionProvider>

View file

@ -59,26 +59,26 @@ export default async function Home() {
const collectedSpaces =
contents.length > 0 ? await transformContent(contents) : [];
collectedSpaces.push({
id: 2,
title: "Test",
content: [
{
id: 1,
content: "Test",
title: "Vscode",
description: "Test",
url: "https://vscode-remake.vercel.app/",
savedAt: new Date(),
baseUrl: "https://vscode-remake.vercel.app/",
image: "https://vscode-remake.vercel.app/favicon.svg",
},
],
});
// collectedSpaces.push({
// id: 2,
// title: "Test",
// content: [
// {
// id: 1,
// content: "Test",
// title: "Vscode",
// description: "Test",
// url: "https://vscode-remake.vercel.app/",
// savedAt: new Date(),
// baseUrl: "https://vscode-remake.vercel.app/",
// image: "https://vscode-remake.vercel.app/favicon.svg",
// },
// ],
// });
return (
<MemoryProvider spaces={collectedSpaces}>
<Content />
<Content jwt={token} />
{/* <MessagePoster jwt={token} /> */}
</MemoryProvider>
);

View file

@ -315,7 +315,6 @@ export default function Main({ sidebarOpen }: { sidebarOpen: boolean }) {
autoFocus: true,
onChange: (e) => setValue(e.target.value),
onKeyDown: (e) => {
console.log(e.key, e.ctrlKey, e.metaKey);
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
onSend();
}

View file

@ -7,6 +7,7 @@ import { AnimatePresence, motion } from 'framer-motion';
import { Bin } from '@/assets/Bin';
import { Avatar, AvatarFallback, AvatarImage } from '@radix-ui/react-avatar';
import { useSession } from 'next-auth/react';
import MessagePoster from '@/app/MessagePoster';
export type MenuItem = {
icon: React.ReactNode | React.ReactNode[];
@ -16,8 +17,10 @@ export type MenuItem = {
export default function Sidebar({
selectChange,
jwt
}: {
selectChange?: (selectedItem: string | null) => void;
jwt: string;
}) {
const { data: session } = useSession();
const menuItemsTop: Array<MenuItem> = [
@ -117,6 +120,7 @@ export default function Sidebar({
selectedItem={selectedItem}
setSelectedItem={setSelectedItem}
/>
<MessagePoster jwt={jwt} />
</div>
<AnimatePresence>
{selectedItem && <SubSidebar>{Subbar}</SubSidebar>}