scheduling ui
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import { NextResponse, NextRequest } from 'next/server';
|
||||
import { TwitterApi } from 'twitter-api-v2';
|
||||
import config from '@/app/api/env';
|
||||
import { PostRequest } from '@/utils';
|
||||
import { inspect } from 'util';
|
||||
import database from '../database';
|
||||
import { generateUrlSafeString } from '@/utils';
|
||||
|
||||
// Account creation
|
||||
// Email doesn't exist
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MongoClient } from 'mongodb';
|
||||
import config from './env';
|
||||
import { generateUrlSafeString, Session, User } from '@/utils';
|
||||
import { Session, User } from '@/utils';
|
||||
|
||||
const client = new MongoClient(config.mongoUrl);
|
||||
|
||||
|
||||
@@ -20,6 +20,14 @@ export async function POST(req: NextRequest) {
|
||||
});
|
||||
|
||||
await twitterClient.v2.tweet(content);
|
||||
|
||||
default:
|
||||
return NextResponse.json(
|
||||
{
|
||||
message: 'Not implemented',
|
||||
},
|
||||
{ status: 501 }
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
'use client';
|
||||
import { useCalendarApp, ScheduleXCalendar } from '@schedule-x/react';
|
||||
import {
|
||||
createViewDay,
|
||||
createViewMonthAgenda,
|
||||
createViewMonthGrid,
|
||||
createViewWeek,
|
||||
} from '@schedule-x/calendar';
|
||||
|
||||
import { createEventsServicePlugin } from '@schedule-x/events-service';
|
||||
import { createDragAndDropPlugin } from '@schedule-x/drag-and-drop';
|
||||
|
||||
import '@/calendar-theme.css';
|
||||
import { useEffect, useState } from 'react';
|
||||
import App from '@/components/app';
|
||||
import {
|
||||
ContextMenu,
|
||||
ContextMenuContent,
|
||||
ContextMenuItem,
|
||||
ContextMenuTrigger,
|
||||
} from '@/components/ui/context-menu';
|
||||
|
||||
import { PlusCircle } from 'lucide-react';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
function CalendarApp() {
|
||||
const eventsService = useState(() => createEventsServicePlugin())[0];
|
||||
const dragAndDrop = useState(() => createDragAndDropPlugin())[0];
|
||||
|
||||
const calendar = useCalendarApp({
|
||||
views: [
|
||||
createViewDay(),
|
||||
createViewWeek(),
|
||||
createViewMonthGrid(),
|
||||
createViewMonthAgenda(),
|
||||
],
|
||||
events: [
|
||||
{
|
||||
id: '1',
|
||||
title: 'Linus tech tips drama',
|
||||
start: '2025-02-16 01:00',
|
||||
end: '2025-02-16 02:00',
|
||||
},
|
||||
],
|
||||
plugins: [eventsService, dragAndDrop],
|
||||
isDark: true,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
console.log(eventsService.getAll());
|
||||
}, [eventsService]);
|
||||
|
||||
const [newPostDialogOpen, setNewPostDialogOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<App>
|
||||
<div>
|
||||
<Dialog
|
||||
open={newPostDialogOpen}
|
||||
onOpenChange={setNewPostDialogOpen}
|
||||
>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Feature not available</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div></div>
|
||||
<DialogFooter>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => setNewPostDialogOpen(false)}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button>Submit</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<ContextMenu>
|
||||
<ContextMenuTrigger>
|
||||
<ScheduleXCalendar
|
||||
calendarApp={calendar}
|
||||
customComponents={{
|
||||
headerContent: CalendarHeader,
|
||||
}}
|
||||
/>
|
||||
</ContextMenuTrigger>
|
||||
<ContextMenuContent>
|
||||
<ContextMenuItem
|
||||
onClick={() => {
|
||||
setNewPostDialogOpen(true);
|
||||
}}
|
||||
>
|
||||
<PlusCircle className="w-4 mt-0.5" />{' '}
|
||||
<p className="ml-1">New post</p>
|
||||
</ContextMenuItem>
|
||||
</ContextMenuContent>
|
||||
</ContextMenu>
|
||||
</div>
|
||||
</App>
|
||||
);
|
||||
}
|
||||
|
||||
function CalendarHeader() {
|
||||
return <div className="flex flex-row w-full"></div>;
|
||||
}
|
||||
|
||||
export default CalendarApp;
|
||||
@@ -2,25 +2,12 @@ import AccountStatus from '@/components/accountStatus';
|
||||
import Engagement from '@/components/engagement';
|
||||
import Ideas from '@/components/ideas';
|
||||
import RecentPosts from '@/components/recentPosts';
|
||||
import App from '@/components/app';
|
||||
import { Calendar } from '@/components/ui/calendar';
|
||||
|
||||
import {
|
||||
SidebarProvider,
|
||||
Sidebar,
|
||||
SidebarContent,
|
||||
} from '@/components/ui/sidebar';
|
||||
|
||||
export default function Dashboard() {
|
||||
return (
|
||||
<div className="flex w-full">
|
||||
<div>
|
||||
<SidebarProvider>
|
||||
<Sidebar className="w-64 h-full">
|
||||
<SidebarContent className="p-6">Hello</SidebarContent>
|
||||
</Sidebar>
|
||||
</SidebarProvider>
|
||||
</div>
|
||||
|
||||
<App>
|
||||
<div className="flex flex-1 flex-col p-6 px-5 md:px-10 h-max">
|
||||
<div className="w-full">
|
||||
<h1 className="text-3xl font-bold">Dashboard</h1>
|
||||
@@ -103,6 +90,6 @@ export default function Dashboard() {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</App>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user