Fixed 'use client' usage.

This commit is contained in:
Mike Cao 2024-02-05 23:59:33 -08:00
parent be5592446a
commit f7151a880e
208 changed files with 323 additions and 385 deletions

View file

@ -1,4 +1,3 @@
'use client';
import { ErrorInfo, ReactNode } from 'react';
import { ErrorBoundary as Boundary } from 'react-error-boundary';
import { Button } from 'react-basics';

View file

@ -1,4 +1,3 @@
'use client';
import * as reactQuery from '@tanstack/react-query';
import { useApi as nextUseApi } from 'next-basics';
import { getClientAuthToken } from 'lib/client';

View file

@ -1,4 +1,3 @@
'use client';
import { useEffect } from 'react';
import useStore, { setConfig } from 'store/app';
import { useApi } from './useApi';

View file

@ -1,4 +1,3 @@
'use client';
import { UseQueryOptions } from '@tanstack/react-query';
import { useState, Dispatch, SetStateAction } from 'react';
import { useApi } from './useApi';

View file

@ -1,4 +1,3 @@
'use client';
import useStore, { setUser } from 'store/app';
import useApi from './useApi';
import { UseQueryResult } from '@tanstack/react-query';

View file

@ -1,4 +1,3 @@
'use client';
import { produce } from 'immer';
import { useCallback, useEffect, useState } from 'react';
import { useApi } from './useApi';

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
import useFilterQuery from './useFilterQuery';
import useModified from 'store/modified';

View file

@ -1,4 +1,3 @@
'use client';
import useStore, { setShareToken } from 'store/app';
import useApi from './useApi';

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
export function useTeam(teamId: string) {

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
import useFilterQuery from './useFilterQuery';

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
import useFilterQuery from './useFilterQuery';

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
import useFilterQuery from './useFilterQuery';
import { useLogin } from 'components/hooks';

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
export function useUser(userId: string, options?: { [key: string]: any }) {

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
import useFilterQuery from './useFilterQuery';
import useModified from 'store/modified';

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
export function useWebsite(websiteId: string, options?: { [key: string]: any }) {

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
import { UseQueryOptions } from '@tanstack/react-query';

View file

@ -1,4 +1,3 @@
'use client';
import useApi from './useApi';
import { UseQueryOptions } from '@tanstack/react-query';

View file

@ -1,4 +1,3 @@
'use client';
import { useApi } from './useApi';
import { useFilterQuery } from './useFilterQuery';
import { useLogin } from './useLogin';

View file

@ -1,4 +1,3 @@
'use client';
import { useState, useEffect } from 'react';
import { httpGet } from 'next-basics';
import enUS from '../../../public/intl/country/en-US.json';

View file

@ -1,4 +1,3 @@
'use client';
import { getMinimumUnit, parseDateRange } from 'lib/date';
import { setItem } from 'next-basics';
import { DATE_RANGE_CONFIG, DEFAULT_DATE_RANGE } from 'lib/constants';

View file

@ -1,4 +1,3 @@
'use client';
import { useEffect } from 'react';
export function useDocumentClick(handler: (event: MouseEvent) => any) {

View file

@ -1,4 +1,3 @@
'use client';
import { useEffect, useCallback, KeyboardEvent } from 'react';
export function useEscapeKey(handler: (event: KeyboardEvent) => void) {

View file

@ -1,4 +1,3 @@
'use client';
import { useMessages } from './useMessages';
import { OPERATORS } from 'lib/constants';

View file

@ -1,4 +1,3 @@
'use client';
import { useCallback, useState } from 'react';
export function useForceUpdate() {

View file

@ -1,4 +1,3 @@
'use client';
import useMessages from './useMessages';
import { BROWSERS } from 'lib/constants';
import useLocale from './useLocale';

View file

@ -1,4 +1,3 @@
'use client';
import { useState, useEffect } from 'react';
import { httpGet } from 'next-basics';
import enUS from '../../../public/intl/language/en-US.json';

View file

@ -1,4 +1,3 @@
'use client';
import { useEffect } from 'react';
import { httpGet, setItem } from 'next-basics';
import { LOCALE_CONFIG } from 'lib/constants';

View file

@ -1,4 +1,3 @@
'use client';
import { useIntl, FormattedMessage } from 'react-intl';
import { messages, labels } from 'components/messages';

View file

@ -1,4 +1,3 @@
'use client';
import { useMemo } from 'react';
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
import { buildUrl } from 'next-basics';

View file

@ -1,4 +1,3 @@
'use client';
import { useState, useEffect, useRef } from 'react';
export function useSticky({ enabled = true, threshold = 1 }) {

View file

@ -1,4 +1,3 @@
'use client';
import { usePathname } from 'next/navigation';
export function useTeamUrl(): {

View file

@ -1,4 +1,3 @@
'use client';
import { useEffect } from 'react';
import useStore, { setTheme } from 'store/app';
import { getItem, setItem } from 'next-basics';

View file

@ -1,4 +1,3 @@
'use client';
import { useState, useCallback } from 'react';
import { getTimezone } from 'lib/date';
import { getItem, setItem } from 'next-basics';

View file

@ -1,4 +1,3 @@
'use client';
import { useState } from 'react';
import { Icon, Modal, Dropdown, Item, Text, Flexbox } from 'react-basics';
import { endOfYear, isSameDay } from 'date-fns';

View file

@ -9,7 +9,7 @@ export function LogoutButton({
}) {
const { formatMessage, labels } = useMessages();
return (
<Link href="/src/app/logout/logout">
<Link href="/src/app/logout/LogoutPage">
<TooltipPopup label={formatMessage(labels.logout)} position={tooltipPosition}>
<Button variant="quiet">
<Icon>

View file

@ -1,4 +1,3 @@
'use client';
import { Key } from 'react';
import { Text, Icon, Button, Popup, Menu, Item, PopupTrigger, Flexbox } from 'react-basics';
import classNames from 'classnames';

View file

@ -1,4 +1,3 @@
'use client';
import { useState, Key } from 'react';
import { Dropdown, Item } from 'react-basics';
import { useWebsite, useWebsites, useMessages } from 'components/hooks';

View file

@ -1,10 +1,9 @@
'use client';
import { ReactNode } from 'react';
import { usePathname } from 'next/navigation';
import SideNav from 'components/layout/SideNav';
import styles from './SettingsLayout.module.css';
import styles from './MenuLayout.module.css';
export function SettingsLayout({ items = [], children }: { items: any[]; children: ReactNode }) {
export function MenuLayout({ items = [], children }: { items: any[]; children: ReactNode }) {
const pathname = usePathname();
const cloudMode = !!process.env.cloudMode;
@ -22,4 +21,4 @@ export function SettingsLayout({ items = [], children }: { items: any[]; childre
);
}
export default SettingsLayout;
export default MenuLayout;

View file

@ -1,4 +1,3 @@
'use client';
import { ReactNode } from 'react';
import classNames from 'classnames';
import { Banner, Loading } from 'react-basics';