feat(slot blocking): add buttons to sidebar
All checks were successful
container-scan / Container Scan (pull_request) Successful in 2m34s
docker-build / docker (pull_request) Successful in 3m57s
tests / Tests (pull_request) Successful in 3m30s

This commit is contained in:
Dominik 2025-06-30 20:45:29 +02:00
parent 016b4371c2
commit 3d07ca077f
Signed by: dominik
GPG key ID: 06A4003FC5049644
8 changed files with 32 additions and 21 deletions

View file

@ -22,7 +22,7 @@ export default function BlockedSlots() {
<div className='relative h-full flex flex-col items-center'>
{/* Heading */}
<h1 className='text-3xl font-bold mt-8 mb-4 text-center z-10'>
My Blocked Slots
My Blockers
</h1>
{/* Scrollable blocked slot list */}
@ -40,11 +40,11 @@ export default function BlockedSlots() {
) : (
<div className='flex flex-1 flex-col items-center justify-center min-h-[300px]'>
<Label size='large' className='justify-center text-center'>
You don&#39;t have any blocked slots right now
You don&#39;t have any blockers right now
</Label>
<RedirectButton
redirectUrl='/blocked_slots/new'
buttonText='create Blocked Slot'
redirectUrl='/blocker/new'
buttonText='Create New Blocker'
className='mt-4'
/>
</div>

View file

@ -234,7 +234,7 @@ function CalendarWithUserEvents({
onSelectEvent={(event) => {
if (event.type === 'blocked_private') return;
if (event.type === 'blocked_owned') {
router.push(`/blocked_slots/${event.id}`);
router.push(`/blocker/${event.id}`);
return;
}
if (event.type === 'event') {

View file

@ -14,7 +14,7 @@ import {
SidebarMenuItem,
} from '@/components/custom-ui/sidebar';
import { ChevronDown } from 'lucide-react';
import { CalendarMinus, CalendarMinus2, ChevronDown } from 'lucide-react';
import {
Collapsible,
CollapsibleContent,
@ -28,8 +28,8 @@ import Link from 'next/link';
import {
Star,
CalendarDays,
User,
Users,
//User,
//Users,
CalendarClock,
CalendarPlus,
} from 'lucide-react';
@ -40,7 +40,7 @@ const items = [
url: '/home',
icon: CalendarDays,
},
{
/*{
title: 'Friends',
url: '#',
icon: User,
@ -49,12 +49,17 @@ const items = [
title: 'Groups',
url: '#',
icon: Users,
},
},*/
{
title: 'Events',
url: '/events',
icon: CalendarClock,
},
{
title: 'Blockers',
url: '/blocker',
icon: CalendarMinus,
},
];
export function AppSidebar() {
@ -123,6 +128,17 @@ export function AppSidebar() {
</span>
</Link>
</SidebarMenuItem>
<SidebarMenuItem className='pl-[8px]'>
<Link
href='/blocker/new'
className='flex items-center gap-2 text-xl font-label'
>
<CalendarMinus2 className='size-8' />
<span className='group-data-[collapsible=icon]:hidden text-nowrap whitespace-nowrap'>
New Blocker
</span>
</Link>
</SidebarMenuItem>
</SidebarFooter>
</SidebarContent>
</Sidebar>

View file

@ -22,7 +22,7 @@ export default function BlockedSlotListEntry(slot: BlockedSlotListEntryProps) {
});
};
return (
<Link href={`/blocked_slots/${slot.id}`} className='block'>
<Link href={`/blocker/${slot.id}`} className='block'>
<Card className='w-full'>
<div className='grid grid-cols-1 gap-2 mx-auto md:mx-4 md:grid-cols-[80px_1fr_250px]'>
<div className='w-full items-center justify-center grid'>

View file

@ -71,7 +71,7 @@ export default function BlockedSlotForm({
const { mutateAsync: deleteBlockedSlot } = useDeleteApiBlockedSlotsSlotID({
mutation: {
onSuccess: () => {
router.push('/blocked_slots');
router.push('/blocker');
},
},
});
@ -80,7 +80,7 @@ export default function BlockedSlotForm({
mutation: {
onSuccess: () => {
resetCreate();
router.push('/blocked_slots');
router.push('/blocker');
},
},
});
@ -155,9 +155,7 @@ export default function BlockedSlotForm({
</div>
<div className='items-center ml-auto mr-auto max-sm:mb-6 max-sm:w-full max-sm:flex max-sm:justify-center'>
<h1 className='text-center'>
{existingBlockedSlotId
? 'Update Blocked Slot'
: 'Create Blocked Slot'}
{existingBlockedSlotId ? 'Update Blocker' : 'Create Blocker'}
</h1>
</div>
<div className='w-0 sm:w-[100px]'></div>
@ -216,9 +214,7 @@ export default function BlockedSlotForm({
formStateCreate.isSubmitting || formStateUpdate.isSubmitting
}
>
{existingBlockedSlotId
? 'Update Blocked Slot'
: 'Create Blocked Slot'}
{existingBlockedSlotId ? 'Update Blocker' : 'Create Blocker'}
</Button>
{existingBlockedSlotId && (
<Button
@ -226,7 +222,7 @@ export default function BlockedSlotForm({
variant='destructive'
onClick={onDeleteSubmit}
>
Delete Blocked Slot
Delete Blocker
</Button>
)}
</div>

View file

@ -175,7 +175,6 @@ const EventForm: React.FC<EventFormProps> = (props) => {
console.log('Creating event');
const mutationResult = await createEvent({ data });
eventID = mutationResult.data.event.id;
createEvent({ data });
}
toast.custom((t) => (