Render external links for referrer drilldown modal

pull/252/head
Uku Taht 6 years ago
parent e2c636c7e8
commit fc9cc64745

@ -48,12 +48,26 @@ class ReferrerDrilldownModal extends React.Component {
}
}
renderExternalLink(name) {
return (
<a target="_blank" href={'//' + name}>
<svg className="inline h-4 w-4 ml-1 -mt-1 text-gray-600" fill="currentColor" viewBox="0 0 20 20"><path d="M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"></path><path d="M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"></path></svg>
</a>
)
}
renderReferrerName(name) {
if (name) {
return <a className="hover:underline" target="_blank" href={'//' + name}>{name}</a>
} else {
return '(no referrer)'
}
const query = new URLSearchParams(window.location.search)
query.set('referrer', name)
return (
<span className="flex">
<Link className="block truncate hover:underline" to={{search: query.toString(), pathname: '/' + this.props.site.domain}} title={name}>
{ name === '' ? '(no referrer)' : name }
</Link>
{ this.renderExternalLink(name) }
</span>
)
}
renderTweet(tweet, index) {

@ -448,7 +448,7 @@ defmodule Plausible.Stats.Clickhouse do
def countries(site, query) do
Clickhouse.all(
from e in base_session_query(site, query),
from e in base_query(site, query),
select: {fragment("? as name", e.country_code), fragment("uniq(user_id) as count")},
group_by: e.country_code,
where: e.country_code != "\0\0",
@ -466,7 +466,7 @@ defmodule Plausible.Stats.Clickhouse do
def browsers(site, query, limit \\ 5) do
Clickhouse.all(
from e in base_session_query(site, query),
from e in base_query(site, query),
select: {fragment("? as name", e.browser), fragment("uniq(user_id) as count")},
group_by: e.browser,
where: e.browser != "",
@ -478,7 +478,7 @@ defmodule Plausible.Stats.Clickhouse do
def operating_systems(site, query, limit \\ 5) do
Clickhouse.all(
from e in base_session_query(site, query),
from e in base_query(site, query),
select: {fragment("? as name", e.operating_system), fragment("uniq(user_id) as count")},
group_by: e.operating_system,
where: e.operating_system != "",

Loading…
Cancel
Save