mirror of https://github.com/buster-so/buster.git
Export issues resolved
This commit is contained in:
parent
18febf7428
commit
847ea87dde
|
@ -1,6 +1,6 @@
|
|||
import { QueryClient, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { userQueryKeys } from '@/api/query_keys/users';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
import { useMemoizedFn } from '@/hooks/useMemoizedFn';
|
||||
import { useCreateOrganization } from '../organizations/queryRequests';
|
||||
import {
|
||||
getMyUserInfo,
|
||||
|
|
|
@ -2,21 +2,17 @@
|
|||
|
||||
import { Avatar } from '@/components/ui/avatar';
|
||||
import { Text, Title } from '@/components/ui/typography';
|
||||
import { useUserConfigContextSelector } from '@/context/Users';
|
||||
import { useUserConfigContextSelector } from '@/context/Users/BusterUserConfigProvider';
|
||||
import { formatDate } from '@/lib/date';
|
||||
import { SettingsPageHeader } from '../../_components/SettingsPageHeader';
|
||||
|
||||
export default function ProfilePage() {
|
||||
const user = useUserConfigContextSelector((state) => state.user);
|
||||
|
||||
if (!user) return null;
|
||||
|
||||
const { name, email, created_at } = user;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SettingsPageHeader title="Profile" description="Manage your profile & information" />
|
||||
|
||||
<div className="bg-background rounded-lg border shadow">
|
||||
{/* Header Section */}
|
||||
<div className="border-border/30 flex flex-col items-center gap-4 border-b p-6 sm:flex-row sm:items-start">
|
||||
|
@ -28,14 +24,12 @@ export default function ProfilePage() {
|
|||
<Text className="text-gray-light mt-1">{email}</Text>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Info Section */}
|
||||
<div className="space-y-4 p-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<Text variant="secondary">Member Since</Text>
|
||||
<Text className="font-medium">{formatDate({ date: created_at, format: 'll' })}</Text>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<Text variant="secondary">Account Status</Text>
|
||||
<div className="flex items-center gap-2">
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
import isEmpty from 'lodash/isEmpty';
|
||||
import React, { useCallback } from 'react';
|
||||
import {
|
||||
DEFAULT_CHART_CONFIG,
|
||||
type BusterChartPropsBase,
|
||||
type ChartConfigProps
|
||||
} from '@buster/server-shared/metrics';
|
||||
import { DEFAULT_CHART_CONFIG, type ChartConfigProps } from '@buster/server-shared/metrics';
|
||||
import { AppDataGrid } from '@/components/ui/table/AppDataGrid';
|
||||
import { useUpdateMetricChart } from '@/context/Metrics';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
import { cn } from '@/lib/classMerge';
|
||||
import { formatLabel } from '@/lib/columnFormatter';
|
||||
import type { BusterTableChartConfig } from './interfaces';
|
||||
import type { BusterChartPropsBase } from '@/api/asset_interfaces/metric';
|
||||
|
||||
export interface BusterTableChartProps extends BusterTableChartConfig, BusterChartPropsBase {}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import { jwtDecode } from 'jwt-decode';
|
|||
import React, { type PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||
import { createContext, useContextSelector } from 'use-context-selector';
|
||||
import { checkTokenValidityFromServer } from '@/api/buster_rest/nextjs/auth';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
import { millisecondsFromUnixTimestamp } from '@/lib/date';
|
||||
import { useMemoizedFn } from '@/hooks/useMemoizedFn';
|
||||
import { millisecondsFromUnixTimestamp } from '@/lib/timestamp';
|
||||
import type { UseSupabaseUserContextType } from '@/lib/supabase';
|
||||
|
||||
const PREEMTIVE_REFRESH_MINUTES = 5;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import React, { type PropsWithChildren } from 'react';
|
||||
import { createContext, useContextSelector } from 'use-context-selector';
|
||||
import { useGetMyUserInfo } from '@/api/buster_rest/users';
|
||||
import { useGetMyUserInfo } from '@/api/buster_rest/users/queryRequests';
|
||||
import { checkIfUserIsAdmin } from '@/lib/user';
|
||||
import { useSupabaseContext } from '../Supabase';
|
||||
|
||||
|
@ -15,10 +15,9 @@ export const useUserConfigProvider = () => {
|
|||
const userOrganizations = userResponse?.organizations?.[0];
|
||||
const userRole = userOrganizations?.role;
|
||||
const isUserRegistered =
|
||||
!!userResponse &&
|
||||
!!userResponse?.organizations?.[0]?.id &&
|
||||
!!userResponse?.user?.name &&
|
||||
!isAnonymousUser;
|
||||
!!userResponse && !!userResponse?.organizations?.[0]?.id && !!userResponse?.user?.name;
|
||||
//&&
|
||||
// !isAnonymousUser;
|
||||
|
||||
const isAdmin = checkIfUserIsAdmin(userResponse);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
DEFAULT_DAY_OF_WEEK_FORMAT,
|
||||
type ColumnLabelFormat
|
||||
} from '@buster/server-shared/metrics';
|
||||
import { SupportedLanguages } from '../config/languages';
|
||||
import { SupportedLanguages } from '@/config/languages';
|
||||
import { getBrowserLanguage } from './language';
|
||||
import { isNumeric } from './numbers';
|
||||
|
||||
|
@ -309,10 +309,6 @@ export const formatTime = (date: string | Date, format: string, isUTC: boolean)
|
|||
return isUTC ? dayjs.utc(date).format(format) : dayjs(date).format(format || 'h:mm A');
|
||||
};
|
||||
|
||||
export const millisecondsFromUnixTimestamp = (timestamp = 0) => {
|
||||
return (timestamp - dayjs().unix()) * 1000;
|
||||
};
|
||||
|
||||
export enum DEFAULT_TIME_ENCODE_FORMATS {
|
||||
MONTHS = 'month',
|
||||
YEARS = 'year',
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import dayjs from 'dayjs';
|
||||
|
||||
/**
|
||||
* Converts a Unix timestamp to milliseconds from now
|
||||
* @param timestamp Unix timestamp in seconds
|
||||
* @returns Milliseconds from now (can be negative if timestamp is in the past)
|
||||
*/
|
||||
export const millisecondsFromUnixTimestamp = (timestamp = 0) => {
|
||||
return (timestamp - dayjs().unix()) * 1000;
|
||||
};
|
|
@ -1,10 +0,0 @@
|
|||
//ONLY USED IN COMPONENTS
|
||||
export type BusterChartPropsBase = {
|
||||
onMounted: () => void;
|
||||
onInitialAnimationEnd: () => void;
|
||||
className?: string;
|
||||
animate?: boolean;
|
||||
data: Record<string, string | null | Date | number>[];
|
||||
isDarkMode?: boolean;
|
||||
readOnly?: boolean;
|
||||
};
|
|
@ -1,6 +1,5 @@
|
|||
export * from './annotationInterfaces';
|
||||
export * from './axisInterfaces';
|
||||
export * from './chartBaseInterfaces';
|
||||
export * from './chartConfigProps';
|
||||
export * from './columnInterfaces';
|
||||
export * from './columnLabelInterfaces';
|
||||
|
|
Loading…
Reference in New Issue