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 { QueryClient, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||||
import { userQueryKeys } from '@/api/query_keys/users';
|
import { userQueryKeys } from '@/api/query_keys/users';
|
||||||
import { useMemoizedFn } from '@/hooks';
|
import { useMemoizedFn } from '@/hooks/useMemoizedFn';
|
||||||
import { useCreateOrganization } from '../organizations/queryRequests';
|
import { useCreateOrganization } from '../organizations/queryRequests';
|
||||||
import {
|
import {
|
||||||
getMyUserInfo,
|
getMyUserInfo,
|
||||||
|
|
|
@ -2,21 +2,17 @@
|
||||||
|
|
||||||
import { Avatar } from '@/components/ui/avatar';
|
import { Avatar } from '@/components/ui/avatar';
|
||||||
import { Text, Title } from '@/components/ui/typography';
|
import { Text, Title } from '@/components/ui/typography';
|
||||||
import { useUserConfigContextSelector } from '@/context/Users';
|
import { useUserConfigContextSelector } from '@/context/Users/BusterUserConfigProvider';
|
||||||
import { formatDate } from '@/lib/date';
|
import { formatDate } from '@/lib/date';
|
||||||
import { SettingsPageHeader } from '../../_components/SettingsPageHeader';
|
import { SettingsPageHeader } from '../../_components/SettingsPageHeader';
|
||||||
|
|
||||||
export default function ProfilePage() {
|
export default function ProfilePage() {
|
||||||
const user = useUserConfigContextSelector((state) => state.user);
|
const user = useUserConfigContextSelector((state) => state.user);
|
||||||
|
|
||||||
if (!user) return null;
|
if (!user) return null;
|
||||||
|
|
||||||
const { name, email, created_at } = user;
|
const { name, email, created_at } = user;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<SettingsPageHeader title="Profile" description="Manage your profile & information" />
|
<SettingsPageHeader title="Profile" description="Manage your profile & information" />
|
||||||
|
|
||||||
<div className="bg-background rounded-lg border shadow">
|
<div className="bg-background rounded-lg border shadow">
|
||||||
{/* Header Section */}
|
{/* Header Section */}
|
||||||
<div className="border-border/30 flex flex-col items-center gap-4 border-b p-6 sm:flex-row sm:items-start">
|
<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>
|
<Text className="text-gray-light mt-1">{email}</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Info Section */}
|
{/* Info Section */}
|
||||||
<div className="space-y-4 p-6">
|
<div className="space-y-4 p-6">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<Text variant="secondary">Member Since</Text>
|
<Text variant="secondary">Member Since</Text>
|
||||||
<Text className="font-medium">{formatDate({ date: created_at, format: 'll' })}</Text>
|
<Text className="font-medium">{formatDate({ date: created_at, format: 'll' })}</Text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<Text variant="secondary">Account Status</Text>
|
<Text variant="secondary">Account Status</Text>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import {
|
import { DEFAULT_CHART_CONFIG, type ChartConfigProps } from '@buster/server-shared/metrics';
|
||||||
DEFAULT_CHART_CONFIG,
|
|
||||||
type BusterChartPropsBase,
|
|
||||||
type ChartConfigProps
|
|
||||||
} from '@buster/server-shared/metrics';
|
|
||||||
import { AppDataGrid } from '@/components/ui/table/AppDataGrid';
|
import { AppDataGrid } from '@/components/ui/table/AppDataGrid';
|
||||||
import { useUpdateMetricChart } from '@/context/Metrics';
|
import { useUpdateMetricChart } from '@/context/Metrics';
|
||||||
import { useMemoizedFn } from '@/hooks';
|
import { useMemoizedFn } from '@/hooks';
|
||||||
import { cn } from '@/lib/classMerge';
|
import { cn } from '@/lib/classMerge';
|
||||||
import { formatLabel } from '@/lib/columnFormatter';
|
import { formatLabel } from '@/lib/columnFormatter';
|
||||||
import type { BusterTableChartConfig } from './interfaces';
|
import type { BusterTableChartConfig } from './interfaces';
|
||||||
|
import type { BusterChartPropsBase } from '@/api/asset_interfaces/metric';
|
||||||
|
|
||||||
export interface BusterTableChartProps extends BusterTableChartConfig, BusterChartPropsBase {}
|
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 React, { type PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||||
import { createContext, useContextSelector } from 'use-context-selector';
|
import { createContext, useContextSelector } from 'use-context-selector';
|
||||||
import { checkTokenValidityFromServer } from '@/api/buster_rest/nextjs/auth';
|
import { checkTokenValidityFromServer } from '@/api/buster_rest/nextjs/auth';
|
||||||
import { useMemoizedFn } from '@/hooks';
|
import { useMemoizedFn } from '@/hooks/useMemoizedFn';
|
||||||
import { millisecondsFromUnixTimestamp } from '@/lib/date';
|
import { millisecondsFromUnixTimestamp } from '@/lib/timestamp';
|
||||||
import type { UseSupabaseUserContextType } from '@/lib/supabase';
|
import type { UseSupabaseUserContextType } from '@/lib/supabase';
|
||||||
|
|
||||||
const PREEMTIVE_REFRESH_MINUTES = 5;
|
const PREEMTIVE_REFRESH_MINUTES = 5;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import React, { type PropsWithChildren } from 'react';
|
import React, { type PropsWithChildren } from 'react';
|
||||||
import { createContext, useContextSelector } from 'use-context-selector';
|
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 { checkIfUserIsAdmin } from '@/lib/user';
|
||||||
import { useSupabaseContext } from '../Supabase';
|
import { useSupabaseContext } from '../Supabase';
|
||||||
|
|
||||||
|
@ -15,10 +15,9 @@ export const useUserConfigProvider = () => {
|
||||||
const userOrganizations = userResponse?.organizations?.[0];
|
const userOrganizations = userResponse?.organizations?.[0];
|
||||||
const userRole = userOrganizations?.role;
|
const userRole = userOrganizations?.role;
|
||||||
const isUserRegistered =
|
const isUserRegistered =
|
||||||
!!userResponse &&
|
!!userResponse && !!userResponse?.organizations?.[0]?.id && !!userResponse?.user?.name;
|
||||||
!!userResponse?.organizations?.[0]?.id &&
|
//&&
|
||||||
!!userResponse?.user?.name &&
|
// !isAnonymousUser;
|
||||||
!isAnonymousUser;
|
|
||||||
|
|
||||||
const isAdmin = checkIfUserIsAdmin(userResponse);
|
const isAdmin = checkIfUserIsAdmin(userResponse);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
DEFAULT_DAY_OF_WEEK_FORMAT,
|
DEFAULT_DAY_OF_WEEK_FORMAT,
|
||||||
type ColumnLabelFormat
|
type ColumnLabelFormat
|
||||||
} from '@buster/server-shared/metrics';
|
} from '@buster/server-shared/metrics';
|
||||||
import { SupportedLanguages } from '../config/languages';
|
import { SupportedLanguages } from '@/config/languages';
|
||||||
import { getBrowserLanguage } from './language';
|
import { getBrowserLanguage } from './language';
|
||||||
import { isNumeric } from './numbers';
|
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');
|
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 {
|
export enum DEFAULT_TIME_ENCODE_FORMATS {
|
||||||
MONTHS = 'month',
|
MONTHS = 'month',
|
||||||
YEARS = 'year',
|
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 './annotationInterfaces';
|
||||||
export * from './axisInterfaces';
|
export * from './axisInterfaces';
|
||||||
export * from './chartBaseInterfaces';
|
|
||||||
export * from './chartConfigProps';
|
export * from './chartConfigProps';
|
||||||
export * from './columnInterfaces';
|
export * from './columnInterfaces';
|
||||||
export * from './columnLabelInterfaces';
|
export * from './columnLabelInterfaces';
|
||||||
|
|
Loading…
Reference in New Issue