Added ProfileButton to cloud mode.

This commit is contained in:
Mike Cao 2023-04-06 20:34:02 -07:00
parent f56374b259
commit 25d4a9cec0
4 changed files with 16 additions and 9 deletions

View File

@ -3,11 +3,13 @@ import { useRouter } from 'next/router';
import Icons from 'components/icons'; import Icons from 'components/icons';
import useMessages from 'hooks/useMessages'; import useMessages from 'hooks/useMessages';
import useUser from 'hooks/useUser'; import useUser from 'hooks/useUser';
import useConfig from 'hooks/useConfig';
import styles from './ProfileButton.module.css'; import styles from './ProfileButton.module.css';
export default function ProfileButton() { export default function ProfileButton() {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
const { user } = useUser(); const { user } = useUser();
const { cloudMode } = useConfig();
const router = useRouter(); const router = useRouter();
const handleSelect = key => { const handleSelect = key => {
@ -40,12 +42,14 @@ export default function ProfileButton() {
</Icon> </Icon>
<Text>{formatMessage(labels.profile)}</Text> <Text>{formatMessage(labels.profile)}</Text>
</Item> </Item>
<Item key="logout" className={styles.item}> {!cloudMode && (
<Icon> <Item key="logout" className={styles.item}>
<Icons.Logout /> <Icon>
</Icon> <Icons.Logout />
<Text>{formatMessage(labels.logout)}</Text> </Icon>
</Item> <Text>{formatMessage(labels.logout)}</Text>
</Item>
)}
</Menu> </Menu>
</Popup> </Popup>
</PopupTrigger> </PopupTrigger>

View File

@ -50,7 +50,7 @@ export default function NavBar() {
<div className={styles.actions}> <div className={styles.actions}>
<ThemeButton /> <ThemeButton />
<LanguageButton /> <LanguageButton />
{!cloudMode && <ProfileButton />} <ProfileButton />
</div> </div>
</Column> </Column>
</Row> </Row>

View File

@ -35,7 +35,10 @@ export default function MetricsTable({
const { get, useQuery } = useApi(); const { get, useQuery } = useApi();
const { data, isLoading, isFetched, error } = useQuery( const { data, isLoading, isFetched, error } = useQuery(
['websites:metrics', websiteId, type, modified, url, referrer, os, browser, device, country], [
'websites:metrics',
{ websiteId, type, modified, url, referrer, os, browser, device, country },
],
() => () =>
get(`/websites/${websiteId}/metrics`, { get(`/websites/${websiteId}/metrics`, {
type, type,

View File

@ -39,7 +39,7 @@ export default function WebsiteChart({
const { ref, isSticky } = useSticky({ enabled: stickyHeader }); const { ref, isSticky } = useSticky({ enabled: stickyHeader });
const { data, isLoading, error } = useQuery( const { data, isLoading, error } = useQuery(
['websites:pageviews', websiteId, modified, url, referrer, os, browser, device, country], ['websites:pageviews', { websiteId, modified, url, referrer, os, browser, device, country }],
() => () =>
get(`/websites/${websiteId}/pageviews`, { get(`/websites/${websiteId}/pageviews`, {
startAt: +startDate, startAt: +startDate,