Skip to content

Commit

Permalink
Calendar v2 (#148)
Browse files Browse the repository at this point in the history
* new eventpopup + fixes

* cleanup

* more fixes

* editing and deleting calendar events

* one more bug
  • Loading branch information
hingobway authored Aug 27, 2024
1 parent 65fd292 commit def47e3
Show file tree
Hide file tree
Showing 29 changed files with 609 additions and 182 deletions.
2 changes: 1 addition & 1 deletion client/graphql-schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type introspection = {
'Int': unknown;
'Mutation': { kind: 'OBJECT'; name: 'Mutation'; fields: { 'cabinCreate': { name: 'cabinCreate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; }; } }; 'cabinCreateMultiple': { name: 'cabinCreateMultiple'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; }; }; }; } }; 'cabinDelete': { name: 'cabinDelete'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; }; } }; 'cabinUpdate': { name: 'cabinUpdate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; }; } }; 'cmsFileCreateFolder': { name: 'cmsFileCreateFolder'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'cmsFileDelete': { name: 'cmsFileDelete'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'cmsFileMove': { name: 'cmsFileMove'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'cmsFileUpload': { name: 'cmsFileUpload'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSFileUploadOutput'; ofType: null; }; } }; 'cmsImageConfirm': { name: 'cmsImageConfirm'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; } }; 'cmsImageDelete': { name: 'cmsImageDelete'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; } }; 'cmsImageDeleteMultiple': { name: 'cmsImageDeleteMultiple'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; }; } }; 'cmsImageDeleteUnconfirmed': { name: 'cmsImageDeleteUnconfirmed'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; }; } }; 'cmsImageUpdate': { name: 'cmsImageUpdate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; } }; 'cmsImageUpload': { name: 'cmsImageUpload'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImageUploadOutput'; ofType: null; }; } }; 'cmsPageCreate': { name: 'cmsPageCreate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; }; } }; 'cmsPageDelete': { name: 'cmsPageDelete'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; }; } }; 'cmsPageUpdate': { name: 'cmsPageUpdate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; }; } }; 'preUserCreate': { name: 'preUserCreate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; }; } }; 'preUserDelete': { name: 'preUserDelete'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; }; } }; 'preUserUpdate': { name: 'preUserUpdate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; }; } }; 'roomCreate': { name: 'roomCreate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; } }; 'roomCreateMultiple': { name: 'roomCreateMultiple'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; }; }; } }; 'roomDelete': { name: 'roomDelete'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; } }; 'roomUpdate': { name: 'roomUpdate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; } }; 'stayCreate': { name: 'stayCreate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Stay'; ofType: null; }; } }; 'stayDelete': { name: 'stayDelete'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Stay'; ofType: null; }; } }; 'stayUpdate': { name: 'stayUpdate'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Stay'; ofType: null; }; } }; 'userCreate': { name: 'userCreate'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userCreateCredential': { name: 'userCreateCredential'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'userDelete': { name: 'userDelete'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userDeleteCredential': { name: 'userDeleteCredential'; type: { kind: 'OBJECT'; name: 'UserCredential'; ofType: null; } }; 'userResetSecret': { name: 'userResetSecret'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userUpdate': { name: 'userUpdate'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; }; };
'PreUser': { kind: 'OBJECT'; name: 'PreUser'; fields: { 'email': { name: 'email'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'name': { name: 'name'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'scope': { name: 'scope'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'UserScopeProp'; ofType: null; }; }; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'TS'; ofType: null; }; } }; }; };
'Query': { kind: 'OBJECT'; name: 'Query'; fields: { 'cabin': { name: 'cabin'; type: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; } }; 'cabins': { name: 'cabins'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; }; }; } }; 'cmsFilePresign': { name: 'cmsFilePresign'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'cmsFiles': { name: 'cmsFiles'; type: { kind: 'OBJECT'; name: 'CMSFileListOutput'; ofType: null; } }; 'cmsImage': { name: 'cmsImage'; type: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; } }; 'cmsImages': { name: 'cmsImages'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; }; } }; 'cmsImagesFromPageId': { name: 'cmsImagesFromPageId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; }; } }; 'cmsPage': { name: 'cmsPage'; type: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; } }; 'cmsPageFromSlug': { name: 'cmsPageFromSlug'; type: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; } }; 'cmsPages': { name: 'cmsPages'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; }; }; } }; 'preUser': { name: 'preUser'; type: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; } }; 'preUserFromEmail': { name: 'preUserFromEmail'; type: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; } }; 'preUsers': { name: 'preUsers'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; }; }; } }; 'room': { name: 'room'; type: { kind: 'OBJECT'; name: 'Room'; ofType: null; } }; 'rooms': { name: 'rooms'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; }; } }; 'roomsFromCabin': { name: 'roomsFromCabin'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; }; } }; 'roomsNoCabin': { name: 'roomsNoCabin'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; }; } }; 'stay': { name: 'stay'; type: { kind: 'OBJECT'; name: 'Stay'; ofType: null; } }; 'stays': { name: 'stays'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Stay'; ofType: null; }; }; }; } }; 'staysInRoom': { name: 'staysInRoom'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Stay'; ofType: null; }; }; }; } }; 'user': { name: 'user'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userFromAuth': { name: 'userFromAuth'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userFromEmail': { name: 'userFromEmail'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userSECURE': { name: 'userSECURE'; type: { kind: 'OBJECT'; name: 'UserSECURE'; ofType: null; } }; 'users': { name: 'users'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'User'; ofType: null; }; }; } }; }; };
'Query': { kind: 'OBJECT'; name: 'Query'; fields: { 'cabin': { name: 'cabin'; type: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; } }; 'cabins': { name: 'cabins'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; }; }; } }; 'cmsFilePresign': { name: 'cmsFilePresign'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'cmsFiles': { name: 'cmsFiles'; type: { kind: 'OBJECT'; name: 'CMSFileListOutput'; ofType: null; } }; 'cmsImage': { name: 'cmsImage'; type: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; } }; 'cmsImages': { name: 'cmsImages'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; }; } }; 'cmsImagesFromPageId': { name: 'cmsImagesFromPageId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSImage'; ofType: null; }; }; } }; 'cmsPage': { name: 'cmsPage'; type: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; } }; 'cmsPageFromSlug': { name: 'cmsPageFromSlug'; type: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; } }; 'cmsPages': { name: 'cmsPages'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'CMSPage'; ofType: null; }; }; } }; 'preUser': { name: 'preUser'; type: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; } }; 'preUserFromEmail': { name: 'preUserFromEmail'; type: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; } }; 'preUsers': { name: 'preUsers'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PreUser'; ofType: null; }; }; } }; 'room': { name: 'room'; type: { kind: 'OBJECT'; name: 'Room'; ofType: null; } }; 'rooms': { name: 'rooms'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; }; } }; 'roomsById': { name: 'roomsById'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; }; } }; 'roomsFromCabin': { name: 'roomsFromCabin'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; }; } }; 'roomsNoCabin': { name: 'roomsNoCabin'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'OBJECT'; name: 'Room'; ofType: null; }; }; } }; 'stay': { name: 'stay'; type: { kind: 'OBJECT'; name: 'Stay'; ofType: null; } }; 'stays': { name: 'stays'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Stay'; ofType: null; }; }; }; } }; 'staysInRoom': { name: 'staysInRoom'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Stay'; ofType: null; }; }; }; } }; 'user': { name: 'user'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userFromAuth': { name: 'userFromAuth'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userFromEmail': { name: 'userFromEmail'; type: { kind: 'OBJECT'; name: 'User'; ofType: null; } }; 'userSECURE': { name: 'userSECURE'; type: { kind: 'OBJECT'; name: 'UserSECURE'; ofType: null; } }; 'users': { name: 'users'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'User'; ofType: null; }; }; } }; }; };
'Room': { kind: 'OBJECT'; name: 'Room'; fields: { 'aliases': { name: 'aliases'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'availableBeds': { name: 'availableBeds'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'beds': { name: 'beds'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; } }; 'cabin': { name: 'cabin'; type: { kind: 'OBJECT'; name: 'Cabin'; ofType: null; } }; 'forCouples': { name: 'forCouples'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ID'; ofType: null; }; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'noCount': { name: 'noCount'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'timestamp': { name: 'timestamp'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'TS'; ofType: null; }; } }; }; };
'RoomCreate': { kind: 'INPUT_OBJECT'; name: 'RoomCreate'; isOneOf: false; inputFields: [{ name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; defaultValue: null }, { name: 'aliases'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; }; defaultValue: null }, { name: 'cabinId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; defaultValue: null }, { name: 'beds'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; }; defaultValue: null }, { name: 'forCouples'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; }; defaultValue: null }, { name: 'noCount'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; }; defaultValue: null }]; };
'RoomOrCustomRoom': { kind: 'UNION'; name: 'RoomOrCustomRoom'; fields: {}; possibleTypes: 'CustomRoom' | 'Room'; };
Expand Down
10 changes: 5 additions & 5 deletions client/src/app/_components/_base/FloatingWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
type useReverseCbTrigger,
} from '@/util/reverseCb';
import { clx } from '@/util/classConcat';
import { LoadStateProvider } from '@/app/_ctx/transition';
import { TransitionProvider } from '@/app/_ctx/transition';
import { createCallbackCtx } from '@/app/_ctx/callback';

const { Provider: CloseProvider, useHook: useCloseFloatingWindow } =
Expand Down Expand Up @@ -67,7 +67,7 @@ export default function FloatingWindow({
return (
<>
<CloseProvider cb={() => close()}>
<LoadStateProvider transition={transition}>
<TransitionProvider transition={transition}>
<Dialog open={isOpen} onClose={safeClose}>
{/* frame */}
<div
Expand All @@ -81,7 +81,7 @@ export default function FloatingWindow({
{/* panel */}
<motion.div
layout
className="flex h-full max-w-screen-sm flex-col justify-end group-data-[m]:!w-96"
className="flex h-full flex-col justify-end group-data-[m]:!w-96"
style={{
width: width ?? '48rem',
}}
Expand All @@ -95,7 +95,7 @@ export default function FloatingWindow({
>
{/* HEADER */}
<div
className="group flex flex-row items-center justify-between border-b border-slate-300 bg-slate-50 p-2 group-data-[m]:border-none"
className="group flex flex-row items-center justify-between border-b border-slate-300 p-2 group-data-[m]:border-none"
onClick={() => {
if (minimized) setMinimized(false);
}}
Expand Down Expand Up @@ -174,7 +174,7 @@ export default function FloatingWindow({
</motion.div>
</div>
</Dialog>
</LoadStateProvider>
</TransitionProvider>
</CloseProvider>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions client/src/app/_ctx/transition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
export type TransitionType = [boolean | null, TransitionStartFunction | null];

const loadCtx = createContext<TransitionType>([null, null]);
export function useLoadState() {
export function usePassedTransition() {
return useContext(loadCtx);
}

export function LoadStateProvider({
export function TransitionProvider({
children,
transition: passedTransition,
}: { transition?: ReturnType<typeof useTransition> } & Children) {
Expand Down
Loading

0 comments on commit def47e3

Please sign in to comment.