mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Settings refactor.
This commit is contained in:
parent
1b81074752
commit
c98f324c22
56 changed files with 706 additions and 348 deletions
|
|
@ -25,10 +25,17 @@ export function ConfirmationForm({
|
|||
|
||||
return (
|
||||
<Form onSubmit={onConfirm} error={error}>
|
||||
<Row marginY="4">{message}</Row>
|
||||
<Row marginY="4" gap="2">
|
||||
{message}
|
||||
</Row>
|
||||
<FormButtons>
|
||||
<Button onPress={onClose}>{formatMessage(labels.cancel)}</Button>
|
||||
<FormSubmitButton data-test="button-confirm" isLoading={isLoading} variant={buttonVariant}>
|
||||
<FormSubmitButton
|
||||
data-test="button-confirm"
|
||||
isLoading={isLoading}
|
||||
variant={buttonVariant}
|
||||
isDisabled={false}
|
||||
>
|
||||
{buttonLabel || formatMessage(labels.ok)}
|
||||
</FormSubmitButton>
|
||||
</FormButtons>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
import { useApi } from '../useApi';
|
||||
import { useModified } from '@/components/hooks';
|
||||
import { keepPreviousData } from '@tanstack/react-query';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function useTeamQuery(teamId: string) {
|
||||
export function useTeamQuery(teamId: string, options?: ReactQueryOptions<any>) {
|
||||
const { get, useQuery } = useApi();
|
||||
const { modified } = useModified(`teams:${teamId}`);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['teams', teamId],
|
||||
queryKey: ['teams', { teamId, modified }],
|
||||
queryFn: () => get(`/teams/${teamId}`),
|
||||
enabled: !!teamId,
|
||||
placeholderData: keepPreviousData,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
import { useApi } from '../useApi';
|
||||
import { useModified } from '@/components/hooks';
|
||||
import { keepPreviousData } from '@tanstack/react-query';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function useUserQuery(userId: string, options?: Record<string, any>) {
|
||||
export function useUserQuery(userId: string, options?: ReactQueryOptions<any>) {
|
||||
const { get, useQuery } = useApi();
|
||||
const { modified } = useModified(`user:${userId}`);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['users', userId],
|
||||
queryKey: ['users', { userId, modified }],
|
||||
queryFn: () => get(`/users/${userId}`),
|
||||
enabled: !!userId,
|
||||
placeholderData: keepPreviousData,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,17 @@
|
|||
import { useApi } from '../useApi';
|
||||
import { useModified } from '@/components/hooks';
|
||||
import { keepPreviousData } from '@tanstack/react-query';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function useWebsiteQuery(websiteId: string, options?: Record<string, any>) {
|
||||
export function useWebsiteQuery(websiteId: string, options?: ReactQueryOptions<any>) {
|
||||
const { get, useQuery } = useApi();
|
||||
const { modified } = useModified(`website:${websiteId}`);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['website', { websiteId }],
|
||||
queryKey: ['website', { websiteId, modified }],
|
||||
queryFn: () => get(`/websites/${websiteId}`),
|
||||
enabled: !!websiteId,
|
||||
placeholderData: keepPreviousData,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export function FilterBar() {
|
|||
})}
|
||||
</Row>
|
||||
<TooltipTrigger delay={0}>
|
||||
<Button variant="wrapper" onPress={handleResetFilter} style={{ alignSelf: 'flex-start' }}>
|
||||
<Button variant="zero" onPress={handleResetFilter} style={{ alignSelf: 'flex-start' }}>
|
||||
<Icon>
|
||||
<Close />
|
||||
</Icon>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@ import { Ellipsis } from '@/components/icons';
|
|||
export function MenuButton({
|
||||
children,
|
||||
onAction,
|
||||
isDisabled,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
onAction?: (action: string) => void;
|
||||
isDisabled?: boolean;
|
||||
}) {
|
||||
const handleAction = (key: Key) => {
|
||||
onAction?.(key.toString());
|
||||
|
|
@ -15,7 +17,7 @@ export function MenuButton({
|
|||
|
||||
return (
|
||||
<DialogTrigger>
|
||||
<Button variant="quiet">
|
||||
<Button variant="quiet" isDisabled={isDisabled}>
|
||||
<Icon>
|
||||
<Ellipsis />
|
||||
</Icon>
|
||||
|
|
|
|||
|
|
@ -334,6 +334,7 @@ export const labels = defineMessages({
|
|||
firstClick: { id: 'label.first-click', defaultMessage: 'First click' },
|
||||
lastClick: { id: 'label.last-click', defaultMessage: 'Last click' },
|
||||
online: { id: 'label.online', defaultMessage: 'Online' },
|
||||
preferences: { id: 'label.preferences', defaultMessage: 'Preferences' },
|
||||
});
|
||||
|
||||
export const messages = defineMessages({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue