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

View File

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

View File

@ -35,7 +35,10 @@ export default function MetricsTable({
const { get, useQuery } = useApi();
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`, {
type,

View File

@ -39,7 +39,7 @@ export default function WebsiteChart({
const { ref, isSticky } = useSticky({ enabled: stickyHeader });
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`, {
startAt: +startDate,