mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 03:55:37 +01:00
Added lookup for cloud account. Added SessionModal component.
This commit is contained in:
parent
caf04015bb
commit
f733690d38
7 changed files with 79 additions and 48 deletions
|
|
@ -0,0 +1,49 @@
|
|||
import { Dialog, Modal, ModalProps } from '@umami/react-zen';
|
||||
import { SessionProfile } from '@/app/(main)/websites/[websiteId]/sessions/SessionProfile';
|
||||
import { useNavigation } from '@/components/hooks';
|
||||
|
||||
export interface SessionModalProps extends ModalProps {
|
||||
websiteId: string;
|
||||
}
|
||||
|
||||
export function SessionModal({ websiteId, ...props }: SessionModalProps) {
|
||||
const {
|
||||
router,
|
||||
query: { session },
|
||||
updateParams,
|
||||
} = useNavigation();
|
||||
|
||||
const handleClose = (close: () => void) => {
|
||||
router.push(updateParams({ session: undefined }));
|
||||
close();
|
||||
};
|
||||
|
||||
const handleOpenChange = (isOpen: boolean) => {
|
||||
if (!isOpen) {
|
||||
router.push(updateParams({ session: undefined }));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal isOpen={!!session} onOpenChange={handleOpenChange} isDismissable {...props}>
|
||||
<Dialog
|
||||
style={{
|
||||
maxWidth: 1320,
|
||||
width: '100vw',
|
||||
minHeight: '300px',
|
||||
height: 'calc(100vh - 40px)',
|
||||
}}
|
||||
>
|
||||
{({ close }) => {
|
||||
return (
|
||||
<SessionProfile
|
||||
websiteId={websiteId}
|
||||
sessionId={session}
|
||||
onClose={() => handleClose(close)}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
</Dialog>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue