More mobile fixes.
Some checks failed
Create docker images (cloud) / Build, push, and deploy (push) Has been cancelled
Node.js CI / build (postgresql, 18.18, 10) (push) Has been cancelled

This commit is contained in:
Mike Cao 2025-10-18 02:20:11 -07:00
parent 9a5604f236
commit ddc7affa6a
6 changed files with 34 additions and 59 deletions

View file

@ -9,7 +9,7 @@ import { MobileMenuButton } from '@/components/input/MobileMenuButton';
export function MobileNav() { export function MobileNav() {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
const { websiteId } = useNavigation(); const { websiteId, renderUrl } = useNavigation();
const links = [ const links = [
{ {
@ -42,7 +42,7 @@ export function MobileNav() {
<NavButton /> <NavButton />
{links.map(link => { {links.map(link => {
return ( return (
<Link key={link.id} href={link.path}> <Link key={link.id} href={renderUrl(link.path)}>
<NavMenuItem> <NavMenuItem>
<IconLabel icon={link.icon} label={link.label} /> <IconLabel icon={link.icon} label={link.label} />
</NavMenuItem> </NavMenuItem>

View file

@ -7,7 +7,13 @@ export function CohortAddButton({ websiteId }: { websiteId: string }) {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
return ( return (
<DialogButton icon={<Plus />} label={formatMessage(labels.cohort)} variant="primary"> <DialogButton
icon={<Plus />}
label={formatMessage(labels.cohort)}
variant="primary"
width="800px"
minHeight="300px"
>
{({ close }) => { {({ close }) => {
return <CohortEditForm websiteId={websiteId} onClose={close} />; return <CohortEditForm websiteId={websiteId} onClose={close} />;
}} }}

View file

@ -7,7 +7,12 @@ export function SegmentAddButton({ websiteId }: { websiteId: string }) {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
return ( return (
<DialogButton icon={<Plus />} label={formatMessage(labels.segment)} variant="primary"> <DialogButton
icon={<Plus />}
label={formatMessage(labels.segment)}
variant="primary"
width="800px"
>
{({ close }) => { {({ close }) => {
return <SegmentEditForm websiteId={websiteId} onClose={close} />; return <SegmentEditForm websiteId={websiteId} onClose={close} />;
}} }}

View file

@ -1,4 +1,4 @@
import { Dialog, Modal, ModalProps } from '@umami/react-zen'; import { Dialog, Modal, ModalProps, Column } from '@umami/react-zen';
import { SessionProfile } from '@/app/(main)/websites/[websiteId]/sessions/SessionProfile'; import { SessionProfile } from '@/app/(main)/websites/[websiteId]/sessions/SessionProfile';
import { useNavigation } from '@/components/hooks'; import { useNavigation } from '@/components/hooks';
@ -12,12 +12,6 @@ export function SessionModal({ websiteId, ...props }: SessionModalProps) {
query: { session }, query: { session },
updateParams, updateParams,
} = useNavigation(); } = useNavigation();
const handleClose = (close: () => void) => {
router.push(updateParams({ session: undefined }));
close();
};
const handleOpenChange = (isOpen: boolean) => { const handleOpenChange = (isOpen: boolean) => {
if (!isOpen) { if (!isOpen) {
router.push(updateParams({ session: undefined })); router.push(updateParams({ session: undefined }));
@ -25,25 +19,21 @@ export function SessionModal({ websiteId, ...props }: SessionModalProps) {
}; };
return ( return (
<Modal isOpen={!!session} onOpenChange={handleOpenChange} isDismissable {...props}> <Modal
<Dialog placement="bottom"
style={{ offset="80px"
maxWidth: 1320, isOpen={!!session}
width: '100vw', onOpenChange={handleOpenChange}
minHeight: '300px', isDismissable
height: 'calc(100vh - 40px)', {...props}
}} >
> <Column height="100%" maxWidth="1320px" style={{ margin: '0 auto' }}>
{({ close }) => { <Dialog variant="sheet">
return ( <Column padding="6">
<SessionProfile <SessionProfile websiteId={websiteId} sessionId={session} />
websiteId={websiteId} </Column>
sessionId={session} </Dialog>
onClose={() => handleClose(close)} </Column>
/>
);
}}
</Dialog>
</Modal> </Modal>
); );
} }

View file

@ -1,32 +1,13 @@
import { import { TextField, Row, Column, Tabs, TabList, Tab, TabPanel } from '@umami/react-zen';
TextField,
Row,
Column,
Tabs,
TabList,
Tab,
TabPanel,
Icon,
Button,
} from '@umami/react-zen';
import { Avatar } from '@/components/common/Avatar'; import { Avatar } from '@/components/common/Avatar';
import { LoadingPanel } from '@/components/common/LoadingPanel'; import { LoadingPanel } from '@/components/common/LoadingPanel';
import { X } from '@/components/icons';
import { useMessages, useWebsiteSessionQuery } from '@/components/hooks'; import { useMessages, useWebsiteSessionQuery } from '@/components/hooks';
import { SessionActivity } from './SessionActivity'; import { SessionActivity } from './SessionActivity';
import { SessionData } from './SessionData'; import { SessionData } from './SessionData';
import { SessionInfo } from './SessionInfo'; import { SessionInfo } from './SessionInfo';
import { SessionStats } from './SessionStats'; import { SessionStats } from './SessionStats';
export function SessionProfile({ export function SessionProfile({ websiteId, sessionId }: { websiteId: string; sessionId: string }) {
websiteId,
sessionId,
onClose,
}: {
websiteId: string;
sessionId: string;
onClose?: () => void;
}) {
const { data, isLoading, error } = useWebsiteSessionQuery(websiteId, sessionId); const { data, isLoading, error } = useWebsiteSessionQuery(websiteId, sessionId);
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
@ -40,13 +21,6 @@ export function SessionProfile({
> >
{data && ( {data && (
<Column gap> <Column gap>
<Row alignItems="center" justifyContent="flex-end">
<Button onPress={onClose} variant="quiet">
<Icon>
<X />
</Icon>
</Button>
</Row>
<Column gap="6"> <Column gap="6">
<Row justifyContent="center" alignItems="center" gap="6"> <Row justifyContent="center" alignItems="center" gap="6">
<Avatar seed={data?.id} size={128} /> <Avatar seed={data?.id} size={128} />

View file

@ -7,7 +7,7 @@ export interface MetricsBarProps extends GridProps {
export function MetricsBar({ children, ...props }: MetricsBarProps) { export function MetricsBar({ children, ...props }: MetricsBarProps) {
return ( return (
<Grid columns="repeat(auto-fit, minmax(170px, 1fr))" gap {...props}> <Grid columns="repeat(auto-fit, minmax(140px, 1fr))" gap {...props}>
{children} {children}
</Grid> </Grid>
); );