mirror of
https://github.com/umami-software/umami.git
synced 2026-02-21 04:55:36 +01:00
Renamed query hooks. Fixed conversion bugs.
This commit is contained in:
parent
adca3c36d0
commit
7886c3f393
110 changed files with 423 additions and 489 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useMessages, useTeamUrl } from '@/components/hooks';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { PageHeader } from '@/components/layout/PageHeader';
|
||||
import { WebsiteAddButton } from './WebsiteAddButton';
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ export interface WebsitesHeaderProps {
|
|||
|
||||
export function WebsitesHeader({ allowCreate = true }: WebsitesHeaderProps) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { teamId } = useTeamUrl();
|
||||
const { teamId } = useNavigation();
|
||||
|
||||
return (
|
||||
<PageHeader title={formatMessage(labels.websites)}>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
'use client';
|
||||
import { useLogin } from '@/components/hooks';
|
||||
import { useLoginQuery } from '@/components/hooks';
|
||||
import { WebsitesDataTable } from './WebsitesDataTable';
|
||||
import { WebsitesHeader } from './WebsitesHeader';
|
||||
import { ROLES } from '@/lib/constants';
|
||||
|
||||
export function WebsitesSettingsPage({ teamId }: { teamId: string }) {
|
||||
const { user } = useLogin();
|
||||
const { user } = useLoginQuery();
|
||||
const canCreate = user.role !== ROLES.viewOnly;
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ReactNode } from 'react';
|
||||
import { Row, Text, Icon, Icons, DataTable, DataColumn, Button } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import { useMessages, useTeamUrl } from '@/components/hooks';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
|
||||
export interface WebsitesTableProps {
|
||||
data: any[];
|
||||
|
|
@ -20,7 +20,7 @@ export function WebsitesTable({
|
|||
children,
|
||||
}: WebsitesTableProps) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { renderTeamUrl } = useTeamUrl();
|
||||
const { renderTeamUrl } = useNavigation();
|
||||
|
||||
if (!data?.length) {
|
||||
return children;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
import { Button, Modal, DialogTrigger, Dialog, Column } from '@umami/react-zen';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useLogin, useMessages, useModified, useTeams, useTeamUrl } from '@/components/hooks';
|
||||
import {
|
||||
useLoginQuery,
|
||||
useMessages,
|
||||
useModified,
|
||||
useTeamsQuery,
|
||||
useNavigation,
|
||||
} from '@/components/hooks';
|
||||
import { WebsiteDeleteForm } from './WebsiteDeleteForm';
|
||||
import { WebsiteResetForm } from './WebsiteResetForm';
|
||||
import { WebsiteTransferForm } from './WebsiteTransferForm';
|
||||
|
|
@ -9,11 +15,11 @@ import { ROLES } from '@/lib/constants';
|
|||
|
||||
export function WebsiteData({ websiteId, onSave }: { websiteId: string; onSave?: () => void }) {
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const { user } = useLogin();
|
||||
const { user } = useLoginQuery();
|
||||
const { touch } = useModified();
|
||||
const { teamId, renderTeamUrl } = useTeamUrl();
|
||||
const { teamId, renderTeamUrl } = useNavigation();
|
||||
const router = useRouter();
|
||||
const { result } = useTeams(user.id);
|
||||
const { result } = useTeamsQuery(user.id);
|
||||
const canTransferWebsite =
|
||||
(
|
||||
!teamId &&
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
ListItem,
|
||||
Text,
|
||||
} from '@umami/react-zen';
|
||||
import { useApi, useLogin, useMessages, useTeams } from '@/components/hooks';
|
||||
import { useApi, useLoginQuery, useMessages, useTeamsQuery } from '@/components/hooks';
|
||||
import { WebsiteContext } from '@/app/(main)/websites/[websiteId]/WebsiteProvider';
|
||||
import { ROLES } from '@/lib/constants';
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ export function WebsiteTransferForm({
|
|||
onSave?: () => void;
|
||||
onClose?: () => void;
|
||||
}) {
|
||||
const { user } = useLogin();
|
||||
const { user } = useLoginQuery();
|
||||
const website = useContext(WebsiteContext);
|
||||
const [teamId, setTeamId] = useState<string>(null);
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
|
|
@ -31,7 +31,7 @@ export function WebsiteTransferForm({
|
|||
const { mutate, error } = useMutation({
|
||||
mutationFn: (data: any) => post(`/websites/${websiteId}/transfer`, data),
|
||||
});
|
||||
const { result, query } = useTeams(user.id);
|
||||
const { result, query } = useTeamsQuery(user.id);
|
||||
const isTeamWebsite = !!website?.teamId;
|
||||
|
||||
const items = result.data.filter(({ teamUser }) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue