mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 12:05:41 +01:00
DEV :: same styles
This commit is contained in:
parent
edce3c5223
commit
83b6214260
3 changed files with 22 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
import { Loading } from 'react-basics';
|
import { Loading } from 'react-basics';
|
||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
|
import { useEffect } from 'react';
|
||||||
import Page from 'components/layout/Page';
|
import Page from 'components/layout/Page';
|
||||||
import FilterTags from 'components/metrics/FilterTags';
|
import FilterTags from 'components/metrics/FilterTags';
|
||||||
import { useNavigation, useWebsite } from 'components/hooks';
|
import { useNavigation, useWebsite } from 'components/hooks';
|
||||||
|
|
@ -12,18 +13,34 @@ import WebsiteTableView from './WebsiteTableView';
|
||||||
|
|
||||||
export default function WebsiteDetails({ websiteId }: { websiteId: string }) {
|
export default function WebsiteDetails({ websiteId }: { websiteId: string }) {
|
||||||
const { data: website, isLoading, error } = useWebsite(websiteId);
|
const { data: website, isLoading, error } = useWebsite(websiteId);
|
||||||
|
const pathname = usePathname();
|
||||||
const { query } = useNavigation();
|
const { query } = useNavigation();
|
||||||
|
|
||||||
if (isLoading || error) {
|
if (isLoading || error) {
|
||||||
return <Page isLoading={isLoading} error={error} />;
|
return <Page isLoading={isLoading} error={error} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const showLinks = false
|
const showLinks = !pathname.includes('/share/');
|
||||||
const { view, ...params } = query;
|
const { view, ...params } = query;
|
||||||
|
useEffect(() => {
|
||||||
|
// Send message to parent window with content height
|
||||||
|
const sendHeight = () => {
|
||||||
|
const height = document.body.scrollHeight;
|
||||||
|
window.parent.postMessage({ height: height }, "*");
|
||||||
|
};
|
||||||
|
|
||||||
|
// Send content height initially and on resize
|
||||||
|
sendHeight();
|
||||||
|
window.addEventListener('resize', sendHeight);
|
||||||
|
|
||||||
|
// Cleanup event listener on component unmount
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('resize', sendHeight);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WebsiteHeader websiteId={websiteId} showLinks={showLinks} />
|
{showLinks && <WebsiteHeader websiteId={websiteId} showLinks={showLinks} />}
|
||||||
<FilterTags websiteId={websiteId} params={params} />
|
<FilterTags websiteId={websiteId} params={params} />
|
||||||
<WebsiteMetricsBar websiteId={websiteId} sticky={false} />
|
<WebsiteMetricsBar websiteId={websiteId} sticky={false} />
|
||||||
<WebsiteChart websiteId={websiteId} />
|
<WebsiteChart websiteId={websiteId} />
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,12 @@ export function WebsiteHeader({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.header}>
|
<div className={styles.header}>
|
||||||
|
{showLinks && (
|
||||||
<div className={styles.title}>
|
<div className={styles.title}>
|
||||||
<Favicon domain={domain} />
|
<Favicon domain={domain} />
|
||||||
<Text>{name}</Text>
|
<Text>{name}</Text>
|
||||||
<ActiveUsers websiteId={websiteId} />
|
<ActiveUsers websiteId={websiteId} />
|
||||||
</div>
|
</div>)}
|
||||||
<div className={styles.actions}>
|
<div className={styles.actions}>
|
||||||
{showLinks && (
|
{showLinks && (
|
||||||
<div className={styles.links}>
|
<div className={styles.links}>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: end;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue