mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
Add links to referrer urls.
This commit is contained in:
parent
7c0e0dd8c4
commit
e7f83c084e
@ -23,6 +23,7 @@ export default function MetricsTable({
|
|||||||
headerComponent,
|
headerComponent,
|
||||||
onDataLoad = () => {},
|
onDataLoad = () => {},
|
||||||
onExpand = () => {},
|
onExpand = () => {},
|
||||||
|
labelRenderer = e => e,
|
||||||
}) {
|
}) {
|
||||||
const [data, setData] = useState();
|
const [data, setData] = useState();
|
||||||
const [format, setFormat] = useState(true);
|
const [format, setFormat] = useState(true);
|
||||||
@ -65,6 +66,7 @@ export default function MetricsTable({
|
|||||||
animate={shouldAnimate}
|
animate={shouldAnimate}
|
||||||
format={formatFunc}
|
format={formatFunc}
|
||||||
onClick={handleSetFormat}
|
onClick={handleSetFormat}
|
||||||
|
labelRenderer={labelRenderer}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -113,7 +115,7 @@ export default function MetricsTable({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const AnimatedRow = ({ label, value = 0, percent, animate, format, onClick }) => {
|
const AnimatedRow = ({ label, value = 0, percent, animate, format, onClick, labelRenderer }) => {
|
||||||
const props = useSpring({
|
const props = useSpring({
|
||||||
width: percent,
|
width: percent,
|
||||||
y: value,
|
y: value,
|
||||||
@ -123,7 +125,7 @@ const AnimatedRow = ({ label, value = 0, percent, animate, format, onClick }) =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.row}>
|
<div className={styles.row}>
|
||||||
<div className={styles.label}>{decodeURI(label)}</div>
|
<div className={styles.label}>{labelRenderer(decodeURI(label))}</div>
|
||||||
<div className={styles.value} onClick={onClick}>
|
<div className={styles.value} onClick={onClick}>
|
||||||
<animated.div className={styles.value}>{props.y?.interpolate(format)}</animated.div>
|
<animated.div className={styles.value}>{props.y?.interpolate(format)}</animated.div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,6 +45,15 @@
|
|||||||
flex: 2;
|
flex: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.label a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label a:hover {
|
||||||
|
color: var(--primary400);
|
||||||
|
}
|
||||||
|
|
||||||
.label:empty {
|
.label:empty {
|
||||||
color: #b3b3b3;
|
color: #b3b3b3;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,16 @@ export default function Referrers({
|
|||||||
}) {
|
}) {
|
||||||
const [filter, setFilter] = useState('Combined');
|
const [filter, setFilter] = useState('Combined');
|
||||||
|
|
||||||
|
const renderLink = url => {
|
||||||
|
return url.startsWith('http') ? (
|
||||||
|
<a href={url} target="_blank" rel="noreferrer">
|
||||||
|
{url}
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
url
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MetricsTable
|
<MetricsTable
|
||||||
title="Referrers"
|
title="Referrers"
|
||||||
@ -30,6 +40,7 @@ export default function Referrers({
|
|||||||
raw: filter === 'Raw',
|
raw: filter === 'Raw',
|
||||||
}}
|
}}
|
||||||
onExpand={onExpand}
|
onExpand={onExpand}
|
||||||
|
labelRenderer={renderLink}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "umami",
|
"name": "umami",
|
||||||
"version": "0.16.0",
|
"version": "0.16.1",
|
||||||
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
|
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
|
||||||
"author": "Mike Cao <mike@mikecao.com>",
|
"author": "Mike Cao <mike@mikecao.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
Loading…
Reference in New Issue
Block a user