diff --git a/components/layout/NavBar.js b/components/layout/NavBar.js index d4defcb6..a9792eae 100644 --- a/components/layout/NavBar.js +++ b/components/layout/NavBar.js @@ -9,8 +9,10 @@ import ProfileButton from 'components/input/ProfileButton'; import styles from './NavBar.module.css'; import useConfig from 'hooks/useConfig'; import useMessages from 'hooks/useMessages'; +import { useRouter } from 'next/router'; export default function NavBar() { + const { pathname } = useRouter(); const { cloudMode } = useConfig(); const { formatMessage, labels } = useMessages(); const [minimized, setMinimized] = useState(false); @@ -34,8 +36,11 @@ export default function NavBar() {
{links.map(({ url, icon, label }) => { return ( - - {icon} + {label} ); diff --git a/components/layout/NavBar.module.css b/components/layout/NavBar.module.css index 4accadf4..393c34f7 100644 --- a/components/layout/NavBar.module.css +++ b/components/layout/NavBar.module.css @@ -5,7 +5,7 @@ align-items: center; height: 60px; background: var(--base75); - border-bottom: 1px solid var(--base200); + border-bottom: 2px solid var(--base300); padding: 0 20px; } @@ -23,7 +23,7 @@ .links { display: flex; flex-direction: row; - gap: 20px; + gap: 30px; padding: 0 40px; flex: 1; font-weight: 700; @@ -33,11 +33,19 @@ display: flex; align-items: center; gap: 10px; - color: var(--font-color100); + line-height: 60px; + color: var(--font-color200); + border-bottom: 2px solid transparent; } .links a:hover { - color: var(--primary400); + color: var(--font-color100); + border-bottom: 2px solid var(--primary400); +} + +.links .selected { + color: var(--font-color100); + border-bottom: 2px solid var(--primary400); } .actions { diff --git a/components/layout/SettingsLayout.js b/components/layout/SettingsLayout.js new file mode 100644 index 00000000..be4a07e3 --- /dev/null +++ b/components/layout/SettingsLayout.js @@ -0,0 +1,26 @@ +import AppLayout from './AppLayout'; +import styles from './SettingsLayout.module.css'; +import useMessages from 'hooks/useMessages'; +import SideNav from './SideNav'; + +export default function SettingsLayout({ children }) { + const { formatMessage, labels } = useMessages(); + + const items = [ + { label: formatMessage(labels.websites), url: '/settings/websites' }, + { label: formatMessage(labels.teams), url: '/settings/teams' }, + { label: formatMessage(labels.users), url: '/settings/users' }, + { label: formatMessage(labels.profile), url: '/settings/profile' }, + ]; + + return ( + +
+
+ +
+
{children}
+
+
+ ); +} diff --git a/components/layout/SettingsLayout.module.css b/components/layout/SettingsLayout.module.css new file mode 100644 index 00000000..5f0884c4 --- /dev/null +++ b/components/layout/SettingsLayout.module.css @@ -0,0 +1,17 @@ +.container { + display: grid; + grid-template-columns: max-content 1fr; + grid-template-rows: 1fr; +} + +.menu { + display: flex; + flex-direction: column; + width: 200px; + padding: 40px 0; +} + +.content { + display: flex; + flex-direction: column; +} diff --git a/components/layout/SideNav.js b/components/layout/SideNav.js new file mode 100644 index 00000000..2706dc7f --- /dev/null +++ b/components/layout/SideNav.js @@ -0,0 +1,17 @@ +import { Menu, Item } from 'react-basics'; +import Link from 'next/link'; +import styles from './SideNav.module.css'; + +export default function SideNav({ selectedKey, items, shallow }) { + return ( + + {({ key, label, url }) => ( + + + {label} + + + )} + + ); +} diff --git a/components/layout/SideNav.module.css b/components/layout/SideNav.module.css new file mode 100644 index 00000000..e55f5d7a --- /dev/null +++ b/components/layout/SideNav.module.css @@ -0,0 +1,14 @@ +.menu { + display: flex; + flex-direction: column; +} + +.item a { + color: var(--font-color100); + flex: 1; + padding: var(--size300) var(--size600); +} + +.item { + padding: 0; +} diff --git a/components/metrics/PagesTable.js b/components/metrics/PagesTable.js index 5dbb0658..ba9a3153 100644 --- a/components/metrics/PagesTable.js +++ b/components/metrics/PagesTable.js @@ -38,7 +38,6 @@ export default function PagesTable({ websiteId, showFilters, ...props }) { type="url" metric={formatMessage(labels.views)} websiteId={websiteId} - dataFilter={filters[filter]} renderLabel={renderLink} {...props} /> diff --git a/components/pages/realtime/RealtimeHeader.module.css b/components/pages/realtime/RealtimeHeader.module.css index a7ebf36c..a326e631 100644 --- a/components/pages/realtime/RealtimeHeader.module.css +++ b/components/pages/realtime/RealtimeHeader.module.css @@ -2,6 +2,7 @@ display: flex; align-items: center; justify-content: space-between; + margin-bottom: 20px; } .metrics { diff --git a/components/pages/settings/websites/WebsiteAddForm.js b/components/pages/settings/websites/WebsiteAddForm.js index d08849e2..636f8d91 100644 --- a/components/pages/settings/websites/WebsiteAddForm.js +++ b/components/pages/settings/websites/WebsiteAddForm.js @@ -12,7 +12,7 @@ import { DOMAIN_REGEX } from 'lib/constants'; import useMessages from 'hooks/useMessages'; export default function WebsiteAddForm({ onSave, onClose }) { - const { formatMessage, labels } = useMessages(); + const { formatMessage, labels, messages } = useMessages(); const { post, useMutation } = useApi(); const { mutate, error, isLoading } = useMutation(data => post('/websites', data)); @@ -37,7 +37,7 @@ export default function WebsiteAddForm({ onSave, onClose }) { name="domain" rules={{ required: formatMessage(labels.required), - pattern: { value: DOMAIN_REGEX, message: formatMessage(labels.invalidDomain) }, + pattern: { value: DOMAIN_REGEX, message: formatMessage(messages.invalidDomain) }, }} > diff --git a/components/pages/websites/WebsiteMenuView.js b/components/pages/websites/WebsiteMenuView.js index 99e2dc5b..d6440eb8 100644 --- a/components/pages/websites/WebsiteMenuView.js +++ b/components/pages/websites/WebsiteMenuView.js @@ -11,10 +11,11 @@ import QueryParametersTable from 'components/metrics/QueryParametersTable'; import ReferrersTable from 'components/metrics/ReferrersTable'; import ScreenTable from 'components/metrics/ScreenTable'; import EventsTable from 'components/metrics/EventsTable'; -import usePageQuery from 'hooks/usePageQuery'; import Icons from 'components/icons'; -import styles from './WebsiteMenuView.module.css'; +import SideNav from 'components/layout/SideNav'; +import usePageQuery from 'hooks/usePageQuery'; import useMessages from 'hooks/useMessages'; +import styles from './WebsiteMenuView.module.css'; const views = { url: PagesTable, @@ -40,42 +41,52 @@ export default function WebsiteMenuView({ websiteId, websiteDomain }) { { key: 'url', label: formatMessage(labels.pages), + url: resolveUrl({ view: 'url' }), }, { key: 'referrer', label: formatMessage(labels.referrers), + url: resolveUrl({ view: 'referrer' }), }, { key: 'browser', label: formatMessage(labels.browsers), + url: resolveUrl({ view: 'browser' }), }, { key: 'os', label: formatMessage(labels.os), + url: resolveUrl({ view: 'os' }), }, { key: 'device', label: formatMessage(labels.devices), + url: resolveUrl({ view: 'device' }), }, { key: 'country', label: formatMessage(labels.countries), + url: resolveUrl({ view: 'country' }), }, { key: 'language', label: formatMessage(labels.languages), + url: resolveUrl({ view: 'language' }), }, { key: 'screen', label: formatMessage(labels.screens), + url: resolveUrl({ view: 'screen' }), }, { key: 'event', label: formatMessage(labels.events), + url: resolveUrl({ view: 'event' }), }, { key: 'query', label: formatMessage(labels.query), + url: resolveUrl({ view: 'query' }), }, ]; @@ -94,15 +105,7 @@ export default function WebsiteMenuView({ websiteId, websiteDomain }) { - - {({ key, label }) => ( - - - {label} - - - )} - + + - + ); } diff --git a/queries/analytics/event/getEvents.ts b/queries/analytics/event/getEvents.ts index d4a3d6ce..3c175216 100644 --- a/queries/analytics/event/getEvents.ts +++ b/queries/analytics/event/getEvents.ts @@ -31,7 +31,7 @@ function clickhouseQuery(websiteId: string, startAt: Date) { session_id as sessionId, created_at as createdAt, toUnixTimestamp(created_at) as timestamp, - url, + url_path, event_name as eventName from event where event_type = ${EVENT_TYPE.customEvent} diff --git a/queries/analytics/pageview/getPageviews.ts b/queries/analytics/pageview/getPageviews.ts index 33fa33db..d23669a7 100644 --- a/queries/analytics/pageview/getPageviews.ts +++ b/queries/analytics/pageview/getPageviews.ts @@ -30,7 +30,7 @@ async function clickhouseQuery(websiteId: string, startAt: Date) { session_id as sessionId, created_at as createdAt, toUnixTimestamp(created_at) as timestamp, - url + url_path from event where event_type = ${EVENT_TYPE.pageView} and website_id = {websiteId:UUID}