mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
fix realtime logs for mobile
Some checks are pending
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run
Some checks are pending
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run
This commit is contained in:
parent
f3e246c64b
commit
64a6379c3c
3 changed files with 35 additions and 14 deletions
|
|
@ -9,6 +9,7 @@ import {
|
||||||
useCountryNames,
|
useCountryNames,
|
||||||
useLocale,
|
useLocale,
|
||||||
useMessages,
|
useMessages,
|
||||||
|
useMobile,
|
||||||
useNavigation,
|
useNavigation,
|
||||||
useTimezone,
|
useTimezone,
|
||||||
useWebsite,
|
useWebsite,
|
||||||
|
|
@ -40,6 +41,7 @@ export function RealtimeLog({ data }: { data: any }) {
|
||||||
const { countryNames } = useCountryNames(locale);
|
const { countryNames } = useCountryNames(locale);
|
||||||
const [filter, setFilter] = useState(TYPE_ALL);
|
const [filter, setFilter] = useState(TYPE_ALL);
|
||||||
const { updateParams } = useNavigation();
|
const { updateParams } = useNavigation();
|
||||||
|
const { isPhone } = useMobile();
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
{
|
{
|
||||||
|
|
@ -123,12 +125,18 @@ export function RealtimeLog({ data }: { data: any }) {
|
||||||
const row = logs[index];
|
const row = logs[index];
|
||||||
return (
|
return (
|
||||||
<Row alignItems="center" style={style} gap>
|
<Row alignItems="center" style={style} gap>
|
||||||
|
<Row minWidth="30px">
|
||||||
<Link href={updateParams({ session: row.sessionId })}>
|
<Link href={updateParams({ session: row.sessionId })}>
|
||||||
<Avatar seed={row.sessionId} size={32} />
|
<Avatar seed={row.sessionId} size={32} />
|
||||||
</Link>
|
</Link>
|
||||||
<Row width="100px">{getTime(row)}</Row>
|
</Row>
|
||||||
|
<Row minWidth="100px">
|
||||||
|
<Text wrap="nowrap">{getTime(row)}</Text>
|
||||||
|
</Row>
|
||||||
<IconLabel icon={getIcon(row)}>
|
<IconLabel icon={getIcon(row)}>
|
||||||
<Text>{getDetail(row)}</Text>
|
<Text style={{ maxWidth: isPhone ? '400px' : null }} truncate>
|
||||||
|
{getDetail(row)}
|
||||||
|
</Text>
|
||||||
</IconLabel>
|
</IconLabel>
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
|
|
@ -168,10 +176,22 @@ export function RealtimeLog({ data }: { data: any }) {
|
||||||
return (
|
return (
|
||||||
<Column gap>
|
<Column gap>
|
||||||
<Heading size="2">{formatMessage(labels.activity)}</Heading>
|
<Heading size="2">{formatMessage(labels.activity)}</Heading>
|
||||||
|
{isPhone ? (
|
||||||
|
<>
|
||||||
|
<Row>
|
||||||
|
<SearchField value={search} onSearch={setSearch} />
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<FilterButtons items={buttons} value={filter} onChange={setFilter} />
|
||||||
|
</Row>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
<Row alignItems="center" justifyContent="space-between">
|
<Row alignItems="center" justifyContent="space-between">
|
||||||
<SearchField value={search} onSearch={setSearch} />
|
<SearchField value={search} onSearch={setSearch} />
|
||||||
<FilterButtons items={buttons} value={filter} onChange={setFilter} />
|
<FilterButtons items={buttons} value={filter} onChange={setFilter} />
|
||||||
</Row>
|
</Row>
|
||||||
|
)}
|
||||||
|
|
||||||
<Column>
|
<Column>
|
||||||
{logs?.length === 0 && <Empty />}
|
{logs?.length === 0 && <Empty />}
|
||||||
{logs?.length > 0 && (
|
{logs?.length > 0 && (
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { PageBody } from '@/components/common/PageBody';
|
||||||
import { Panel } from '@/components/common/Panel';
|
import { Panel } from '@/components/common/Panel';
|
||||||
import { RealtimeChart } from '@/components/metrics/RealtimeChart';
|
import { RealtimeChart } from '@/components/metrics/RealtimeChart';
|
||||||
import { WorldMap } from '@/components/metrics/WorldMap';
|
import { WorldMap } from '@/components/metrics/WorldMap';
|
||||||
import { useRealtimeQuery } from '@/components/hooks';
|
import { useMobile, useRealtimeQuery } from '@/components/hooks';
|
||||||
import { RealtimeLog } from './RealtimeLog';
|
import { RealtimeLog } from './RealtimeLog';
|
||||||
import { RealtimeHeader } from './RealtimeHeader';
|
import { RealtimeHeader } from './RealtimeHeader';
|
||||||
import { RealtimePaths } from './RealtimePaths';
|
import { RealtimePaths } from './RealtimePaths';
|
||||||
|
|
@ -16,6 +16,7 @@ import { percentFilter } from '@/lib/filters';
|
||||||
|
|
||||||
export function RealtimePage({ websiteId }: { websiteId: string }) {
|
export function RealtimePage({ websiteId }: { websiteId: string }) {
|
||||||
const { data, isLoading, error } = useRealtimeQuery(websiteId);
|
const { data, isLoading, error } = useRealtimeQuery(websiteId);
|
||||||
|
const { isMobile } = useMobile();
|
||||||
|
|
||||||
if (isLoading || error) {
|
if (isLoading || error) {
|
||||||
return <PageBody isLoading={isLoading} error={error} />;
|
return <PageBody isLoading={isLoading} error={error} />;
|
||||||
|
|
@ -48,7 +49,7 @@ export function RealtimePage({ websiteId }: { websiteId: string }) {
|
||||||
<Panel>
|
<Panel>
|
||||||
<RealtimeCountries data={countries} />
|
<RealtimeCountries data={countries} />
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel gridColumn="span 2" padding="0">
|
<Panel gridColumn={isMobile ? null : 'span 2'} padding="0">
|
||||||
<WorldMap data={countries} />
|
<WorldMap data={countries} />
|
||||||
</Panel>
|
</Panel>
|
||||||
</GridRow>
|
</GridRow>
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export function ListTable({
|
||||||
showPercentage={showPercentage}
|
showPercentage={showPercentage}
|
||||||
change={renderChange ? renderChange(row, index) : null}
|
change={renderChange ? renderChange(row, index) : null}
|
||||||
currency={currency}
|
currency={currency}
|
||||||
isMobile={isPhone}
|
isPhone={isPhone}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
@ -101,7 +101,7 @@ const AnimatedRow = ({
|
||||||
animate,
|
animate,
|
||||||
showPercentage = true,
|
showPercentage = true,
|
||||||
currency,
|
currency,
|
||||||
isMobile,
|
isPhone,
|
||||||
}) => {
|
}) => {
|
||||||
const props = useSpring({
|
const props = useSpring({
|
||||||
width: percent,
|
width: percent,
|
||||||
|
|
@ -120,7 +120,7 @@ const AnimatedRow = ({
|
||||||
gap
|
gap
|
||||||
>
|
>
|
||||||
<Row alignItems="center">
|
<Row alignItems="center">
|
||||||
<Text truncate={true} style={{ maxWidth: isMobile ? '200px' : '400px' }}>
|
<Text truncate={true} style={{ maxWidth: isPhone ? '200px' : '400px' }}>
|
||||||
{label}
|
{label}
|
||||||
</Text>
|
</Text>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue