Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Pass domain to realtime components.
Mike Cao5657a64c7737
diff --git a/components/common/OverflowText.js b/components/common/OverflowText.jsdeleted file mode 100644index aaeb9c46e..000000000--- a/components/common/OverflowText.js+++ /dev/null@@ -1,60 +0,0 @@-import { useCallback, useEffect, useRef, useState } from 'react';-import ReactTooltip from 'react-tooltip';--import styles from './OverflowText.module.css';--const OverflowText = ({ children, tooltipId }) => {- const measureEl = useRef();- const [isOverflown, setIsOverflown] = useState(false);-- const measure = useCallback(- el => {- if (!el) return;- setIsOverflown(el.scrollWidth > el.clientWidth);- },- [setIsOverflown],- );-- // Do one measure on mount- useEffect(() => {- measure(measureEl.current);- }, [measure]);-- // Set up resize listener for subsequent measures- useEffect(() => {- if (!measureEl.current) return;-- // Destructure ref in case it changes out from under us- const el = measureEl.current;-- if ('ResizeObserver' in global) {- // Ideally, we have access to ResizeObservers- const observer = new ResizeObserver(() => {- measure(el);- });- observer.observe(el);- return () => observer.unobserve(el);- } else {- // Otherwise, fall back to measuring on window resizes- const handler = () => measure(el);-- window.addEventListener('resize', handler, { passive: true });- return () => window.removeEventListener('resize', handler, { passive: true });- }- });-- return (- <span- ref={measureEl}- data-tip={children.toString()}- data-effect="solid"- data-for={tooltipId}- className={styles.root}- >- {children}- {isOverflown && <ReactTooltip id={tooltipId}>{children}</ReactTooltip>}- </span>- );-};--export default OverflowText;diff --git a/components/common/OverflowText.module.css b/components/common/OverflowText.module.cssdeleted file mode 100644index c20666314..000000000--- a/components/common/OverflowText.module.css+++ /dev/null@@ -1,6 +0,0 @@-.root {- max-width: 100%;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;-}diff --git a/components/input/WebsiteSelect.js b/components/input/WebsiteSelect.jsindex 82f516e82..2a1a4e178 100644--- a/components/input/WebsiteSelect.js+++ b/components/input/WebsiteSelect.js@@ -22,7 +22,7 @@ export default function WebsiteSelect({ websiteId, onSelect }) {placeholder={formatMessage(labels.selectWebsite)}style={{ width: 200 }}>- {item => <Item key={item.id}>{item.name}</Item>}+ {({ id, name }) => <Item key={id}>{name}</Item>}</Dropdown>);}diff --git a/components/metrics/WebsiteHeader.js b/components/metrics/WebsiteHeader.jsindex 8f102c088..d1817c8bd 100644--- a/components/metrics/WebsiteHeader.js+++ b/components/metrics/WebsiteHeader.js@@ -1,6 +1,5 @@-import { Row, Column } from 'react-basics';+import { Row, Column, Text } from 'react-basics';import Favicon from 'components/common/Favicon';-import OverflowText from 'components/common/OverflowText';import ActiveUsers from './ActiveUsers';import styles from './WebsiteHeader.module.css';@@ -9,7 +8,7 @@ export default function WebsiteHeader({ websiteId, title, domain, children }) {<Row className={styles.header} justifyContent="center"><Column className={styles.title} variant="two"><Favicon domain={domain} />- <OverflowText tooltipId={`${websiteId}-title`}>{title}</OverflowText>+ <Text>{title}</Text></Column><Column className={styles.body} variant="two"><ActiveUsers websiteId={websiteId} />diff --git a/components/pages/realtime/RealtimeDashboard.js b/components/pages/realtime/RealtimeDashboard.jsindex 9ac6a8630..9e6c2d1b1 100644--- a/components/pages/realtime/RealtimeDashboard.js+++ b/components/pages/realtime/RealtimeDashboard.js@@ -32,11 +32,12 @@ export default function RealtimeDashboard({ websiteId }) {const router = useRouter();const [currentData, setCurrentData] = useState();const { get, useQuery } = useApi();+ const { data: website } = useQuery(['websites', websiteId], () => get(`/websites/${websiteId}`));const { data, isLoading, error } = useQuery(['realtime', websiteId],() => get(`/realtime/${websiteId}`, { startAt: currentData?.timestamp || 0 }),{- enabled: !!websiteId,+ enabled: !!(websiteId && website),refetchInterval: REALTIME_INTERVAL,cache: false,},@@ -111,10 +112,10 @@ export default function RealtimeDashboard({ websiteId }) {</div><GridRow><GridColumn xs={12} sm={12} md={12} lg={4} xl={4}>- <RealtimeUrls websiteId={websiteId} data={realtimeData} />+ <RealtimeUrls websiteId={websiteId} websiteDomain={website?.domain} data={realtimeData} /></GridColumn><GridColumn xs={12} sm={12} md={12} lg={8} xl={8}>- <RealtimeLog websiteId={websiteId} data={realtimeData} />+ <RealtimeLog websiteId={websiteId} websiteDomain={website?.domain} data={realtimeData} /></GridColumn></GridRow><GridRow>diff --git a/components/pages/realtime/RealtimeHome.js b/components/pages/realtime/RealtimeHome.jsindex f54ed4dee..67b34ee98 100644--- a/components/pages/realtime/RealtimeHome.js+++ b/components/pages/realtime/RealtimeHome.js@@ -17,10 +17,10 @@ export default function RealtimeHome() {if (data?.length) {router.push(`realtime/${data[0].id}`);}- }, [data]);+ }, [data, router]);return (- <Page loading={isLoading || !data} error={error}>+ <Page loading={isLoading || data?.length > 0} error={error}><PageHeader title={formatMessage(labels.realtime)} />{data?.length === 0 && <EmptyPlaceholder message={formatMessage(messages.noWebsites)} />}</Page>diff --git a/pages/settings/teams/[...id].js b/pages/settings/teams/[id]/index.jssimilarity index 100%rename from pages/settings/teams/[...id].jsrename to pages/settings/teams/[id]/index.jsdiff --git a/pages/settings/users/[...id].js b/pages/settings/users/[id]/index.jssimilarity index 100%rename from pages/settings/users/[...id].jsrename to pages/settings/users/[id]/index.js